walberla::math::Matrix3< Type > Class Template Reference

Detailed Description

template<typename Type>
class walberla::math::Matrix3< Type >

Efficient, generic implementation of a 3x3 matrix.

The Matrix3 class is the representation of a 3x3 matrix with a total of 9 statically allocated elements of arbitrary type. The naming convention of the elements is as follows:

                      \f[\left(\begin{array}{*{3}{c}}
                      xx & xy & xz \\
                      yx & yy & yz \\
                      zx & zy & zz \\
                      \end{array}\right)\f]\n

These elements can be accessed directly with the 1D subscript operator or with the 2D function operator. The numbering of the matrix elements is

                      \f[\left(\begin{array}{*{3}{c}}
                      0 & 1 & 2 \\
                      3 & 4 & 5 \\
                      6 & 7 & 8 \\
                      \end{array}\right)\f]

#include <Types.h>

Public Member Functions

constexpr Matrix3 ()=default
 
constexpr Matrix3 (Type init)
 Constructor for a homogeneous initialization of all elements. More...
 
constexpr Matrix3 (const Vector3< Type > &a, const Vector3< Type > &b, const Vector3< Type > &c)
 
constexpr Matrix3 (Type xx, Type xy, Type xz, Type yx, Type yy, Type yz, Type zx, Type zy, Type zz)
 Constructor for a direct initialization of all matrix elements. More...
 
constexpr Matrix3 (const Type *init)
 Constructor for an array initializer. More...
 
template<typename Axis , typename Angle >
 Matrix3 (Vector3< Axis > axis, Angle angle)
 Rotation matrix constructor. More...
 
 Matrix3 (const Matrix3 &m)=default
 
template<typename Other >
 Matrix3 (const Matrix3< Other > &m)
 Conversion constructor from different Matrix3 instances. More...
 
template<typename Other >
Matrix3< Type > & operator= (const Matrix3< Other > &set)
 
template<typename Other >
Matrix3< Type > & operator+= (const Matrix3< Other > &rhs)
 
template<typename Other >
Matrix3< Type > & operator-= (const Matrix3< Other > &rhs)
 
template<typename Other >
Matrix3< Type > & operator*= (const Matrix3< Other > &rhs)
 
Operators
Matrix3operator= (Type set)
 Homogenous assignment to all matrix elements. More...
 
Matrix3operator= (const Matrix3 &set)=default
 
template<typename Other >
Matrix3operator= (const Matrix3< Other > &set)
 Assignment operator for different Matrix3 instances. More...
 
template<typename Other >
bool operator== (const Matrix3< Other > &rhs) const
 Equality operator for the comparison of two matrices. More...
 
template<typename Other >
bool operator!= (const Matrix3< Other > &rhs) const
 Inequality operator for the comparison of two matrices. More...
 
Type & operator[] (uint_t index)
 1D-access to the matrix elements. More...
 
const Type & operator[] (uint_t index) const
 1D-access to the matrix elements. More...
 
Type & operator() (uint_t i, uint_t j)
 2D-access to the matrix elements. More...
 
const Type & operator() (uint_t i, uint_t j) const
 2D-access to the matrix elements. More...
 
Arithmetic operators

The return type of the arithmetic operators depends on the involved data types of

the matrices. HIGH denotes the more significant data type of the arithmetic operation

(for further detail see the MathTrait class description).

template<typename Other >
Matrix3operator+= (const Matrix3< Other > &rhs)
 Addition assignment operator for the addition of two matrices ( \( A+=B \)). More...
 
template<typename Other >
Matrix3operator-= (const Matrix3< Other > &rhs)
 Subtraction assignment operator for the subtraction of two matrices ( \( A-=B \)). More...
 
template<typename Other >
Matrix3operator*= (const Matrix3< Other > &rhs)
 Multiplication assignment operator for the multiplication between two matrices. More...
 
template<typename Other >
const Matrix3< typename MathTrait< Type, Other >::High > operator+ (const Matrix3< Other > &rhs) const
 Addition operator for the addition of two matrices ( \( A=B+C \)). More...
 
