Opm::MixedMatrixWrapper< Vector > Class Template Reference

Wraps c-implementation of mixed-precision matrix. More...

#include <MatrixWrapper.hpp>

Public Member Functions

 MixedMatrixWrapper (int nrows, int nnz)
 constructor More...
 
 ~MixedMatrixWrapper ()
 destructor More...
 
void update (double const *data)
 update matrix entries More...
 
void mv (const Vector &x, Vector &y) const
 block-sparse matrix-vector multiplication (y = M.x) More...
 
void umv (const Vector &x, Vector &y) const
 block-sparse matrix-vector multiplication with update (y += M.x) More...
 
void usmv (double alpha, const Vector &x, Vector &y) const
 block-sparse matrix-vector multiplication with scaled update (y += alpha * M.x) More...
 
int * rowptr ()
 access row offset pointer More...
 
int * colidx ()
 access column index pointer More...
 
int nrows () const
 

Static Public Attributes

static constexpr auto block_size = Vector::block_type::dimension
 

Detailed Description

template<class Vector>
class Opm::MixedMatrixWrapper< Vector >

Wraps c-implementation of mixed-precision matrix.

Note
matrix is stored in single precision, but all operations are performed in double-precision
Template Parameters
Vectorthe block-vector used by linear operator

Constructor & Destructor Documentation

◆ MixedMatrixWrapper()

template<class Vector >
Opm::MixedMatrixWrapper< Vector >::MixedMatrixWrapper ( int  nrows,
int  nnz 
)
inline

constructor

Parameters
nrowsnumber of block rows
nnznumber of nonzero blocks

References Opm::MixedMatrixWrapper< Vector >::block_size, bsr_alloc(), bsr_init(), and Opm::MixedMatrixWrapper< Vector >::nrows().

◆ ~MixedMatrixWrapper()

template<class Vector >
Opm::MixedMatrixWrapper< Vector >::~MixedMatrixWrapper ( )
inline

destructor

References bsr_free().

Member Function Documentation

◆ colidx()

template<class Vector >
int * Opm::MixedMatrixWrapper< Vector >::colidx ( )
inline

access column index pointer

References bsr_matrix::colidx.

◆ mv()

template<class Vector >
void Opm::MixedMatrixWrapper< Vector >::mv ( const Vector &  x,
Vector &  y 
) const

block-sparse matrix-vector multiplication (y = M.x)

mixed-precision block-sparse matrix-vector multiplication (y = M.x)

Parameters
xinput vector
youtput vector
Note
hand-optimized versions are provided for block-sizes 2,3, and 4. A generic implementation is provided for block- sizes > 4
Parameters
xinput vector
youtput vector

References bsr_vmspmv2(), bsr_vmspmv3(), and bsr_vmspmv4().

◆ nrows()

template<class Vector >
int Opm::MixedMatrixWrapper< Vector >::nrows ( ) const
inline

◆ rowptr()

template<class Vector >
int * Opm::MixedMatrixWrapper< Vector >::rowptr ( )
inline

access row offset pointer

References bsr_matrix::rowptr.

◆ umv()

template<class Vector >
void Opm::MixedMatrixWrapper< Vector >::umv ( const Vector &  x,
Vector &  y 
) const

block-sparse matrix-vector multiplication with update (y += M.x)

mixed-precision block-sparse matrix-vector multiplication with update (y += M.x)

Parameters
xinput vector
youtput vector
Note
hand-optimized versions are provided for block-sizes 2,3, and 4. A generic implementation for block-sizes > 4 is NOT provided
Parameters
xinput vector
youtput vector

References bsr_vmspumv2(), bsr_vmspumv3(), and bsr_vmspumv4().

◆ update()

template<class Vector >
void Opm::MixedMatrixWrapper< Vector >::update ( double const *  data)

update matrix entries

Note
downcasts from double precision and transposes each non-zero block entry
Parameters
datapointer to double precision data

◆ usmv()

template<class Vector >
void Opm::MixedMatrixWrapper< Vector >::usmv ( double  alpha,
const Vector &  x,
Vector &  y 
) const

block-sparse matrix-vector multiplication with scaled update (y += alpha * M.x)

mixed-precision block-sparse matrix-vector multiplication with scaled update (y += alpha * M.x)

Parameters
alphascaling factor
xinput vector
youtput vector
Note
hand-optimized versions are provided for block-sizes 2,3, and 4. A generic implementation is provided for block- sizes > 4
Parameters
alphascaling factor
xinput vector
youtput vector

References bsr_vmspumv2(), bsr_vmspumv3(), and bsr_vmspumv4().

Member Data Documentation

◆ block_size

template<class Vector >
constexpr auto Opm::MixedMatrixWrapper< Vector >::block_size = Vector::block_type::dimension
staticconstexpr

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