HLIBpro  2.8.1
Matrix< T_value > Class Template Reference

Standard dense matrix in basic linear algebra, i.e. BLAS/LAPACK. More...

#include <Matrix.hh>

Inheritance diagram for Matrix< T_value >:
MatrixBase< Matrix< T_value > > MemBlock< T_value >

Public Types

using value_t = T_value
 internal value type
 
using super_t = MemBlock< value_t >
 super class type
 
- Public Types inherited from MatrixBase< Matrix< T_value > >
using value_t = typename matrix_trait< Matrix< T_value > >::value_t
 scalar value type of matrix
 
- Public Types inherited from MemBlock< T_value >
using value_t = T_value
 internal value type
 

Public Member Functions

 Matrix () noexcept
 creates zero sized matrix
 
 Matrix (const size_t anrows, const size_t ancols)
 creates matrix of size anrows × ancols
 
 Matrix (const Matrix &M, const copy_policy_t p=copy_reference)
 copy constructor
 
template<typename T_matrix >
 Matrix (const T_matrix &M)
 copy constructor for other matrix types
 
 Matrix (Matrix &&M) noexcept
 move constructor
 
 Matrix (const Matrix &M, const Range &ar1, const Range &ar2, const copy_policy_t p=copy_reference)
 
Matrixoperator= (const Matrix &M)
 copy operator for matrices (always copy reference! for real copy, use BLAS::copy)
 
Matrixoperator= (Matrix &&M) noexcept
 move operator
 
size_t nrows () const noexcept
 return number of rows of matrix
 
size_t ncols () const noexcept
 return number of columns of matrix
 
blasview_t blas_view () const noexcept
 return BLAS matrix view of matrix object
 
size_t blas_nrows () const noexcept
 return number of rows of actual BLAS matrix
 
size_t blas_ncols () const noexcept
 return number of columns of actual BLAS matrix
 
value_t operator() (const idx_t i, const idx_t j) const noexcept
 return coefficient (i,j)
 
value_toperator() (const idx_t i, const idx_t j) noexcept
 return reference to coefficient (i,j)
 
value_tdata () const noexcept
 return pointer to internal data
 
size_t row_stride () const noexcept
 return stride w.r.t. row index set
 
size_t col_stride () const noexcept
 return stride w.r.t. column index set
 
void resize (const size_t n, const size_t m)
 optimised resize: only change if (n,m) != (nrows,ncols)
 
Matrix< value_tcopy () const
 create real copy of matrix
 
Matrix< value_treference () const
 create reference to this matrix
 
Matrix< value_toperator() (const Range &r1, const Range &r2) const
 return matrix referencing sub matrix defined by r1 × r2
 
Vector< value_toperator() (const Range &r, const idx_t j) const
 return vector referencing part of column j defined by r
 
Vector< value_toperator() (const idx_t i, const Range &r) const
 return vector referencing part of row i defined by r
 
Vector< value_tcolumn (const idx_t j) const
 return vector referencing column j
 
Vector< value_trow (const idx_t i) const
 return vector referencing row i
 
void check_data () const
 test data for invalid values, e.g. INF and NAN
 
- Public Member Functions inherited from MatrixBase< Matrix< T_value > >
size_t nrows () const noexcept
 return number of rows of matrix
 
size_t ncols () const noexcept
 return number of columns of matrix
 
Range row_range () const noexcept
 return number of rows of matrix
 
Range col_range () const noexcept
 return number of columns of matrix
 
value_t operator() (const idx_t i, const idx_t j) const noexcept
 return coefficient (i,j)
 
value_toperator() (const idx_t i, const idx_t j) noexcept
 return reference to coefficient (i,j)
 
value_tdata () const noexcept
 return pointer to internal data
 
size_t row_stride () const noexcept
 return stride w.r.t. row index set
 
size_t col_stride () const noexcept
 return stride w.r.t. column index set
 
blasview_t blas_view () const noexcept
 return BLAS matrix view of matrix object
 
size_t blas_nrows () const noexcept
 return number of rows of actual BLAS matrix
 
size_t blas_ncols () const noexcept
 return number of columns of actual BLAS matrix
 
- Public Member Functions inherited from MemBlock< T_value >
 MemBlock () noexcept
 ctor with nullptr data and 0 references
 
 MemBlock (const size_t n)
 ctor for n elements of value_t and 0 references
 
 MemBlock (const MemBlock &b)
 copy ctor (copy reference!)
 
 MemBlock (MemBlock &&b) noexcept
 move ctor (move ownership)
 
 ~MemBlock ()
 dtor removing all data even if references exist !
 
MemBlockoperator= (const MemBlock &b)
 copy operator (copy reference!)
 
MemBlockoperator= (MemBlock &&b) noexcept
 move ctor (move ownership)
 
value_tdata () noexcept
 return pointer to internal array
 
const value_tdata () const noexcept
 return const pointer to internal array
 
bool is_owner () const noexcept
 return is_owner status
 

Detailed Description

template<typename T_value>
class HLIB::BLAS::Matrix< T_value >

\detail Standard dmatrixvector class in linear algebra routines. It holds a reference to a memory block, which is controlled by this matrix, e.g. if the matrix is gone or resized, the memory block is also gone.

Constructor & Destructor Documentation

◆ Matrix()

Matrix ( const Matrix< T_value > &  M,
const Range ar1,
const Range ar2,
const copy_policy_t  p = copy_reference 
)
inline

creates matrix using part of M defined by r1 × r2 p defines whether data is copied or referenced