Loading...
Searching...
No Matches
System Solvers (Small Systems)
Collaboration diagram for System Solvers (Small Systems):
unsigned int bitpit::linearalgebra::factorizeLU (std::vector< std::vector< double > > &A, std::vector< std::vector< double > > &L, std::vector< std::vector< double > > &U, std::vector< std::vector< double > > *P)
 
void bitpit::linearalgebra::backwardSubstitution (std::vector< std::vector< double > > &A, std::vector< double > &B, std::vector< double > &x)
 
void bitpit::linearalgebra::forwardSubstitution (std::vector< std::vector< double > > &A, std::vector< double > &B, std::vector< double > &x)
 
void bitpit::linearalgebra::solveLU (std::vector< std::vector< double > > &A, std::vector< double > &B, std::vector< double > &x)
 
int bitpit::linearalgebra::solveLU (int layout, std::vector< double > &A, std::vector< double > &B)
 
int bitpit::linearalgebra::solveLU (int layout, int matrixOrder, double *A, double *B, int *ipiv)
 
template<class T >
void bitpit::linearalgebra::cramer (std::vector< std::vector< T > > &, std::vector< T > &, std::vector< T > &)
 
template<class T , size_t m, size_t n>
void bitpit::linearalgebra::cramer (std::array< std::array< T, n >, m > &, std::array< T, m > &, std::array< T, n > &)
 
template<size_t m>
unsigned int bitpit::linearalgebra::factorizeLU (std::array< std::array< double, m >, m > &, std::array< std::array< double, m >, m > &, std::array< std::array< double, m >, m > &, std::array< std::array< double, m >, m > *)
 
template<size_t m>
void bitpit::linearalgebra::backwardSubstitution (std::array< std::array< double, m >, m > &, std::array< double, m > &, std::array< double, m > &)
 
template<size_t m>
void bitpit::linearalgebra::forwardSubstitution (std::array< std::array< double, m >, m > &, std::array< double, m > &, std::array< double, m > &)
 
template<size_t m>
void bitpit::linearalgebra::solveLU (std::array< std::array< double, m >, m > &, std::array< double, m > &, std::array< double, m > &)
 

Detailed Description

Function Documentation

◆ backwardSubstitution() [1/2]

template<size_t m>
void bitpit::linearalgebra::backwardSubstitution ( std::array< std::array< double, m >, m > & A,
std::array< double, m > & B,
std::array< double, m > & x )

Solve a lower triangular system using backward substitution. Overloading of backwardSubstitution() for container array.

Parameters
[in]Acoeffs matrix
[in]Br.h.s. of the linear system
[in]xon output stores the solution to the linear system

Definition at line 278 of file system_solvers_small.tpp.

◆ backwardSubstitution() [2/2]

void bitpit::linearalgebra::backwardSubstitution ( std::vector< std::vector< double > > & A,
std::vector< double > & B,
std::vector< double > & x )

Solve a upper triangular linear system, using backward substitution.

Parameters
[in]Acoeffs. matrix
[in]Br.h.s. of linear system
[in,out]xon output store the solution of the linear system

Definition at line 186 of file system_solvers_small.cpp.

◆ cramer() [1/2]

template<class T , size_t m, size_t n>
void bitpit::linearalgebra::cramer ( std::array< std::array< T, n >, m > & A,
std::array< T, m > & B,
std::array< T, n > & x )

Solve a linear system of small dimenions using cramer's rule. Overloading of cramer() function for container array.

Parameters
[in]Acoeffs matrix
[in]Br.h.s. of the linear system
[in,out]xon output stores the solution to the linear system

Definition at line 110 of file system_solvers_small.tpp.

◆ cramer() [2/2]

template<class T >
void bitpit::linearalgebra::cramer ( std::vector< std::vector< T > > & A,
std::vector< T > & B,
std::vector< T > & x )

Solve a linear system of small dimenions using cramer's rule.

Parameters
[in]Acoeffs matrix
[in]Br.h.s. of the linear system
[in,out]xon output stores the solution to the linear system

Definition at line 41 of file system_solvers_small.tpp.

◆ factorizeLU() [1/2]

template<size_t m>
unsigned int bitpit::linearalgebra::factorizeLU ( std::array< std::array< double, m >, m > & A,
std::array< std::array< double, m >, m > & L,
std::array< std::array< double, m >, m > & U,
std::array< std::array< double, m >, m > * P )

Compute the LU factorization (with row pivoting) for a given non-singular matrix. Overloading of LU() function for container array.

Parameters
[in]Ainput matrix
[in,out]Llower triangular part (L factor)
[in,out]Uupper triangular part (U factor)
[in,out]Ppermutation matrix
Returns
returns an error flag: err = 0: no error(s) encountered err = 1: matrix is ill conditioned err = 2: matrix is singular to working precision err = 3: wrong dimensions

