mirror of
https://gitlab.com/klmp200/LO27.git
synced 2024-11-26 09:54:13 +00:00
idk
This commit is contained in:
commit
0dfa280bfc
@ -299,7 +299,7 @@ Matrix freeMatrix(Matrix matrix){
|
|||||||
|
|
||||||
matrix.colCount = 0;
|
matrix.colCount = 0;
|
||||||
matrix.rowCount = 0;
|
matrix.rowCount = 0;
|
||||||
/*il faut free les cellElements car FreeList ne peut pas le faire*/
|
|
||||||
if (matrix.cols != NULL){
|
if (matrix.cols != NULL){
|
||||||
current= matrix.cols->head;
|
current= matrix.cols->head;
|
||||||
while (current != NULL){
|
while (current != NULL){
|
||||||
@ -312,6 +312,29 @@ Matrix freeMatrix(Matrix matrix){
|
|||||||
return 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)){
|
Matrix colSequenceOnMatrix(Matrix m, bool (operator)(bool, bool)){
|
||||||
bool a;
|
bool a;
|
||||||
@ -383,7 +406,8 @@ Matrix orRowSequenceOnMatrix(Matrix m){
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* todos :
|
/* todos :
|
||||||
*finir le freeMatrix
|
*mulMatrix
|
||||||
|
*
|
||||||
*chasser les bugs
|
*chasser les bugs
|
||||||
*ecrire doc
|
*ecrire doc
|
||||||
*faire un print + opti pour que sli l'adapte avec sdl
|
*faire un print + opti pour que sli l'adapte avec sdl
|
||||||
|
@ -186,6 +186,8 @@ Matrix andRowSequenceOnMatrix(Matrix m);
|
|||||||
* @return matrix the copmuted matrix
|
* @return matrix the copmuted matrix
|
||||||
*/
|
*/
|
||||||
Matrix orRowSequenceOnMatrix(Matrix m);
|
Matrix orRowSequenceOnMatrix(Matrix m);
|
||||||
|
Matrix sumMatrix(Matrix matrix1,Matrix matrix2);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user