MCKL
Monte Carlo Kernel Library
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
mckl::Matrix< T, Layout, Alloc > Class Template Reference

Matrix container. More...

#include <mckl/core/matrix.hpp>

Public Types

using allocator_type = Alloc
 
using col_iterator = std::conditional_t< Layout==ColMajor, pointer, StepIterator< pointer > >
 
using col_range = Range< col_iterator >
 
using const_col_iterator = std::conditional_t< Layout==ColMajor, const_pointer, StepIterator< const_pointer > >
 
using const_col_range = Range< const_col_iterator >
 
using const_iterator = const_pointer
 
using const_pointer = const value_type *
 
using const_reference = const value_type &
 
using const_reverse_col_iterator = std::reverse_iterator< const_col_iterator >
 
using const_reverse_col_range = Range< const_reverse_col_iterator >
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 
using const_reverse_row_iterator = std::reverse_iterator< const_row_iterator >
 
using const_reverse_row_range = Range< const_reverse_row_iterator >
 
using const_row_iterator = std::conditional_t< Layout==RowMajor, const_pointer, StepIterator< const_pointer > >
 
using const_row_range = Range< const_row_iterator >
 
using difference_type = std::ptrdiff_t
 
using iterator = pointer
 
using pointer = value_type *
 
using reference = value_type &
 
using reverse_col_iterator = std::reverse_iterator< col_iterator >
 
using reverse_col_range = Range< reverse_col_iterator >
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using reverse_row_iterator = std::reverse_iterator< row_iterator >
 
using reverse_row_range = Range< reverse_row_iterator >
 
using row_iterator = std::conditional_t< Layout==RowMajor, pointer, StepIterator< pointer > >
 
using row_range = Range< row_iterator >
 
using size_type = std::size_t
 
using transpose_type = Matrix< T, Layout==RowMajor ? ColMajor :RowMajor, Alloc >
 
using value_type = T
 

Public Member Functions

 Matrix () noexcept(std::is_nothrow_default_constructible< Vector< T, Alloc >>::value)
 Construct an empty matrix. More...
 
 Matrix (size_type nrow, size_type ncol)
 Construct an nrow by ncol matrix. More...
 
 Matrix (const Matrix &)=default
 Copy constructor. More...
 
 Matrix (Matrix &&other) noexcept(std::is_nothrow_move_constructible< Vector< T, Alloc >>::value)
 Move constructor. More...
 
reference at (size_type i, size_type j)
 Access an element in the matrix with bound checking. More...
 
const_reference at (size_type i, size_type j) const
 Access an element in the matrix with bound checking. More...
 
iterator begin ()
 Iterator to the upper left corner of the matrix. More...
 
const_iterator begin () const
 Iterator to the upper left corner of the matrix. More...
 
const_iterator cbegin () const
 Iterator to the upper left corner of the matrix. More...
 
const_col_range ccol (size_type i) const
 Range of a column. More...
 
const_iterator cend () const
 Iterator to one pass the lower right corner of the matrix. More...
 
void clear ()
 Clear the matrix of all elements. More...
 
col_range col (size_type i)
 Range of a column. More...
 
const_col_range col (size_type i) const
 Range of a column. More...
 
col_iterator col_begin (size_type i)
 Iterator to the beginning of a column. More...
 
const_col_iterator col_begin (size_type j) const
 Iterator to the beginning of a column. More...
 
const_col_iterator col_cbegin (size_type j) const
 Iterator to the beginning of a column. More...
 
const_col_iterator col_cend (size_type j) const
 Iterator to one pass the end of a column. More...
 
const_reverse_col_iterator col_crbegin (size_type j) const
 Iterator to the end of a column. More...
 
const_reverse_col_iterator col_crend (size_type j) const
 Iterator to one before the beginning of a column. More...
 
pointer col_data (size_type j)
 Pointer to the beginning of a column. More...
 
const_pointer col_data (size_type j) const
 Pointer to the beginning of a column. More...
 
col_iterator col_end (size_type j)
 Iterator to one pass the end of a column. More...
 
const_col_iterator col_end (size_type j) const
 Iterator to one pass the end of a column. More...
 
reverse_col_iterator col_rbegin (size_type j)
 Iterator to the end of a column. More...
 
const_reverse_col_iterator col_rbegin (size_type j) const
 Iterator to the end of a column. More...
 
