LifeV
MatrixSmall< Dim1, Dim2 > Class Template Reference

class VectorSmall This class implements a simple $ R^n $ vector More...

#include <VectorSmall.hpp>

+ Collaboration diagram for MatrixSmall< Dim1, Dim2 >:

Private Types

typedef Real &(MatrixSmall::* DereferenceMethod) (UInt const &i)
 
typedef const Real &(MatrixSmall::* ConstDereferenceMethod) (UInt const &i) const
 
typedef RealOpIndexReturnType
 
typedef Real const * OpIndexReturnConstType
 

Private Member Functions

void copyFrom (MatrixSmall< Dim1, Dim2 > const &matrix)
 
bool realEquality (const Real &r1, const Real &r2) const
 

Constructors and destructors

 MatrixSmall ()
 Empty constructor (all components are set to zero) More...
 
 MatrixSmall (MatrixSmall< Dim1, Dim2 > const &matrix)
 Copy constructor. More...
 
 MatrixSmall (const std::vector< std::vector< Real > > &matrix)
 Import from a vector. More...
 

Overloaded operators

bool operator== (MatrixSmall< Dim1, Dim2 > const &matrix) const
 Operator ==. More...
 
bool operator!= (MatrixSmall< Dim1, Dim2 > const &matrix) const
 Operator !=. More...
 
MatrixSmall< Dim1, Dim2 > & operator= (MatrixSmall< Dim1, Dim2 > const &matrix)
 Assignment operator. More...
 
MatrixSmall< Dim1, Dim2 > & operator+= (MatrixSmall< Dim1, Dim2 > const &matrix)
 Operator +=. More...
 
MatrixSmall< Dim1, Dim2 > operator+ (MatrixSmall< Dim1, Dim2 > const &matrix) const
 Operator +. More...
 
MatrixSmall< Dim1, Dim2 > & operator-= (MatrixSmall< Dim1, Dim2 > const &matrix)
 Operator -=. More...
 
MatrixSmall< Dim1, Dim2 > operator- (MatrixSmall< Dim1, Dim2 > const &matrix) const
 Operator -. More...
 
MatrixSmall< Dim1, Dim2 > & operator*= (Real const &factor)
 Operator *= (multiplication by scalar) More...
 
MatrixSmall< Dim1, Dim2 > & operator/= (Real const &factor)
 Operator /= (division by scalar) More...
 
MatrixSmall< Dim1, Dim2 > operator/ (Real const &factor) const
 Operator / (division by scalar) More...
 
MatrixSmall< Dim1, Dim2 > operator* (Real const &factor) const
 Operator * (division by scalar) More...
 
VectorSmall< Dim1 > operator* (VectorSmall< Dim2 > const &vector) const
 Operator * (multiplication by a vector) More...
 
MatrixSmall< Dim1, Dim2 > operator* (MatrixSmall< Dim2, Dim1 > const &matrix) const
 Operator * between two squared matrices (multiplication by a matrix) More...
 
OpIndexReturnConstType const operator[] (UInt const &i) const
 Operator []. More...
 
OpIndexReturnType operator[] (UInt const &i)
 Operator []. More...
 
Real const & operator() (UInt const &i, UInt const &j) const
 Operator () More...
 
Realoperator() (UInt const &i, UInt const &j)
 Operator () More...
 

Geometric Methods

Real dot (MatrixSmall< Dim1, Dim2 > const &matrix) const
 Scalar product. More...
 
MatrixSmall< Dim1, Dim2 > emult (MatrixSmall< Dim1, Dim2 > const &matrix) const
 Element-wise multiplication between matrices. More...
 
MatrixSmall< Dim1, Dim2 > emult (VectorSmall< Dim1 > const &vector) const
 Element-wise multiplication between a matrix and a vector. More...
 
VectorSmall< Dim2 > extractRow (UInt const &i) const
 Extraction of a row. More...
 
VectorSmall< Dim1 > extractColumn (UInt const &j) const
 Extraction of a column. More...
 
Real extract (UInt const &i, UInt const &j) const
 Extraction of a component. More...
 
MatrixSmall< Dim2, Dim1 > transpose () const
 Transpose of a matrix. More...
 
Real determinant () const
 Determinant of a matrix In this class the determinant is computed explicitly for matrices of dimensions 1 2 3. More...
 
