resolve rectangular systems
This commit is contained in:
@@ -25,6 +25,18 @@ Vect Solver::Noyau() const {
|
||||
result.GetColumnCount() - origine_colonne)};
|
||||
}
|
||||
|
||||
VectAffine Solver::SystemeTriangulaire() const {
|
||||
Matrix mat = m_Matrix;
|
||||
mat.GaussJordan(true);
|
||||
|
||||
Solver solver{mat.SubMatrix(0, 0, mat.GetRawCount(), mat.GetColumnCount() - 1)};
|
||||
|
||||
Vect noyau = solver.Noyau();
|
||||
Matrix origin = mat.SubMatrix(0, mat.GetColumnCount() - 1, mat.GetRawCount(), 1);
|
||||
|
||||
return {noyau, origin};
|
||||
}
|
||||
|
||||
std::size_t Solver::Rang() const {
|
||||
Vect image = Image();
|
||||
return image.GetCardinal();
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
class Solver {
|
||||
private:
|
||||
Matrix m_Matrix;
|
||||
|
||||
public:
|
||||
Solver(const Matrix& mat);
|
||||
~Solver() {}
|
||||
@@ -12,5 +13,7 @@ class Solver {
|
||||
Vect Image() const;
|
||||
Vect Noyau() const;
|
||||
|
||||
VectAffine SystemeTriangulaire() const;
|
||||
|
||||
std::size_t Rang() const;
|
||||
};
|
||||
13
src/Vect.cpp
13
src/Vect.cpp
@@ -1,6 +1,7 @@
|
||||
#include "Vect.h"
|
||||
|
||||
#include "Solver.h"
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
|
||||
Vect::Vect(const Matrix& mat) : m_Data(mat) {
|
||||
@@ -75,4 +76,14 @@ void Vect::Print() const {
|
||||
|
||||
std::size_t Vect::GetDimension() const {
|
||||
return m_Data.GetRawCount();
|
||||
}
|
||||
}
|
||||
|
||||
VectAffine::VectAffine(const Vect& base, const Matrix& origine) :
|
||||
m_Base(base), m_Origin(origine.SubMatrix(0, 0, m_Base.GetDimension(), 1)) {}
|
||||
|
||||
void VectAffine::Print() const {
|
||||
std::cout << "\tEspace Affine :\n\n";
|
||||
m_Base.Print();
|
||||
std::cout << "\nOrigine :\n\n";
|
||||
m_Origin.Print();
|
||||
}
|
||||
|
||||
20
src/Vect.h
20
src/Vect.h
@@ -36,4 +36,24 @@ class Vect {
|
||||
|
||||
private:
|
||||
void Simplify();
|
||||
};
|
||||
|
||||
|
||||
class VectAffine {
|
||||
private:
|
||||
Vect m_Base;
|
||||
Matrix m_Origin;
|
||||
|
||||
public:
|
||||
VectAffine(const Vect& base, const Matrix& origin);
|
||||
|
||||
void Print() const;
|
||||
|
||||
const Vect& GetBase() const {
|
||||
return m_Base;
|
||||
}
|
||||
|
||||
const Matrix& GetOrigin() const {
|
||||
return m_Origin;
|
||||
}
|
||||
};
|
||||
@@ -32,6 +32,9 @@ void test() {
|
||||
noyau.Print();
|
||||
std::cout << "Système :\n";
|
||||
noyau.GetLinearSystem().Print();
|
||||
|
||||
std::cout << "\n\n";
|
||||
solver.SystemeTriangulaire().Print();
|
||||
}
|
||||
|
||||
void prompt() {
|
||||
|
||||
Reference in New Issue
Block a user