template<typename Other >
const Matrix3< typename MathTrait< Type, Other >::High > operator- (const Matrix3< Other > &rhs) const
 Subtraction operator for the subtraction of two matrices ( \( A=B-C \)). More...
 
template<typename Other >
const Vector3< typename MathTrait< Type, Other >::High > operator* (const Vector3< Other > &rhs) const
 Multiplication operator for the multiplication of a matrix and a vector. More...
 
template<typename Other >
const Matrix3< typename MathTrait< Type, Other >::High > operator* (const Matrix3< Other > &rhs) const
 Multiplication operator for the multiplication of two matrices ( \( A=B*C \)). More...
 
template<typename Other >
std::enable_if< std::is_arithmetic< Other >::value, Matrix3 & >::type operator*= (Other rhs)
 Multiplication assignment operator for the multiplication between a matrix and. More...
 
template<typename Other >
std::enable_if< std::is_arithmetic< Other >::value, const Matrix3< typename MathTrait< Type, Other >::High > >::type operator* (Other rhs) const
 Multiplication operator for the multiplication of a matrix and a scalar value. More...
 
Euler rotations

For the classification of the Euler rotation, the following characteristics are

defined:

  • Inner axis: the inner axis is the axis of the first rotation matrix multiplied

to a vector.

  • Parity: the parity is even, if the inner axis X is followed by the middle axis

Y, or Y is followed by Z, or Z is followed by X; otherwise parity is odd.

  • Repetition: repetition tells, if the first and last axes are the same or different.
  • Frame: the frame refers to the frame from which the Euler angles are calculated.

Altogether, there are 24 possible Euler rotations. The possibilities are consisting

of the choice of the inner axis (X,Y or Z), the parity (even or odd), repetition

(yes or no) and the frame (static or rotating). E.g., an Euler order of XYZs stands

for the rotation order of x-, y- and z-axis in a static frame (inner axis: X, parity:

even, repetition: no, frame: static), whereas YXYr stands for the rotation order y-,

x- and y-axis in a rotating frame ( inner axis: Y, parity: odd, repetition: yes,

frame: rotating).

const Vector3< Type > getEulerAngles (EulerRotation order) const
 Calculation of the Euler angles for a specific rotation order. More...
 
const Vector3< Type > getEulerAnglesXYZ () const
 Calculation of the Euler angles (in radian measure). More...
 

Static Public Member Functions

static Matrix3 makeDiagonalMatrix (const Type xx, const Type yy, const Type zz)
 Named constructor to create a diagonal matrix. All non-diagonal elements are initialized with zero. More...
 
static Matrix3 makeDiagonalMatrix (const Type d)
 Named constructor to create a diagonal matrix. All non-diagonal elements are initialized with zero. More...
 
static Matrix3 makeIdentityMatrix ()
 Named constructor to create the identity matrix. More...
 

Private Attributes

Member variables
std::array< Type, 9 > v_
 The nine statically allocated matrix elements. More...
 

Utility functions

The return type of the utility functions depends on the involved data types of the

matrices. HIGH denotes the more significant data type of the utility operations

(for further detail see the MathTrait class description).

enum  EulerRotation {
  XYZs = 0, ZYXr = 1, XYXs = 2, XYXr = 3,
  XZYs = 4, YZXr = 5, XZXs = 6, XZXr = 7,
  YZXs = 8, XZYr = 9, YZYs = 10, YZYr = 11,
  YXZs = 12, ZXYr = 13, YXYs = 14, YXYr = 15,
  ZXYs = 16, YXZr = 17, ZXZs = 18, ZXZr = 19,
  ZYXs = 20, XYZr = 21, ZYZs = 22, ZYZr = 23
}
 Order of the Euler rotation. More...
 
Type getDeterminant () const
 Calculation of the determinant of the matrix. More...
 
Matrix3transpose ()
 Transposing the matrix. More...
 
const Matrix3 getTranspose () const
 Calculation of the transpose of the matrix. More...
 
Matrix3invert ()
 Inverting the matrix. More...
 
const Matrix3 getInverse () const
 Calculation of the inverse of the matrix. More...
 