Definition at line 177 of file system_solvers_small.tpp.

◆ factorizeLU() [2/2]

unsigned int bitpit::linearalgebra::factorizeLU ( std::vector< std::vector< double > > & A,
std::vector< std::vector< double > > & L,
std::vector< std::vector< double > > & U,
std::vector< std::vector< double > > * P )

Compute the LU factorization (with partial pivoting) of an input matrix of small dimensions.

Parameters
[in]Ainput matrix
[in,out]Llower triangular part (factor L)
[in,out]Uupper triangular part (factor U)
[in,out]Ppermutation matrix
Returns
error flag: err = 0: no error(s) encountered err = 1: matrix is ill conditioned err = 2: matrix is singular to working precision err = 3: wrong dimensions

Definition at line 80 of file system_solvers_small.cpp.

◆ forwardSubstitution() [1/2]

template<size_t m>
void bitpit::linearalgebra::forwardSubstitution ( std::array< std::array< double, m >, m > & A,
std::array< double, m > & B,
std::array< double, m > & x )

Solve a upper triangular system using forward substitution. Overloading of forwardSubstitution() for container array.

Parameters
[in]Acoeffs matrix
[in]Br.h.s. of the linear system
[in]xon output stores the solution to the linear system

Definition at line 333 of file system_solvers_small.tpp.

◆ forwardSubstitution() [2/2]

void bitpit::linearalgebra::forwardSubstitution ( std::vector< std::vector< double > > & A,
std::vector< double > & B,
std::vector< double > & x )

Solve a lower triangular linear system, using forward substitution.

Parameters
[in]Acoeffs. matrix
[in]Br.h.s. of linear system
[in,out]xon output store the solution of the linear system

Definition at line 255 of file system_solvers_small.cpp.

◆ solveLU() [1/4]

int bitpit::linearalgebra::solveLU ( int layout,
int matrixOrder,
double * A,
double * B,
int * ipiv )

Solve a linear system using partial pivoting and LU factorization (the LAPACK function Lapacke_dgesv is used).

This routine works on the entire matrix, the number of considered equations is equal to the leading dimension of the matrix, the same is for the r.h.s. Multiple r.h.s. are not allowed. Containers MUST be correctly sized.

This function is intended for both solution and factorization computation.

Parameters
[in]layoutmatrix layout (possible values are ROW_MAJOR and COL_MAJOR).
[in]matrixOrdernumber of equations in linear system.
[in,out]Ain input the coefficients of square matrix (linear), in output the factors L and U, A = P * L * U.
[in,out]Bin input r.h.s. of the linear system, in output the solution.
[out]ipivthe pivot indices that define the permutation matrix P, see LAPACK documentation.
Returns
information on the execution of LAPACKE_dgesv, see LAPACK documentation

Definition at line 417 of file system_solvers_small.cpp.

◆ solveLU() [2/4]

int bitpit::linearalgebra::solveLU ( int layout,
std::vector< double > & A,
std::vector< double > & B )

Solve a linear system using partial pivoting and LU factorization (the LAPACK function Lapacke_dgesv is used).

This routine works on the entire matrix, the number of considered equations is equal to the leading dimension of the matrix, the same is for the r.h.s. Multiple r.h.s. are not allowed. Containers MUST be correctly sized. Permutation matrix not provided.

This function is intended for solution computation ONLY.

Parameters
[in]layoutmatrix layout (possible values are ROW_MAJOR and COL_MAJOR)
[in,out]Ain input the coefficients of square matrix (linear), the solver will the use the matrix as a storage for temporary data needed during the solution of the system, hence on output the matrix coefficients will be overwritten and the original matrix coefficients cannot be recovered
[in,out]Bin input r.h.s. of the linear system, in output the solution.
Returns
information on the execution of LAPACKE_dgesv, see LAPACK  documentation

Definition at line 385 of file system_solvers_small.cpp.

◆ solveLU() [3/4]

template<size_t m>
void bitpit::linearalgebra::solveLU ( std::array< std::array< double, m >, m > & A,
std::array< double, m > & B,
std::array< double, m > & x )

Solve a non-singular linear system using LU factorization. Overloading of LU() function for container array.

Parameters
[in]Acoeffs matrix
[in]Br.h.s. of linear system
[in,out]xon output stores the solution to the linear system

Definition at line 389 of file system_solvers_small.tpp.

◆ solveLU() [4/4]

void bitpit::linearalgebra::solveLU ( std::vector< std::vector< double > > & A,
std::vector< double > & B,
std::vector< double > & x )

Solve a linear system of small dimenions (coeffs. matrix must have full rank) using LU factorization.

Parameters
[in]Acoeffs matrix
[in]Br.h.s. of the linear system
[in,out]xon output stores the solution of the linear system

Definition at line 326 of file system_solvers_small.cpp.

--- layout: doxygen_footer ---