Matrix< Form, Type > Class Template Reference

A templated (m x n) matrix of objects of <T>. More...

Inheritance diagram for Matrix< Form, Type >:

Public Types

typedef Matrix< Form, Type > mType
 Matrix type. More...
 
typedef Type cmptType
 Component type. More...
 

Public Member Functions

 Matrix ()
 Null constructor. More...
 
 Matrix (const label m, const label n)
 Construct given number of rows and columns. More...
 
 Matrix (const label m, const label n, const zero)
 Construct with given number of rows and columns. More...
 
 Matrix (const label m, const label n, const Type &)
 Construct with given number of rows and columns. More...
 
 Matrix (const mType &)
 Copy constructor. More...
 
template<class Form2 >
 Matrix (const Matrix< Form2, Type > &)
 Copy constructor from matrix of a different form. More...
 
template<class MatrixType >
 Matrix (const ConstMatrixBlock< MatrixType > &)
 Construct from a block of another matrix. More...
 
template<class MatrixType >
 Matrix (const MatrixBlock< MatrixType > &)
 Construct from a block of another matrix. More...
 
 Matrix (Istream &)
 Construct from Istream. More...
 
autoPtr< mTypeclone () const
 Clone. More...
 
 ~Matrix ()
 Destructor. More...
 
label m () const
 Return the number of rows. More...
 
label n () const
 Return the number of columns. More...
 
label size () const
 Return the number of elements in matrix (m*n) More...
 
const Type * v () const
 Return element vector of the constant Matrix. More...
 
Type * v ()
 Return element vector of the Matrix. More...
 
ConstMatrixBlock< mTypeblock (const label m, const label n, const label mStart, const label nStart) const
 
template<class VectorSpace >
ConstMatrixBlock< mTypeblock (const label mStart, const label nStart) const
 
ConstMatrixBlock< mTypecol (const label m, const label rowStart) const
 
ConstMatrixBlock< mTypecol (const label m, const label mStart, const label nStart) const
 
MatrixBlock< mTypeblock (const label m, const label n, const label mStart, const label nStart)
 
template<class VectorSpace >
MatrixBlock< mTypeblock (const label mStart, const label nStart)
 
MatrixBlock< mTypecol (const label m, const label rowStart)
 
MatrixBlock< mTypecol (const label m, const label mStart, const label nStart)
 
void checki (const label i) const
 Check index i is within valid range (0 ... m-1). More...
 
void checkj (const label j) const
 Check index j is within valid range (0 ... n-1). More...
 
void clear ()
 Clear the Matrix, i.e. set sizes to zero. More...
 
void transfer (mType &)
 Transfer the contents of the argument Matrix into this Matrix. More...
 
void setSize (const label m, const label n)
 Resize the matrix preserving the elements. More...
 
void shallowResize (const label m, const label n)
 Resize the matrix without reallocating storage (unsafe) More...
 
Form T () const
 Return the transpose of the matrix. More...
 
Type * operator[] (const label)
 Return subscript-checked row of Matrix. More...
 
const Type * operator[] (const label) const
 Return subscript-checked row of constant Matrix. More...
 
const Type & operator() (const label i, const label j) const
 (i, j) const element access operator More...
 
Type & operator() (const label i, const label j)
 (i, j) element access operator More...
 
void operator= (const mType &)
 Assignment operator. Takes linear time. More...
 
template<class MatrixType >
void operator= (const ConstMatrixBlock< MatrixType > &)
 Assignment to a block of another matrix. More...
 
template<class MatrixType >
void operator= (const MatrixBlock< MatrixType > &)
 Assignment to a block of another matrix. More...
 
void operator= (const zero)
 Assignment of all elements to zero. More...
 
void operator= (const Type &)
 Assignment of all elements to the given value. More...
 
template<class VectorSpace >
Foam::ConstMatrixBlock< Foam::Matrix< Form, Type > > block (const label mStart, const label nStart) const
 
template<class VectorSpace >
Foam::MatrixBlock< Foam::Matrix< Form, Type > > block (const label mStart, const label nStart)
 

