testing matrix.c
This commit is contained in:
parent
758dc03ab8
commit
f149efb86a
@ -36,7 +36,7 @@ GrayScaleImageSeries *readImages(const char *path)
|
||||
|
||||
expectedHeader = checkHeaderString(headerString);
|
||||
|
||||
printf("llu %llu\n", series->count * numberOfBytesToRead * sizeof(GrayScalePixelType));
|
||||
// printf("llu %llu\n", series->count * numberOfBytesToRead * sizeof(GrayScalePixelType));
|
||||
series->images->buffer = calloc((series->count) * numberOfBytesToRead, sizeof(GrayScalePixelType));
|
||||
series->labels = calloc((series->count), sizeof(&(series->labels)));
|
||||
|
||||
|
||||
18
matrix.c
18
matrix.c
@ -57,13 +57,15 @@ void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned
|
||||
//printf("Ungueltige Indizes beim Setzen!\n");
|
||||
return;
|
||||
}
|
||||
// printf("%d \n", rowIdx + matrix.cols * colIdx);
|
||||
matrix.buffer[rowIdx + matrix.cols * colIdx] = value;
|
||||
// printf("%d \n", rowIdx + matrix.rows * colIdx);
|
||||
*(&matrix.buffer[0] + colIdx * matrix.rows + rowIdx) = value;
|
||||
// printf("value %f\n", value);
|
||||
}
|
||||
|
||||
MatrixType getMatrixAt(const Matrix matrix, unsigned int rowIdx, unsigned int colIdx)
|
||||
{
|
||||
float wert = 0;
|
||||
|
||||
if(matrix.buffer == NULL)
|
||||
{
|
||||
//printf("Fehler beim Lesen! Matrix nicht initialisiert");
|
||||
@ -76,7 +78,11 @@ MatrixType getMatrixAt(const Matrix matrix, unsigned int rowIdx, unsigned int co
|
||||
return 0;
|
||||
}
|
||||
|
||||
return matrix.buffer[rowIdx * matrix.cols + colIdx];
|
||||
wert = matrix.buffer[rowIdx * matrix.cols + colIdx];
|
||||
//printf("wert row %d col %d: %f\n", rowIdx, colIdx, *(&matrix.buffer[0] + colIdx * matrix.cols + rowIdx));
|
||||
//printf("geholter wert = %f\n", wert);
|
||||
|
||||
return wert;
|
||||
}
|
||||
|
||||
Matrix add(const Matrix matrix1, const Matrix matrix2)
|
||||
@ -159,9 +165,9 @@ Matrix add(const Matrix matrix1, const Matrix matrix2)
|
||||
}
|
||||
else
|
||||
{
|
||||
//printf("Fehler bei Addition: Matrix Dimensionen stimmen nicht ueberein!\n");
|
||||
Matrix empty = {0, 0, NULL};
|
||||
return empty;
|
||||
//printf("Fehler bei Addition: Matrix Dimensionen stimmen nicht ueberein!\n");
|
||||
Matrix empty = {0, 0, NULL};
|
||||
return empty;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user