fix solver
Some checks failed
Linux arm64 / Build (push) Failing after 2m0s

This commit is contained in:
2024-05-12 09:23:37 +02:00
parent 2af915057a
commit 7f1ef38286
3 changed files with 58 additions and 15 deletions

View File

@@ -2,6 +2,15 @@
#include "Gauss.h"
static int FirstNotNullElementIndexOnLine(const Matrix& mat, std::size_t line) {
for (std::size_t i = 0; i < mat.GetColumnCount(); i++) {
if (!IsEqualZero(mat.at(line, i))) {
return i;
}
}
return -1;
}
Vect Solver::Image(Matrix&& a_Matrix) const {
a_Matrix.Transpose();
Gauss::GaussJordan(a_Matrix, false, false);
@@ -40,11 +49,10 @@ VectAffine Solver::RectangularSystem(Matrix&& a_MatrixA, const Matrix& a_VectorB
Matrix fullOrigin {mat.GetColumnCount() - 1, 1};
for (std::size_t i = 0; i < mat.GetRawCount(); i++) {
fullOrigin.at(i, 0) = origin.at(i, 0);
}
for (std::size_t i = mat.GetRawCount(); i < mat.GetColumnCount() - 1; i++) {
fullOrigin.at(i, 0) = 0;
int pivot_index = FirstNotNullElementIndexOnLine(mat, i);
if(pivot_index >= 0){
fullOrigin.at(pivot_index, 0) = origin.at(i, 0);
}
}
return {noyau, fullOrigin};