forked from freudenreichan/info2Praktikum-NeuronalesNetz
Bug-Fix create matrix
This commit is contained in:
parent
f0cd9abe2b
commit
9dd4eff0d7
11
matrix.c
11
matrix.c
@ -8,6 +8,16 @@
|
|||||||
Matrix createMatrix(unsigned int rows, unsigned int cols)
|
Matrix createMatrix(unsigned int rows, unsigned int cols)
|
||||||
{
|
{
|
||||||
Matrix matrix;
|
Matrix matrix;
|
||||||
|
|
||||||
|
if(rows == 0 || cols == 0)
|
||||||
|
{
|
||||||
|
matrix.rows = 0;
|
||||||
|
matrix.cols = 0;
|
||||||
|
matrix.data = NULL;
|
||||||
|
return matrix;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
matrix.rows = rows;
|
matrix.rows = rows;
|
||||||
matrix.cols = cols;
|
matrix.cols = cols;
|
||||||
|
|
||||||
@ -29,6 +39,7 @@ Matrix createMatrix(unsigned int rows, unsigned int cols)
|
|||||||
matrix.data[i * matrix.cols + j] = UNDEFINED_MATRIX_VALUE;
|
matrix.data[i * matrix.cols + j] = UNDEFINED_MATRIX_VALUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return matrix;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearMatrix(Matrix *matrix)
|
void clearMatrix(Matrix *matrix)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user