Matrix< Form, Type > Class Template Reference

A templated (m x n) matrix of objects of <T>. The layout is (mRows x nCols) - row-major order: More...

Inheritance diagram for Matrix< Form, Type >:
[legend]

Public Types

typedef Matrix< Form, Type > mType
 Matrix type. More...
 
typedef Type cmptType
 Component type. More...
 
typedef Type * iterator
 Random access iterator for traversing a Matrix. More...
 
typedef const Type * const_iterator
 Random access iterator for traversing a Matrix. More...
 

Public Member Functions

 Matrix () noexcept
 Default construct (empty matrix) More...
 
 Matrix (const label m, const label n)
 Construct given number of rows/columns. More...
 
 Matrix (const label m, const label n, const Foam::zero)
 
 Matrix (const label m, const label n, const Type &val)
 
 Matrix (const labelPair &dims)
 Construct given number of rows/columns. More...
 
 Matrix (const labelPair &dims, const Foam::zero)
 
 Matrix (const labelPair &dims, const Type &val)
 
 Matrix (const Matrix< Form, Type > &mat)
 Copy construct. More...
 
 Matrix (Matrix< Form, Type > &&mat)
 Move construct. More...
 
template<class Form2 >
 Matrix (const Matrix< Form2, Type > &mat)
 Copy constructor from Matrix of a different form. More...
 
template<class MatrixType >
 Matrix (const ConstMatrixBlock< MatrixType > &Mb)
 Construct from a block of another Matrix. More...
 
template<class MatrixType >
 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 Type * cdata () const noexcept
 
Type * data () noexcept
 
const char * cdata_bytes () const noexcept
 
char * data_bytes () noexcept
 
std::streamsize size_bytes () const noexcept
 
std::streamsize byteSize () const
 
const Type * rowData (const label irow) const
 Return const pointer to data in the specified row. More...
 
Type * rowData (const label irow)
 Return pointer to data in the specified row. More...
 
const Type & at (const label idx) const
 Linear addressing const element access. More...
 
Type & 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...
 
ConstMatrixBlock< mTypesubRow (const label rowIndex, const label colIndex=0, label len=-1) const
 Return const row or const 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...
 
template<class VectorSpace >
ConstMatrixBlock< mTypeblock (const label rowIndex, const label colIndex) const
 Access Field as a ConstMatrixBlock. More...
 
MatrixBlock< mTypesubColumn (const label colIndex, const label rowIndex=0, label len=-1)
 Return column or column'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...
 
MatrixBlock< mTypesubMatrix (const label rowIndex, const label colIndex, label szRows=-1, label szCols=-1)
 Return sub-block of Matrix. More...
 
template<class VectorSpace >
MatrixBlock< mTypeblock (const label rowIndex, const label colIndex)
 Access Field as a MatrixBlock. More...
 
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< Type > release ()
 
void swap (Matrix< Form, Type > &mat)
 Swap contents. More...
 
void transfer (Matrix< Form, Type > &mat)
 
void resize (const label m, const label n)
 Change Matrix dimensions, preserving the elements. More...
 
void resize_nocopy (const label mrow, const label ncol)
 Change Matrix dimensions without preserving existing content. 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...
 
Form T () const
 Return conjugate transpose of Matrix. More...
 
Form transpose () const
 Return non-conjugate transpose of Matrix. More...
 
tmp< Field< Type > > Amul (const UList< Type > &x) const
 Right-multiply Matrix by a column vector (A * x) More...
 
template<class Addr >
tmp< Field< Type > > Amul (const IndirectListBase< Type, Addr > &x) const
 Right-multiply Matrix by a column vector (A * x) More...
 
tmp< Field< Type > > Tmul (const UList< Type > &x) const
 Left-multiply Matrix by a row vector (x * A) More...
 
template<class Addr >
tmp< Field< Type > > Tmul (const IndirectListBase< Type, Addr > &x) const
 Left-multiply Matrix by a row vector (x * A) More...
 
List< Type > diag () const
 Extract the diagonal elements. Method may change in the future. More...
 
void diag (const UList< Type > &list)
 Assign diagonal of Matrix. More...
 
Type 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 Type * operator[] (const label irow) const
 Return const pointer to data in the specified row - rowData(). More...
 
