From d9e49d13190496093e9904591d8e4bebdb1de384 Mon Sep 17 00:00:00 2001 From: Persson-dev Date: Mon, 13 May 2024 21:30:52 +0200 Subject: [PATCH] forgot this --- src/Solver.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Solver.cpp b/src/Solver.cpp index 57f37e3..8091857 100644 --- a/src/Solver.cpp +++ b/src/Solver.cpp @@ -50,9 +50,17 @@ VectAffine Solver::RectangularSystem(Matrix&& a_MatrixA, const Matrix& a_VectorB Matrix fullOrigin {mat.GetColumnCount(), 1}; for (std::size_t i = 0; i < mat.GetRawCount(); i++) { int pivot_index = FirstNotNullElementIndexOnLine(mat, i); - if(pivot_index >= 0){ - fullOrigin.at(pivot_index, 0) = origin.at(i, 0); + + if (static_cast(pivot_index) == mat.GetColumnCount() - 1) { + // on a une ligne du type 0 = n. Aucune solution ! + return {Matrix {}, Matrix::ColumnVector({0})}; } + + // ligne entière de 0 + if (pivot_index < 0) + continue; + + fullOrigin.at(pivot_index, 0) = origin.at(i, 0); } return {noyau, fullOrigin};