template<typename Other >
const Vector3< typename MathTrait< Type, Other >::High > multTranspose (const Vector3< Other > &rhs) const
 Multiplication of the transpose of the matrix and a vector ( \( \vec{a}=B^T*\vec{c} \)). More...
 
template<typename Other >
const Matrix3< typename MathTrait< Type, Other >::High > rotate (const Matrix3< Other > &m) const
 Rotation of a matrix M ( \( ROT=R*M*R^{-1} \)). More...
 
template<typename Other >
const Matrix3< typename MathTrait< Type, Other >::High > diagRotate (const Matrix3< Other > &m) const
 Rotation of a diagonal matrix M ( \( ROT=R*M*R^{-1} \)). More...
 
bool isSingular () const
 Singularity check for the matrix (det=0). More...
 
bool isSymmetric () const
 Checks if the matrix is symmetric. More...
 
bool isZero () const
 Checks if all matrix entries are zero. More...
 
const Matrix3 getCholesky () const
 Cholesky decomposition of the matrix ( \( A = LR \)). More...
 
template<typename Other >
const Vector3< typename MathTrait< Type, Other >::High > solve (const Vector3< Other > &rhs) const
 Solving the linear system of equations \(A*x=b\) with the decomposed matrix. More...
 
Type trace () const
 Computes the trace of the matrix (sum of diagonal elements). More...
 
Type * data ()
 
const Type * data () const
 

Member Enumeration Documentation

◆ EulerRotation

template<typename Type >
enum walberla::math::Matrix3::EulerRotation

Order of the Euler rotation.

This codes are needed for the EulerAngles function in order to calculate the Euler angles for a specific combination of rotations.

Enumerator
XYZs 

Rotation order x, y, z in a static frame.

ZYXr 

Rotation order z, y, x in a rotating frame.

XYXs 

Rotation order x, y, x in a static frame.

XYXr 

Rotation order x, y, z in a rotating frame.

XZYs 

Rotation order x, z, y in a static frame.

YZXr 

Rotation order y, z, x in a rotating frame.

XZXs 

Rotation order x, z, x in a static frame.

XZXr 

Rotation order x, z, x in a rotating frame.

YZXs 

Rotation order y, z, x in a static frame.

XZYr 

Rotation order x, z, y in a rotating frame.

YZYs 

Rotation order y, z, y in a static frame.

YZYr 

Rotation order y, z, y in a rotating frame.

YXZs 

Rotation order y, x, z in a static frame.

ZXYr 

Rotation order z, x, y in a rotating frame.

YXYs 

Rotation order y, x, y in a static frame.

YXYr 

Rotation order y, x, y in a rotating frame.

ZXYs 

Rotation order z, x, y in a static frame.

YXZr 

Rotation order y, x, z in a rotating frame.

ZXZs 

Rotation order z, x, z in a static frame.

ZXZr 

Rotation order z, x, z in a rotating frame.

ZYXs 

Rotation order z, y, x in a static frame.

XYZr 

Rotation order x, y, z in a rotating frame.

ZYZs 

Rotation order z, y, z in a static frame.

ZYZr 

Rotation order z, y, z in a rotating frame.

Constructor & Destructor Documentation

◆ Matrix3() [1/8]

template<typename Type >
constexpr walberla::math::Matrix3< Type >::Matrix3 ( )
inlineexplicitconstexprdefault

◆ Matrix3() [2/8]

template<typename Type >
constexpr walberla::math::Matrix3< Type >::Matrix3 ( Type  init)
inlineexplicitconstexpr

Constructor for a homogeneous initialization of all elements.

Parameters
initInitial value for all matrix elements.

◆ Matrix3() [3/8]

template<typename Type >
constexpr walberla::math::Matrix3< Type >::Matrix3 ( const Vector3< Type > &  a,
const Vector3< Type > &  b,
const Vector3< Type > &  c 
)
inlineexplicitconstexpr

◆ Matrix3() [4/8]

template<typename Type >
constexpr walberla::math::Matrix3< Type >::Matrix3 ( Type  xx,
Type  xy,
Type  xz,
Type  yx,
Type  yy,
Type  yz,
Type  zx,
Type  zy,
Type  zz 
)
inlineexplicitconstexpr

