add funtion updated
This commit is contained in:
parent
f94ec127f9
commit
f5b255d0aa
2
matrix.c
2
matrix.c
@ -71,6 +71,8 @@ Matrix add(const Matrix matrix1, const Matrix matrix2)
|
|||||||
for (unsigned int col =0; col < resultCols; ++col){
|
for (unsigned int col =0; col < resultCols; ++col){
|
||||||
MatrixType val1 = getMatrixAt(matrix1, row, col);
|
MatrixType val1 = getMatrixAt(matrix1, row, col);
|
||||||
//Handle broadcasting: if matrix2 has 1 column, use column 0
|
//Handle broadcasting: if matrix2 has 1 column, use column 0
|
||||||
|
unsigned int col1 = (matrix1.cols ==1)? 0 : col;
|
||||||
|
MatrixType val1 = getMatrixAt (matrix1,row,col1);
|
||||||
unsigned int col2 = (matrix2.cols==1) ? 0 : col;
|
unsigned int col2 = (matrix2.cols==1) ? 0 : col;
|
||||||
MatrixType val2 = getMatrixAt(matrix2, row, col2);
|
MatrixType val2 = getMatrixAt(matrix2, row, col2);
|
||||||
|
|
||||||
|
|||||||
BIN
runMatrixTests
BIN
runMatrixTests
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user