LibreOffice Module basegfx (master) 1
Functions
gauss.hxx File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<class Matrix , typename BaseType >
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. More...
 
template<class Matrix , class Vector , typename BaseType >
bool substitute (const Matrix &matrix, int rows, int cols, Vector &result)
 Retrieve solution vector of linear system by substituting backwards. More...
 
template<class Matrix , class Vector , typename BaseType >
bool solve (Matrix &matrix, int rows, int cols, Vector &result, BaseType minPivot)
 This method determines solution of given linear system, if any. More...
 

Function Documentation

◆ eliminate()

template<class Matrix , typename BaseType >
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.

Parameters
matrixThe matrix to operate on. Last column is the result vector (right hand side of the linear equation). After successful termination, the matrix is upper triangular. The matrix is expected to be in row major order.
rowsNumber of rows in matrix
colsNumber of columns in matrix
minPivotIf the pivot element gets lesser than minPivot, this method fails, otherwise, elimination succeeds and true is returned.
Returns
true, if elimination succeeded.

Definition at line 45 of file gauss.hxx.

References i, and max.

◆ solve()

template<class Matrix , class Vector , typename BaseType >
bool solve ( Matrix &  matrix,
int  rows,
int  cols,
Vector &  result,
BaseType  minPivot 
)

This method determines solution of given linear system, if any.

This is a wrapper for eliminate and substitute, given matrix must contain right side of equation as the last column.

Parameters
matrixThe matrix to operate on. Last column is the result vector (right hand side of the linear equation). After successful termination, the matrix is upper triangular. The matrix is expected to be in row major order.
rowsNumber of rows in matrix
colsNumber of columns in matrix
minPivotIf the pivot element gets lesser than minPivot, this method fails, otherwise, elimination succeeds and true is returned.
Returns
true, if elimination succeeded.

Definition at line 151 of file gauss.hxx.

References result.

Referenced by Impl_calcFocus().

◆ substitute()

template<class Matrix , class Vector , typename BaseType >
bool substitute ( const Matrix &  matrix,
int  rows,
int  cols,
Vector &  result 
)

Retrieve solution vector of linear system by substituting backwards.

This operation relies on the previous successful application of eliminate()!

Parameters
matrixMatrix in upper diagonal form, as e.g. generated by eliminate()
rowsNumber of rows in matrix
colsNumber of columns in matrix
resultResult vector. Given matrix must have space for one column (rows entries).
Returns
true, if back substitution was possible (i.e. no division by zero occurred).

Definition at line 102 of file gauss.hxx.

References result.