Constructor for a direct initialization of all matrix elements.

Parameters
xxThe initial value for the xx-component.
xyThe initial value for the xy-component.
xzThe initial value for the xz-component.
yxThe initial value for the yx-component.
yyThe initial value for the yy-component.
yzThe initial value for the yz-component.
zxThe initial value for the zx-component.
zyThe initial value for the zy-component.
zzThe initial value for the zz-component.

◆ Matrix3() [5/8]

template<typename Type >
constexpr walberla::math::Matrix3< Type >::Matrix3 ( const Type *  init)
inlineexplicitconstexpr

Constructor for an array initializer.

Parameters
initPointer to the initialization array.

The array is assumed to have at least nine valid elements.

◆ Matrix3() [6/8]

template<typename Type >
template<typename Axis , typename Angle >
walberla::math::Matrix3< Type >::Matrix3 ( Vector3< Axis >  axis,
Angle  angle 
)
explicit

Rotation matrix constructor.

Parameters
axisThe rotation axis.
angleThe rotation angle.

This constructor is only defined for floating point vectors. The attempt to use this constructor for vectors of integral data type results in a compile time error.

◆ Matrix3() [7/8]

template<typename Type >
walberla::math::Matrix3< Type >::Matrix3 ( const Matrix3< Type > &  m)
inlinedefault

◆ Matrix3() [8/8]

template<typename Type >
template<typename Other >
walberla::math::Matrix3< Type >::Matrix3 ( const Matrix3< Other > &  m)
inline

Conversion constructor from different Matrix3 instances.

Parameters
mMatrix to be copied.

Member Function Documentation

◆ data() [1/2]

template<typename Type >
Type* walberla::math::Matrix3< Type >::data ( )
inline

◆ data() [2/2]

template<typename Type >
const Type* walberla::math::Matrix3< Type >::data ( ) const
inline

◆ diagRotate()

template<typename Type >
template<typename Other >
const Matrix3< typename MathTrait< Type, Other >::High > walberla::math::Matrix3< Type >::diagRotate ( const Matrix3< Other > &  m) const
inline

Rotation of a diagonal matrix M ( \( ROT=R*M*R^{-1} \)).

Parameters
mThe diagonal matrix to be rotated.
Returns
The rotated matrix.

The DiagRotate function is a special case of the Rotate function. The matrix is assumed to be a diagonal matrix, which reduces the number of floating point operations of the rotation. This function is only defined for matrices of floating point type. The attempt to use this function with matrices of integral data type will result in a compile time error.

◆ getCholesky()

template<typename Type >
const Matrix3< Type > walberla::math::Matrix3< Type >::getCholesky
inline

Cholesky decomposition of the matrix ( \( A = LR \)).

Returns
The decomposed matrix \( L \).

This function is only defined for matrices of floating point type. The attempt to use this function with matrices of integral data type will result in a compile time error.

◆ getDeterminant()

template<typename Type >
Type walberla::math::Matrix3< Type >::getDeterminant
inline

Calculation of the determinant of the matrix.

Returns
The determinant of the matrix.

◆ getEulerAngles()

template<typename Type >
const Vector3< Type > walberla::math::Matrix3< Type >::getEulerAngles ( EulerRotation  order) const

Calculation of the Euler angles for a specific rotation order.

Parameters
orderThe specific rotation order.
Returns
The specific Euler angles.

This function is only defined for matrices of floating point type. The attempt to use this function with matrices of integral data type will result in a compile time error.

◆ getEulerAnglesXYZ()

template<typename Type >
const Vector3< Type > walberla::math::Matrix3< Type >::getEulerAnglesXYZ
inline

Calculation of the Euler angles (in radian measure).

Returns
The Euler angles for a rotation order of x, y, z.

The Euler angles are calculated for a rotation order of x-, y- and z-axis. This function is only defined for matrices of floating point type. The attempt to use this function with matrices of integral data type will result in a compile time error.

◆ getInverse()

template<typename Type >
const Matrix3< Type > walberla::math::Matrix3< Type >::getInverse
inline

