Compare commits
No commits in common. "2142433257d598287fb7d3223c32cc042630fa9f" and "6179dca96a9f1054201e1a2313804679caff76f9" have entirely different histories.
2142433257
...
6179dca96a
34
matrix.c
34
matrix.c
@ -50,40 +50,10 @@ MatrixType getMatrixAt(const Matrix matrix, unsigned int rowIdx, unsigned int co
|
||||
|
||||
Matrix add(const Matrix matrix1, const Matrix matrix2)
|
||||
{
|
||||
//Überprüfen, ob die Matrizen die gleichen Dimensionen haben
|
||||
//wenn nicht muss die matrix "rows/cols=0 und buffer = NULL" leer zurückgegeben werden
|
||||
|
||||
if (matrix1.rows != matrix2.rows || matrix1.cols != matrix2.cols)
|
||||
{
|
||||
Matrix result;
|
||||
result.rows = 0;
|
||||
result.cols = 0;
|
||||
result.buffer = NULL;
|
||||
return result;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
//Matrix result ist die neue Matrix für das Ergebnis
|
||||
Matrix result;
|
||||
result.rows = matrix1.rows;
|
||||
result.cols = matrix1.cols;
|
||||
|
||||
|
||||
//Addition der beiden Matrizen
|
||||
for (int i = 0; i < result.rows * result.cols; i++)
|
||||
{
|
||||
result.buffer[i] = matrix1.buffer[i] + matrix2.buffer[i];
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Matrix multiply(const Matrix matrix1, const Matrix matrix2)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user