diff --git a/makefile b/makefile index 67a3c53..5d94684 100644 --- a/makefile +++ b/makefile @@ -63,5 +63,6 @@ imageInputTests: imageInput.o imageInputTests.c $(unityfolder)/unity.c #else # rm -f *.o mnist runMatrixTests runNeuralNetworkTests runImageInputTests #endif +# clean für windows clean: - rm -f *.o *.exe \ No newline at end of file + rm -f *.o *.exe \ No newline at end of file diff --git a/matrix.c b/matrix.c index 3049010..7a8dcac 100644 --- a/matrix.c +++ b/matrix.c @@ -20,9 +20,9 @@ void clearMatrix(Matrix *matrix) { matrix->cols = UNDEFINED_MATRIX_VALUE; free((*matrix).buffer); // Speicher freigeben } -void setMatrixAt(MatrixType value, Matrix matrix, - unsigned int rowIdx, // Kopie der Matrix wird übergeben - unsigned int colIdx) { +void setMatrixAt(const MatrixType value, Matrix matrix, + const unsigned int rowIdx, // Kopie der Matrix wird übergeben + const unsigned int colIdx) { matrix.buffer[rowIdx * matrix.cols + colIdx] = value; // rowIdx * matrix.cols -> Beginn der Zeile colIdx ->Spalte @@ -41,7 +41,25 @@ MatrixType getMatrixAt(const Matrix matrix, return value; } Matrix add(const Matrix matrix1, const Matrix matrix2) { - // broadcasting - return matrix1; + + // Ergebnismatrix + Matrix result; + + // Broadcasting nur bei Vektor und Matrix, Fehlermeldung bei zwei unpassender + // Matrix + if (matrix1.rows != matrix2.rows) { + + // check, which one is smaller + // realloc + } + + if (matrix1.cols != matrix2.cols) { + } + + // Speicher reservieren + + // Matrix addieren + + return result; } Matrix multiply(const Matrix matrix1, const Matrix matrix2) { return matrix1; }