Static Public Member Functions

static const mTypenull ()
 Return a null Matrix. More...
 

Friends

Istreamoperator>> (Istream &, mType &)
 Read Matrix from Istream, discarding contents of existing Matrix. More...
 
Ostreamoperator (Ostream &, const mType &)
 Write Matrix to Ostream. More...
 

Detailed Description

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

A templated (m x n) matrix of objects of <T>.

Source files

Definition at line 47 of file DiagonalMatrix.H.

Member Typedef Documentation

◆ mType

typedef Matrix<Form, Type> mType

Matrix type.

Definition at line 96 of file Matrix.H.

◆ cmptType

typedef Type cmptType

Component type.

Definition at line 99 of file Matrix.H.

Constructor & Destructor Documentation

◆ Matrix() [1/9]

Matrix ( )
inline

Null constructor.

Definition at line 31 of file MatrixI.H.

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

Here is the caller graph for this function:

◆ Matrix() [2/9]

Matrix ( const label  m,
const label  n 
)

Construct given number of rows and columns.

Definition at line 43 of file Matrix.C.

◆ Matrix() [3/9]

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

Construct with given number of rows and columns.

initializing all elements to zero

Definition at line 61 of file Matrix.C.

◆ Matrix() [4/9]

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

Construct with given number of rows and columns.

initializing all elements to the given value

Definition at line 88 of file Matrix.C.

◆ Matrix() [5/9]

Matrix ( const mType M)

Copy constructor.

Definition at line 115 of file Matrix.C.

◆ Matrix() [6/9]

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

Copy constructor from matrix of a different form.

Definition at line 136 of file Matrix.C.

◆ Matrix() [7/9]

Matrix ( const ConstMatrixBlock< MatrixType > &  Mb)
inline

Construct from a block of another matrix.

Definition at line 158 of file Matrix.C.

◆ Matrix() [8/9]

Matrix ( const MatrixBlock< MatrixType > &  Mb)
inline

Construct from a block of another matrix.

Definition at line 180 of file Matrix.C.

◆ Matrix() [9/9]

Matrix ( Istream is)

Construct from Istream.

Definition at line 35 of file MatrixIO.C.

◆ ~Matrix()

~Matrix ( )

Destructor.

Definition at line 202 of file Matrix.C.

Member Function Documentation

◆ null()

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

Return a null Matrix.

Definition at line 50 of file MatrixI.H.

◆ clone()

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

Clone.

Definition at line 41 of file MatrixI.H.

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

Here is the caller graph for this function:

◆ m()

◆ n()

Foam::label n ( ) const
inline

Return the number of columns.

Definition at line 64 of file MatrixI.H.

Referenced by Matrix< RectangularMatrix< Type >, Type >::Matrix(), Foam::multiply(), Foam::operator*(), Foam::operator+(), Foam::operator-(), Foam::operator/(), and SVD::SVD().

Here is the caller graph for this function:

◆ size()

Foam::label size ( ) const
inline

Return the number of elements in matrix (m*n)

Definition at line 71 of file MatrixI.H.

Referenced by ISAT< CompType, ThermoType >::add(), Foam::max(), Foam::min(), Foam::operator*(), Foam::operator+(), Foam::operator-(), and Foam::operator/().

Here is the caller graph for this function:

◆ v() [1/2]

const Type * v ( ) const
inline

Return element vector of the constant Matrix.

Definition at line 118 of file MatrixI.H.

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

Here is the caller graph for this function:

◆ v() [2/2]

Type * v ( )
inline

Return element vector of the Matrix.

Definition at line 125 of file MatrixI.H.

◆ block() [1/6]

Foam::ConstMatrixBlock< Foam::Matrix< Form, Type > > block ( const label  m,
const label  n,
const label  mStart,
const label  nStart 
) const
inline

◆ block() [2/6]

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

◆ col() [1/4]

Foam::ConstMatrixBlock< Foam::Matrix< Form, Type > > col ( const label  m,
const label  rowStart 
) const
inline

Definition at line 175 of file MatrixI.H.

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

