mirror of
https://gitlab.com/klmp200/LO27.git
synced 2024-11-22 22:43:19 +00:00
idk
This commit is contained in:
commit
0dfa280bfc
@ -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<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;
|
||||
@ -383,7 +406,8 @@ Matrix orRowSequenceOnMatrix(Matrix m){
|
||||
}
|
||||
|
||||
/* todos :
|
||||
*finir le freeMatrix
|
||||
*mulMatrix
|
||||
*
|
||||
*chasser les bugs
|
||||
*ecrire doc
|
||||
*faire un print + opti pour que sli l'adapte avec sdl
|
||||
|
@ -186,6 +186,8 @@ Matrix andRowSequenceOnMatrix(Matrix m);
|
||||
* @return matrix the copmuted matrix
|
||||
*/
|
||||
Matrix orRowSequenceOnMatrix(Matrix m);
|
||||
Matrix sumMatrix(Matrix matrix1,Matrix matrix2);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user