Kommentare
This commit is contained in:
parent
c748cf5a97
commit
f1bd72f40e
6
matrix.c
6
matrix.c
@ -37,12 +37,12 @@ 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) //Values in matrix schreiben
|
||||
{
|
||||
matrix.buffer[(size_t)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) //aus matrix auslesen
|
||||
{
|
||||
if(rowIdx < matrix.rows && colIdx < matrix.cols){
|
||||
return matrix.buffer[(size_t)rowIdx * matrix.cols + colIdx];
|
||||
@ -111,7 +111,7 @@ Matrix add(const Matrix matrix1, const Matrix matrix2)
|
||||
|
||||
Matrix multiply(const Matrix matrix1, const Matrix matrix2)
|
||||
{
|
||||
if (matrix1.cols != matrix2.rows)
|
||||
if (matrix1.cols != matrix2.rows) //Spalten und Zeilen sind nicht gleich groß
|
||||
{
|
||||
Matrix result;
|
||||
result.rows = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user