forked from freudenreichan/info2Praktikum-NeuronalesNetz
addmatrix mit broadcasten
This commit is contained in:
parent
ede0bd8bd8
commit
86a9d16c4f
5
matrix.c
5
matrix.c
@ -33,6 +33,11 @@ void setMatrixAt(const MatrixType value, Matrix matrix,
|
||||
const unsigned int rowIdx, // Kopie der Matrix wird übergeben
|
||||
const unsigned int colIdx) {
|
||||
|
||||
if (rowIdx >= matrix.rows ||
|
||||
colIdx >= matrix.cols) { // Speichergröße nicht überschreiten
|
||||
return;
|
||||
}
|
||||
|
||||
matrix.buffer[rowIdx * matrix.cols + colIdx] =
|
||||
value; // rowIdx * matrix.cols -> Beginn der Zeile colIdx ->Spalte
|
||||
// innerhalb der Zeile
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user