forked from freudenreichan/info2Praktikum-NeuronalesNetz
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2436240736 | |||
| fde82f2d9a |
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"makefile.configureOnOpen": false
|
|
||||||
}
|
|
||||||
5
matrix.c
5
matrix.c
@ -6,13 +6,12 @@
|
|||||||
|
|
||||||
Matrix createMatrix(unsigned int rows, unsigned int cols)
|
Matrix createMatrix(unsigned int rows, unsigned int cols)
|
||||||
{
|
{
|
||||||
MatrixType* data = malloc(rows * cols * sizeof(MatrixType));
|
|
||||||
Matrix newMatrix = {rows, cols, data};
|
|
||||||
return newMatrix;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearMatrix(Matrix *matrix)
|
void clearMatrix(Matrix *matrix)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned int colIdx)
|
void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned int colIdx)
|
||||||
|
|||||||
6
matrix.h
6
matrix.h
@ -6,12 +6,6 @@
|
|||||||
typedef float MatrixType;
|
typedef float MatrixType;
|
||||||
|
|
||||||
// TODO Matrixtyp definieren
|
// TODO Matrixtyp definieren
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
unsigned int rows;
|
|
||||||
unsigned int cols;
|
|
||||||
MatrixType *data;
|
|
||||||
} Matrix;
|
|
||||||
|
|
||||||
|
|
||||||
Matrix createMatrix(unsigned int rows, unsigned int cols);
|
Matrix createMatrix(unsigned int rows, unsigned int cols);
|
||||||
|
|||||||
@ -164,7 +164,7 @@ void test_setMatrixAtFailsOnIndicesOutOfRange(void)
|
|||||||
Matrix matrixToTest = {.rows=2, .cols=3, .buffer=buffer};
|
Matrix matrixToTest = {.rows=2, .cols=3, .buffer=buffer};
|
||||||
|
|
||||||
setMatrixAt(-1, matrixToTest, 2, 3);
|
setMatrixAt(-1, matrixToTest, 2, 3);
|
||||||
TEST_ASSERT_EQUAL_FLOAT_ARRAY(expectedResults, matrixToTest.buffer, matrixToTest.cols * matrixToTest.rows);
|
TEST_ASSERT_EQUAL_FLOAT_ARRAY(expectedResults, matrixToTest.buffer, sizeof(buffer)/sizeof(MatrixType));
|
||||||
}
|
}
|
||||||
|
|
||||||
void setUp(void) {
|
void setUp(void) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user