ampsci
High-precision calculations for one- and two-valence atomic systems
LinAlg::Matrix_view< T >

Provides a non-owning view onto a Matrix (read/write, but no resize) More...

Public Member Functions

 Matrix_view (T *data, std::size_t rows, std::size_t cols)
 
 Matrix_view (Matrix< std::remove_const_t< T > > &m)
 Implicit conversion from mutable Matrix (works for both mutable and const view)
 
template<typename U = T, typename = std::enable_if_t<std::is_const_v<U>>>
 Matrix_view (const Matrix< std::remove_const_t< T > > &m)
 Implicit conversion from const Matrix (only for Matrix_view<const T>)
 
std::size_t rows () const
 
std::size_t cols () const
 
std::size_t size () const
 
bool empty () const
 
T * data ()
 
const T * data () const
 
T * operator[] (std::size_t i)
 [] index access (no range checking). [i] returns pointer to ith row
 
const T * operator[] (std::size_t i) const
 
T & at (std::size_t i, std::size_t j)
 at(i,j): element access with range checking
 
at (std::size_t i, std::size_t j) const
 
const T & atc (std::size_t i, std::size_t j) const
 
T & operator() (std::size_t i, std::size_t j)
 (i,j): same as at(i,j)
 
operator() (std::size_t i, std::size_t j) const
 
auto begin ()
 
auto end ()
 
auto cbegin () const
 
auto cend () const
 

Detailed Description

template<typename T>
class LinAlg::Matrix_view< T >

Provides a non-owning view onto a Matrix (read/write, but no resize)

Non-owning 2D view onto a Matrix. Supports element access but not resize. Use Matrix_view<const T> for a read-only view.

Constructor & Destructor Documentation

◆ Matrix_view() [1/2]

template<typename T >
LinAlg::Matrix_view< T >::Matrix_view ( Matrix< std::remove_const_t< T > > &  m)
inline

Implicit conversion from mutable Matrix (works for both mutable and const view)

◆ Matrix_view() [2/2]

template<typename T >
template<typename U = T, typename = std::enable_if_t<std::is_const_v<U>>>
LinAlg::Matrix_view< T >::Matrix_view ( const Matrix< std::remove_const_t< T > > &  m)
inline

Implicit conversion from const Matrix (only for Matrix_view<const T>)

Member Function Documentation

◆ operator[]()

template<typename T >
T * LinAlg::Matrix_view< T >::operator[] ( std::size_t  i)
inline

[] index access (no range checking). [i] returns pointer to ith row

◆ at()

template<typename T >
T & LinAlg::Matrix_view< T >::at ( std::size_t  i,
std::size_t  j 
)
inline

at(i,j): element access with range checking

◆ operator()()

template<typename T >
T & LinAlg::Matrix_view< T >::operator() ( std::size_t  i,
std::size_t  j 
)
inline

(i,j): same as at(i,j)


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