MatrixSmall< Dim1, Dim2 > cofactor () const
 Cofactor of a matrix In this class the cofactor is computed explicitly for matrices of dimensions 1 2 3. More...
 
void showMe () const
 Plot the Matrix. More...
 
MatrixSmall< Dim1, Dim2 > minusTransposed () const
 This method In this method, which is based on cofactor and determinant, given a matrix, its inverse transposed is computed explicitly for matrices of dimensions 1 2 3 This method is mainly used for structural problems. More...
 
MatrixSmall< Dim1, Dim2 > inverse () const
 This method In this method, which is based on cofactor and determinant, given a matrix, its inverse is computed explicitly for matrices of dimensions 1 2 3 This method is mainly used for structural problems. More...
 
Real trace () const
 
Real norm () const
 Norm value. More...
 
void normalize ()
 Normalize matrix. More...
 
MatrixSmall< Dim1, Dim2 > normalized ()
 Create the versor associated to this MatrixSmall. More...
 

Output stream operator overload

function to get the size of the MatrixSmall ( for compatibility with Eigen)

Returns
the fixed size of the MatrixSmall
std::ostream & operator<< (std::ostream &out, MatrixSmall< Dim1, Dim2 > const &matrix)
 

Conversion free-functions

template<typename Matrix >
MatrixSmall< Dim1, Dim2 > castToMatrixSmall (Matrix const &coords)
 Conversion of an array (std::vector, KN, etc. if applicable) to a MatrixSmall. More...
 

Data

Real M_coords [Dim1][Dim2]
 Data storage. More...
 

Detailed Description

template<UInt Dim1, UInt Dim2>
class LifeV::MatrixSmall< Dim1, Dim2 >

class VectorSmall This class implements a simple $ R^n $ vector

class MtrixSmall This class implements a simple matrix

Author
A. Cervone ant.c.nosp@m.ervo.nosp@m.ne@gm.nosp@m.ail..nosp@m.com

This class implements a simple $ R^n $ vector.
It allows all kind of geometric operations on the node, such as summation, multiplication by scalar, scalar product, cross product, norm, etc.
The implementation is oriented to best perform with small (less than 30) values of $ n $.
The interface of the class is designed to stay compatible with the Eigen library Matrix class.

Author
Ivan Kuraj ivan..nosp@m.kura.nosp@m.j@epf.nosp@m.l.ch

This class implements a simple matrix.
It allows all kind of geometric operations on the node, such as summation, multiplication by scalar, scalar product, cross product, etc. The implementation is oriented to best perform with small (less than 30) n

Definition at line 68 of file VectorSmall.hpp.

Member Typedef Documentation

◆ DereferenceMethod

typedef Real&(MatrixSmall::* DereferenceMethod) (UInt const &i)
private

Definition at line 77 of file MatrixSmall.hpp.

◆ ConstDereferenceMethod

typedef const Real&(MatrixSmall::* ConstDereferenceMethod) (UInt const &i) const
private

Definition at line 78 of file MatrixSmall.hpp.

◆ OpIndexReturnType

typedef Real* OpIndexReturnType
private

Definition at line 80 of file MatrixSmall.hpp.

◆ OpIndexReturnConstType

typedef Real const* OpIndexReturnConstType
private

Definition at line 81 of file MatrixSmall.hpp.

Constructor & Destructor Documentation

◆ MatrixSmall() [1/3]

MatrixSmall ( )
inline

Empty constructor (all components are set to zero)

Definition at line 107 of file MatrixSmall.hpp.

◆ MatrixSmall() [2/3]

MatrixSmall ( MatrixSmall< Dim1, Dim2 > const &  matrix)
inline

Copy constructor.

Definition at line 116 of file MatrixSmall.hpp.

◆ MatrixSmall() [3/3]

MatrixSmall ( const std::vector< std::vector< Real > > &  matrix)
inline

Import from a vector.

Definition at line 122 of file MatrixSmall.hpp.

Member Function Documentation

◆ copyFrom()

void copyFrom ( MatrixSmall< Dim1, Dim2 > const &  matrix)
inlineprivate

Definition at line 83 of file MatrixSmall.hpp.

+ Here is the caller graph for this function:

