Arcane  4.2.1.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::NumMatrix< T, RowSize, ColumnSize > Class Template Reference

Small fixed-size matrix containing RowSize rows and ColumnSize columns. More...

#include </__w/arcaneframework.github.io/arcaneframework.github.io/framework/arccore/src/base/arccore/base/NumMatrix.h>

Collaboration diagram for Arcane::NumMatrix< T, RowSize, ColumnSize >:

Public Types

using VectorType = NumVector<T, ColumnSize>
using ThatClass = NumMatrix<T, RowSize, ColumnSize>
using DataType = T

Public Member Functions

 NumMatrix ()=default
 Constructs the matrix with all coefficients zero.
constexpr __host__ __device__ NumMatrix (const VectorType &ax, const VectorType &ay)
 Constructs the matrix with rows (ax, ay).
constexpr __host__ __device__ NumMatrix (const VectorType &ax, const VectorType &ay, const VectorType &az)
 Constructs the matrix with rows (ax, ay, az).
constexpr __host__ __device__ NumMatrix (const VectorType &a1, const VectorType &a2, const VectorType &a3, const VectorType &a4)
 Constructs the matrix with rows (a1, a2, a3, a4).
constexpr __host__ __device__ NumMatrix (const VectorType &a1, const VectorType &a2, const VectorType &a3, const VectorType &a4, const VectorType &a5)
 Constructs the matrix with rows (a1, a2, a3, a4, a5).
constexpr __host__ __device__ NumMatrix (const VectorType &a1, const VectorType &a2, const VectorType &a3, const VectorType &a4, const VectorType &a5, const VectorType &a6)
 Constructs the matrix with rows (a1, a2, a3, a4, a5, a6).
constexpr __host__ __device__ NumMatrix (const T &v)
 Constructs the instance with the triplet (v, v, v).
constexpr __host__ __device__ NumMatrix (const Real2x2 &v)
constexpr __host__ __device__ NumMatrix (const Real3x3 &v)
constexpr __host__ __device__ ThatClass & operator= (const DataType &v)
 Assigns the triplet (v, v, v) to the instance.
constexpr __host__ __device__ ThatClass & operator= (const Real2x2 &v)
constexpr __host__ __device__ ThatClass & operator= (const Real3x3 &v)
 operator Real2x2 () const
 Conversion to Real2x2.
constexpr operator Real3x3 () const
 Conversion to Real3x3.
constexpr __host__ __device__ ThatClass operator- () const
 Creates a tensor opposite to the current tensor.
constexpr __host__ __device__ VectorType row (Int32 i) const
constexpr __host__ __device__ DataType & operator() (Int32 i, Int32 j)
constexpr __host__ __device__ DataType operator() (Int32 i, Int32 j) const
constexpr __host__ __device__ void setRow (Int32 i, const VectorType &v)
 Sets the value of the i-th row to v.
constexpr __host__ __device__ void fill (const DataType &v)
 Fill the matrix with the value v.
constexpr __host__ __device__ ArrayView< DataType > view ()
 Returns a mutable view of the elements of the matrix.
constexpr __host__ __device__ ConstArrayView< DataType > constView () const
 Returns a read-only view of the elements of the matrix.
constexpr __host__ __device__ SmallSpan< DataType, NbElement > span ()
 Returns a mutable view of the elements of the matrix.
constexpr __host__ __device__ SmallSpan< const DataType, NbElement > constSpan () const
 Returns a read-only view of the elements of the matrix.
constexpr const VectorType vx () const
constexpr const VectorType vy () const
constexpr const VectorType vz () const

Static Public Member Functions

constexpr __host__ static __device__ ThatClass zero ()
 Constructs the zero matrix.
constexpr __host__ static __device__ ThatClass fromColumns (T ax, T ay, T az, T bx, T by, T bz, T cx, T cy, T cz)
 Constructs the matrix ((ax,bx,cx), (ay,by,cy), (az,bz,cz)).
constexpr __host__ static __device__ ThatClass fromLines (T ax, T bx, T cx, T ay, T by, T cy, T az, T bz, T cz)
 Constructs the matrix ((ax,bx,cx), (ay,by,cy), (az,bz,cz)).

Private Member Functions

template<typename Stream>
void print (Stream &o) const

Static Private Member Functions

static constexpr bool isRealType ()
static constexpr bool isSquare ()
static constexpr bool isSquare2 ()
static constexpr bool isSquare3 ()
constexpr __host__ static __device__ bool _eq (T a, T b)
 Compares the values of a and b using the TypeEqualT comparator.

Private Attributes

DataType m_values [NbElement]
 Matrix values.

Static Private Attributes

static constexpr Int32 NbElement = RowSize * ColumnSize

Friends

constexpr __host__ __device__ ThatClass & operator+= (ThatClass &a, const ThatClass &b)
 Adds b to a and returns a.
constexpr __host__ __device__ ThatClass & operator-= (ThatClass &a, const ThatClass &b)
 Subtracts b from a and returns a.
constexpr __host__ __device__ ThatClass & operator*= (ThatClass &a, T b)
 Multiplies each component of the matrix a by the real number b and return a.
constexpr __host__ __device__ ThatClass & operator/= (ThatClass &a, T b)
 Divides each component of the matrix by the real number b.
constexpr __host__ __device__ ThatClass operator+ (const ThatClass &a, const ThatClass &b)
 Creates a triplet that equals this triplet added to b.
constexpr __host__ __device__ ThatClass operator- (const ThatClass &a, const ThatClass &b)
 Creates a triplet that equals a subtracted from this triplet.
constexpr __host__ __device__ ThatClass operator* (DataType a, const ThatClass &mat)
 Multiplication by a scalar.
constexpr __host__ __device__ ThatClass operator* (const ThatClass &mat, DataType b)
 Multiplication by a scalar.
constexpr __host__ __device__ ThatClass operator/ (const ThatClass &mat, DataType b)
 Division by a scalar.
constexpr __host__ __device__ bool operator== (const ThatClass &a, const ThatClass &b)
 Compares the current instance component by component to b.
constexpr __host__ __device__ bool operator!= (const ThatClass &a, const ThatClass &b)
 Compares two triplets.
std::ostream & operator<< (std::ostream &o, const NumMatrix &t)

Detailed Description

template<typename T, int RowSize, int ColumnSize>
class Arcane::NumMatrix< T, RowSize, ColumnSize >

Small fixed-size matrix containing RowSize rows and ColumnSize columns.

It is possible to access each row using method 'row()' or via the methods vx(), vy(), vz() if the dimension is sufficient (for example, vz() is only accessible if Size>=3.

Definition at line 37 of file arccore/src/base/arccore/base/NumMatrix.h.

Member Typedef Documentation

◆ DataType

template<typename T, int RowSize, int ColumnSize>
using Arcane::NumMatrix< T, RowSize, ColumnSize >::DataType = T

Definition at line 52 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ ThatClass

template<typename T, int RowSize, int ColumnSize>
using Arcane::NumMatrix< T, RowSize, ColumnSize >::ThatClass = NumMatrix<T, RowSize, ColumnSize>

Definition at line 51 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ VectorType

template<typename T, int RowSize, int ColumnSize>
using Arcane::NumMatrix< T, RowSize, ColumnSize >::VectorType = NumVector<T, ColumnSize>

Definition at line 50 of file arccore/src/base/arccore/base/NumMatrix.h.

Constructor & Destructor Documentation

◆ NumMatrix() [1/8]

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ Arcane::NumMatrix< T, RowSize, ColumnSize >::NumMatrix ( const VectorType & ax,
const VectorType & ay )
inlineconstexpr

Constructs the matrix with rows (ax, ay).

Definition at line 60 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ NumMatrix() [2/8]

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ Arcane::NumMatrix< T, RowSize, ColumnSize >::NumMatrix ( const VectorType & ax,
const VectorType & ay,
const VectorType & az )
inlineconstexpr

Constructs the matrix with rows (ax, ay, az).

Definition at line 68 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ NumMatrix() [3/8]

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ Arcane::NumMatrix< T, RowSize, ColumnSize >::NumMatrix ( const VectorType & a1,
const VectorType & a2,
const VectorType & a3,
const VectorType & a4 )
inlineconstexpr

Constructs the matrix with rows (a1, a2, a3, a4).

Definition at line 77 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ NumMatrix() [4/8]

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ Arcane::NumMatrix< T, RowSize, ColumnSize >::NumMatrix ( const VectorType & a1,
const VectorType & a2,
const VectorType & a3,
const VectorType & a4,
const VectorType & a5 )
inlineconstexpr

Constructs the matrix with rows (a1, a2, a3, a4, a5).

Definition at line 88 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ NumMatrix() [5/8]

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ Arcane::NumMatrix< T, RowSize, ColumnSize >::NumMatrix ( const VectorType & a1,
const VectorType & a2,
const VectorType & a3,
const VectorType & a4,
const VectorType & a5,
const VectorType & a6 )
inlineconstexpr

Constructs the matrix with rows (a1, a2, a3, a4, a5, a6).

Definition at line 101 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ NumMatrix() [6/8]

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ Arcane::NumMatrix< T, RowSize, ColumnSize >::NumMatrix ( const T & v)
inlineexplicitconstexpr

Constructs the instance with the triplet (v, v, v).

Definition at line 115 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ NumMatrix() [7/8]

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ Arcane::NumMatrix< T, RowSize, ColumnSize >::NumMatrix ( const Real2x2 & v)
inlineexplicitconstexpr

Definition at line 121 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ NumMatrix() [8/8]

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ Arcane::NumMatrix< T, RowSize, ColumnSize >::NumMatrix ( const Real3x3 & v)
inlineexplicitconstexpr

Definition at line 126 of file arccore/src/base/arccore/base/NumMatrix.h.

Member Function Documentation

◆ _eq()

template<typename T, int RowSize, int ColumnSize>
__host__ static __device__ bool Arcane::NumMatrix< T, RowSize, ColumnSize >::_eq ( T a,
T b )
inlinestaticconstexprprivate

Compares the values of a and b using the TypeEqualT comparator.

Return values
trueif a and b are equal,
falseotherwise.

Definition at line 393 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ constSpan()

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ SmallSpan< const DataType, NbElement > Arcane::NumMatrix< T, RowSize, ColumnSize >::constSpan ( ) const
inlineconstexpr

Returns a read-only view of the elements of the matrix.

Definition at line 353 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ constView()

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ ConstArrayView< DataType > Arcane::NumMatrix< T, RowSize, ColumnSize >::constView ( ) const
inlineconstexpr

Returns a read-only view of the elements of the matrix.

Definition at line 341 of file arccore/src/base/arccore/base/NumMatrix.h.

Referenced by Arcane::NumMatrix< DataType, Row, Column >::operator Real3x3().

Here is the caller graph for this function:

◆ fill()

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ void Arcane::NumMatrix< T, RowSize, ColumnSize >::fill ( const DataType & v)
inlineconstexpr

Fill the matrix with the value v.

Definition at line 327 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ fromColumns()

template<typename T, int RowSize, int ColumnSize>
__host__ static __device__ ThatClass Arcane::NumMatrix< T, RowSize, ColumnSize >::fromColumns ( T ax,
T ay,
T az,
T bx,
T by,
T bz,
T cx,
T cy,
T cz )
inlinestaticconstexpr

Constructs the matrix ((ax,bx,cx), (ay,by,cy), (az,bz,cz)).

Definition at line 174 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ fromLines()

template<typename T, int RowSize, int ColumnSize>
__host__ static __device__ ThatClass Arcane::NumMatrix< T, RowSize, ColumnSize >::fromLines ( T ax,
T bx,
T cx,
T ay,
T by,
T cy,
T az,
T bz,
T cz )
inlinestaticconstexpr

Constructs the matrix ((ax,bx,cx), (ay,by,cy), (az,bz,cz)).

Definition at line 181 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ isRealType()

template<typename T, int RowSize, int ColumnSize>
constexpr bool Arcane::NumMatrix< T, RowSize, ColumnSize >::isRealType ( )
inlinestaticconstexprprivate

Definition at line 42 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ isSquare()

template<typename T, int RowSize, int ColumnSize>
constexpr bool Arcane::NumMatrix< T, RowSize, ColumnSize >::isSquare ( )
inlinestaticconstexprprivate

Definition at line 43 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ isSquare2()

template<typename T, int RowSize, int ColumnSize>
constexpr bool Arcane::NumMatrix< T, RowSize, ColumnSize >::isSquare2 ( )
inlinestaticconstexprprivate

Definition at line 44 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ isSquare3()

template<typename T, int RowSize, int ColumnSize>
constexpr bool Arcane::NumMatrix< T, RowSize, ColumnSize >::isSquare3 ( )
inlinestaticconstexprprivate

Definition at line 45 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ operator Real2x2()

template<typename T, int RowSize, int ColumnSize>
Arcane::NumMatrix< T, RowSize, ColumnSize >::operator Real2x2 ( ) const
inline

Conversion to Real2x2.

Definition at line 154 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ operator Real3x3()

template<typename T, int RowSize, int ColumnSize>
Arcane::NumMatrix< T, RowSize, ColumnSize >::operator Real3x3 ( ) const
inlineconstexpr

Conversion to Real3x3.

Definition at line 160 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ operator()() [1/2]

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ DataType & Arcane::NumMatrix< T, RowSize, ColumnSize >::operator() ( Int32 i,
Int32 j )
inlineconstexpr

Definition at line 302 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ operator()() [2/2]

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ DataType Arcane::NumMatrix< T, RowSize, ColumnSize >::operator() ( Int32 i,
Int32 j ) const
inlineconstexpr

Definition at line 310 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ operator-()

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ ThatClass Arcane::NumMatrix< T, RowSize, ColumnSize >::operator- ( ) const
inlineconstexpr

Creates a tensor opposite to the current tensor.

Definition at line 234 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ operator=() [1/3]

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ ThatClass & Arcane::NumMatrix< T, RowSize, ColumnSize >::operator= ( const DataType & v)
inlineconstexpr

Assigns the triplet (v, v, v) to the instance.

Definition at line 132 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ operator=() [2/3]

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ ThatClass & Arcane::NumMatrix< T, RowSize, ColumnSize >::operator= ( const Real2x2 & v)
inlineconstexpr

Definition at line 139 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ operator=() [3/3]

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ ThatClass & Arcane::NumMatrix< T, RowSize, ColumnSize >::operator= ( const Real3x3 & v)
inlineconstexpr

Definition at line 146 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ print()

template<typename T, int RowSize, int ColumnSize>
template<typename Stream>
void Arcane::NumMatrix< T, RowSize, ColumnSize >::print ( Stream & o) const
inlineprivate

Definition at line 398 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ row()

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ VectorType Arcane::NumMatrix< T, RowSize, ColumnSize >::row ( Int32 i) const
inlineconstexpr

Definition at line 295 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ setRow()

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ void Arcane::NumMatrix< T, RowSize, ColumnSize >::setRow ( Int32 i,
const VectorType & v )
inlineconstexpr

Sets the value of the i-th row to v.

Definition at line 318 of file arccore/src/base/arccore/base/NumMatrix.h.

Referenced by Arcane::NumMatrix< DataType, Row, Column >::NumMatrix(), Arcane::NumMatrix< DataType, Row, Column >::NumMatrix(), Arcane::NumMatrix< DataType, Row, Column >::NumMatrix(), Arcane::NumMatrix< DataType, Row, Column >::NumMatrix(), and Arcane::NumMatrix< DataType, Row, Column >::NumMatrix().

Here is the caller graph for this function:

◆ span()

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ SmallSpan< DataType, NbElement > Arcane::NumMatrix< T, RowSize, ColumnSize >::span ( )
inlineconstexpr

Returns a mutable view of the elements of the matrix.

Definition at line 347 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ view()

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ ArrayView< DataType > Arcane::NumMatrix< T, RowSize, ColumnSize >::view ( )
inlineconstexpr

Returns a mutable view of the elements of the matrix.

Definition at line 335 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ vx()

template<typename T, int RowSize, int ColumnSize>
const VectorType Arcane::NumMatrix< T, RowSize, ColumnSize >::vx ( ) const
inlineconstexpr

Definition at line 366 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ vy()

template<typename T, int RowSize, int ColumnSize>
const VectorType Arcane::NumMatrix< T, RowSize, ColumnSize >::vy ( ) const
inlineconstexpr

Definition at line 371 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ vz()

template<typename T, int RowSize, int ColumnSize>
const VectorType Arcane::NumMatrix< T, RowSize, ColumnSize >::vz ( ) const
inlineconstexpr

Definition at line 376 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ zero()

template<typename T, int RowSize, int ColumnSize>
__host__ static __device__ ThatClass Arcane::NumMatrix< T, RowSize, ColumnSize >::zero ( )
inlinestaticconstexpr

Constructs the zero matrix.

Definition at line 168 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ operator!=

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ bool operator!= ( const ThatClass & a,
const ThatClass & b )
friend

Compares two triplets.

For the notion of equality, see operator==()

Return values
trueif the two triplets are different,
falseotherwise.

Definition at line 288 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ operator* [1/2]

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ ThatClass operator* ( const ThatClass & mat,
DataType b )
friend

Multiplication by a scalar.

Definition at line 251 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ operator* [2/2]

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ ThatClass operator* ( DataType a,
const ThatClass & mat )
friend

Multiplication by a scalar.

Definition at line 243 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ operator*=

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ ThatClass & operator*= ( ThatClass & a,
T b )
friend

Multiplies each component of the matrix a by the real number b and return a.

Definition at line 204 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ operator+

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ ThatClass operator+ ( const ThatClass & a,
const ThatClass & b )
friend

Creates a triplet that equals this triplet added to b.

Definition at line 218 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ operator+=

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ ThatClass & operator+= ( ThatClass & a,
const ThatClass & b )
friend

Adds b to a and returns a.

Definition at line 190 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ operator-

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ ThatClass operator- ( const ThatClass & a,
const ThatClass & b )
friend

Creates a triplet that equals a subtracted from this triplet.

Definition at line 226 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ operator-=

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ ThatClass & operator-= ( ThatClass & a,
const ThatClass & b )
friend

Subtracts b from a and returns a.

Definition at line 197 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ operator/

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ ThatClass operator/ ( const ThatClass & mat,
DataType b )
friend

Division by a scalar.

Definition at line 259 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ operator/=

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ ThatClass & operator/= ( ThatClass & a,
T b )
friend

Divides each component of the matrix by the real number b.

Definition at line 211 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ operator<<

template<typename T, int RowSize, int ColumnSize>
std::ostream & operator<< ( std::ostream & o,
const NumMatrix< T, RowSize, ColumnSize > & t )
friend

Definition at line 358 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ operator==

template<typename T, int RowSize, int ColumnSize>
__host__ __device__ bool operator== ( const ThatClass & a,
const ThatClass & b )
friend

Compares the current instance component by component to b.

Return values
trueif this.x==b.x and this.y==b.y and this.z==b.z.
falseotherwise.

Definition at line 273 of file arccore/src/base/arccore/base/NumMatrix.h.

Member Data Documentation

◆ m_values

◆ NbElement

template<typename T, int RowSize, int ColumnSize>
Int32 Arcane::NumMatrix< T, RowSize, ColumnSize >::NbElement = RowSize * ColumnSize
staticconstexprprivate

Definition at line 46 of file arccore/src/base/arccore/base/NumMatrix.h.


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