diff --git a/src/Matrix.cpp b/src/Matrix.cpp index badb1fa..27341e2 100644 --- a/src/Matrix.cpp +++ b/src/Matrix.cpp @@ -147,7 +147,7 @@ void Matrix::GaussNonJordan(bool reduite) { // std::cout << "l'indice du maximum est : " << indice_ligne_maximum << "\n\n"; // Si A[k,j]≠0 alors (A[k,j] désigne la valeur de la ligne k et de la colonne j) - if (at(indice_ligne_maximum, j) != 0) { + if (!IsEqualZero(at(indice_ligne_maximum, j))) { r++; // PrintDebug(); @@ -179,10 +179,11 @@ void Matrix::GaussNonJordan(bool reduite) { } void Matrix::GaussJordan(bool reduite) { + GaussNonJordan(reduite); for (std::size_t i = 0; i < m_Lignes; i++) { int k = -1; for (std::size_t j = 0; j < m_Colonnes; j++) { - if (at(i, j) != 0) { + if (!IsEqualZero(at(i, j))) { k = j; break; } diff --git a/src/main.cpp b/src/main.cpp index 8b47e66..1e71236 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,16 +2,17 @@ #include void test() { - Matrix mat{"matrice5x5.mat"}; + Matrix mat{"matrice4x4.mat"}; mat.Print(); // mat.Save("matrice3x3.mat"); std::cout << "sdfdjiofoseifheoiefhoig\n"; mat.Print(); - mat = {"matrice5x5.mat"}; + //mat = {"matrice4x4.mat"}; mat.GaussJordan(false); std::cout << "\nResultat :\n"; mat.Print(); mat.Transpose(); + std::cout << "<<\nTransposée:\n"; mat.Print(); // mat.Save("matrice4x4echelonne.mat"); } @@ -30,10 +31,14 @@ void prompt() { mat.Insert(); mat.Print(); + + mat.GaussJordan(true); + + mat.Print(); } int main(int argc, char** argv) { - // test(); + test(); prompt(); return 0; }