Arcane  4.2.3.0
User 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 <arccore/base/NumMatrix.h>

Public Types

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

Public Member Functions

constexpr NumMatrix ()
 Constructs a matrix with each coefficient initialized with default T constructor.
constexpr NumMatrix (NoInitTag)
 Constructs the matrix WITHOUT initializing its coefficients.
constexpr __host__ __device__ NumMatrix (const VectorType &ax)
 Constructs the matrix with row (ax).
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)).

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/11]

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

Constructs a matrix with each coefficient initialized with default T constructor.

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

◆ NumMatrix() [2/11]

template<typename T, int RowSize, int ColumnSize>
Arcane::NumMatrix< T, RowSize, ColumnSize >::NumMatrix ( NoInitTag )
inlineexplicitconstexpr

Constructs the matrix WITHOUT initializing its coefficients.

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

◆ NumMatrix() [3/11]

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

Constructs the matrix with row (ax).

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

◆ NumMatrix() [4/11]

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 74 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ NumMatrix() [5/11]

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 82 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ NumMatrix() [6/11]

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 91 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ NumMatrix() [7/11]

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 102 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ NumMatrix() [8/11]

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 115 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ NumMatrix() [9/11]

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 129 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ NumMatrix() [10/11]

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

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

◆ NumMatrix() [11/11]

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

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

Member Function Documentation

◆ 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 367 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 355 of file arccore/src/base/arccore/base/NumMatrix.h.

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

◆ 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 341 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 188 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 195 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 168 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 174 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 316 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 324 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 248 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 146 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 153 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 160 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 309 of file arccore/src/base/arccore/base/NumMatrix.h.

◆ setRow()

◆ 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 361 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 349 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 380 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 385 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 390 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 182 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 302 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 265 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 257 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 218 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 232 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 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 a subtracted from this triplet.

Definition at line 240 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 211 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 273 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 225 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 372 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 287 of file arccore/src/base/arccore/base/NumMatrix.h.


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