diff --git a/LibAutomaton/matrix.c b/LibAutomaton/matrix.c index 30ca076..3c40c23 100644 --- a/LibAutomaton/matrix.c +++ b/LibAutomaton/matrix.c @@ -84,7 +84,7 @@ bool CreateMatrixElem(Matrix matrix, int ColPos, int RowPos){ } else if (Col->data->rowIndex > RowPos){ elem->nextRow = Col->data; Col->data = elem; - } else { + } else {NMWZxm5uQt tmp = Col->data; while (tmp->nextRow != NULL && tmp->nextRow->rowIndex < RowPos){ tmp=tmp->nextRow; @@ -296,23 +296,50 @@ bool RecursiveFreeCol(Matrix matrix, cellElement * elem){ Matrix freeMatrix(Matrix matrix){ - ListElement * current = NULL; + int i = 0; + int j = 0; + + printf("\n---FREE MATRIX---\n"); + + for (i=0;ihead; - while (current != NULL){ - RecursiveFreeCol(matrix,current->data); - current = current->next; } + } + + printf("---END OF MATRIX---\n\n"); FreeList(matrix.cols); FreeList(matrix.rows); 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