makefile für alle Betriebssysteme

This commit is contained in:
Kristin 2025-11-20 14:46:14 +01:00
parent 6b9711e47d
commit 858673bdca
2 changed files with 25 additions and 6 deletions

View File

@ -63,5 +63,6 @@ imageInputTests: imageInput.o imageInputTests.c $(unityfolder)/unity.c
#else #else
# rm -f *.o mnist runMatrixTests runNeuralNetworkTests runImageInputTests # rm -f *.o mnist runMatrixTests runNeuralNetworkTests runImageInputTests
#endif #endif
# clean für windows
clean: clean:
rm -f *.o *.exe rm -f *.o *.exe

View File

@ -20,9 +20,9 @@ void clearMatrix(Matrix *matrix) {
matrix->cols = UNDEFINED_MATRIX_VALUE; matrix->cols = UNDEFINED_MATRIX_VALUE;
free((*matrix).buffer); // Speicher freigeben free((*matrix).buffer); // Speicher freigeben
} }
void setMatrixAt(MatrixType value, Matrix matrix, void setMatrixAt(const MatrixType value, Matrix matrix,
unsigned int rowIdx, // Kopie der Matrix wird übergeben const unsigned int rowIdx, // Kopie der Matrix wird übergeben
unsigned int colIdx) { const unsigned int colIdx) {
matrix.buffer[rowIdx * matrix.cols + colIdx] = matrix.buffer[rowIdx * matrix.cols + colIdx] =
value; // rowIdx * matrix.cols -> Beginn der Zeile colIdx ->Spalte value; // rowIdx * matrix.cols -> Beginn der Zeile colIdx ->Spalte
@ -41,7 +41,25 @@ MatrixType getMatrixAt(const Matrix matrix,
return value; return value;
} }
Matrix add(const Matrix matrix1, const Matrix matrix2) { 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; } Matrix multiply(const Matrix matrix1, const Matrix matrix2) { return matrix1; }