Opm::gpuistl::MiniMatrix< T, dimension > Class Template Reference

A small fixed-size square matrix class for use in CUDA kernels. More...

#include <MiniMatrix.hpp>

Public Types

using value_type = T
 
using size_type = std::size_t
 
using array_type = std::array< T, dimension *dimension >
 

Public Member Functions

OPM_HOST_DEVICE MiniMatrix ()=default
 Default constructor. Elements are default-initialized. More...
 
OPM_HOST_DEVICE MiniMatrix (std::initializer_list< T > init)
 Constructor from initializer list. More...
 
template<class Type , int n, int m>
 MiniMatrix (MatrixBlock< Type, n, m > mb)
 
OPM_HOST_DEVICE MiniMatrix (const T &value)
 
OPM_HOST_DEVICE T * operator[] (size_type row)
 Access row for further column indexing. More...
 
OPM_HOST_DEVICE const T * operator[] (size_type row) const
 Access row for further column indexing (const version). More...
 
OPM_HOST_DEVICE auto begin ()
 Get iterator to beginning of data. More...
 
OPM_HOST_DEVICE auto end ()
 Get iterator to end of data. More...
 
OPM_HOST_DEVICE auto begin () const
 Get const iterator to beginning of data. More...
 
OPM_HOST_DEVICE auto end () const
 Get const iterator to end of data. More...
 
OPM_HOST_DEVICE T * data ()
 Get pointer to raw data. More...
 
OPM_HOST_DEVICE const T * data () const
 Get const pointer to raw data. More...
 
OPM_HOST_DEVICE void fill (const T &value)
 Fill all elements with a value. More...
 
OPM_HOST_DEVICE MiniMatrixoperator+= (const MiniMatrix &other)
 Add another matrix to this one (element-wise). More...
 
OPM_HOST_DEVICE MiniMatrix operator+ (const MiniMatrix &other) const
 Add two matrices (element-wise). More...
 
OPM_HOST_DEVICE MiniMatrixoperator-= (const MiniMatrix &other)
 Subtract another matrix from this one (element-wise). More...
 
OPM_HOST_DEVICE MiniMatrix operator- (const MiniMatrix &other) const
 Subtract two matrices (element-wise). More...
 
OPM_HOST_DEVICE MiniMatrixoperator= (const T &scalar)
 
OPM_HOST_DEVICE std::array< T, dimension > operator* (const std::array< T, dimension > &x) const
 Matrix-vector multiplication: y = A * x. More...
 
OPM_HOST_DEVICE MiniMatrixoperator*= (const MiniMatrix &B)
 Matrix-matrix multiplication: C = A * B. More...
 
OPM_HOST_DEVICE MiniMatrix operator* (const MiniMatrix &B) const
 Matrix-matrix multiplication: C = A * B. More...
 
OPM_HOST_DEVICE Opm::gpuistl::MiniVector< T, dimension > operator* (const Opm::gpuistl::MiniVector< T, dimension > &x) const
 Matrix-vector multiplication: y = A * x, with MiniVector. More...
 
OPM_HOST_DEVICE MiniMatrixoperator*= (const T &scalar)
 
OPM_HOST_DEVICE MiniMatrix operator+= (const T &scalar)
 

Static Public Member Functions

static OPM_HOST_DEVICE constexpr size_type size ()
 Get matrix dimension. More...
 

Detailed Description

template<class T, int dimension>
class Opm::gpuistl::MiniMatrix< T, dimension >

A small fixed-size square matrix class for use in CUDA kernels.

Template Parameters
TElement type.
dimensionNumber of rows and columns (matrix is dimension x dimension).

Member Typedef Documentation

◆ array_type

template<class T , int dimension>
using Opm::gpuistl::MiniMatrix< T, dimension >::array_type = std::array<T, dimension * dimension>

◆ size_type

template<class T , int dimension>
using Opm::gpuistl::MiniMatrix< T, dimension >::size_type = std::size_t

◆ value_type

template<class T , int dimension>
using Opm::gpuistl::MiniMatrix< T, dimension >::value_type = T

Constructor & Destructor Documentation

◆ MiniMatrix() [1/4]

template<class T , int dimension>
OPM_HOST_DEVICE Opm::gpuistl::MiniMatrix< T, dimension >::MiniMatrix ( )
default

Default constructor. Elements are default-initialized.

◆ MiniMatrix() [2/4]

template<class T , int dimension>
OPM_HOST_DEVICE Opm::gpuistl::MiniMatrix< T, dimension >::MiniMatrix ( std::initializer_list< T >  init)
inline

Constructor from initializer list.

Parameters
initInitializer list of elements (row-major order).

◆ MiniMatrix() [3/4]

template<class T , int dimension>
template<class Type , int n, int m>
Opm::gpuistl::MiniMatrix< T, dimension >::MiniMatrix ( MatrixBlock< Type, n, m >  mb)
inline

◆ MiniMatrix() [4/4]

template<class T , int dimension>
OPM_HOST_DEVICE Opm::gpuistl::MiniMatrix< T, dimension >::MiniMatrix ( const T &  value)
inline

Member Function Documentation

◆ begin() [1/2]

template<class T , int dimension>
OPM_HOST_DEVICE auto Opm::gpuistl::MiniMatrix< T, dimension >::begin ( )
inline

Get iterator to beginning of data.

◆ begin() [2/2]

template<class T , int dimension>
OPM_HOST_DEVICE auto Opm::gpuistl::MiniMatrix< T, dimension >::begin ( ) const
inline

Get const iterator to beginning of data.

◆ data() [1/2]