Here is the caller graph for this function:

◆ col() [2/4]

Foam::ConstMatrixBlock< Foam::Matrix< Form, Type > > col ( const label  m,
const label  mStart,
const label  nStart 
) const
inline

Definition at line 194 of file MatrixI.H.

◆ block() [3/6]

Foam::MatrixBlock< Foam::Matrix< Form, Type > > block ( const label  m,
const label  n,
const label  mStart,
const label  nStart 
)
inline

Definition at line 214 of file MatrixI.H.

◆ block() [4/6]

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

◆ col() [3/4]

Foam::MatrixBlock< Foam::Matrix< Form, Type > > col ( const label  m,
const label  rowStart 
)
inline

Definition at line 250 of file MatrixI.H.

◆ col() [4/4]

Foam::MatrixBlock< Foam::Matrix< Form, Type > > col ( const label  m,
const label  mStart,
const label  nStart 
)
inline

Definition at line 266 of file MatrixI.H.

◆ checki()

void checki ( const label  i) const
inline

Check index i is within valid range (0 ... m-1).

Definition at line 78 of file MatrixI.H.

◆ checkj()

void checkj ( const label  j) const
inline

Check index j is within valid range (0 ... n-1).

Definition at line 98 of file MatrixI.H.

◆ clear()

void clear ( )

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

Definition at line 214 of file Matrix.C.

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

Here is the caller graph for this function:

◆ transfer()

void transfer ( mType M)

Transfer the contents of the argument Matrix into this Matrix.

and annul the argument Matrix.

Definition at line 228 of file Matrix.C.

◆ setSize()

void setSize ( const label  m,
const label  n 
)

Resize the matrix preserving the elements.

Definition at line 244 of file Matrix.C.

◆ shallowResize()

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

Resize the matrix without reallocating storage (unsafe)

Definition at line 284 of file MatrixI.H.

Referenced by seulex::resize().

Here is the caller graph for this function:

◆ T()

Form T ( ) const

Return the transpose of the matrix.

Definition at line 264 of file Matrix.C.

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

Here is the caller graph for this function:

◆ operator[]() [1/2]

Type * operator[] ( const label  i)
inline

Return subscript-checked row of Matrix.

Definition at line 328 of file MatrixI.H.

◆ operator[]() [2/2]

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

Return subscript-checked row of constant Matrix.

Definition at line 320 of file MatrixI.H.

◆ operator()() [1/2]

const Type & operator() ( const label  i,
const label  j 
) const
inline

(i, j) const element access operator

Definition at line 295 of file MatrixI.H.

◆ operator()() [2/2]

Type & operator() ( const label  i,
const label  j 
)
inline

(i, j) element access operator

Definition at line 308 of file MatrixI.H.

◆ operator=() [1/5]

void operator= ( const mType M)

Assignment operator. Takes linear time.

Definition at line 284 of file Matrix.C.

◆ operator=() [2/5]

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

Assignment to a block of another matrix.

Definition at line 315 of file Matrix.C.

◆ operator=() [3/5]

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

Assignment to a block of another matrix.

Definition at line 332 of file Matrix.C.

◆ operator=() [4/5]

void operator= ( const zero  )

Assignment of all elements to zero.

Definition at line 361 of file Matrix.C.

◆ operator=() [5/5]

void operator= ( const Type &  s)

Assignment of all elements to the given value.

Definition at line 347 of file Matrix.C.

◆ block() [5/6]

Foam::ConstMatrixBlock<Foam::Matrix<Form, Type> > block ( const label  mStart,
const label  nStart 
) const
inline

Definition at line 156 of file MatrixI.H.

◆ block() [6/6]

Foam::MatrixBlock<Foam::Matrix<Form, Type> > block ( const label  mStart,
const label  nStart 
)
inline

Definition at line 235 of file MatrixI.H.

Friends And Related Function Documentation

◆ operator>>

Istream& operator>> ( Istream ,
mType  
)
friend

Read Matrix from Istream, discarding contents of existing Matrix.

◆ operator


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