reverse_col_iterator col_rend (size_type j)
 Iterator to one before the beginning of a column. More...
 
const_reverse_col_iterator col_rend (size_type j) const
 Iterator to one before the beginning of a column. More...
 
size_type col_stride () const
 The stride size of column-wise access through col_data() More...
 
const_reverse_iterator crbegin () const
 Iterator to the lower right corner of the matrix. More...
 
const_reverse_col_range crcol (size_type i) const
 Range of a column in reverse order. More...
 
const_reverse_iterator crend () const
 Iterator one before the upper left corner of the matrix. More...
 
const_row_range crow (size_type i) const
 Range of a row. More...
 
const_reverse_row_range crrow (size_type i) const
 Range of a row in reverse order. More...
 
pointer data ()
 Pointer to the upper left corner of the matrix. More...
 
const_pointer data () const
 Pointer to the upper left corner of the matrix. More...
 
bool empty () const
 If the matrix is empty, i.e., nrow() * ncol() == 0 More...
 
iterator end ()
 Iterator to one pass the lower right corner of the matrix. More...
 
const_iterator end () const
 Iterator to one pass the lower right corner of the matrix. More...
 
allocator_type get_allocator () const
 Return the associated allocator. More...
 
size_type ldim () const
 The number of elements in the leading dimension. More...
 
size_type ncol () const
 The number of columns. More...
 
size_type nrow () const
 The number of rows. More...
 
 operator transpose_type () const
 Convert to a matrix with a different storage layout. More...
 
reference operator() (size_type i, size_type j)
 Access an element in the matrix. More...
 
const_reference operator() (size_type i, size_type j) const
 Access an element in the matrix. More...
 
Matrixoperator= (const Matrix &)=default
 Copy assignment operator. More...
 
Matrixoperator= (Matrix &&other) noexcept(noexcept(data_.swap(other.data_)))
 Move assignment operator. More...
 
template<typename InputIter >
void push_back_col (InputIter first)
 Insert a new coloumn at the right. More...
 
template<typename InputIter >
void push_back_row (InputIter first)
 Insert a new row at the bottom. More...
 
reverse_iterator rbegin ()
 Iterator to the lower right corner of the matrix. More...
 
const_reverse_iterator rbegin () const
 Iterator to the lower right corner of the matrix. More...
 
reverse_col_range rcol (size_type i)
 Range of a column in reverse order. More...
 
const_reverse_col_range rcol (size_type i) const
 Range of a column in reverse order. More...
 
reverse_iterator rend ()
 Iterator one before the upper left corner of the matrix. More...
 
const_reverse_iterator rend () const
 Iterator one before the upper left corner of the matrix. More...
 
void reserve (size_type n, size_type m)
 Reserve storage space for the matrix. More...
 
void resize (size_type nrow, size_type ncol)
 Resize the matrix. More...
 
row_range row (size_type i)
 Range of a row. More...
 
const_row_range row (size_type i) const
 Range of a row. More...
 
row_iterator row_begin (size_type i)
 Iterator to the beginning of a row. More...
 
const_row_iterator row_begin (size_type i) const
 Iterator to the beginning of a row. More...
 
const_row_iterator row_cbegin (size_type i) const
 Iterator to the beginning of a row. More...
 
const_row_iterator row_cend (size_type i) const
 Iterator to one pass the end of a row. More...
 
const_reverse_row_iterator row_crbegin (size_type i) const
 Iterator to the end of a row. More...
 
const_reverse_row_iterator row_crend (size_type i) const
 Iterator to one before the beginning of a row. More...
 
pointer row_data (size_type i)
 Pointer to the first element of a row. More...
 
const_pointer row_data (size_type i) const
 Pointer to the first element of a row. More...
 
row_iterator row_end (size_type i)
 Iterator to one pass the end of a row. More...
 
const_row_iterator row_end (size_type i) const
 Iterator to one pass the end of a row. More...
 
reverse_row_iterator row_rbegin (size_type i)
 Iterator to the end of a row. More...
 
const_reverse_row_iterator row_rbegin (size_type i) const
 Iterator to the end of a row. More...
 
reverse_row_iterator row_rend (size_type i)
 Iterator to one before the beginning of a row. More...
 
