mirror of
				https://gitlab.com/klmp200/LO27.git
				synced 2025-10-31 15:03:03 +00:00 
			
		
		
		
	Merge branch 'NaejBranch' into 'master'
Naej branch See merge request !13
This commit is contained in:
		| @@ -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;i<matrix.rowCount;i++){ | ||||
| 		for (j=0;j<matrix.colCount;j++){ | ||||
|  | ||||
| 			SetCellValue(matrix,j,i,false); | ||||
| 			 | ||||
|  | ||||
| 	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){ | ||||
| 			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<SumMatrix.colCount;i++){ | ||||
| 			for (j=0;j<SumMatrix.rowCount;j++){ | ||||
| 				SetCellValue(SumMatrix,i,j,GetCellValue(matrix1,i,j)+GetCellValue(matrix2,i,j)); | ||||
| 				 | ||||
| 				} | ||||
| 		} | ||||
| 	}else{ | ||||
| 		printf("\n- error : Matrices haven't the same size -\n"); | ||||
| 		 | ||||
| 		SumMatrix.colCount = -1; | ||||
| 		SumMatrix.rowCount = -1; | ||||
| 	} | ||||
| 	 | ||||
| 	return SumMatrix; | ||||
| 	 | ||||
| } | ||||
|  | ||||
| Matrix colSequenceOnMatrix(Matrix m, bool (operator)(bool, bool)){ | ||||
| 	bool a; | ||||
| @@ -448,7 +475,8 @@ void FreeBooleanMatrix(BooleanMatrix matrix){ | ||||
| } | ||||
|  | ||||
| /* todos : | ||||
| *finir le freeMatrix | ||||
| *mulMatrix | ||||
| * | ||||
| *chasser les bugs | ||||
| *ecrire doc | ||||
| *faire un print + opti pour que sli l'adapte avec sdl | ||||
|   | ||||
| @@ -230,6 +230,8 @@ Matrix andRowSequenceOnMatrix(Matrix m); | ||||
| * @return matrix the copmuted matrix | ||||
| */ | ||||
| Matrix orRowSequenceOnMatrix(Matrix m); | ||||
| Matrix sumMatrix(Matrix matrix1,Matrix matrix2); | ||||
|  | ||||
|  | ||||
| #endif | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user