◆ realEquality()

bool realEquality ( const Real r1,
const Real r2 
) const
inlineprivate

Definition at line 93 of file MatrixSmall.hpp.

+ Here is the caller graph for this function:

◆ operator==()

bool operator== ( MatrixSmall< Dim1, Dim2 > const &  matrix) const
inline

Operator ==.

Definition at line 150 of file MatrixSmall.hpp.

◆ operator!=()

bool operator!= ( MatrixSmall< Dim1, Dim2 > const &  matrix) const
inline

Operator !=.

Definition at line 162 of file MatrixSmall.hpp.

◆ operator=()

MatrixSmall<Dim1, Dim2>& operator= ( MatrixSmall< Dim1, Dim2 > const &  matrix)
inline

Assignment operator.

Definition at line 168 of file MatrixSmall.hpp.

◆ operator+=()

MatrixSmall<Dim1, Dim2>& operator+= ( MatrixSmall< Dim1, Dim2 > const &  matrix)
inline

Operator +=.

Definition at line 177 of file MatrixSmall.hpp.

◆ operator+()

MatrixSmall<Dim1, Dim2> operator+ ( MatrixSmall< Dim1, Dim2 > const &  matrix) const
inline

Operator +.

Definition at line 188 of file MatrixSmall.hpp.

◆ operator-=()

MatrixSmall<Dim1, Dim2>& operator-= ( MatrixSmall< Dim1, Dim2 > const &  matrix)
inline

Operator -=.

Definition at line 195 of file MatrixSmall.hpp.

◆ operator-()

MatrixSmall<Dim1, Dim2> operator- ( MatrixSmall< Dim1, Dim2 > const &  matrix) const
inline

Operator -.

Definition at line 206 of file MatrixSmall.hpp.

◆ operator*=()

MatrixSmall<Dim1, Dim2>& operator*= ( Real const &  factor)
inline

Operator *= (multiplication by scalar)

Definition at line 213 of file MatrixSmall.hpp.

◆ operator/=()

MatrixSmall<Dim1, Dim2>& operator/= ( Real const &  factor)
inline

Operator /= (division by scalar)

Definition at line 224 of file MatrixSmall.hpp.

◆ operator/()

MatrixSmall<Dim1, Dim2> operator/ ( Real const &  factor) const
inline

Operator / (division by scalar)

Definition at line 232 of file MatrixSmall.hpp.

◆ operator*() [1/3]

MatrixSmall<Dim1, Dim2> operator* ( Real const &  factor) const
inline

Operator * (division by scalar)

Definition at line 239 of file MatrixSmall.hpp.

◆ operator*() [2/3]

VectorSmall<Dim1> operator* ( VectorSmall< Dim2 > const &  vector) const
inline

Operator * (multiplication by a vector)

Definition at line 246 of file MatrixSmall.hpp.

◆ operator*() [3/3]

MatrixSmall<Dim1, Dim2> operator* ( MatrixSmall< Dim2, Dim1 > const &  matrix) const
inline

Operator * between two squared matrices (multiplication by a matrix)

Definition at line 261 of file MatrixSmall.hpp.

◆ operator[]() [1/2]

OpIndexReturnConstType const operator[] ( UInt const &  i) const
inline

Operator [].

Definition at line 281 of file MatrixSmall.hpp.

◆ operator[]() [2/2]

OpIndexReturnType operator[] ( UInt const &  i)
inline

Operator [].

Definition at line 288 of file MatrixSmall.hpp.

◆ operator()() [1/2]

Real const& operator() ( UInt const &  i,
UInt const &  j 
) const
inline

Operator ()

Definition at line 295 of file MatrixSmall.hpp.

◆ operator()() [2/2]

Real& operator() ( UInt const &  i,
UInt const &  j 
)
inline

Operator ()

Definition at line 302 of file MatrixSmall.hpp.

◆ dot()

Real dot ( MatrixSmall< Dim1, Dim2 > const &  matrix) const
inline

Scalar product.

Parameters
matrixsecond operand
Returns
scalar product value

Definition at line 317 of file MatrixSmall.hpp.

◆ emult() [1/2]

MatrixSmall<Dim1, Dim2> emult ( MatrixSmall< Dim1, Dim2 > const &  matrix) const
inline