Calculation of the inverse of the matrix.

Returns
The inverse of the matrix.

The calculation is performed with the matrix inversion by Cramer. This function is only defined for matrices of floating point type. The attempt to use this function with matrices of integral data types will result in a compile time error.

◆ getTranspose()

template<typename Type >
const Matrix3< Type > walberla::math::Matrix3< Type >::getTranspose
inline

Calculation of the transpose of the matrix.

Returns
The transpose of the matrix.

◆ invert()

template<typename Type >
Matrix3< Type > & walberla::math::Matrix3< Type >::invert
inline

Inverting the matrix.

Returns
Reference to the inverted matrix.

The calculation is performed with the matrix inversion by Cramer. This function is only defined for matrices of floating point type. The attempt to use this function with matrices of integral data types will result in a compile time error.

◆ isSingular()

template<typename Type >
bool walberla::math::Matrix3< Type >::isSingular
inline

Singularity check for the matrix (det=0).

Returns
true if the matrix is singular, false if not.

◆ isSymmetric()

template<typename Type >
bool walberla::math::Matrix3< Type >::isSymmetric
inline

Checks if the matrix is symmetric.

Returns
true if the matrix is symmetric, false if not.

◆ isZero()

template<typename Type >
bool walberla::math::Matrix3< Type >::isZero
inline

Checks if all matrix entries are zero.

Returns
true if all entries are zero otherwise false.

◆ makeDiagonalMatrix() [1/2]

template<typename Type >
Matrix3< Type > walberla::math::Matrix3< Type >::makeDiagonalMatrix ( const Type  d)
inlinestatic

Named constructor to create a diagonal matrix. All non-diagonal elements are initialized with zero.

Parameters
dvalue for diagonal elements.

◆ makeDiagonalMatrix() [2/2]

template<typename Type >
Matrix3< Type > walberla::math::Matrix3< Type >::makeDiagonalMatrix ( const Type  xx,
const Type  yy,
const Type  zz 
)
inlinestatic

Named constructor to create a diagonal matrix. All non-diagonal elements are initialized with zero.

Parameters
xxvalue for element (0,0).
yyvalue for element (1,1).
zzvalue for element (2,2).

◆ makeIdentityMatrix()

template<typename Type >
Matrix3< Type > walberla::math::Matrix3< Type >::makeIdentityMatrix
inlinestatic

Named constructor to create the identity matrix.

All diagonal elements are initialized to one, alls others to zero.

◆ multTranspose()

template<typename Type >
template<typename Other >
const Vector3< typename MathTrait< Type, Other >::High > walberla::math::Matrix3< Type >::multTranspose ( const Vector3< Other > &  rhs) const
inline

Multiplication of the transpose of the matrix and a vector ( \( \vec{a}=B^T*\vec{c} \)).

Parameters
rhsThe right-hand-side vector for the multiplication.
Returns
The resulting vector.

◆ operator!=()

template<typename Type >
template<typename Other >
bool walberla::math::Matrix3< Type >::operator!= ( const Matrix3< Other > &  rhs) const
inline

Inequality operator for the comparison of two matrices.

Parameters
rhsThe right-hand-side matrix for the comparison.
Returns
bool

◆ operator()() [1/2]

template<typename Type >
Type & walberla::math::Matrix3< Type >::operator() ( uint_t  i,
uint_t  j 
)
inline

2D-access to the matrix elements.

Parameters
iAccess index for the row. The index has to be in the range [0..2].
jAccess index for the column. The index has to be in the range [0..2].
Returns
Reference to the accessed value.

◆ operator()() [2/2]

template<typename Type >
const Type & walberla::math::Matrix3< Type >::operator() ( uint_t  i,
uint_t  j 
) const
inline

2D-access to the matrix elements.

Parameters
iAccess index for the row. The index has to be in the range [0..2].
jAccess index for the column. The index has to be in the range [0..2].
Returns
Reference-to-const to the accessed value.

◆ operator*() [1/3]

template<typename Type >
template<typename Other >
const Matrix3< typename MathTrait< Type, Other >::High > walberla::math::Matrix3< Type >::operator* ( const Matrix3< Other > &  rhs) const
inline

Multiplication operator for the multiplication of two matrices ( \( A=B*C \)).

Parameters
rhsThe right-hand-side matrix for the multiplication.
Returns
The resulting matrix.

◆ operator*() [2/3]

template<typename Type >
template<typename Other >
const Vector3< typename MathTrait< Type, Other >::High > walberla::math::Matrix3< Type >::operator* ( const Vector3< Other > &  rhs) const
inline

Multiplication operator for the multiplication of a matrix and a vector.

( \( \vec{a}=B*\vec{c} \)).

Parameters
rhsThe right-hand-side vector for the multiplication.
Returns
The resulting vector.

◆ operator*() [3/3]

template<typename Type >
template<typename Other >
std::enable_if< std::is_arithmetic< Other >::value,const Matrix3< typename MathTrait< Type, Other >::High > >::type walberla::math::Matrix3< Type >::operator* ( Other  rhs) const
inline

Multiplication operator for the multiplication of a matrix and a scalar value.

( \( A=B*s \)).

Parameters
rhsThe right-hand-side scalar value for the multiplication.
Returns
The scaled result matrix.

◆ operator*=() [1/3]

template<typename Type >
template<typename Other >
Matrix3< Type > & walberla::math::Matrix3< Type >::operator*= ( const Matrix3< Other > &  rhs)
inline

Multiplication assignment operator for the multiplication between two matrices.

( \( A*=B \)).

Parameters
rhsThe right-hand-side matrix for the multiplication.
Returns
Reference to the matrix.

◆ operator*=() [2/3]

template<typename Type >
template<typename Other >
Matrix3<Type>& walberla::math::Matrix3< Type >::operator*= ( const Matrix3< Other > &  rhs)
inline

◆ operator*=() [3/3]

template<typename Type >
template<typename Other >
std::enable_if< std::is_arithmetic< Other >::value, Matrix3< Type > & >::type walberla::math::Matrix3< Type >::operator*= ( Other  rhs)
inline

Multiplication assignment operator for the multiplication between a matrix and.

a scalar value ( \( A*=s \)).

Parameters
rhsThe right-hand-side scalar value for the multiplication.
Returns
Reference to the matrix.

◆ operator+()

template<typename Type >
template<typename Other >
const Matrix3< typename MathTrait< Type, Other >::High > walberla::math::Matrix3< Type >::operator+ ( const Matrix3< Other > &  rhs) const
inline

Addition operator for the addition of two matrices ( \( A=B+C \)).

Parameters
rhsThe right-hand-side matrix to be added to the matrix.
Returns
The sum of the two matrices.

◆ operator+=() [1/2]

template<typename Type >
template<typename Other >
Matrix3< Type > & walberla::math::Matrix3< Type >::operator+= ( const Matrix3< Other > &  rhs)
inline

Addition assignment operator for the addition of two matrices ( \( A+=B \)).

Parameters
rhsThe right-hand-side matrix to be added to the matrix.
Returns
Reference to the matrix.

◆ operator+=() [2/2]

template<typename Type >
template<typename Other >
Matrix3<Type>& walberla::math::Matrix3< Type >::operator+= ( const Matrix3< Other > &  rhs)
inline

◆ operator-()

template<typename Type >
template<typename Other >
const Matrix3< typename MathTrait< Type, Other >::High > walberla::math::Matrix3< Type >::operator- ( const Matrix3< Other > &  rhs) const
inline

Subtraction operator for the subtraction of two matrices ( \( A=B-C \)).

Parameters
rhsThe right-hand-side matrix to be subtracted from the matrix.
Returns
The difference of the two matrices.

◆ operator-=() [1/2]

template<typename Type >
template<typename Other >
Matrix3< Type > & walberla::math::Matrix3< Type >::operator-= ( const Matrix3< Other > &  rhs)
inline

Subtraction assignment operator for the subtraction of two matrices ( \( A-=B \)).

Parameters
rhsThe right-hand-side matrix to be subtracted from the matrix.
Returns
Reference to the matrix.

◆ operator-=() [2/2]

template<typename Type >
template<typename Other >
Matrix3<Type>& walberla::math::Matrix3< Type >::operator-= ( const Matrix3< Other > &  rhs)
inline

◆ operator=() [1/4]

template<typename Type >
Matrix3& walberla::math::Matrix3< Type >::operator= ( const Matrix3< Type > &  set)
inlinedefault

◆ operator=() [2/4]

template<typename Type >
template<typename Other >
Matrix3< Type > & walberla::math::Matrix3< Type >::operator= ( const Matrix3< Other > &  set)
inline

Assignment operator for different Matrix3 instances.

Parameters
setMatrix to be copied.
Returns
Reference to the assigned matrix.

◆ operator=() [3/4]

template<typename Type >
template<typename Other >
Matrix3<Type>& walberla::math::Matrix3< Type >::operator= ( const Matrix3< Other > &  set)
inline

◆ operator=() [4/4]

template<typename Type >
Matrix3< Type > & walberla::math::Matrix3< Type >::operator= ( Type  set)
inline

Homogenous assignment to all matrix elements.

Parameters
setScalar value to be assigned to all matrix elements.
Returns
Reference to the assigned matrix.

◆ operator==()

template<typename Type >
template<typename Other >
bool walberla::math::Matrix3< Type >::operator== ( const Matrix3< Other > &  rhs) const
inline

Equality operator for the comparison of two matrices.

Parameters
rhsThe right-hand-side matrix for the comparison.
Returns
bool

◆ operator[]() [1/2]

template<typename Type >
Type & walberla::math::Matrix3< Type >::operator[] ( uint_t  index)
inline

1D-access to the matrix elements.

Parameters
indexAccess index. The index has to be in the range \([0..8]\).
Returns
Reference to the accessed value.

◆ operator[]() [2/2]

template<typename Type >
const Type & walberla::math::Matrix3< Type >::operator[] ( uint_t  index) const
inline

1D-access to the matrix elements.

Parameters
indexAccess index. The index has to be in the range \([0..8]\).
Returns
Reference-to-const to the accessed value.

◆ rotate()

template<typename Type >
template<typename Other >
const Matrix3< typename MathTrait< Type, Other >::High > walberla::math::Matrix3< Type >::rotate ( const Matrix3< Other > &  m) const
inline

Rotation of a matrix M ( \( ROT=R*M*R^{-1} \)).

Parameters
mThe matrix to be rotated.
Returns
The rotated matrix.

This function is only defined for matrices of floating point type. The attempt to use this function with matrices of integral data type will result in a compile time error.

◆ solve()

template<typename Type >
template<typename Other >
const Vector3< typename MathTrait< Type, Other >::High > walberla::math::Matrix3< Type >::solve ( const Vector3< Other > &  rhs) const
inline

Solving the linear system of equations \(A*x=b\) with the decomposed matrix.

\(LR = A\).

Parameters
rhsThe right-hand-side of the linear system of equations.
Returns
The solution of the linear system of equations.

This function is only defined for matrices of floating point type. The attempt to use this function with matrices of integral data type will result in a compile time error.

◆ trace()

template<typename Type >
Type walberla::math::Matrix3< Type >::trace
inline

Computes the trace of the matrix (sum of diagonal elements).

Returns
The trace of the matrix.

◆ transpose()

template<typename Type >
Matrix3< Type > & walberla::math::Matrix3< Type >::transpose
inline

Transposing the matrix.

Returns
Reference to the transposed matrix.

Member Data Documentation

◆ v_

template<typename Type >
std::array<Type, 9> walberla::math::Matrix3< Type >::v_
private
Initial value:
= {{Type(1), Type(0), Type(0),
Type(0), Type(1), Type(0),
Type(0), Type(0), Type(1)}}

The nine statically allocated matrix elements.

Access to the matrix elements is gained via the subscript or function call operator. The order of the elements is

\[\left(\begin{array}{*{3}{c}} 0 & 1 & 2 \\ 3 & 4 & 5 \\ 6 & 7 & 8 \\ \end{array}\right)\]


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