Type * operator[] (const label irow)
 Return pointer to data in the specified row - rowData(). More...
 
const Type & operator() (const label irow, const label jcol) const
 (i, j) const element access operator More...
 
Type & operator() (const label irow, const label jcol)
 (i, j) element access operator More...
 
void operator= (const Matrix< Form, Type > &mat)
 Copy assignment. Takes linear time. More...
 
void operator= (Matrix< Form, Type > &&mat)
 Move assignment. More...
 
template<class MatrixType >
void operator= (const ConstMatrixBlock< MatrixType > &Mb)
 Assignment to a block of another Matrix. More...
 
template<class MatrixType >
void operator= (const MatrixBlock< MatrixType > &Mb)
 Assignment to a block of another Matrix. More...
 
void operator= (const Foam::zero)
 Assignment of all elements to zero. More...
 
void operator= (const Type &val)
 Assignment of all elements to the given value. More...
 
void operator+= (const Matrix< Form, Type > &other)
 Matrix addition. More...
 
void operator-= (const Matrix< Form, Type > &other)
 Matrix subtraction. More...
 
void operator+= (const Type &s)
 Matrix scalar addition. More...
 
void operator-= (const Type &s)
 Matrix scalar subtraction. More...
 
void operator*= (const Type &s)
 Matrix scalar multiplication. More...
 
void operator/= (const Type &s)
 Matrix scalar division. More...
 
iterator begin () noexcept
 Return an iterator to begin traversing a Matrix. More...
 
iterator end () noexcept
 Return an iterator to end traversing a Matrix. More...
 
const_iterator cbegin () const noexcept
 Return const_iterator to begin traversing a constant Matrix. More...
 
const_iterator cend () const noexcept
 Return const_iterator to end traversing a constant Matrix. More...
 
const_iterator begin () const noexcept
 Return const_iterator to begin traversing a constant Matrix. More...
 
const_iterator end () const noexcept
 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 Type * v () const
 Deprecated(2019-04) raw data pointer, const access. More...
 
Type * v ()
 Deprecated(2019-04) raw data pointer, non-const access. 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...
 
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...
 
template<class ListType >
Foam::tmp< Foam::Field< Type > > AmulImpl (const ListType &x) const
 
template<class ListType >
Foam::tmp< Foam::Field< Type > > TmulImpl (const ListType &x) const
 
template<class VectorSpace >
Foam::ConstMatrixBlock< Foam::Matrix< Form, Type > > block (const label rowIndex, const label colIndex) const
 
template<class VectorSpace >
Foam::MatrixBlock< Foam::Matrix< Form, Type > > block (const label rowIndex, const label colIndex)
 
template<class Addr >
Foam::tmp< Foam::Field< Type > > Amul (const IndirectListBase< Type, Addr > &x) const
 
template<class Addr >
Foam::tmp< Foam::Field< Type > > Tmul (const IndirectListBase< Type, Addr > &x) const
 

Static Public Member Functions

static const Matrix< Form, Type > & null ()
 Return a null Matrix. More...
 

Detailed Description

template<class Form, class Type>
class Foam::Matrix< Form, Type >

A templated (m x n) matrix of objects of <T>. The layout is (mRows x nCols) - row-major order:

    (0,0)
      +---> j [nCols]
      |
      |
      v
      i [mRows]
Source files

Definition at line 80 of file Matrix.H.

Member Typedef Documentation

◆ mType

typedef Matrix<Form, Type> mType

Matrix type.

Definition at line 108 of file Matrix.H.

◆ cmptType

typedef Type cmptType

Component type.

Definition at line 111 of file Matrix.H.

◆ iterator

typedef Type* iterator

Random access iterator for traversing a Matrix.

Definition at line 123 of file Matrix.H.

◆ const_iterator

typedef const Type* const_iterator

Random access iterator for traversing a Matrix.

Definition at line 126 of file Matrix.H.

Constructor & Destructor Documentation

◆ Matrix() [1/13]

Matrix
inlinenoexcept

Default construct (empty matrix)

Definition at line 49 of file MatrixI.H.

◆ Matrix() [2/13]

Matrix ( const label  m,
const label  n 
)

Construct given number of rows/columns.

Definition at line 109 of file Matrix.C.

References Matrix< Form, Type >::checkSize().

Here is the call graph for this function:

