This commit is contained in:
31
src/Solver.cpp
Normal file
31
src/Solver.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#include "Solver.h"
|
||||
|
||||
Solver::Solver(const Matrix& mat) : m_Matrix(mat) {}
|
||||
|
||||
Vect Solver::Image() const {
|
||||
Matrix result = m_Matrix;
|
||||
result.Transpose();
|
||||
result.GaussJordan(true);
|
||||
result.Transpose();
|
||||
return {result};
|
||||
}
|
||||
|
||||
// https://en.wikipedia.org/wiki/Kernel_(linear_algebra)#Computation_by_Gaussian_elimination
|
||||
Vect Solver::Noyau() const {
|
||||
Matrix result = m_Matrix;
|
||||
result.Transpose();
|
||||
result.Augmenter(Matrix::Identity(result.GetRawCount()));
|
||||
result.GaussJordan(true);
|
||||
result.Transpose();
|
||||
|
||||
// nombre de colonnes non nulles
|
||||
std::size_t origine_colonne = Vect(result.SubMatrix(0, 0, m_Matrix.GetRawCount(), m_Matrix.GetColumnCount())).GetDimension();
|
||||
|
||||
return {result.SubMatrix(m_Matrix.GetRawCount(), origine_colonne, result.GetRawCount() - m_Matrix.GetRawCount(),
|
||||
result.GetColumnCount() - origine_colonne)};
|
||||
}
|
||||
|
||||
std::size_t Solver::Rang() const {
|
||||
Vect image = Image();
|
||||
return image.GetDimension();
|
||||
}
|
||||
Reference in New Issue
Block a user