The open source CFD toolbox
LUscalarMatrix Class Reference

Class to perform the LU decomposition on a symmetric matrix. More...

Inheritance diagram for LUscalarMatrix:
[legend]
Collaboration diagram for LUscalarMatrix:
[legend]

## Public Member Functions

ClassName ("LUscalarMatrix")

LUscalarMatrix ()
Construct null. More...

LUscalarMatrix (const scalarSquareMatrix &M)
Construct from and perform LU decomposition of the matrix M. More...

LUscalarMatrix (const lduMatrix &ldum, const FieldField< Field, scalar > &interfaceCoeffs, const lduInterfaceFieldPtrsList &interfaces)
Construct from lduMatrix and perform LU decomposition. More...

void decompose (const scalarSquareMatrix &M)
Perform the LU decomposition of the matrix M. More...

template<class Type >
void solve (List< Type > &x, const UList< Type > &source) const
Solve the linear system with the given source. More...

template<class Type >
tmp< Field< Type > > solve (const UList< Type > &source) const
Solve the linear system with the given source. More...

void inv (scalarSquareMatrix &M) const
Set M to the inverse of this square matrix. More...

template<class Type >
Foam::tmp< Foam::Field< Type > > solve (const UList< Type > &source) const

Public Member Functions inherited from SquareMatrix< scalar >
SquareMatrix ()=default
Default construct. More...

SquareMatrix (const SquareMatrix &)=default
Copy construct. More...

SquareMatrix (const label n)
Construct for given size (rows == cols) More...

SquareMatrix (const label n, const zero)

SquareMatrix (const label n, const scalar &val)

SquareMatrix (const label n, const Identity< AnyType >)

SquareMatrix (const labelPair &dims, const Identity< AnyType >)

SquareMatrix (const labelPair &dims)

SquareMatrix (const labelPair &dims, const zero)

SquareMatrix (const labelPair &dims, const scalar &val)

SquareMatrix (const label m, const label n, const zero)

SquareMatrix (const ConstMatrixBlock< MatrixType > &mat)
Construct from const sub-matrix block. More...

SquareMatrix (const MatrixBlock< MatrixType > &mat)
Construct from sub-matrix block. More...

SquareMatrix (const RectangularMatrix< scalar > &mat)

SquareMatrix (Istream &is)
Construct from Istream. More...

SquareMatrixoperator= (const SquareMatrix &)=default
Copy assignment. More...

void operator= (const zero)
Assign all elements to zero. More...

void operator= (const scalar &val)
Assign all elements to value. More...

void operator= (const Identity< AnyType >)
Set to identity matrix. More...

autoPtr< SquareMatrix< scalar > > clone () const
Clone. More...

void resize (const label m)
Resize the matrix preserving the elements. More...

void resize (const label m, const label n)
Resize the matrix preserving the elements (compatibility) More...

void setSize (const label m)
Resize the matrix preserving the elements. More...

void shallowResize (const label m)
Resize the matrix without reallocating storage (unsafe) More...

bool symmetric () const
Return true if the square matrix is effectively symmetric/Hermitian. More...

bool tridiagonal () const
Return true if the square matrix is reduced tridiagonal. More...

List< label > sortPermutation (CompOp &compare) const

Foam::List< Foam::label > sortPermutation (CompOp &compare) const

void applyPermutation (const List< label > &p)

Public Member Functions inherited from Matrix< SquareMatrix< scalar >, scalar >
Foam::tmp< Foam::Field< scalar > > AmulImpl (const ListType &x) const

Foam::tmp< Foam::Field< scalar > > TmulImpl (const ListType &x) const

Matrix ()
Construct null. More...

Matrix (const label m, const label n)
Construct given number of rows/columns. More...

Matrix (const label m, const label n, const zero)

Matrix (const label m, const label n, const scalar &val)

Matrix (const labelPair &dims)
Construct given number of rows/columns. More...

Matrix (const labelPair &dims, const zero)

Matrix (const labelPair &dims, const scalar &val)

Matrix (const Matrix< SquareMatrix< scalar >, scalar > &mat)
Copy construct. More...

Matrix (Matrix< SquareMatrix< scalar >, scalar > &&mat)
Move construct. More...

Matrix (const Matrix< Form2, scalar > &mat)
Copy constructor from Matrix of a different form. More...

Matrix (const ConstMatrixBlock< MatrixType > &Mb)
Construct from a block of another Matrix. More...

Matrix (const MatrixBlock< MatrixType > &Mb)
Construct from a block of another Matrix. More...

Matrix (Istream &is)
Construct from Istream. More...

autoPtr< mTypeclone () const
Clone. More...

~Matrix ()
Destructor. More...

label m () const noexcept
The number of rows. More...

label n () const noexcept
The number of columns. More...

label size () const
The number of elements in Matrix (m*n) More...

labelPair sizes () const
Return row/column sizes. More...

bool empty () const noexcept
Return true if Matrix is empty (i.e., size() is zero) More...

const scalar * cdata () const noexcept

scalar * data () noexcept

const scalar * rowData (const label irow) const
Return const pointer to data in the specified row. More...