template<class T , int dimension>
OPM_HOST_DEVICE T * Opm::gpuistl::MiniMatrix< T, dimension >::data ( )
inline

Get pointer to raw data.

◆ data() [2/2]

template<class T , int dimension>
OPM_HOST_DEVICE const T * Opm::gpuistl::MiniMatrix< T, dimension >::data ( ) const
inline

Get const pointer to raw data.

◆ end() [1/2]

template<class T , int dimension>
OPM_HOST_DEVICE auto Opm::gpuistl::MiniMatrix< T, dimension >::end ( )
inline

Get iterator to end of data.

◆ end() [2/2]

template<class T , int dimension>
OPM_HOST_DEVICE auto Opm::gpuistl::MiniMatrix< T, dimension >::end ( ) const
inline

Get const iterator to end of data.

◆ fill()

template<class T , int dimension>
OPM_HOST_DEVICE void Opm::gpuistl::MiniMatrix< T, dimension >::fill ( const T &  value)
inline

Fill all elements with a value.

Parameters
valueValue to fill.

Referenced by Opm::gpuistl::MiniMatrix< T, dimension >::MiniMatrix().

◆ operator*() [1/3]

template<class T , int dimension>
OPM_HOST_DEVICE MiniMatrix Opm::gpuistl::MiniMatrix< T, dimension >::operator* ( const MiniMatrix< T, dimension > &  B) const
inline

Matrix-matrix multiplication: C = A * B.

Parameters
BRight-hand side matrix
Returns
Resulting matrix

◆ operator*() [2/3]

template<class T , int dimension>
OPM_HOST_DEVICE Opm::gpuistl::MiniVector< T, dimension > Opm::gpuistl::MiniMatrix< T, dimension >::operator* ( const Opm::gpuistl::MiniVector< T, dimension > &  x) const
inline

Matrix-vector multiplication: y = A * x, with MiniVector.

Parameters
xInput MiniVector (length = dimension)
Returns
Resulting MiniVector (length = dimension)

◆ operator*() [3/3]

template<class T , int dimension>
OPM_HOST_DEVICE std::array< T, dimension > Opm::gpuistl::MiniMatrix< T, dimension >::operator* ( const std::array< T, dimension > &  x) const
inline

Matrix-vector multiplication: y = A * x.

Parameters
xInput vector (length = dimension)
Returns
Resulting vector (length = dimension)

◆ operator*=() [1/2]

template<class T , int dimension>
OPM_HOST_DEVICE MiniMatrix & Opm::gpuistl::MiniMatrix< T, dimension >::operator*= ( const MiniMatrix< T, dimension > &  B)
inline

Matrix-matrix multiplication: C = A * B.

Parameters
BRight-hand side matrix
Returns
Resulting matrix

◆ operator*=() [2/2]

template<class T , int dimension>
OPM_HOST_DEVICE MiniMatrix & Opm::gpuistl::MiniMatrix< T, dimension >::operator*= ( const T &  scalar)
inline

◆ operator+()

template<class T , int dimension>
OPM_HOST_DEVICE MiniMatrix Opm::gpuistl::MiniMatrix< T, dimension >::operator+ ( const MiniMatrix< T, dimension > &  other) const
inline

Add two matrices (element-wise).

Parameters
otherMatrix to add.
Returns
Resulting matrix.

◆ operator+=() [1/2]

template<class T , int dimension>
OPM_HOST_DEVICE MiniMatrix & Opm::gpuistl::MiniMatrix< T, dimension >::operator+= ( const MiniMatrix< T, dimension > &  other)
inline

Add another matrix to this one (element-wise).

Parameters
otherMatrix to add.
Returns
Reference to this matrix.

◆ operator+=() [2/2]

template<class T , int dimension>
OPM_HOST_DEVICE MiniMatrix Opm::gpuistl::MiniMatrix< T, dimension >::operator+= ( const T &  scalar)
inline

◆ operator-()

template<class T , int dimension>
OPM_HOST_DEVICE MiniMatrix Opm::gpuistl::MiniMatrix< T, dimension >::operator- ( const MiniMatrix< T, dimension > &  other) const
inline

Subtract two matrices (element-wise).

Parameters
otherMatrix to subtract.
Returns
Resulting matrix.

◆ operator-=()

template<class T , int dimension>
OPM_HOST_DEVICE MiniMatrix & Opm::gpuistl::MiniMatrix< T, dimension >::operator-= ( const MiniMatrix< T, dimension > &  other)
inline

Subtract another matrix from this one (element-wise).

Parameters
otherMatrix to subtract.
Returns
Reference to this matrix.

◆ operator=()

template<class T , int dimension>
OPM_HOST_DEVICE MiniMatrix & Opm::gpuistl::MiniMatrix< T, dimension >::operator= ( const T &  scalar)
inline

◆ operator[]() [1/2]

template<class T , int dimension>
OPM_HOST_DEVICE T * Opm::gpuistl::MiniMatrix< T, dimension >::operator[] ( size_type  row)
inline

Access row for further column indexing.

Parameters
rowRow index.
Returns
Pointer to the beginning of the row.

◆ operator[]() [2/2]

template<class T , int dimension>
OPM_HOST_DEVICE const T * Opm::gpuistl::MiniMatrix< T, dimension >::operator[] ( size_type  row) const
inline

Access row for further column indexing (const version).

Parameters
rowRow index.
Returns
Const pointer to the beginning of the row.

◆ size()

template<class T , int dimension>
static OPM_HOST_DEVICE constexpr size_type Opm::gpuistl::MiniMatrix< T, dimension >::size ( )
inlinestaticconstexpr

Get matrix dimension.


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