Element-wise multiplication between matrices.

Parameters
matrixsecond operand
Returns
resultant matrix

Definition at line 334 of file MatrixSmall.hpp.

◆ emult() [2/2]

MatrixSmall<Dim1, Dim2> emult ( VectorSmall< Dim1 > const &  vector) const
inline

Element-wise multiplication between a matrix and a vector.

Line[i] of the matrix is multipled by the scalar vector[i]

Parameters
vector
Returns
resultant matrix

Definition at line 351 of file MatrixSmall.hpp.

◆ extractRow()

VectorSmall<Dim2> extractRow ( UInt const &  i) const
inline

Extraction of a row.

Parameters
indexof the row to be extracted
Returns
extracted row

Definition at line 368 of file MatrixSmall.hpp.

◆ extractColumn()

VectorSmall<Dim1> extractColumn ( UInt const &  j) const
inline

Extraction of a column.

Parameters
indexof the column to be extracted
Returns
extracted column

Definition at line 383 of file MatrixSmall.hpp.

◆ extract()

Real extract ( UInt const &  i,
UInt const &  j 
) const
inline

Extraction of a component.

Parameters
indexof the component to be extracted
Returns
extracted component

Definition at line 398 of file MatrixSmall.hpp.

◆ transpose()

MatrixSmall<Dim2, Dim1> transpose ( ) const
inline

Transpose of a matrix.

Returns
transposed matrix

Definition at line 407 of file MatrixSmall.hpp.

◆ determinant()

Real determinant ( ) const
inline

Determinant of a matrix In this class the determinant is computed explicitly for matrices of dimensions 1 2 3.

Returns
determinant of the matrix

Definition at line 425 of file MatrixSmall.hpp.

◆ cofactor()

MatrixSmall<Dim1, Dim2> cofactor ( ) const
inline

Cofactor of a matrix In this class the cofactor is computed explicitly for matrices of dimensions 1 2 3.

Returns
determinant of the matrix

Definition at line 459 of file MatrixSmall.hpp.

◆ showMe()

void showMe ( ) const
inline

Plot the Matrix.

Returns
void

Definition at line 501 of file MatrixSmall.hpp.

◆ minusTransposed()

MatrixSmall<Dim1, Dim2> minusTransposed ( ) const
inline

This method In this method, which is based on cofactor and determinant, given a matrix, its inverse transposed is computed explicitly for matrices of dimensions 1 2 3 This method is mainly used for structural problems.

Returns
determinant of the matrix

Definition at line 521 of file MatrixSmall.hpp.

◆ inverse()

MatrixSmall<Dim1, Dim2> inverse ( ) const
inline

This method In this method, which is based on cofactor and determinant, given a matrix, its inverse is computed explicitly for matrices of dimensions 1 2 3 This method is mainly used for structural problems.

Returns
a small matrix containing the inverse

Definition at line 548 of file MatrixSmall.hpp.

◆ trace()

Real trace ( ) const
inline

Definition at line 562 of file MatrixSmall.hpp.

◆ norm()

Real norm ( ) const
inline

Norm value.

Returns
norm value

Definition at line 580 of file MatrixSmall.hpp.

+ Here is the caller graph for this function:

◆ normalize()

void normalize ( )
inline

Normalize matrix.

Definition at line 586 of file MatrixSmall.hpp.

◆ normalized()

MatrixSmall<Dim1, Dim2> normalized ( )
inline

Create the versor associated to this MatrixSmall.

Returns
the versor associated to this MatrixSmall

Definition at line 595 of file MatrixSmall.hpp.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
MatrixSmall< Dim1, Dim2 > const &  matrix 
)
friend

Definition at line 616 of file MatrixSmall.hpp.

◆ castToMatrixSmall

MatrixSmall<Dim1, Dim2> castToMatrixSmall ( Matrix const &  coords)
friend

Conversion of an array (std::vector, KN, etc. if applicable) to a MatrixSmall.

Parameters
coordsmatrix of point coordinates with operator[][] available
Returns
the matrixSmall that corresponds to the input

Definition at line 641 of file MatrixSmall.hpp.

Field Documentation

◆ M_coords

Real M_coords[Dim1][Dim2]
private

Data storage.

Definition at line 659 of file MatrixSmall.hpp.


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