diff --git a/matrix.c b/matrix.c index d06b036..187a6d1 100644 --- a/matrix.c +++ b/matrix.c @@ -68,6 +68,7 @@ Matrix add(const Matrix matrix1, const Matrix matrix2) Matrix result; result.rows = matrix1.rows; result.cols = matrix1.cols; + //TODO: Chat sagt hier noch buffer calloc rein //Addition der beiden Matrizen @@ -85,5 +86,35 @@ Matrix add(const Matrix matrix1, const Matrix matrix2) Matrix multiply(const Matrix matrix1, const Matrix matrix2) { + //Spalten matrix 1 muss mit Reihen Matrix 2 übereinstimmen + if (matrix1.cols != matrix2.rows) + { + Matrix result; + result.rows = 0; + result.cols = 0; + result.buffer = NULL; + return result; + } + else + { + Matrix result; + result.rows = matrix1.rows; + result.cols = matrix2.cols; + //TODO: Chat sagt hier noch buffer calloc rein + + //Multipliaktion der beiden Matrizen + for(int i = 0; ... ; i++) + { + result.buffer[i] = matrix1.buffer[i] * matrix2.buffer[i]; + for(int j = 1; ... ; j++) + { + result.buffer[i] += matrix1.buffer[j] * matrix2.buffer[i*j] + } + + } + //FIXME: hier steht glaube viel bullshit lol + + + } } \ No newline at end of file