scalar * rowData (const label irow)
Return pointer to data in the specified row. More...

const scalar & at (const label idx) const
Linear addressing const element access. More...

scalar & at (const label idx)
Linear addressing element access. More...

ConstMatrixBlock< mTypesubColumn (const label colIndex, const label rowIndex=0, label len=-1) const
Return const column or column's subset of Matrix. More...

MatrixBlock< mTypesubColumn (const label colIndex, const label rowIndex=0, label len=-1)
Return column or column's subset of Matrix. More...

ConstMatrixBlock< mTypesubRow (const label rowIndex, const label colIndex=0, label len=-1) const
Return const row or const row's subset of Matrix. More...

MatrixBlock< mTypesubRow (const label rowIndex, const label colIndex=0, label len=-1)
Return row or row's subset of Matrix. More...

ConstMatrixBlock< mTypesubMatrix (const label rowIndex, const label colIndex, label szRows=-1, label szCols=-1) const
Return const sub-block of Matrix. More...

MatrixBlock< mTypesubMatrix (const label rowIndex, const label colIndex, label szRows=-1, label szCols=-1)
Return sub-block of Matrix. More...

ConstMatrixBlock< mTypeblock (const label rowIndex, const label colIndex) const
Access Field as a ConstMatrixBlock. More...

MatrixBlock< mTypeblock (const label rowIndex, const label colIndex)
Access Field as a MatrixBlock. More...

ConstMatrixBlock< mTypeblock (const label m, const label n, const label mStart, const label nStart) const
Deprecated(2019-04) - use subMatrix() More...

MatrixBlock< mTypeblock (const label m, const label n, const label mStart, const label nStart)
Deprecated(2019-04) - use subMatrix() More...

Foam::ConstMatrixBlock< Foam::Matrix< SquareMatrix< scalar >, scalar > > block (const label rowIndex, const label colIndex) const

Foam::MatrixBlock< Foam::Matrix< SquareMatrix< scalar >, scalar > > block (const label rowIndex, const label colIndex)

void checki (const label irow) const
Check index i is within valid range [0, m) More...

void checkj (const label jcol) const
Check index j is within valid range [0, n) More...

void checkSize () const
Check that dimensions are positive, non-zero. More...

bool uniform () const
True if all entries have identical values, and Matrix is non-empty. More...

void clear ()
Clear Matrix, i.e. set sizes to zero. More...

List< scalar > release ()

void swap (Matrix< SquareMatrix< scalar >, scalar > &mat)
Swap contents. More...

void transfer (Matrix< SquareMatrix< scalar >, scalar > &mat)

void resize (const label m, const label n)
Change Matrix dimensions, preserving the elements. More...

void setSize (const label m, const label n)
Change Matrix dimensions, preserving the elements. More...

void shallowResize (const label m, const label n)
Resize Matrix without reallocating storage (unsafe) More...

void round (const scalar tol=SMALL)
Round elements with magnitude smaller than tol (SMALL) to zero. More...

SquareMatrix< scalar > T () const
Return (conjugate) transpose of Matrix. More...

tmp< Field< scalar > > Amul (const UList< scalar > &x) const
Right-multiply Matrix by a column vector (A * x) More...

tmp< Field< scalar > > Amul (const IndirectListBase< scalar, Addr > &x) const
Right-multiply Matrix by a column vector (A * x) More...

Foam::tmp< Foam::Field< scalar > > Amul (const IndirectListBase< scalar, Addr > &x) const

tmp< Field< scalar > > Tmul (const UList< scalar > &x) const
Left-multiply Matrix by a row vector (x * A) More...

tmp< Field< scalar > > Tmul (const IndirectListBase< scalar, Addr > &x) const
Left-multiply Matrix by a row vector (x * A) More...

Foam::tmp< Foam::Field< scalar > > Tmul (const IndirectListBase< scalar, Addr > &x) const

List< scalar > diag () const
Extract the diagonal elements. Method may change in the future. More...

void diag (const UList< scalar > &list)
Assign diagonal of Matrix. More...

scalar trace () const
Return the trace. More...

scalar columnNorm (const label colIndex, const bool noSqrt=false) const
Return L2-Norm of chosen column. More...

scalar norm (const bool noSqrt=false) const
Return Frobenius norm of Matrix. More...

const scalar * operator[] (const label irow) const
Return const pointer to data in the specified row - rowData(). More...

scalar * operator[] (const label irow)
Return pointer to data in the specified row - rowData(). More...

const scalar & operator() (const label irow, const label jcol) const
(i, j) const element access operator More...

scalar & operator() (const label irow, const label jcol)
(i, j) element access operator More...

void operator= (const Matrix< SquareMatrix< scalar >, scalar > &mat)
Copy assignment. Takes linear time. More...

void operator= (Matrix< SquareMatrix< scalar >, scalar > &&mat)
Move assignment. More...

void operator= (const ConstMatrixBlock< MatrixType > &Mb)
Assignment to a block of another Matrix. More...

void operator= (const MatrixBlock< MatrixType > &Mb)
Assignment to a block of another Matrix. More...

