forked from freudenreichan/info2Praktikum-NeuronalesNetz
set und getMatrixAt
This commit is contained in:
1 parent
5832db7c2e
commit
67bc75a113
1 file changed
+13
-3
+13
-3
@@ -27,17 +27,27 @@ void clearMatrix(Matrix *matrix)
|
|||||||
|
|
||||||
void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned int colIdx)
|
void setMatrixAt(MatrixType value, Matrix matrix, unsigned int rowIdx, unsigned int colIdx)
|
||||||
{
|
{
|
||||||
|
if(rowIdx < matrix.rows && colIdx < matrix.cols)
|
||||||
|
{
|
||||||
|
matrix.data[rowIdx * matrix.cols + colIdx] = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MatrixType getMatrixAt(const Matrix matrix, unsigned int rowIdx, unsigned int colIdx)
|
MatrixType getMatrixAt(const Matrix matrix, unsigned int rowIdx, unsigned int colIdx)
|
||||||
{
|
{
|
||||||
|
if(rowIdx < matrix.rows && colIdx < matrix.cols)
|
||||||
|
{
|
||||||
|
return matrix.data[rowIdx * matrix.cols + colIdx];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return UNDEFINED_MATRIX_VALUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Matrix add(const Matrix matrix1, const Matrix matrix2)
|
Matrix add(const Matrix matrix1, const Matrix matrix2)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Matrix multiply(const Matrix matrix1, const Matrix matrix2)
|
Matrix multiply(const Matrix matrix1, const Matrix matrix2)
|
||||||
|
|||||||
Reference in new issue
Block a user