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 >:

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)
 Construct with given number of rows/columns initializing all elements to zero. More...
 
 Matrix (const label m, const label n, const Type &val)
 Construct with given number of rows/columns initializing all elements to the given value. More...
 
 Matrix (const labelPair &dims)
 Construct given number of rows/columns. More...
 
 Matrix (const labelPair &dims, const Foam::zero)
 Construct given number of rows/columns initializing all elements to zero. More...
 
 Matrix (const labelPair &dims, const Type &val)
 Construct with given number of rows/columns initializing all elements to the given value. More...
 
 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 mRows () const noexcept
 The number of rows. More...
 
label nRows () const noexcept
 The number of rows. More...
 
label m () const noexcept
 The number of rows. More...
 
label nCols () const noexcept
 The number of columns. More...
 
label n () const noexcept
 The number of columns. More...
 
bool empty () const noexcept
 Return true if Matrix is empty (i.e., size() is zero) More...
 
label size () const
 The number of elements in Matrix (m*n) More...
 
labelPair sizes () const
 Return row/column sizes. More...
 
const Type * cdata () const noexcept
 Return const pointer to the first data element, which can also be used to address into Matrix contents. More...
 
Type * data () noexcept
 Return pointer to the first data element, which can also be used to address into Matrix contents. More...
 
const char * cdata_bytes () const noexcept
 Return pointer to the underlying array serving as data storage, reinterpreted as byte data. More...
 
char * data_bytes () noexcept
 Return pointer to the underlying array serving as data storage, reinterpreted as byte data. More...
 
std::streamsize size_bytes () const noexcept
 Number of contiguous bytes for the Matrix data, no runtime check that the type is actually contiguous. More...
 
std::streamsize byteSize () const
 Number of contiguous bytes for the Matrix data, runtime FatalError if type is not contiguous. More...
 
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 ()
 Release storage management of Matrix contents by transferring management to a List. More...
 
void swap (Matrix< Form, Type > &mat)
 Swap contents. More...
 
void transfer (Matrix< Form, Type > &mat)
 Transfer the contents of the argument Matrix into this Matrix and annul the argument Matrix. More...
 
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
 Write Matrix, with line-breaks in ASCII when length exceeds shortLen. 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 49 of file DiagonalMatrix.H.

Member Typedef Documentation

◆ mType

typedef Matrix<Form, Type> mType

Matrix type.

Definition at line 116 of file Matrix.H.

◆ cmptType

typedef Type cmptType

Component type.

Definition at line 121 of file Matrix.H.

◆ iterator

typedef Type* iterator

Random access iterator for traversing a Matrix.

Definition at line 137 of file Matrix.H.

◆ const_iterator

typedef const Type* const_iterator

Random access iterator for traversing a Matrix.

Definition at line 142 of file Matrix.H.

Constructor & Destructor Documentation

◆ Matrix() [1/13]

Matrix ( )
inlinenoexcept

Default construct (empty matrix)

Definition at line 42 of file MatrixI.H.

◆ Matrix() [2/13]

Matrix ( const label  m,
const label  n 
)

Construct given number of rows/columns.

Definition at line 101 of file Matrix.C.

◆ 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 114 of file Matrix.C.

◆ 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 129 of file Matrix.C.

◆ Matrix() [5/13]

Matrix ( const labelPair dims)
inlineexplicit

Construct given number of rows/columns.

Definition at line 51 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 58 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 65 of file MatrixI.H.

◆ Matrix() [8/13]

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

Copy construct.

Definition at line 144 of file Matrix.C.

◆ Matrix() [9/13]

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

Move construct.

Definition at line 160 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 174 of file Matrix.C.

◆ Matrix() [11/13]

Matrix ( const ConstMatrixBlock< MatrixType > &  Mb)
inline

Construct from a block of another Matrix.

Definition at line 192 of file Matrix.C.

◆ Matrix() [12/13]

Matrix ( const MatrixBlock< MatrixType > &  Mb)
inline

Construct from a block of another Matrix.

Definition at line 215 of file Matrix.C.

◆ Matrix() [13/13]

Matrix ( Istream is)
explicit

Construct from Istream.

Definition at line 32 of file MatrixIO.C.

◆ ~Matrix()

~Matrix ( )

Destructor.

Definition at line 238 of file Matrix.C.

Member Function Documentation

◆ null()

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

Return a null Matrix.

Definition at line 82 of file MatrixI.H.

◆ clone()

Foam::autoPtr< Foam::Matrix< Form, Type > > clone ( ) const
inline

Clone.

Definition at line 73 of file MatrixI.H.

◆ mRows()

label mRows ( ) const
inlinenoexcept

The number of rows.

Definition at line 238 of file Matrix.H.

◆ nRows()

label nRows ( ) const
inlinenoexcept

The number of rows.

Definition at line 243 of file Matrix.H.

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

Here is the caller graph for this function:

◆ m()

◆ nCols()

label nCols ( ) const
inlinenoexcept

The number of columns.

Definition at line 253 of file Matrix.H.

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

Here is the caller graph for this function:

◆ n()

◆ empty()

bool empty ( ) const
inlinenoexcept

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

Definition at line 103 of file MatrixI.H.

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

Here is the caller graph for this function:

◆ size()

Foam::label size ( ) const
inline

The number of elements in Matrix (m*n)

Definition at line 89 of file MatrixI.H.

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

Here is the caller graph for this function:

◆ sizes()

Foam::labelPair sizes ( ) const
inline

Return row/column sizes.

Definition at line 96 of file MatrixI.H.

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

Here is the caller graph for this function:

◆ cdata()

const Type * cdata ( ) const
inlinenoexcept

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

Definition at line 182 of file MatrixI.H.

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

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 189 of file MatrixI.H.

◆ cdata_bytes()

const char * cdata_bytes ( ) const
inlinenoexcept

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

Note
Only meaningful for contiguous data

Definition at line 196 of file MatrixI.H.

Referenced by Matrix< RectangularMatrix< Type >, 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 203 of file MatrixI.H.

◆ size_bytes()

std::streamsize size_bytes ( ) const
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 210 of file MatrixI.H.

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

Here is the caller graph for this function:

◆ byteSize()

std::streamsize byteSize ( ) const

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

Definition at line 502 of file Matrix.C.

◆ 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 217 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 227 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 237 of file MatrixI.H.

◆ at() [2/2]

Type & at ( const label  idx)
inline

Linear addressing element access.

Subscript checking only with FULLDEBUG

Definition at line 252 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 269 of file MatrixI.H.

Referenced by Foam::applyPermutation(), and Matrix< RectangularMatrix< Type >, 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 294 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 319 of file MatrixI.H.

Referenced by Matrix< RectangularMatrix< Type >, 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 363 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 388 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 413 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 110 of file MatrixI.H.

◆ checkj()

void checkj ( const label  jcol) const
inline

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

Definition at line 128 of file MatrixI.H.

◆ checkSize()

void checkSize ( ) const
inline

Check that dimensions are positive, non-zero.

Definition at line 146 of file MatrixI.H.

◆ uniform()

bool uniform ( ) const
inline

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

Definition at line 159 of file MatrixI.H.

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

Here is the caller graph for this function:

◆ clear()

void clear ( )

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

Definition at line 247 of file Matrix.C.

Referenced by STDMD::fit().

Here is the caller graph for this function:

◆ release()

Foam::List< Type > release ( )

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

Definition at line 261 of file Matrix.C.

◆ swap()

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

Swap contents.

Definition at line 281 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 295 of file Matrix.C.

◆ resize()

void resize ( const label  m,
const label  n 
)

Change Matrix dimensions, preserving the elements.

Definition at line 315 of file Matrix.C.

◆ resize_nocopy()

void resize_nocopy ( const label  mrow,
const label  ncol 
)

Change Matrix dimensions without preserving existing content.

Definition at line 340 of file Matrix.C.

◆ setSize()

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

Change Matrix dimensions, preserving the elements.

Definition at line 455 of file MatrixI.H.

◆ shallowResize()

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

Resize Matrix without reallocating storage (unsafe)

Definition at line 462 of file MatrixI.H.

◆ round()

void round ( const scalar  tol = SMALL)

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

Definition at line 370 of file Matrix.C.

◆ T()

Form T ( ) const

Return conjugate transpose of Matrix.

Definition at line 383 of file Matrix.C.

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

Here is the caller graph for this function:

◆ transpose()

Form transpose ( ) const

Return non-conjugate transpose of Matrix.

Definition at line 400 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 471 of file MatrixI.H.

Referenced by Foam::operator*().

Here is the caller graph for this function:

◆ 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 492 of file MatrixI.H.

Referenced by Foam::operator*().

Here is the caller graph for this function:

◆ 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 ( ) const

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

Definition at line 417 of file Matrix.C.

◆ diag() [2/2]

void diag ( const UList< Type > &  list)

Assign diagonal of Matrix.

Definition at line 433 of file Matrix.C.

◆ trace()

Type trace ( ) const

Return the trace.

Definition at line 454 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 471 of file Matrix.C.

◆ norm()

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

Return Frobenius norm of Matrix.

Optional without sqrt for parallel usage.

Definition at line 488 of file Matrix.C.

◆ 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 594 of file MatrixI.H.

◆ 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 604 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 565 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 580 of file MatrixI.H.

◆ operator=() [1/6]

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

Copy assignment. Takes linear time.

Definition at line 517 of file Matrix.C.

◆ operator=() [2/6]

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

Move assignment.

Definition at line 540 of file Matrix.C.

◆ operator=() [3/6]

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

Assignment to a block of another Matrix.

Definition at line 553 of file Matrix.C.

◆ operator=() [4/6]

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

Assignment to a block of another Matrix.

Definition at line 570 of file Matrix.C.

◆ operator=() [5/6]

void operator= ( const Foam::zero  )

Assignment of all elements to zero.

Definition at line 592 of file Matrix.C.

◆ operator=() [6/6]

void operator= ( const Type &  val)

Assignment of all elements to the given value.

Definition at line 585 of file Matrix.C.

◆ operator+=() [1/2]

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

Matrix addition.

Definition at line 599 of file Matrix.C.

◆ operator-=() [1/2]

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

Matrix subtraction.

Definition at line 629 of file Matrix.C.

◆ operator+=() [2/2]

void operator+= ( const Type &  s)

Matrix scalar addition.

Definition at line 659 of file Matrix.C.

◆ operator-=() [2/2]

void operator-= ( const Type &  s)

Matrix scalar subtraction.

Definition at line 669 of file Matrix.C.

◆ operator*=()

void operator*= ( const Type &  s)

Matrix scalar multiplication.

Definition at line 679 of file Matrix.C.

◆ operator/=()

void operator/= ( const Type &  s)

Matrix scalar division.

Definition at line 689 of file Matrix.C.

◆ begin() [1/2]

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

Return an iterator to begin traversing a Matrix.

Definition at line 515 of file MatrixI.H.

◆ end() [1/2]

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

Return an iterator to end traversing a Matrix.

Definition at line 523 of file MatrixI.H.

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

Here is the caller graph for this function:

◆ cbegin()

◆ cend()

Foam::Matrix< Form, Type >::const_iterator cend ( ) const
inlinenoexcept

Return const_iterator to end traversing a constant Matrix.

Definition at line 539 of file MatrixI.H.

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

Here is the caller graph for this function:

◆ begin() [2/2]

Foam::Matrix< Form, Type >::const_iterator begin ( ) const
inlinenoexcept

Return const_iterator to begin traversing a constant Matrix.

Definition at line 547 of file MatrixI.H.

◆ end() [2/2]

Foam::Matrix< Form, Type >::const_iterator end ( ) const
inlinenoexcept

Return const_iterator to end traversing a constant Matrix.

Definition at line 555 of file MatrixI.H.

◆ readMatrix()

bool readMatrix ( Istream is)

Read Matrix from Istream, discarding existing contents.

Definition at line 45 of file MatrixIO.C.

Referenced by Foam::operator>>().

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 135 of file MatrixIO.C.

◆ 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 738 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 749 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 761 of file Matrix.H.

◆ 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 778 of file Matrix.H.

◆ 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 796 of file Matrix.H.

◆ 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 812 of file Matrix.H.

◆ 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 30 of file Matrix.C.

◆ TmulImpl()

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

Definition at line 65 of file Matrix.C.

◆ block() [5/6]

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

Definition at line 344 of file MatrixI.H.

◆ block() [6/6]

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

Definition at line 438 of file MatrixI.H.

◆ Amul() [3/3]

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

Definition at line 482 of file MatrixI.H.

◆ Tmul() [3/3]

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

Definition at line 503 of file MatrixI.H.


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