void operator= (const zero)
Assignment of all elements to zero. More...

void operator= (const scalar &val)
Assignment of all elements to the given value. More...

void operator+= (const Matrix< SquareMatrix< scalar >, scalar > &other)
Matrix addition. More...

void operator+= (const scalar &s)
Matrix scalar addition. More...

void operator-= (const Matrix< SquareMatrix< scalar >, scalar > &other)
Matrix subtraction. More...

void operator-= (const scalar &s)
Matrix scalar subtraction. More...

void operator*= (const scalar &s)
Matrix scalar multiplication. More...

void operator/= (const scalar &s)
Matrix scalar division. More...

iterator begin ()
Return an iterator to begin traversing a Matrix. More...

const_iterator begin () const
Return const_iterator to begin traversing a constant Matrix. More...

iterator end ()
Return an iterator to end traversing a Matrix. More...

const_iterator end () const
Return const_iterator to end traversing a constant Matrix. More...

const_iterator cbegin () const
Return const_iterator to begin traversing a constant Matrix. More...

const_iterator cend () const
Return const_iterator to end traversing a constant Matrix. More...

bool readMatrix (Istream &is)
Read Matrix from Istream, discarding existing contents. More...

OstreamwriteMatrix (Ostream &os, const label shortLen=0) const

label mRows () const noexcept
The number of rows - same as m() More...

label nRows () const noexcept
The number of rows - same as m() More...

label nCols () const noexcept
The number of columns - same as n() More...

const scalar * v () const
Deprecated(2019-04) raw data pointer, const access. More...

scalar * v ()
Deprecated(2019-04) raw data pointer, non-const access. More...

ConstMatrixBlock< mTypecol (const label m, const label mStart, const label nStart) const
Deprecated(2019-04) - use subColumn() More...

MatrixBlock< mTypecol (const label m, const label mStart, const label nStart)
Deprecated(2019-04) - use subColumn() More...

void col (const label m, const label rowStart) const=delete
Deleted(2019-04) - use subColumn() More...

void col (const label m, const label rowStart)=delete
Deleted(2019-04) - use subColumn() More...

## Additional Inherited Members

Public Types inherited from Matrix< SquareMatrix< scalar >, scalar >
typedef Matrix< SquareMatrix< scalar >, scalar > mType
Matrix type. More...

typedef scalar cmptType
Component type. More...

typedef scalar * iterator
Random access iterator for traversing a Matrix. More...

Static Public Member Functions inherited from Matrix< SquareMatrix< scalar >, scalar >
static const Matrix< SquareMatrix< scalar >, scalar > & null ()
Return a null Matrix. More...

Public Attributes inherited from Matrix< SquareMatrix< scalar >, scalar >
const typedef scalar * const_iterator
Random access iterator for traversing a Matrix. More...

## Detailed Description

Class to perform the LU decomposition on a symmetric matrix.

Source files

Definition at line 56 of file LUscalarMatrix.H.

## ◆ LUscalarMatrix() [1/3]

 LUscalarMatrix ( )

Construct null.

Definition at line 44 of file LUscalarMatrix.C.

## ◆ LUscalarMatrix() [2/3]

 LUscalarMatrix ( const scalarSquareMatrix & M )

Construct from and perform LU decomposition of the matrix M.

Definition at line 50 of file LUscalarMatrix.C.

References Foam::LUDecompose().

Here is the call graph for this function:

## ◆ LUscalarMatrix() [3/3]

 LUscalarMatrix ( const lduMatrix & ldum, const FieldField< Field, scalar > & interfaceCoeffs, const lduInterfaceFieldPtrsList & interfaces )

Construct from lduMatrix and perform LU decomposition.

Definition at line 61 of file LUscalarMatrix.C.

Here is the call graph for this function:

## ◆ ClassName()

 ClassName ( "LUscalarMatrix" )

## ◆ decompose()

 void decompose ( const scalarSquareMatrix & M )

Perform the LU decomposition of the matrix M.

Definition at line 407 of file LUscalarMatrix.C.

References Foam::LUDecompose(), M, and SquareMatrix< scalar >::operator=().

Here is the call graph for this function:

## ◆ solve() [1/3]

 void solve ( List< Type > & x, const UList< Type > & source ) const

Solve the linear system with the given source.

and returning the solution in the Field argument x. This function may be called with the same field for x and source.

Definition at line 36 of file LUscalarMatrixTemplates.C.

Here is the call graph for this function:

## ◆ solve() [2/3]

 tmp > solve ( const UList< Type > & source ) const

Solve the linear system with the given source.

returning the solution

## ◆ inv()

 void inv ( scalarSquareMatrix & M ) const

Set M to the inverse of this square matrix.

Definition at line 415 of file LUscalarMatrix.C.

References Foam::LUBacksubstitute(), M, and Foam::Zero.

Here is the call graph for this function:

## ◆ solve() [3/3]

 Foam::tmp > solve ( const UList< Type > & source ) const

Definition at line 140 of file LUscalarMatrixTemplates.C.

References Foam::New(), and solve().

Here is the call graph for this function:

The documentation for this class was generated from the following files: