Functions
Foam::MatrixTools Namespace Reference

Collection of functions for matrix-related verifications. More...

Functions

template<class Form1 , class Form2 , class Type >
bool equal (const Matrix< Form1, Type > &A, const Matrix< Form2, Type > &B, const bool verbose=false, const label maxDiffs=10, const scalar relTol=1e-5, const scalar absTol=1e-8)
 Compare matrix elements for absolute or relative equality. More...
 
template<class Container >
OstreamprintMatrix (Ostream &os, const Container &mat)
 Simple ASCII output of Matrix, MatrixBlock. More...
 
template<class MatrixType >
MatrixType pinv (const MatrixType &A, scalar tol=1e-5)
 Moore-Penrose inverse of singular/non-singular square/rectangular scalar/complex matrices (KPP:p. 9834; KP:p. 648) More...
 

Detailed Description

Collection of functions for matrix-related verifications.

Source files

Function Documentation

◆ equal()

bool equal ( const Matrix< Form1, Type > &  A,
const Matrix< Form2, Type > &  B,
const bool  verbose = false,
const label  maxDiffs = 10,
const scalar  relTol = 1e-5,
const scalar  absTol = 1e-8 
)

Compare matrix elements for absolute or relative equality.

Parameters
maxDiffsStop reporting after maxDiffs (0 to disable)

Definition at line 27 of file MatrixTools.C.

References A, B, Foam::Info, Foam::mag(), and Foam::nl.

Referenced by SemiImplicitSource< Type >::addSup(), thermo< Thermo, Type >::dKcdTbyKc(), if(), thermo< Thermo, Type >::Kc(), thermo< Thermo, Type >::Kn(), thermo< Thermo, Type >::Kx(), lineDivide::lineDivide(), CirculatorIters< Container, true >::operator!=(), CirculatorIters< Container, true >::operator==(), UList< Foam::vector >::operator==(), and MeshedSurface< Foam::face >::scalePoints().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printMatrix()

Ostream& Foam::MatrixTools::printMatrix ( Ostream os,
const Container &  mat 
)

Simple ASCII output of Matrix, MatrixBlock.

◆ pinv()

MatrixType pinv ( const MatrixType &  A,
scalar  tol = 1e-5 
)

Moore-Penrose inverse of singular/non-singular square/rectangular scalar/complex matrices (KPP:p. 9834; KP:p. 648)

The tolerance to ensure the R1 matrix full-rank is set to 1e-5 by (TA; mentioned in (KPP:p. 9832)) in contrast to 1e-13 (KPP:p. 9834).

Definition at line 577 of file QRMatrix.C.

References A, Foam::abort(), C, Foam::diag(), Foam::distance(), Foam::constant::electromagnetic::e, Foam::endl(), Foam::FatalError, FatalErrorInFunction, Foam::ListOps::find_if(), Foam::lessThan(), Foam::mag(), QRMatrix< MatrixType >::P(), QRMatrix< MatrixType >::Q(), R, QRMatrix< MatrixType >::R(), Matrix< RectangularMatrix< Type >, Type >::resize(), QRMatrix< MatrixType >::solve(), WarningInFunction, x, and Foam::Zero.

Here is the call graph for this function: