generated from freudenreichan/info2Praktikum-NeuronalesNetz
Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
0ac4b64866
9
matrix.c
9
matrix.c
@ -13,12 +13,17 @@ typedef struct Matrix {
|
|||||||
|
|
||||||
Matrix createMatrix(unsigned int rows, unsigned int cols)
|
Matrix createMatrix(unsigned int rows, unsigned int cols)
|
||||||
{
|
{
|
||||||
|
Matrix newMatrix;
|
||||||
|
newMatrix.rows = rows;
|
||||||
|
newMatrix.cols = cols;
|
||||||
|
newMatrix.buffer = calloc(rows*cols, sizeof(MatrixType))
|
||||||
|
return newMatrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearMatrix(Matrix *matrix)
|
void clearMatrix(Matrix *matrix)
|
||||||
{
|
{
|
||||||
|
free(*matrix.buffer);
|
||||||
|
*matrix.buffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned int colIdx)
|
void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned int colIdx)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user