fertige funktion?

This commit is contained in:
John Neumeier 2025-11-16 18:24:33 +01:00
parent b4cacb2f0c
commit 3b18b43fca
2 changed files with 14 additions and 9 deletions

View File

@ -6,14 +6,19 @@
Matrix createMatrix(unsigned int rows, unsigned int cols) Matrix createMatrix(unsigned int rows, unsigned int cols)
{ {
Matrix m;
m.rows = rows;
m.cols = cols;
m.buffer = malloc(rows * cols * sizeof(MatrixType));
return m;
} }
void clearMatrix(Matrix *matrix) void clearMatrix(Matrix *m)
{ {
} }
void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned int colIdx) void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned int colIdx)
{ {

View File

@ -240,6 +240,7 @@ void test_predictReturnsCorrectLabels(void)
MatrixType weightsBuffer2[] = {-9, 10, 11, 12, 13, 14}; MatrixType weightsBuffer2[] = {-9, 10, 11, 12, 13, 14};
MatrixType weightsBuffer3[] = {-15, 16, 17, 18, -19, 20, 21, 22, 23, -24, 25, 26, 27, -28, -29}; MatrixType weightsBuffer3[] = {-15, 16, 17, 18, -19, 20, 21, 22, 23, -24, 25, 26, 27, -28, -29};
Matrix weights1 = {.buffer=weightsBuffer1, .rows=2, .cols=4}; Matrix weights1 = {.buffer=weightsBuffer1, .rows=2, .cols=4};
Matrix weights2 = {.buffer=weightsBuffer2, .rows=3, .cols=2}; Matrix weights2 = {.buffer=weightsBuffer2, .rows=3, .cols=2};
Matrix weights3 = {.buffer=weightsBuffer3, .rows=5, .cols=3}; Matrix weights3 = {.buffer=weightsBuffer3, .rows=5, .cols=3};
MatrixType biasBuffer1[] = {200, 0}; MatrixType biasBuffer1[] = {200, 0};
@ -258,7 +259,6 @@ void test_predictReturnsCorrectLabels(void)
TEST_ASSERT_EQUAL_UINT8_ARRAY(expectedLabels, predictedLabels, n); TEST_ASSERT_EQUAL_UINT8_ARRAY(expectedLabels, predictedLabels, n);
free(predictedLabels); free(predictedLabels);
} }
void setUp(void) { void setUp(void) {
// Falls notwendig, kann hier Vorbereitungsarbeit gemacht werden // Falls notwendig, kann hier Vorbereitungsarbeit gemacht werden
} }