44template <
class Matrix,
typename BaseType>
48 const BaseType& minPivot )
52 for(
int i=0;
i<cols-1; ++
i)
56 for(
int j=
i+1; j<rows; ++j)
65 for(
int k=0; k<cols; ++k)
71 for(
int j=
i+1; j<rows; ++j)
72 for(
int k=cols-1; k>=
i; --k)
101template <
class Matrix,
class Vector,
typename BaseType>
111 for(
int j=rows-1; j>=0; --j)
114 for(
int k=j+1; k<cols-1; ++k)
117 if(
matrix[ j*cols + j ] == 0.0 )
150template <
class Matrix,
class Vector,
typename BaseType>
157 if( eliminate<Matrix,BaseType>(
matrix, rows, cols, minPivot) )
158 return substitute<Matrix,Vector,BaseType>(
matrix, rows, cols,
result);
bool substitute(const Matrix &matrix, int rows, int cols, Vector &result)
Retrieve solution vector of linear system by substituting backwards.
bool eliminate(Matrix &matrix, int rows, int cols, const BaseType &minPivot)
This method eliminates elements below main diagonal in the given matrix by gaussian elimination.
bool solve(Matrix &matrix, int rows, int cols, Vector &result, BaseType minPivot)
This method determines solution of given linear system, if any.