diff --git a/LibAutomaton/matrix.c b/LibAutomaton/matrix.c index 40893f1..ed0b051 100644 --- a/LibAutomaton/matrix.c +++ b/LibAutomaton/matrix.c @@ -299,7 +299,7 @@ Matrix freeMatrix(Matrix matrix){ matrix.colCount = 0; matrix.rowCount = 0; - /*il faut free les cellElements car FreeList ne peut pas le faire*/ + if (matrix.cols != NULL){ current= matrix.cols->head; while (current != NULL){ @@ -312,6 +312,29 @@ Matrix freeMatrix(Matrix matrix){ return matrix; } +Matrix sumMatrix(Matrix matrix1,Matrix matrix2){ + Matrix SumMatrix = CreateMatrix(); + int i =0; + int j = 0; + + if (matrix1.colCount == matrix2.colCount && matrix1.rowCount == matrix2.rowCount){ + SumMatrix = SetMatrixDim(SumMatrix,matrix2.colCount,matrix1.rowCount); + for (i=0;i