const_reverse_row_iterator row_rend (size_type i) const
 Iterator to one before the beginning of a row. More...
 
size_type row_stride () const
 The stride of row-wise access through row_data() More...
 
reverse_row_range rrow (size_type i)
 Range of a row in reverse order. More...
 
const_reverse_row_range rrow (size_type i) const
 Range of a row in reverse order. More...
 
void shrink_to_fit ()
 Release memory no longer needed. More...
 
size_type size () const
 The total number of elements. More...
 
void swap (Matrix &other) noexcept(noexcept(data_.swap(other.data_)))
 Swap two matrices. More...
 

Static Public Member Functions

static constexpr MatrixLayout layout ()
 The layout of the matrix. More...
 

Friends

bool is_equal (const Matrix &m1, const Matrix &m2)
 Compare equality. More...
 
bool operator!= (const Matrix &m1, const Matrix &m2)
 Compare inequality. More...
 
bool operator== (const Matrix &m1, const Matrix &m2)
 Compare equality. More...
 
void swap (Matrix &m1, Matrix &m2) noexcept(noexcept(m1.swap(m2)))
 Swap two matrices. More...
 

Detailed Description

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
class mckl::Matrix< T, Layout, Alloc >

Matrix container.

Template Parameters
TThe value type
LayoutThe storage layout, either RowMajor or ColMajor
AllocThe allocator type

Definition at line 49 of file matrix.hpp.

Member Typedef Documentation

◆ allocator_type

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
using mckl::Matrix< T, Layout, Alloc >::allocator_type = Alloc

Definition at line 59 of file matrix.hpp.

◆ col_iterator

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
using mckl::Matrix< T, Layout, Alloc >::col_iterator = std::conditional_t<Layout == ColMajor, pointer, StepIterator<pointer> >

Definition at line 81 of file matrix.hpp.

◆ col_range

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
using mckl::Matrix< T, Layout, Alloc >::col_range = Range<col_iterator>

Definition at line 93 of file matrix.hpp.

◆ const_col_iterator

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
using mckl::Matrix< T, Layout, Alloc >::const_col_iterator = std::conditional_t<Layout == ColMajor, const_pointer, StepIterator<const_pointer> >

Definition at line 83 of file matrix.hpp.

◆ const_col_range

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
using mckl::Matrix< T, Layout, Alloc >::const_col_range = Range<const_col_iterator>

Definition at line 94 of file matrix.hpp.

◆ const_iterator

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
using mckl::Matrix< T, Layout, Alloc >::const_iterator = const_pointer

Definition at line 68 of file matrix.hpp.

◆ const_pointer

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
using mckl::Matrix< T, Layout, Alloc >::const_pointer = const value_type *

Definition at line 65 of file matrix.hpp.

◆ const_reference

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
using mckl::Matrix< T, Layout, Alloc >::const_reference = const value_type &

Definition at line 63 of file matrix.hpp.

◆ const_reverse_col_iterator

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
using mckl::Matrix< T, Layout, Alloc >::const_reverse_col_iterator = std::reverse_iterator<const_col_iterator>

Definition at line 86 of file matrix.hpp.

◆ const_reverse_col_range

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
using mckl::Matrix< T, Layout, Alloc >::const_reverse_col_range = Range<const_reverse_col_iterator>

Definition at line 96 of file matrix.hpp.

◆ const_reverse_iterator

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
using mckl::Matrix< T, Layout, Alloc >::const_reverse_iterator = std::reverse_iterator<const_iterator>

Definition at line 70 of file matrix.hpp.

◆ const_reverse_row_iterator

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
using mckl::Matrix< T, Layout, Alloc >::const_reverse_row_iterator = std::reverse_iterator<const_row_iterator>

Definition at line 78 of file matrix.hpp.

◆ const_reverse_row_range

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
using mckl::Matrix< T, Layout, Alloc >::const_reverse_row_range = Range<const_reverse_row_iterator>

Definition at line 91 of file matrix.hpp.

◆ const_row_iterator

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
using mckl::Matrix< T, Layout, Alloc >::const_row_iterator = std::conditional_t<Layout == RowMajor, const_pointer, StepIterator<const_pointer> >

Definition at line 75 of file matrix.hpp.

◆ const_row_range

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
using mckl::Matrix< T, Layout, Alloc >::const_row_range = Range<const_row_iterator>

Definition at line 89 of file matrix.hpp.

◆ difference_type

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
using mckl::Matrix< T, Layout, Alloc >::difference_type = std::ptrdiff_t

Definition at line 61 of file matrix.hpp.

◆ iterator

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
using mckl::Matrix< T, Layout, Alloc >::iterator = pointer

Definition at line 67 of file matrix.hpp.

◆ pointer

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
using mckl::Matrix< T, Layout, Alloc >::pointer = value_type *

Definition at line 64 of file matrix.hpp.

◆ reference

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
using mckl::Matrix< T, Layout, Alloc >::reference = value_type &

Definition at line 62 of file matrix.hpp.

◆ reverse_col_iterator

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
using mckl::Matrix< T, Layout, Alloc >::reverse_col_iterator = std::reverse_iterator<col_iterator>

Definition at line 84 of file matrix.hpp.

◆ reverse_col_range

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
using mckl::Matrix< T, Layout, Alloc >::reverse_col_range = Range<reverse_col_iterator>

Definition at line 95 of file matrix.hpp.

◆ reverse_iterator

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
using mckl::Matrix< T, Layout, Alloc >::reverse_iterator = std::reverse_iterator<iterator>

Definition at line 69 of file matrix.hpp.

◆ reverse_row_iterator

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
using mckl::Matrix< T, Layout, Alloc >::reverse_row_iterator = std::reverse_iterator<row_iterator>

Definition at line 76 of file matrix.hpp.

◆ reverse_row_range

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
using mckl::Matrix< T, Layout, Alloc >::reverse_row_range = Range<reverse_row_iterator>

Definition at line 90 of file matrix.hpp.

◆ row_iterator

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
using mckl::Matrix< T, Layout, Alloc >::row_iterator = std::conditional_t<Layout == RowMajor, pointer, StepIterator<pointer> >

Definition at line 73 of file matrix.hpp.

◆ row_range

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
using mckl::Matrix< T, Layout, Alloc >::row_range = Range<row_iterator>

Definition at line 88 of file matrix.hpp.

◆ size_type

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
using mckl::Matrix< T, Layout, Alloc >::size_type = std::size_t

Definition at line 60 of file matrix.hpp.

◆ transpose_type

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
using mckl::Matrix< T, Layout, Alloc >::transpose_type = Matrix<T, Layout == RowMajor ? ColMajor : RowMajor, Alloc>

Definition at line 99 of file matrix.hpp.

◆ value_type

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
using mckl::Matrix< T, Layout, Alloc >::value_type = T

Definition at line 58 of file matrix.hpp.

Constructor & Destructor Documentation

◆ Matrix() [1/4]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
mckl::Matrix< T, Layout, Alloc >::Matrix ( )
inlinenoexcept

Construct an empty matrix.

Definition at line 102 of file matrix.hpp.

◆ Matrix() [2/4]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
mckl::Matrix< T, Layout, Alloc >::Matrix ( size_type  nrow,
size_type  ncol 
)
inline

Construct an nrow by ncol matrix.

Definition at line 109 of file matrix.hpp.

◆ Matrix() [3/4]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
mckl::Matrix< T, Layout, Alloc >::Matrix ( const Matrix< T, Layout, Alloc > &  )
default

Copy constructor.

◆ Matrix() [4/4]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
mckl::Matrix< T, Layout, Alloc >::Matrix ( Matrix< T, Layout, Alloc > &&  other)
inlinenoexcept

Move constructor.

Definition at line 118 of file matrix.hpp.

Member Function Documentation

