Linear Equations Solver  1.0
Using Gaussian elimination
Loading...
Searching...
No Matches
methods.h File Reference

Core computational functions for solving linear systems. More...

#include <vector>
#include <string>
+ Include dependency graph for methods.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int GaussianElimination (std::vector< std::vector< double > > &m, int rows, int cols)
 Performs Gaussian elimination on the augmented matrix with partial pivoting.
 
int DetermineRank (const std::vector< std::vector< double > > &m, int rows, int cols)
 Determines the rank of the coefficient matrix A (excluding augmented column).
 
bool BackSubstitution (const std::vector< std::vector< double > > &m, int rows, int cols, std::vector< double > &solution)
 Performs back-substitution to find the solution vector.
 
void ShowGeneralSolution (const std::vector< std::vector< double > > &m, int rows, int cols, int rank)
 Displays the general solution for systems with infinitely many solutions.
 
std::vector< int > IdentifyPivots (const std::vector< std::vector< double > > &m, int rows, int cols)
 Identifies the pivot columns in the matrix.
 

Detailed Description

Core computational functions for solving linear systems.

Author
Gilbert Young
Date
2024/09/25

This header declares functions for Gaussian elimination with partial pivoting, back-substitution, rank determination, and displaying general solutions.

Definition in file methods.h.

Function Documentation

◆ BackSubstitution()

bool BackSubstitution ( const std::vector< std::vector< double > > & m,
int rows,
int cols,
std::vector< double > & solution )

Performs back-substitution to find the solution vector.

Parameters
mThe upper triangular matrix after Gaussian elimination.
rowsNumber of rows in the matrix.
colsNumber of columns in the matrix (including augmented column).
solutionReference to store the solution vector.
Returns
true If a unique solution exists.
false If the system is inconsistent.

◆ DetermineRank()

int DetermineRank ( const std::vector< std::vector< double > > & m,
int rows,
int cols )

Determines the rank of the coefficient matrix A (excluding augmented column).

Parameters
mThe augmented matrix [A|b].
rowsNumber of rows in the matrix.
colsNumber of columns in the matrix (including augmented column).
Returns
int The rank of the matrix A.

◆ GaussianElimination()

int GaussianElimination ( std::vector< std::vector< double > > & m,
int rows,
int cols )

Performs Gaussian elimination on the augmented matrix with partial pivoting.

Parameters
mReference to the augmented matrix [A|b] to be modified.
rowsNumber of rows in the matrix.
colsNumber of columns in the matrix (including augmented column).
Returns
int Number of row exchanges performed during elimination.

◆ IdentifyPivots()

std::vector< int > IdentifyPivots ( const std::vector< std::vector< double > > & m,
int rows,
int cols )

Identifies the pivot columns in the matrix.

Parameters
mThe matrix after Gaussian elimination.
rowsNumber of rows in the matrix.
colsNumber of columns in the matrix (including augmented column).
Returns
std::vector<int> A vector containing the indices of the pivot columns.

◆ ShowGeneralSolution()

void ShowGeneralSolution ( const std::vector< std::vector< double > > & m,
int rows,
int cols,
int rank )

Displays the general solution for systems with infinitely many solutions.

Parameters
mThe matrix after Gaussian elimination.
rowsNumber of rows in the matrix.
colsNumber of columns in the matrix (including augmented column).
rankThe rank of the coefficient matrix A.