◆ Matrix() [3/13]

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

Construct with given number of rows/columns initializing all elements to zero

Definition at line 122 of file Matrix.C.

References Matrix< Form, Type >::begin(), Matrix< Form, Type >::checkSize(), Matrix< Form, Type >::end(), and Foam::Zero.

Here is the call graph for this function:

◆ Matrix() [4/13]

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

Construct with given number of rows/columns initializing all elements to the given value

Definition at line 137 of file Matrix.C.

◆ Matrix() [5/13]

Matrix ( const labelPair dims)
inlineexplicit

Construct given number of rows/columns.

Definition at line 58 of file MatrixI.H.

◆ Matrix() [6/13]

Matrix ( const labelPair dims,
const Foam::zero   
)
inline

Construct given number of rows/columns initializing all elements to zero

Definition at line 65 of file MatrixI.H.

◆ Matrix() [7/13]

Matrix ( const labelPair dims,
const Type &  val 
)
inline

Construct with given number of rows/columns initializing all elements to the given value

Definition at line 72 of file MatrixI.H.

◆ Matrix() [8/13]

Matrix ( const Matrix< Form, Type > &  mat)

Copy construct.

Definition at line 152 of file Matrix.C.

◆ Matrix() [9/13]

Matrix ( Matrix< Form, Type > &&  mat)

Move construct.

Definition at line 168 of file Matrix.C.

◆ Matrix() [10/13]

Matrix ( const Matrix< Form2, Type > &  mat)
explicit

Copy constructor from Matrix of a different form.

Definition at line 182 of file Matrix.C.

References Matrix< Form, Type >::cbegin(), Matrix< Form, Type >::cdata(), and Matrix< Form, Type >::cend().

Here is the call graph for this function:

◆ Matrix() [11/13]

Matrix ( const ConstMatrixBlock< MatrixType > &  Mb)
inline

Construct from a block of another Matrix.

Definition at line 199 of file Matrix.C.

◆ Matrix() [12/13]

Matrix ( const MatrixBlock< MatrixType > &  Mb)
inline

Construct from a block of another Matrix.

Definition at line 221 of file Matrix.C.

◆ Matrix() [13/13]

Matrix ( Istream is)
explicit

Construct from Istream.

Definition at line 40 of file MatrixIO.C.

References Matrix< Form, Type >::readMatrix().

Here is the call graph for this function:

◆ ~Matrix()

Destructor.

Definition at line 244 of file Matrix.C.

Member Function Documentation

◆ null()

const Foam::Matrix< Form, Type > & null
inlinestatic

Return a null Matrix.

Definition at line 89 of file MatrixI.H.

◆ clone()

Foam::autoPtr< Foam::Matrix< Form, Type > > clone
inline

Clone.

Definition at line 80 of file MatrixI.H.

References Foam::New().

Here is the call graph for this function:

◆ m()

◆ n()

Foam::label n
inlinenoexcept

◆ size()

Foam::label size
inline

The number of elements in Matrix (m*n)

Definition at line 110 of file MatrixI.H.

Referenced by Matrix< Form, Type >::writeMatrix().

Here is the caller graph for this function:

◆ sizes()

Foam::labelPair sizes
inline

Return row/column sizes.

Definition at line 117 of file MatrixI.H.

Referenced by Foam::applyPermutation(), Foam::operator*(), Foam::operator+(), Foam::operator-(), and Foam::operator/().

Here is the caller graph for this function:

◆ empty()

bool empty
inlinenoexcept

Return true if Matrix is empty (i.e., size() is zero)

Definition at line 124 of file MatrixI.H.

Referenced by Foam::max(), and Foam::min().

Here is the caller graph for this function:

◆ cdata()

const Type * cdata
inlinenoexcept

Return const pointer to the first data element, which can also be used to address into Matrix contents

Definition at line 202 of file MatrixI.H.

Referenced by Matrix< Form, Type >::Matrix(), Matrix< RectangularMatrix< Type >, Type >::Matrix(), and Matrix< Form, Type >::writeMatrix().

Here is the caller graph for this function:

◆ data()

Type * data
inlinenoexcept

Return pointer to the first data element, which can also be used to address into Matrix contents

Definition at line 209 of file MatrixI.H.

◆ cdata_bytes()

const char * cdata_bytes
inlinenoexcept

Return pointer to the underlying array serving as data storage, reinterpreted as byte data.

Note
Only meaningful for contiguous data

Definition at line 216 of file MatrixI.H.

Referenced by Matrix< Form, Type >::writeMatrix().

Here is the caller graph for this function:

◆ data_bytes()

char * data_bytes
inlinenoexcept

Return pointer to the underlying array serving as data storage, reinterpreted as byte data.

Note
Only meaningful for contiguous data

Definition at line 223 of file MatrixI.H.

◆ size_bytes()

std::streamsize size_bytes
inlinenoexcept

Number of contiguous bytes for the Matrix data, no runtime check that the type is actually contiguous

Note
Only meaningful for contiguous data

Definition at line 230 of file MatrixI.H.

Referenced by Matrix< Form, Type >::writeMatrix().

Here is the caller graph for this function:

◆ byteSize()

std::streamsize byteSize

Number of contiguous bytes for the Matrix data, runtime FatalError if type is not contiguous

Definition at line 511 of file Matrix.C.

References Foam::abort(), Foam::FatalError, and FatalErrorInFunction.

Here is the call graph for this function:

◆ rowData() [1/2]

const Type * rowData ( const label  irow) const
inline

Return const pointer to data in the specified row.

Subscript checking only with FULLDEBUG

Definition at line 237 of file MatrixI.H.

◆ rowData() [2/2]

Type * rowData ( const label  irow)
inline

Return pointer to data in the specified row.

Subscript checking only with FULLDEBUG

Definition at line 247 of file MatrixI.H.

◆ at() [1/2]

const Type & at ( const label  idx) const
inline

Linear addressing const element access.

Subscript checking only with FULLDEBUG

Definition at line 257 of file MatrixI.H.

References Foam::abort(), Foam::FatalError, and FatalErrorInFunction.

Here is the call graph for this function:

◆ at() [2/2]

Type & at ( const label  idx)
inline

Linear addressing element access.

Subscript checking only with FULLDEBUG

Definition at line 272 of file MatrixI.H.

◆ subColumn() [1/2]

Foam::ConstMatrixBlock< Foam::Matrix< Form, Type > > subColumn ( const label  colIndex,
const label  rowIndex = 0,
label  len = -1 
) const
inline

Return const column or column's subset of Matrix.

Return entire column by its index: M.subColumn(a); Return subset of a column starting from rowIndex: M.subColumn(a, b); Return subset of a column starting from rowIndex with szRows elems: M.subColumn(a, b, c);

Definition at line 288 of file MatrixI.H.

Referenced by SquareMatrix< Type >::applyPermutation(), Foam::applyPermutation(), and Matrix< Form, Type >::col().

Here is the caller graph for this function:

◆ subRow() [1/2]

Foam::ConstMatrixBlock< Foam::Matrix< Form, Type > > subRow ( const label  rowIndex,
const label  colIndex = 0,
label  len = -1 
) const
inline

Return const row or const row's subset of Matrix.

Return entire row by its index: M.subRow(a); Return subset of a row starting from columnIndex: M.subRow(a,b); Return subset of a row starting from columnIndex with szCols elems: M.subRow(a, b, c);

Definition at line 313 of file MatrixI.H.

◆ subMatrix() [1/2]

Foam::ConstMatrixBlock< Foam::Matrix< Form, Type > > subMatrix ( const label  rowIndex,
const label  colIndex,
label  szRows = -1,
label  szCols = -1 
) const
inline

Return const sub-block of Matrix.

Sub-block starting at columnIndex & rowIndex indices

Definition at line 338 of file MatrixI.H.

Referenced by Matrix< Form, Type >::block().

Here is the caller graph for this function:

◆ block() [1/6]

ConstMatrixBlock< mType > block ( const label  rowIndex,
const label  colIndex 
) const
inline

Access Field as a ConstMatrixBlock.

◆ subColumn() [2/2]

Foam::MatrixBlock< Foam::Matrix< Form, Type > > subColumn ( const label  colIndex,
const label  rowIndex = 0,
label  len = -1 
)
inline

Return column or column's subset of Matrix.

Definition at line 382 of file MatrixI.H.

◆ subRow() [2/2]

Foam::MatrixBlock< Foam::Matrix< Form, Type > > subRow ( const label  rowIndex,
const label  colIndex = 0,
label  len = -1 
)
inline

Return row or row's subset of Matrix.

Definition at line 407 of file MatrixI.H.

◆ subMatrix() [2/2]

Foam::MatrixBlock< Foam::Matrix< Form, Type > > subMatrix ( const label  rowIndex,
const label  colIndex,
label  szRows = -1,
label  szCols = -1 
)
inline

Return sub-block of Matrix.

Definition at line 432 of file MatrixI.H.

◆ block() [2/6]

MatrixBlock< mType > block ( const label  rowIndex,
const label  colIndex 
)
inline

Access Field as a MatrixBlock.

◆ checki()

void checki ( const label  irow) const
inline

Check index i is within valid range [0, m)

Definition at line 131 of file MatrixI.H.

◆ checkj()

void checkj ( const label  jcol) const
inline

Check index j is within valid range [0, n)

Definition at line 149 of file MatrixI.H.

◆ checkSize()

void checkSize
inline

Check that dimensions are positive, non-zero.

Definition at line 167 of file MatrixI.H.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, and Foam::nl.

Referenced by Matrix< Form, Type >::Matrix().

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

◆ uniform()

bool uniform
inline

True if all entries have identical values, and Matrix is non-empty.

Definition at line 180 of file MatrixI.H.

Referenced by Matrix< Form, Type >::writeMatrix().

Here is the caller graph for this function:

◆ clear()

void clear

Clear Matrix, i.e. set sizes to zero.

Definition at line 256 of file Matrix.C.

◆ release()

Foam::List< Type > release

Release storage management of Matrix contents by transferring management to a List

Definition at line 270 of file Matrix.C.

References clear(), and UList< T >::swap().

Here is the call graph for this function:

◆ swap()

void swap ( Matrix< Form, Type > &  mat)

Swap contents.

Definition at line 290 of file Matrix.C.

◆ transfer()

void transfer ( Matrix< Form, Type > &  mat)

Transfer the contents of the argument Matrix into this Matrix and annul the argument Matrix

Definition at line 304 of file Matrix.C.

References clear().

Referenced by LUscalarMatrix::LUscalarMatrix().

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

◆ resize()

void resize ( const label  m,
const label  n 
)

Change Matrix dimensions, preserving the elements.

Definition at line 324 of file Matrix.C.

References Foam::min(), n, and Foam::Zero.

Referenced by Foam::MatrixTools::pinv().

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

◆ resize_nocopy()

void resize_nocopy ( const label  mrow,
const label  ncol 
)

Change Matrix dimensions without preserving existing content.

Definition at line 349 of file Matrix.C.

◆ setSize()

void setSize ( const label  m,
const label  n 
)
inline

Change Matrix dimensions, preserving the elements.

Definition at line 475 of file MatrixI.H.

References n, and resize().

Here is the call graph for this function:

◆ shallowResize()

void shallowResize ( const label  m,
const label  n 
)
inline

Resize Matrix without reallocating storage (unsafe)

Definition at line 482 of file MatrixI.H.

References n.

◆ round()

void round ( const scalar  tol = SMALL)

Round elements with magnitude smaller than tol (SMALL) to zero.

Definition at line 379 of file Matrix.C.

References Foam::mag(), and Foam::Zero.

Here is the call graph for this function:

◆ T()

Form T

Return conjugate transpose of Matrix.

Definition at line 392 of file Matrix.C.

References Foam::Detail::conj(), and n.

Referenced by chemPointISAT< CompType, ThermoType >::chemPointISAT().

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

◆ transpose()

Form transpose

Return non-conjugate transpose of Matrix.

Definition at line 409 of file Matrix.C.

◆ Amul() [1/3]

Foam::tmp< Foam::Field< Type > > Amul ( const UList< Type > &  x) const
inline

Right-multiply Matrix by a column vector (A * x)

Definition at line 490 of file MatrixI.H.

◆ Amul() [2/3]

tmp< Field< Type > > Amul ( const IndirectListBase< Type, Addr > &  x) const
inline

Right-multiply Matrix by a column vector (A * x)

◆ Tmul() [1/3]

Foam::tmp< Foam::Field< Type > > Tmul ( const UList< Type > &  x) const
inline

Left-multiply Matrix by a row vector (x * A)

Definition at line 511 of file MatrixI.H.

References x.

◆ Tmul() [2/3]

tmp< Field< Type > > Tmul ( const IndirectListBase< Type, Addr > &  x) const
inline

Left-multiply Matrix by a row vector (x * A)

◆ diag() [1/2]

Foam::List< Type > diag

Extract the diagonal elements. Method may change in the future.

Definition at line 426 of file Matrix.C.

References Foam::min().

Here is the call graph for this function:

◆ diag() [2/2]

void diag ( const UList< Type > &  list)

Assign diagonal of Matrix.

Definition at line 442 of file Matrix.C.

◆ trace()

Type trace

Return the trace.

Definition at line 463 of file Matrix.C.

◆ columnNorm()

Foam::scalar columnNorm ( const label  colIndex,
const bool  noSqrt = false 
) const

Return L2-Norm of chosen column.

Optional without sqrt for parallel usage.

Definition at line 479 of file Matrix.C.

References Foam::magSqr(), Foam::sqrt(), and Foam::Zero.

Here is the call graph for this function:

◆ norm()

Foam::scalar norm ( const bool  noSqrt = false) const

Return Frobenius norm of Matrix.

Optional without sqrt for parallel usage.

Definition at line 497 of file Matrix.C.

References Foam::magSqr(), Foam::sqrt(), and Foam::Zero.

Here is the call graph for this function:

◆ operator[]() [1/2]

const Type * operator[] ( const label  irow) const
inline

Return const pointer to data in the specified row - rowData().

Subscript checking only with FULLDEBUG

Definition at line 614 of file MatrixI.H.

Referenced by LUscalarMatrix::LUscalarMatrix().

Here is the caller graph for this function:

◆ operator[]() [2/2]

Type * operator[] ( const label  irow)
inline

Return pointer to data in the specified row - rowData().

Subscript checking only with FULLDEBUG

Definition at line 624 of file MatrixI.H.

◆ operator()() [1/2]

const Type & operator() ( const label  irow,
const label  jcol 
) const
inline

(i, j) const element access operator

Subscript checking only with FULLDEBUG

Definition at line 584 of file MatrixI.H.

◆ operator()() [2/2]

Type & operator() ( const label  irow,
const label  jcol 
)
inline

(i, j) element access operator

Subscript checking only with FULLDEBUG

Definition at line 599 of file MatrixI.H.

◆ operator=() [1/6]

void operator= ( const Matrix< Form, Type > &  mat)

Copy assignment. Takes linear time.

Definition at line 526 of file Matrix.C.

References Matrix< Form, Type >::cbegin(), Matrix< Form, Type >::cend(), and clear().

Here is the call graph for this function:

◆ operator=() [2/6]

void operator= ( Matrix< Form, Type > &&  mat)

Move assignment.

Definition at line 549 of file Matrix.C.

◆ operator=() [3/6]

void operator= ( const ConstMatrixBlock< MatrixType > &  Mb)

Assignment to a block of another Matrix.

Definition at line 561 of file Matrix.C.

◆ operator=() [4/6]

void operator= ( const MatrixBlock< MatrixType > &  Mb)

Assignment to a block of another Matrix.

Definition at line 578 of file Matrix.C.

◆ operator=() [5/6]

void operator= ( const Foam::zero  )

Assignment of all elements to zero.

Definition at line 601 of file Matrix.C.

References Foam::Zero.

◆ operator=() [6/6]

void operator= ( const Type &  val)

Assignment of all elements to the given value.

Definition at line 594 of file Matrix.C.

◆ operator+=() [1/2]

void operator+= ( const Matrix< Form, Type > &  other)

Matrix addition.

Definition at line 608 of file Matrix.C.

References Foam::abort(), Matrix< Form, Type >::cbegin(), Foam::FatalError, FatalErrorInFunction, Matrix< Form, Type >::m(), n, Matrix< Form, Type >::n(), and Foam::nl.

Here is the call graph for this function:

◆ operator-=() [1/2]

void operator-= ( const Matrix< Form, Type > &  other)

Matrix subtraction.

Definition at line 638 of file Matrix.C.

References Foam::abort(), Matrix< Form, Type >::cbegin(), Foam::FatalError, FatalErrorInFunction, Matrix< Form, Type >::m(), n, Matrix< Form, Type >::n(), and Foam::nl.

Here is the call graph for this function:

◆ operator+=() [2/2]

void operator+= ( const Type &  s)

Matrix scalar addition.

Definition at line 668 of file Matrix.C.

References s().

Here is the call graph for this function:

◆ operator-=() [2/2]

void operator-= ( const Type &  s)

Matrix scalar subtraction.

Definition at line 678 of file Matrix.C.

References s().

Here is the call graph for this function:

◆ operator*=()

void operator*= ( const Type &  s)

Matrix scalar multiplication.

Definition at line 688 of file Matrix.C.

References s().

Here is the call graph for this function:

◆ operator/=()

void operator/= ( const Type &  s)

Matrix scalar division.

Definition at line 698 of file Matrix.C.

References s().

Here is the call graph for this function:

◆ begin() [1/2]

Foam::Matrix< Form, Type >::iterator begin
inlinenoexcept

Return an iterator to begin traversing a Matrix.

Definition at line 535 of file MatrixI.H.

Referenced by EigenMatrix< cmptType >::complexEVecs(), and Matrix< Form, Type >::Matrix().

Here is the caller graph for this function:

◆ end() [1/2]

Foam::Matrix< Form, Type >::iterator end
inlinenoexcept

Return an iterator to end traversing a Matrix.

Definition at line 543 of file MatrixI.H.

Referenced by Matrix< Form, Type >::Matrix(), Foam::operator-(), and Foam::operator/().

Here is the caller graph for this function:

◆ cbegin()

Foam::Matrix< Form, Type >::const_iterator cbegin
inlinenoexcept

Return const_iterator to begin traversing a constant Matrix.

Definition at line 551 of file MatrixI.H.

Referenced by STDMD::initialise(), Matrix< Form, Type >::Matrix(), Foam::max(), Foam::min(), Foam::operator*(), Foam::operator+(), Matrix< Form, Type >::operator+=(), Foam::operator-(), Matrix< Form, Type >::operator-=(), Foam::operator/(), and Matrix< Form, Type >::operator=().

Here is the caller graph for this function:

◆ cend()

Foam::Matrix< Form, Type >::const_iterator cend
inlinenoexcept

Return const_iterator to end traversing a constant Matrix.

Definition at line 559 of file MatrixI.H.

Referenced by Matrix< Form, Type >::Matrix(), Foam::max(), Foam::min(), Foam::operator*(), Foam::operator+(), Foam::operator-(), and Matrix< Form, Type >::operator=().

Here is the caller graph for this function:

◆ begin() [2/2]

Foam::Matrix< Form, Type >::const_iterator begin
inlinenoexcept

Return const_iterator to begin traversing a constant Matrix.

Definition at line 567 of file MatrixI.H.

◆ end() [2/2]

Foam::Matrix< Form, Type >::const_iterator end
inlinenoexcept

Return const_iterator to end traversing a constant Matrix.

Definition at line 575 of file MatrixI.H.

◆ readMatrix()

bool readMatrix ( Istream is)

Read Matrix from Istream, discarding existing contents.

Definition at line 53 of file MatrixIO.C.

References token::BEGIN_LIST, STLCore::BINARY, clear(), Foam::exit(), IOstream::fatalCheck(), Foam::FatalIOError, FatalIOErrorInFunction, IOstreamOption::format(), FUNCTION_NAME, token::info(), token::isLabel(), token::labelToken(), Foam::nl, Istream::readBeginList(), Istream::readEndList(), and Foam::readLabel().

Referenced by Matrix< Form, Type >::Matrix(), and Foam::operator>>().

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

◆ writeMatrix()

Foam::Ostream & writeMatrix ( Ostream os,
const label  shortLen = 0 
) const

Write Matrix, with line-breaks in ASCII when length exceeds shortLen.

Using '0' suppresses line-breaks entirely.

Definition at line 143 of file MatrixIO.C.

References STLCore::BINARY, Matrix< Form, Type >::cdata(), Matrix< Form, Type >::cdata_bytes(), IOstreamOption::format(), Matrix< Form, Type >::nCols(), Matrix< Form, Type >::nRows(), os(), Matrix< Form, Type >::size(), Matrix< Form, Type >::size_bytes(), token::SPACE, Matrix< Form, Type >::uniform(), and OBJstream::write().

Referenced by Foam::operator<<().

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

◆ mRows()

label mRows ( ) const
inlinenoexcept

The number of rows - same as m()

Definition at line 513 of file Matrix.H.

◆ nRows()

label nRows ( ) const
inlinenoexcept

The number of rows - same as m()

Definition at line 519 of file Matrix.H.

Referenced by Matrix< Form, Type >::writeMatrix().

Here is the caller graph for this function:

◆ nCols()

label nCols ( ) const
inlinenoexcept

The number of columns - same as n()

Definition at line 525 of file Matrix.H.

Referenced by Matrix< Form, Type >::writeMatrix().

Here is the caller graph for this function:

◆ v() [1/2]

const Type * v ( ) const
inline

Deprecated(2019-04) raw data pointer, const access.

Deprecated:
(2019-04) - use cdata() method

Definition at line 534 of file Matrix.H.

◆ v() [2/2]

Type * v ( )
inline

Deprecated(2019-04) raw data pointer, non-const access.

Deprecated:
(2019-04) - use data() method

Definition at line 542 of file Matrix.H.

◆ block() [3/6]

ConstMatrixBlock< mType > block ( const label  m,
const label  n,
const label  mStart,
const label  nStart 
) const
inline

Deprecated(2019-04) - use subMatrix()

Deprecated:
(2019-04) - use subMatrix()

Definition at line 550 of file Matrix.H.

References Matrix< Form, Type >::m(), n, and Matrix< Form, Type >::subMatrix().

Here is the call graph for this function:

◆ block() [4/6]

MatrixBlock< mType > block ( const label  m,
const label  n,
const label  mStart,
const label  nStart 
)
inline

Deprecated(2019-04) - use subMatrix()

Deprecated:
(2019-04) - use subMatrix()

Definition at line 564 of file Matrix.H.

References Matrix< Form, Type >::m(), n, and Matrix< Form, Type >::subMatrix().

Here is the call graph for this function:

◆ col() [1/4]

ConstMatrixBlock< mType > col ( const label  m,
const label  mStart,
const label  nStart 
) const
inline

Deprecated(2019-04) - use subColumn()

Deprecated:
(2019-04) - use subColumn()

Definition at line 579 of file Matrix.H.

References Matrix< Form, Type >::m(), and Matrix< Form, Type >::subColumn().

Here is the call graph for this function:

◆ col() [2/4]

MatrixBlock< mType > col ( const label  m,
const label  mStart,
const label  nStart 
)
inline

Deprecated(2019-04) - use subColumn()

Deprecated:
(2019-04) - use subColumn()

Definition at line 592 of file Matrix.H.

References Matrix< Form, Type >::m(), and Matrix< Form, Type >::subColumn().

Here is the call graph for this function:

◆ col() [3/4]

void col ( const label  m,
const label  rowStart 
) const
delete

Deleted(2019-04) - use subColumn()

Deprecated:
(2019-04) - use subColumn()

◆ col() [4/4]

void col ( const label  m,
const label  rowStart 
)
delete

Deleted(2019-04) - use subColumn()

Deprecated:
(2019-04) - use subColumn()

◆ AmulImpl()

Foam::tmp< Foam::Field< Type > > AmulImpl ( const ListType &  x) const

Definition at line 37 of file Matrix.C.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, Matrix< Form, Type >::m(), Matrix< Form, Type >::n(), Foam::nl, and x.

Here is the call graph for this function:

◆ TmulImpl()

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

Definition at line 72 of file Matrix.C.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, Matrix< Form, Type >::m(), Matrix< Form, Type >::n(), Foam::nl, and x.

Here is the call graph for this function:

◆ block() [5/6]

Foam::ConstMatrixBlock< Foam::Matrix< Form, Type > > block ( const label  rowIndex,
const label  colIndex 
) const
inline

Definition at line 363 of file MatrixI.H.

◆ block() [6/6]

Foam::MatrixBlock< Foam::Matrix< Form, Type > > block ( const label  rowIndex,
const label  colIndex 
)
inline

◆ Amul() [3/3]

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

Definition at line 501 of file MatrixI.H.

References x.

◆ Tmul() [3/3]

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

Definition at line 522 of file MatrixI.H.

References x.


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