◆ at() [1/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
reference mckl::Matrix< T, Layout, Alloc >::at ( size_type  i,
size_type  j 
)
inline

Access an element in the matrix with bound checking.

Definition at line 403 of file matrix.hpp.

◆ at() [2/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_reference mckl::Matrix< T, Layout, Alloc >::at ( size_type  i,
size_type  j 
) const
inline

Access an element in the matrix with bound checking.

Definition at line 414 of file matrix.hpp.

◆ begin() [1/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
iterator mckl::Matrix< T, Layout, Alloc >::begin ( )
inline

Iterator to the upper left corner of the matrix.

Definition at line 169 of file matrix.hpp.

◆ begin() [2/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_iterator mckl::Matrix< T, Layout, Alloc >::begin ( ) const
inline

Iterator to the upper left corner of the matrix.

Definition at line 172 of file matrix.hpp.

◆ cbegin()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_iterator mckl::Matrix< T, Layout, Alloc >::cbegin ( ) const
inline

Iterator to the upper left corner of the matrix.

Definition at line 175 of file matrix.hpp.

◆ ccol()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_col_range mckl::Matrix< T, Layout, Alloc >::ccol ( size_type  i) const
inline

Range of a column.

Definition at line 379 of file matrix.hpp.

◆ cend()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_iterator mckl::Matrix< T, Layout, Alloc >::cend ( ) const
inline

Iterator to one pass the lower right corner of the matrix.

Definition at line 184 of file matrix.hpp.

◆ clear()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
void mckl::Matrix< T, Layout, Alloc >::clear ( )
inline

Clear the matrix of all elements.

Definition at line 526 of file matrix.hpp.

◆ col() [1/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
col_range mckl::Matrix< T, Layout, Alloc >::col ( size_type  i)
inline

Range of a column.

Definition at line 370 of file matrix.hpp.

◆ col() [2/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_col_range mckl::Matrix< T, Layout, Alloc >::col ( size_type  i) const
inline

Range of a column.

Definition at line 373 of file matrix.hpp.

◆ col_begin() [1/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
col_iterator mckl::Matrix< T, Layout, Alloc >::col_begin ( size_type  i)
inline

Iterator to the beginning of a column.

Definition at line 274 of file matrix.hpp.

◆ col_begin() [2/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_col_iterator mckl::Matrix< T, Layout, Alloc >::col_begin ( size_type  j) const
inline

Iterator to the beginning of a column.

Definition at line 280 of file matrix.hpp.

◆ col_cbegin()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_col_iterator mckl::Matrix< T, Layout, Alloc >::col_cbegin ( size_type  j) const
inline

Iterator to the beginning of a column.

Definition at line 283 of file matrix.hpp.

◆ col_cend()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_col_iterator mckl::Matrix< T, Layout, Alloc >::col_cend ( size_type  j) const
inline

Iterator to one pass the end of a column.

Definition at line 295 of file matrix.hpp.

◆ col_crbegin()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_reverse_col_iterator mckl::Matrix< T, Layout, Alloc >::col_crbegin ( size_type  j) const
inline

Iterator to the end of a column.

Definition at line 313 of file matrix.hpp.

◆ col_crend()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_reverse_col_iterator mckl::Matrix< T, Layout, Alloc >::col_crend ( size_type  j) const
inline

Iterator to one before the beginning of a column.

Definition at line 331 of file matrix.hpp.

◆ col_data() [1/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
pointer mckl::Matrix< T, Layout, Alloc >::col_data ( size_type  j)
inline

Pointer to the beginning of a column.

Definition at line 461 of file matrix.hpp.

◆ col_data() [2/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_pointer mckl::Matrix< T, Layout, Alloc >::col_data ( size_type  j) const
inline

Pointer to the beginning of a column.

Definition at line 467 of file matrix.hpp.

◆ col_end() [1/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
col_iterator mckl::Matrix< T, Layout, Alloc >::col_end ( size_type  j)
inline

Iterator to one pass the end of a column.

Definition at line 289 of file matrix.hpp.

◆ col_end() [2/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_col_iterator mckl::Matrix< T, Layout, Alloc >::col_end ( size_type  j) const
inline

Iterator to one pass the end of a column.

Definition at line 292 of file matrix.hpp.

◆ col_rbegin() [1/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
reverse_col_iterator mckl::Matrix< T, Layout, Alloc >::col_rbegin ( size_type  j)
inline

Iterator to the end of a column.

Definition at line 301 of file matrix.hpp.

◆ col_rbegin() [2/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_reverse_col_iterator mckl::Matrix< T, Layout, Alloc >::col_rbegin ( size_type  j) const
inline

Iterator to the end of a column.

Definition at line 307 of file matrix.hpp.

◆ col_rend() [1/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
reverse_col_iterator mckl::Matrix< T, Layout, Alloc >::col_rend ( size_type  j)
inline

Iterator to one before the beginning of a column.

Definition at line 319 of file matrix.hpp.

◆ col_rend() [2/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_reverse_col_iterator mckl::Matrix< T, Layout, Alloc >::col_rend ( size_type  j) const
inline

Iterator to one before the beginning of a column.

Definition at line 325 of file matrix.hpp.

◆ col_stride()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
size_type mckl::Matrix< T, Layout, Alloc >::col_stride ( ) const
inline

The stride size of column-wise access through col_data()

Definition at line 473 of file matrix.hpp.

◆ crbegin()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_reverse_iterator mckl::Matrix< T, Layout, Alloc >::crbegin ( ) const
inline

Iterator to the lower right corner of the matrix.

Definition at line 193 of file matrix.hpp.

◆ crcol()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_reverse_col_range mckl::Matrix< T, Layout, Alloc >::crcol ( size_type  i) const
inline

Range of a column in reverse order.

Definition at line 397 of file matrix.hpp.

◆ crend()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_reverse_iterator mckl::Matrix< T, Layout, Alloc >::crend ( ) const
inline

Iterator one before the upper left corner of the matrix.

Definition at line 205 of file matrix.hpp.

◆ crow()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_row_range mckl::Matrix< T, Layout, Alloc >::crow ( size_type  i) const
inline

Range of a row.

Definition at line 346 of file matrix.hpp.

◆ crrow()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_reverse_row_range mckl::Matrix< T, Layout, Alloc >::crrow ( size_type  i) const
inline

Range of a row in reverse order.

Definition at line 364 of file matrix.hpp.

◆ data() [1/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
pointer mckl::Matrix< T, Layout, Alloc >::data ( )
inline

Pointer to the upper left corner of the matrix.

Definition at line 437 of file matrix.hpp.

◆ data() [2/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_pointer mckl::Matrix< T, Layout, Alloc >::data ( ) const
inline

Pointer to the upper left corner of the matrix.

Definition at line 440 of file matrix.hpp.

◆ empty()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
bool mckl::Matrix< T, Layout, Alloc >::empty ( ) const
inline

If the matrix is empty, i.e., nrow() * ncol() == 0

Definition at line 482 of file matrix.hpp.

◆ end() [1/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
iterator mckl::Matrix< T, Layout, Alloc >::end ( )
inline

Iterator to one pass the lower right corner of the matrix.

Definition at line 178 of file matrix.hpp.

◆ end() [2/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_iterator mckl::Matrix< T, Layout, Alloc >::end ( ) const
inline

Iterator to one pass the lower right corner of the matrix.

Definition at line 181 of file matrix.hpp.

◆ get_allocator()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
allocator_type mckl::Matrix< T, Layout, Alloc >::get_allocator ( ) const
inline

Return the associated allocator.

Definition at line 166 of file matrix.hpp.

◆ layout()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
static constexpr MatrixLayout mckl::Matrix< T, Layout, Alloc >::layout ( )
inlinestatic

The layout of the matrix.

Definition at line 479 of file matrix.hpp.

◆ ldim()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
size_type mckl::Matrix< T, Layout, Alloc >::ldim ( ) const
inline

The number of elements in the leading dimension.

Definition at line 491 of file matrix.hpp.

◆ ncol()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
size_type mckl::Matrix< T, Layout, Alloc >::ncol ( ) const
inline

The number of columns.

Definition at line 488 of file matrix.hpp.

◆ nrow()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
size_type mckl::Matrix< T, Layout, Alloc >::nrow ( ) const
inline

The number of rows.

Definition at line 485 of file matrix.hpp.

◆ operator transpose_type()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
mckl::Matrix< T, Layout, Alloc >::operator transpose_type ( ) const
inlineexplicit

Convert to a matrix with a different storage layout.

Definition at line 143 of file matrix.hpp.

◆ operator()() [1/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
reference mckl::Matrix< T, Layout, Alloc >::operator() ( size_type  i,
size_type  j 
)
inline

Access an element in the matrix.

Definition at line 425 of file matrix.hpp.

◆ operator()() [2/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_reference mckl::Matrix< T, Layout, Alloc >::operator() ( size_type  i,
size_type  j 
) const
inline

Access an element in the matrix.

Definition at line 431 of file matrix.hpp.

◆ operator=() [1/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
Matrix& mckl::Matrix< T, Layout, Alloc >::operator= ( const Matrix< T, Layout, Alloc > &  )
default

Copy assignment operator.

◆ operator=() [2/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
Matrix& mckl::Matrix< T, Layout, Alloc >::operator= ( Matrix< T, Layout, Alloc > &&  other)
inlinenoexcept

Move assignment operator.

Definition at line 130 of file matrix.hpp.

◆ push_back_col()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
template<typename InputIter >
void mckl::Matrix< T, Layout, Alloc >::push_back_col ( InputIter  first)
inline

Insert a new coloumn at the right.

Definition at line 543 of file matrix.hpp.

◆ push_back_row()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
template<typename InputIter >
void mckl::Matrix< T, Layout, Alloc >::push_back_row ( InputIter  first)
inline

Insert a new row at the bottom.

Definition at line 535 of file matrix.hpp.

◆ rbegin() [1/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
reverse_iterator mckl::Matrix< T, Layout, Alloc >::rbegin ( )
inline

Iterator to the lower right corner of the matrix.

Definition at line 187 of file matrix.hpp.

◆ rbegin() [2/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_reverse_iterator mckl::Matrix< T, Layout, Alloc >::rbegin ( ) const
inline

Iterator to the lower right corner of the matrix.

Definition at line 190 of file matrix.hpp.

◆ rcol() [1/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
reverse_col_range mckl::Matrix< T, Layout, Alloc >::rcol ( size_type  i)
inline

Range of a column in reverse order.

Definition at line 385 of file matrix.hpp.

◆ rcol() [2/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_reverse_col_range mckl::Matrix< T, Layout, Alloc >::rcol ( size_type  i) const
inline

Range of a column in reverse order.

Definition at line 391 of file matrix.hpp.

◆ rend() [1/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
reverse_iterator mckl::Matrix< T, Layout, Alloc >::rend ( )
inline

Iterator one before the upper left corner of the matrix.

Definition at line 199 of file matrix.hpp.

◆ rend() [2/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_reverse_iterator mckl::Matrix< T, Layout, Alloc >::rend ( ) const
inline

Iterator one before the upper left corner of the matrix.

Definition at line 202 of file matrix.hpp.

◆ reserve()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
void mckl::Matrix< T, Layout, Alloc >::reserve ( size_type  n,
size_type  m 
)
inline

Reserve storage space for the matrix.

Definition at line 497 of file matrix.hpp.

◆ resize()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
void mckl::Matrix< T, Layout, Alloc >::resize ( size_type  nrow,
size_type  ncol 
)
inline

Resize the matrix.

Let the orignal be a \(p\) by \(q\) matrix and the new matrix be of dimensions \(s\) by \(t\). Then the sub-matrix at the upper left corner, of dimensions \(n = \min\{p,s\}\) by \(m = \min\{q,t\}\) has its original values.

Definition at line 506 of file matrix.hpp.

◆ row() [1/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
row_range mckl::Matrix< T, Layout, Alloc >::row ( size_type  i)
inline

Range of a row.

Definition at line 337 of file matrix.hpp.

◆ row() [2/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_row_range mckl::Matrix< T, Layout, Alloc >::row ( size_type  i) const
inline

Range of a row.

Definition at line 340 of file matrix.hpp.

◆ row_begin() [1/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
row_iterator mckl::Matrix< T, Layout, Alloc >::row_begin ( size_type  i)
inline

Iterator to the beginning of a row.

Definition at line 211 of file matrix.hpp.

◆ row_begin() [2/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_row_iterator mckl::Matrix< T, Layout, Alloc >::row_begin ( size_type  i) const
inline

Iterator to the beginning of a row.

Definition at line 217 of file matrix.hpp.

◆ row_cbegin()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_row_iterator mckl::Matrix< T, Layout, Alloc >::row_cbegin ( size_type  i) const
inline

Iterator to the beginning of a row.

Definition at line 220 of file matrix.hpp.

◆ row_cend()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_row_iterator mckl::Matrix< T, Layout, Alloc >::row_cend ( size_type  i) const
inline

Iterator to one pass the end of a row.

Definition at line 232 of file matrix.hpp.

◆ row_crbegin()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_reverse_row_iterator mckl::Matrix< T, Layout, Alloc >::row_crbegin ( size_type  i) const
inline

Iterator to the end of a row.

Definition at line 250 of file matrix.hpp.

◆ row_crend()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_reverse_row_iterator mckl::Matrix< T, Layout, Alloc >::row_crend ( size_type  i) const
inline

Iterator to one before the beginning of a row.

Definition at line 268 of file matrix.hpp.

◆ row_data() [1/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
pointer mckl::Matrix< T, Layout, Alloc >::row_data ( size_type  i)
inline

Pointer to the first element of a row.

Definition at line 443 of file matrix.hpp.

◆ row_data() [2/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_pointer mckl::Matrix< T, Layout, Alloc >::row_data ( size_type  i) const
inline

Pointer to the first element of a row.

Definition at line 449 of file matrix.hpp.

◆ row_end() [1/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
row_iterator mckl::Matrix< T, Layout, Alloc >::row_end ( size_type  i)
inline

Iterator to one pass the end of a row.

Definition at line 226 of file matrix.hpp.

◆ row_end() [2/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_row_iterator mckl::Matrix< T, Layout, Alloc >::row_end ( size_type  i) const
inline

Iterator to one pass the end of a row.

Definition at line 229 of file matrix.hpp.

◆ row_rbegin() [1/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
reverse_row_iterator mckl::Matrix< T, Layout, Alloc >::row_rbegin ( size_type  i)
inline

Iterator to the end of a row.

Definition at line 238 of file matrix.hpp.

◆ row_rbegin() [2/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_reverse_row_iterator mckl::Matrix< T, Layout, Alloc >::row_rbegin ( size_type  i) const
inline

Iterator to the end of a row.

Definition at line 244 of file matrix.hpp.

◆ row_rend() [1/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
reverse_row_iterator mckl::Matrix< T, Layout, Alloc >::row_rend ( size_type  i)
inline

Iterator to one before the beginning of a row.

Definition at line 256 of file matrix.hpp.

◆ row_rend() [2/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_reverse_row_iterator mckl::Matrix< T, Layout, Alloc >::row_rend ( size_type  i) const
inline

Iterator to one before the beginning of a row.

Definition at line 262 of file matrix.hpp.

◆ row_stride()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
size_type mckl::Matrix< T, Layout, Alloc >::row_stride ( ) const
inline

The stride of row-wise access through row_data()

Definition at line 455 of file matrix.hpp.

◆ rrow() [1/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
reverse_row_range mckl::Matrix< T, Layout, Alloc >::rrow ( size_type  i)
inline

Range of a row in reverse order.

Definition at line 352 of file matrix.hpp.

◆ rrow() [2/2]

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
const_reverse_row_range mckl::Matrix< T, Layout, Alloc >::rrow ( size_type  i) const
inline

Range of a row in reverse order.

Definition at line 358 of file matrix.hpp.

◆ shrink_to_fit()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
void mckl::Matrix< T, Layout, Alloc >::shrink_to_fit ( )
inline

Release memory no longer needed.

Definition at line 523 of file matrix.hpp.

◆ size()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
size_type mckl::Matrix< T, Layout, Alloc >::size ( ) const
inline

The total number of elements.

Definition at line 494 of file matrix.hpp.

◆ swap()

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
void mckl::Matrix< T, Layout, Alloc >::swap ( Matrix< T, Layout, Alloc > &  other)
inlinenoexcept

Swap two matrices.

Definition at line 550 of file matrix.hpp.

Friends And Related Function Documentation

◆ is_equal

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
bool is_equal ( const Matrix< T, Layout, Alloc > &  m1,
const Matrix< T, Layout, Alloc > &  m2 
)
friend

Compare equality.

Definition at line 582 of file matrix.hpp.

◆ operator!=

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
bool operator!= ( const Matrix< T, Layout, Alloc > &  m1,
const Matrix< T, Layout, Alloc > &  m2 
)
friend

Compare inequality.

Definition at line 576 of file matrix.hpp.

◆ operator==

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
bool operator== ( const Matrix< T, Layout, Alloc > &  m1,
const Matrix< T, Layout, Alloc > &  m2 
)
friend

Compare equality.

Definition at line 564 of file matrix.hpp.

◆ swap

template<typename T, MatrixLayout Layout = ColMajor, typename Alloc = Allocator<T>>
void swap ( Matrix< T, Layout, Alloc > &  m1,
Matrix< T, Layout, Alloc > &  m2 
)
friend

Swap two matrices.

Definition at line 558 of file matrix.hpp.