openGPMP
Open Source Mathematics Package
|
Class for solving linear systems and performing matrix operations. More...
#include <linsys.hpp>
Public Member Functions | |
LinSys (const std::vector< std::vector< double >> &mat) | |
Constructor for LinSys class. More... | |
void | display_mtx () const |
Display the augmented matrix. More... | |
void | display (const std::vector< std::vector< double >> &mat) const |
std::vector< double > | solve_gauss () |
Solve the linear system using Gaussian Elimination. More... | |
double | determinant () const |
Calculate the determinant of the matrix. More... | |
void | invert_mtx () |
Invert the matrix. More... | |
std::pair< std::vector< std::vector< double > >, std::vector< std::vector< double > > > | lu_decomp () |
Perform LU decomposition of the matrix. More... | |
void | solve_lu () |
Solve the linear system using LU decomposition. More... | |
void | solve_cholesky () |
Solve the linear system using Cholesky decomposition. More... | |
void | solve_jacobi (int maxIterations=100, double tolerance=1e-10) |
Solve the linear system using Jacobi iteration. More... | |
bool | is_symmetric () const |
Check if the matrix is symmetric. More... | |
double | frobenius_norm () const |
Calculate the Frobenius norm of the matrix. More... | |
double | one_norm () const |
Calculate the 1-norm of the matrix. More... | |
double | inf_norm () const |
Calculate the infinity norm of the matrix. More... | |
void | gram_schmidt () |
Perform Gram-Schmidt orthogonalization on the matrix. More... | |
bool | diagonally_dominant () const |
Check if the matrix is diagonally dominant. More... | |
bool | is_consistent () const |
Check if the linear system is consistent. More... | |
bool | is_homogeneous () const |
Check if the linear system is homogeneous. More... | |
Public Attributes | |
std::vector< std::vector< double > > | matrix |
int | num_rows |
int | num_cols |
Class for solving linear systems and performing matrix operations.
Definition at line 48 of file linsys.hpp.
gpmp::linalg::LinSys::LinSys | ( | const std::vector< std::vector< double >> & | mat | ) |
Constructor for LinSys class.
mat | The augmented matrix [A|B] representing the linear system |
Definition at line 40 of file linsys.cpp.
double gpmp::linalg::LinSys::determinant | ( | ) | const |
Calculate the determinant of the matrix.
Definition at line 107 of file linsys.cpp.
Referenced by is_symmetric().
bool gpmp::linalg::LinSys::diagonally_dominant | ( | ) | const |
Check if the matrix is diagonally dominant.
Definition at line 396 of file linsys.cpp.
void gpmp::linalg::LinSys::display | ( | const std::vector< std::vector< double >> & | mat | ) | const |
void gpmp::linalg::LinSys::display_mtx | ( | ) | const |
Display the augmented matrix.
Definition at line 47 of file linsys.cpp.
double gpmp::linalg::LinSys::frobenius_norm | ( | ) | const |
Calculate the Frobenius norm of the matrix.
Definition at line 338 of file linsys.cpp.
void gpmp::linalg::LinSys::gram_schmidt | ( | ) |
double gpmp::linalg::LinSys::inf_norm | ( | ) | const |
Calculate the infinity norm of the matrix.
Definition at line 362 of file linsys.cpp.
void gpmp::linalg::LinSys::invert_mtx | ( | ) |
Invert the matrix.
Definition at line 135 of file linsys.cpp.
bool gpmp::linalg::LinSys::is_consistent | ( | ) | const |
Check if the linear system is consistent.
Definition at line 413 of file linsys.cpp.
bool gpmp::linalg::LinSys::is_homogeneous | ( | ) | const |
Check if the linear system is homogeneous.
Definition at line 432 of file linsys.cpp.
bool gpmp::linalg::LinSys::is_symmetric | ( | ) | const |
Check if the matrix is symmetric.
Definition at line 302 of file linsys.cpp.
References determinant().
std::pair< std::vector< std::vector< double > >, std::vector< std::vector< double > > > gpmp::linalg::LinSys::lu_decomp | ( | ) |
Perform LU decomposition of the matrix.
Definition at line 165 of file linsys.cpp.
double gpmp::linalg::LinSys::one_norm | ( | ) | const |
Calculate the 1-norm of the matrix.
Definition at line 349 of file linsys.cpp.
void gpmp::linalg::LinSys::solve_cholesky | ( | ) |
Solve the linear system using Cholesky decomposition.
Definition at line 214 of file linsys.cpp.
std::vector< double > gpmp::linalg::LinSys::solve_gauss | ( | ) |
Solve the linear system using Gaussian Elimination.
Definition at line 70 of file linsys.cpp.
void gpmp::linalg::LinSys::solve_jacobi | ( | int | maxIterations = 100 , |
double | tolerance = 1e-10 |
||
) |
Solve the linear system using Jacobi iteration.
maxIterations | Maximum number of iterations (default: 100) |
tolerance | Convergence tolerance (default: 1e-10) |
Definition at line 263 of file linsys.cpp.
void gpmp::linalg::LinSys::solve_lu | ( | ) |
Solve the linear system using LU decomposition.
Definition at line 195 of file linsys.cpp.
std::vector<std::vector<double> > gpmp::linalg::LinSys::matrix |
Definition at line 50 of file linsys.hpp.
Referenced by LinSys().
int gpmp::linalg::LinSys::num_cols |
Definition at line 52 of file linsys.hpp.
Referenced by LinSys().
int gpmp::linalg::LinSys::num_rows |
Definition at line 51 of file linsys.hpp.
Referenced by LinSys().