forked from freudenreichan/info2Praktikum-NeuronalesNetz
matrix in matrix.h definiert und create und clearMatrix geschrieben
This commit is contained in:
parent
84ef6ad220
commit
2897a9f2a4
19
matrix.c
19
matrix.c
@ -3,15 +3,26 @@
|
||||
#include "matrix.h"
|
||||
|
||||
// TODO Matrix-Funktionen implementieren
|
||||
|
||||
// Matrix erstellen
|
||||
Matrix createMatrix(unsigned int rows, unsigned int cols)
|
||||
{
|
||||
|
||||
}
|
||||
Matrix matrix;
|
||||
matrix.rows = rows;
|
||||
matrix.cols = cols;
|
||||
// Speicher allokieren
|
||||
matrix.data = (double *)calloc(rows * cols, sizeof(double));
|
||||
|
||||
return matrix;
|
||||
}
|
||||
// Matrix Speicher freigeben
|
||||
void clearMatrix(Matrix *matrix)
|
||||
{
|
||||
|
||||
if (matrix != NULL && matrix->data != NULL) {
|
||||
free(matrix->data);
|
||||
matrix->data = NULL;
|
||||
matrix->rows = 0;
|
||||
matrix->cols = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned int colIdx)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user