cortexlib  v0.2.0
Public Types | Public Member Functions | List of all members
cxl::matrix< T, Alloc > Class Template Reference

matrix - Two Dimensional Array More...

#include <matrix.hxx>

Public Types

using value_type = T
 
using size_type = std::size_t
 
using difference_type = std::ptrdiff_t
 
using allocator_type = Alloc
 
using alloc_traits = typename std::allocator_traits< Alloc >
 
using reference = T &
 
using const_reference = const T &
 
using pointer = typename alloc_traits::pointer
 
using const_pointer = typename alloc_traits::const_pointer
 
using iterator = cxl::normal_iterator< pointer, matrix >
 
using const_iterator = cxl::normal_iterator< const_pointer, matrix >
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 

Public Member Functions

constexpr matrix () noexcept
 Default Constructor. More...
 
constexpr matrix (const allocator_type &alloc) noexcept
 Allocator Constructor. More...
 
constexpr matrix (size_type num_rows, size_type num_columns, const allocator_type &alloc=allocator_type{})
 Default Size Constructor. More...
 
constexpr matrix (size_type num_rows, size_type num_columns, const_reference fill_value, const allocator_type &alloc=allocator_type())
 Explicit Value and Size Constructor. More...
 
constexpr matrix (const matrix &other)
 Copy Constructor. More...
 
constexpr matrix (const matrix &other, const allocator_type &alloc)
 Copy Constructor with Alternative Allocator. More...
 
constexpr matrix (matrix &&other) noexcept
 Move Constructor. More...
 
constexpr matrix (matrix &&other, const allocator_type &alloc) noexcept
 Move Constructor with Alternative Allocator. More...
 
constexpr matrix (std::initializer_list< std::initializer_list< value_type >> list, [[maybe_unused]] const allocator_type &alloc=allocator_type{})
 Initialiser List Constructor. More...
 
constexpr matrix (const std::tuple< size_type, size_type > &dimensions, [[maybe_unused]] const allocator_type &alloc=allocator_type{})
 Dimension Constructor. More...
 
constexpr auto operator= (const matrix &other) -> matrix &
 Copy Assignment. More...
 
constexpr auto operator= (matrix &&other) noexcept -> matrix &
 Move Assignment. More...
 
constexpr auto operator= (std::initializer_list< std::initializer_list< value_type >> list) -> matrix &
 Initialiser List Assignment. More...
 
 ~matrix ()
 Destructor. More...
 
constexpr auto assign (std::initializer_list< std::initializer_list< value_type >> list) -> void
 Initialiser List Assign. More...
 
constexpr auto resize (size_type new_rows, size_type new_columns) -> void
 Resizes the matrix memory. More...
 
constexpr auto resize (size_type new_rows, size_type new_columns, const_reference fill_value) -> void
 Resizes Matrices memory. More...
 
constexpr auto erase (const_iterator position) -> iterator
 Erases element indicated by position. More...
 
constexpr auto erase (const_iterator first, const_iterator last) -> iterator
 Erases elements between first and last. More...
 
constexpr auto clear () -> void
 Clears the matrix elements. More...
 
constexpr auto reshape (size_type new_rows, size_type new_columns) -> void
 Reshape current matrix elements to new dimensions. More...
 
void swap (matrix &other) noexcept
 Swaps two Matrices of the same type. More...
 
constexpr auto get_allocator () const noexcept -> allocator_type
 Get Allocator. More...
 
constexpr auto size () const noexcept -> size_type
 matrix Size More...
 
constexpr auto num_rows () const noexcept -> size_type
 Number of rows. More...
 
constexpr auto num_columns () const noexcept -> size_type
 Number of Columns. More...
 
constexpr auto max_size () const noexcept -> size_type
 Max matrix Size. More...
 
constexpr auto shape () const noexcept -> std::tuple< size_type, size_type >
 Dimensions. More...
 
constexpr auto is_square () const noexcept -> bool
 Is Square Predicate. More...
 
constexpr auto empty () const noexcept -> bool
 Empty. More...
 
constexpr auto data () noexcept -> pointer
 Data. More...
 
constexpr auto data () const noexcept -> const_pointer
 Data. More...
 
constexpr auto at (size_type row, size_type column) -> reference
 Point based element access. More...
 
constexpr auto at (size_type row, size_type column) const -> const_reference
 Point based element access. More...
 
constexpr auto operator() (size_type row, size_type column) -> reference
 Point based element access operator. More...
 
constexpr auto operator() (size_type row, size_type column) const -> const_reference
 Point based element access operator. More...
 
constexpr auto front () noexcept -> reference
 Front. More...
 
constexpr auto front () const noexcept -> const_reference
 Front. More...
 
constexpr auto back () noexcept -> reference
 Back. More...
 
constexpr auto back () const noexcept -> const_reference
 Back. More...
 
constexpr auto begin () noexcept -> iterator
 Begin Iterator. More...
 
constexpr auto begin () const noexcept -> const_iterator
 Begin Iterator (const) More...
 
constexpr auto cbegin () const noexcept -> const_iterator
 Constant Begin Iterator. More...
 
constexpr auto rbegin () noexcept -> reverse_iterator
 Reverse Begin Iterator. More...
 
constexpr auto rbegin () const noexcept -> const_reverse_iterator
 Reverse Begin Iterator (const) More...
 
constexpr auto crbegin () const noexcept -> const_reverse_iterator
 Constant Reverse Begin Iterator. More...
 
constexpr auto end () noexcept -> iterator
 End Iterator. More...
 
constexpr auto end () const noexcept -> const_iterator
 End Iterator (const) More...
 
constexpr auto cend () const noexcept -> const_iterator
 Constant End Iterator. More...
 
constexpr auto rend () noexcept -> reverse_iterator
 Reverse End Iterator. More...
 
constexpr auto rend () const noexcept -> const_reverse_iterator
 Reverse End Iterator (const) More...
 
constexpr auto crend () const noexcept -> const_reverse_iterator
 Constant Reverse End Iterator. More...
 
template<std::copy_constructible F>
constexpr auto map (F func) const -> matrix< std::invoke_result_t< F, value_type >>
 matrix Transpose More...
 
template<std::ranges::input_range Rng, std::copy_constructible F>
constexpr auto map (Rng &&rng, F func) const -> matrix< std::invoke_result_t< F, value_type, typename std::remove_cvref_t< decltype(*std::ranges::begin(rng))>>>
 matrix map with range More...
 
template<std::input_iterator It, std::sentinel_for< It > Sn, std::copy_constructible Fn>
constexpr auto map (It first, Sn last, Fn func) const -> matrix< std::invoke_result_t< Fn, value_type, typename std::remove_cvref_t< typename std::iterator_traits< It >::value_type >>>
 Map - Iterator Pair. More...
 

Detailed Description

template<typename T, typename Alloc = std::allocator<T>>
class cxl::matrix< T, Alloc >

matrix - Two Dimensional Array

A two dimensional, owning generic array. Support slicing, array based operations and multidimensional iteration and point based index.
Elements are stored continuously in memory and are layed out in a row-wise fashion.

Template Parameters
T
Allocdefault: std::allocator<T>

Member Typedef Documentation

◆ alloc_traits

template<typename T , typename Alloc = std::allocator<T>>
using cxl::matrix< T, Alloc >::alloc_traits = typename std::allocator_traits<Alloc>

◆ allocator_type

template<typename T , typename Alloc = std::allocator<T>>
using cxl::matrix< T, Alloc >::allocator_type = Alloc

◆ const_iterator

template<typename T , typename Alloc = std::allocator<T>>
using cxl::matrix< T, Alloc >::const_iterator = cxl::normal_iterator<const_pointer, matrix>

◆ const_pointer

template<typename T , typename Alloc = std::allocator<T>>
using cxl::matrix< T, Alloc >::const_pointer = typename alloc_traits::const_pointer

◆ const_reference

template<typename T , typename Alloc = std::allocator<T>>
using cxl::matrix< T, Alloc >::const_reference = const T&

◆ const_reverse_iterator

template<typename T , typename Alloc = std::allocator<T>>
using cxl::matrix< T, Alloc >::const_reverse_iterator = std::reverse_iterator<const_iterator>

◆ difference_type

template<typename T , typename Alloc = std::allocator<T>>
using cxl::matrix< T, Alloc >::difference_type = std::ptrdiff_t

◆ iterator

template<typename T , typename Alloc = std::allocator<T>>
using cxl::matrix< T, Alloc >::iterator = cxl::normal_iterator<pointer, matrix>

◆ pointer

template<typename T , typename Alloc = std::allocator<T>>
using cxl::matrix< T, Alloc >::pointer = typename alloc_traits::pointer

◆ reference

template<typename T , typename Alloc = std::allocator<T>>
using cxl::matrix< T, Alloc >::reference = T&

◆ reverse_iterator

template<typename T , typename Alloc = std::allocator<T>>
using cxl::matrix< T, Alloc >::reverse_iterator = std::reverse_iterator<iterator>

◆ size_type

template<typename T , typename Alloc = std::allocator<T>>
using cxl::matrix< T, Alloc >::size_type = std::size_t

◆ value_type

template<typename T , typename Alloc = std::allocator<T>>
using cxl::matrix< T, Alloc >::value_type = T

Constructor & Destructor Documentation

◆ matrix() [1/10]

template<typename T , typename Alloc = std::allocator<T>>
constexpr cxl::matrix< T, Alloc >::matrix ( )
inlineconstexprnoexcept

Default Constructor.

Default constructor for matrix.

◆ matrix() [2/10]

template<typename T , typename Alloc = std::allocator<T>>
constexpr cxl::matrix< T, Alloc >::matrix ( const allocator_type alloc)
inlineexplicitconstexprnoexcept

Allocator Constructor.

Default Constructs a matrix with a given allocator.

Parameters
alloctype: const allocator_type&

◆ matrix() [3/10]

template<typename T , typename Alloc = std::allocator<T>>
constexpr cxl::matrix< T, Alloc >::matrix ( size_type  num_rows,
size_type  num_columns,
const allocator_type alloc = allocator_type{} 
)
inlineexplicitconstexpr

Default Size Constructor.

Constructs a matrix with dimensions of num_rows x num_columns. Values are default constructed or fill constructed depending on the default contractibility qualification.

/* Construct a zero matrix of size 3x5 */
matrix - Two Dimensional Array
Definition: matrix.hxx:43
Parameters
num_columnstype: size_type
num_rowstype: size_type
alloctype: const allocator_type&

◆ matrix() [4/10]

template<typename T , typename Alloc = std::allocator<T>>
constexpr cxl::matrix< T, Alloc >::matrix ( size_type  num_rows,
size_type  num_columns,
const_reference  fill_value,
const allocator_type alloc = allocator_type() 
)
inlineexplicitconstexpr

Explicit Value and Size Constructor.

Constructs a matrix with dimensions of num_rows x num_columns. Values are constructed from the a constant reference to a provided fill_value.

Parameters
num_columnstype: size_type
num_rowstype: size_type
fill_valuetype: value_type
alloctype: const allocator_type&

◆ matrix() [5/10]

template<typename T , typename Alloc = std::allocator<T>>
constexpr cxl::matrix< T, Alloc >::matrix ( const matrix< T, Alloc > &  other)
inlineconstexpr

Copy Constructor.

Constructs a matrix that is a copy of another matrix of the same underlying type.

Parameters
othertype: const matrix&

◆ matrix() [6/10]

template<typename T , typename Alloc = std::allocator<T>>
constexpr cxl::matrix< T, Alloc >::matrix ( const matrix< T, Alloc > &  other,
const allocator_type alloc 
)
inlineexplicitconstexpr

Copy Constructor with Alternative Allocator.

Constructs a matrix that is a copy of another matrix of the same underlying type.

Parameters
othertype: const matrix&
alloctype: const allocator_type&

◆ matrix() [7/10]

template<typename T , typename Alloc = std::allocator<T>>
constexpr cxl::matrix< T, Alloc >::matrix ( matrix< T, Alloc > &&  other)
inlineconstexprnoexcept

Move Constructor.

Moves ownership of an existing Matrix's resources to this matrix and leaves the other matrix in a default constructed state.

Parameters
othertype: matrix&&

◆ matrix() [8/10]

template<typename T , typename Alloc = std::allocator<T>>
constexpr cxl::matrix< T, Alloc >::matrix ( matrix< T, Alloc > &&  other,
const allocator_type alloc 
)
inlineexplicitconstexprnoexcept

Move Constructor with Alternative Allocator.

Moves ownership of an existing Matrices resources to this matrix and leaves the other matrix in a default constructed state. Uses an alternative allocator for construction of this matrix.

Parameters
othertype: matrix&&
alloctype: const allocator_type&

◆ matrix() [9/10]

template<typename T , typename Alloc = std::allocator<T>>
constexpr cxl::matrix< T, Alloc >::matrix ( std::initializer_list< std::initializer_list< value_type >>  list,
[[maybe_unused] ] const allocator_type alloc = allocator_type{} 
)
inlineconstexpr

Initialiser List Constructor.

Uses std::initializer_list to create a matrix from an initializer list of initializer lists. Elements ownership is moved to the Matrices memory.

Exceptions
std::invalid_argument
Parameters
listtype: std::initializer_list<std::initializer_list<value_type>>
alloctype: [[maybe_unused]] const allocator_type&

◆ matrix() [10/10]

template<typename T , typename Alloc = std::allocator<T>>
constexpr cxl::matrix< T, Alloc >::matrix ( const std::tuple< size_type, size_type > &  dimensions,
[[maybe_unused] ] const allocator_type alloc = allocator_type{} 
)
inlineexplicitconstexpr

Dimension Constructor.

Constructs a matrix from the dimensions of another. The matrix is default constructed. Takes the result of a call to matrix::dimension().

Parameters
dimensionstype: const std::tuple<size_type, size_type>&
alloctype: [[maybe_unused]] const allocator_type&

◆ ~matrix()

template<typename T , typename Alloc = std::allocator<T>>
cxl::matrix< T, Alloc >::~matrix ( )
inline

Destructor.

Releases the resources of this matrix and leaves the matrix in an uninitialized state.

Member Function Documentation

◆ assign()

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::assign ( std::initializer_list< std::initializer_list< value_type >>  list) -> void
inlineconstexpr

Initialiser List Assign.

Uses std::initializer_list to reassign values to a matrix. If the lists dimensions are not the same as the Matrices dimensions, then the matrix is resized to match the dimensions of the list.

Exceptions
std::invalid_argument
Parameters
listtype: std::initializer_list<std::initializer_list<value_type>>

◆ at() [1/2]

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::at ( size_type  row,
size_type  column 
) -> reference
inlineconstexpr

Point based element access.

Returns a reference to the element that is at the point position (column, row) of the matrix.

Parameters
columntype: size_type
rowtype: size_type
Returns
constexpr reference

◆ at() [2/2]

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::at ( size_type  row,
size_type  column 
) const -> const_reference
inlineconstexpr

Point based element access.

Returns a reference to the element that is at the point position (column, row) of the matrix.

Parameters
columntype: size_type
rowtype: size_type
Returns
constexpr const_reference

◆ back() [1/2]

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::back ( ) const -> const_reference
inlineconstexprnoexcept

Back.

Returns a reference to the back element of the matrix.

Returns
constexpr const_reference

◆ back() [2/2]

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::back ( ) -> reference
inlineconstexprnoexcept

Back.

Returns a reference to the back element of the matrix.

Returns
constexpr reference

◆ begin() [1/2]

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::begin ( ) const -> const_iterator
inlineconstexprnoexcept

Begin Iterator (const)

Constant iterator to the beginning of the Matrices data.

Returns
constexpr const_iterator

◆ begin() [2/2]

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::begin ( ) -> iterator
inlineconstexprnoexcept

Begin Iterator.

Iterator to the beginning of the Matrices data.

Returns
constexpr iterator

◆ cbegin()

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::cbegin ( ) const -> const_iterator
inlineconstexprnoexcept

Constant Begin Iterator.

Constant iterator to the beginning of the matrix.

Returns
constexpr const_iterator

◆ cend()

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::cend ( ) const -> const_iterator
inlineconstexprnoexcept

Constant End Iterator.

Constant iterator to the end of the Matrices data.

Returns
constexpr const_iterator

◆ clear()

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::clear ( ) -> void
inlineconstexpr

Clears the matrix elements.

The elements of the matrix are destroyed and the memory is deallocated entirely. The matrix is however, left in a state where it could be re-initialised through matrix::resize or reassignment.

◆ crbegin()

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::crbegin ( ) const -> const_reverse_iterator
inlineconstexprnoexcept

Constant Reverse Begin Iterator.

Constant iterator to the reversed beginning of the Matrices data.

Returns
constexpr const_reverse_iterator

◆ crend()

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::crend ( ) const -> const_reverse_iterator
inlineconstexprnoexcept

Constant Reverse End Iterator.

Constant iterator to the reversed end of the Matrices data.

Returns
constexpr const_reverse_iterator

◆ data() [1/2]

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::data ( ) const -> const_pointer
inlineconstexprnoexcept

Data.

Returns the underlying data pointer.

Returns
const_pointer

◆ data() [2/2]

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::data ( ) -> pointer
inlineconstexprnoexcept

Data.

Returns the underlying data pointer.

Returns
pointer

◆ empty()

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::empty ( ) const -> bool
inlineconstexprnoexcept

Empty.

Checks whether the matrix is empty.

Returns
constexpr bool

◆ end() [1/2]

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::end ( ) const -> const_iterator
inlineconstexprnoexcept

End Iterator (const)

Constant iterator to the end of the Matrices data.

Returns
constexpr const_iterator

◆ end() [2/2]

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::end ( ) -> iterator
inlineconstexprnoexcept

End Iterator.

Iterator to the end of the Matrices data.

Returns
constexpr iterator

◆ erase() [1/2]

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::erase ( const_iterator  first,
const_iterator  last 
) -> iterator
inlineconstexpr

Erases elements between first and last.

Erases elements between first and last and then resets memory to value_type.

Parameters
firsttype: const_iterator
lasttype: const_iterator
Returns
[[maybe_unused]] constexpr iterator

◆ erase() [2/2]

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::erase ( const_iterator  position) -> iterator
inlineconstexpr

Erases element indicated by position.

Erases the value of the matrix at position and resets it to value_type.

Parameters
positiontype: const_iterator
Returns
[[maybe_unused]] constexpr iterator

◆ front() [1/2]

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::front ( ) const -> const_reference
inlineconstexprnoexcept

Front.

Returns a reference to the front element of the matrix.

Returns
constexpr const_reference

◆ front() [2/2]

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::front ( ) -> reference
inlineconstexprnoexcept

Front.

Returns a reference to the front element of the matrix.

Returns
constexpr reference

◆ get_allocator()

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::get_allocator ( ) const -> allocator_type
inlineconstexprnoexcept

Get Allocator.

Returns the allocator used by the matrix.

Returns
constexpr allocator_type

◆ is_square()

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::is_square ( ) const -> bool
inlineconstexprnoexcept

Is Square Predicate.

If the number of rows and columns are equal, the matrix is square.

Returns
constexpr bool

◆ map() [1/3]

template<typename T , typename Alloc = std::allocator<T>>
template<std::copy_constructible F>
constexpr auto cxl::matrix< T, Alloc >::map ( func) const -> matrix<std::invoke_result_t<F, value_type>>
inlineconstexpr

matrix Transpose

Performs a matrix transpose. Uses std::copy over std::ranges::copy as the output iterator is required to be std::constructible_v which column_iterator doesn't satisfy yet.

Returns
constexpr auto

matrix map

Maps a function over the matrix, returning the mapped matrix.

Template Parameters
Fconcept: std::copy_constructible
Parameters
functype: F
Returns
constexpr matrix<std::invoke_result_t<F, value_type>>

◆ map() [2/3]

template<typename T , typename Alloc = std::allocator<T>>
template<std::input_iterator It, std::sentinel_for< It > Sn, std::copy_constructible Fn>
constexpr auto cxl::matrix< T, Alloc >::map ( It  first,
Sn  last,
Fn  func 
) const -> matrix<std::invoke_result_t<Fn, value_type, typename std::remove_cvref_t<typename std::iterator_traits<It>::value_type>>>
inlineconstexpr

Map - Iterator Pair.

Maps a function over the matrix and a range denoted by an iterator pair, returning the mapped matrix. Returns an empty matrix if this is empty.

Template Parameters
Itconcept: std::input_iterator
Snconcept: std::sentinel_for<It>
Fconcept: std::copy_constructible
Parameters
firsttype: It
lasttype Sn
functype: Fn
Returns
constexpr matrix<std::invoke_result_t<F, value_type, typename std::remove_cvref_t<typename std::iterator_traits<It>::value_type>>>

◆ map() [3/3]

template<typename T , typename Alloc = std::allocator<T>>
template<std::ranges::input_range Rng, std::copy_constructible F>
constexpr auto cxl::matrix< T, Alloc >::map ( Rng &&  rng,
func 
) const -> matrix<std::invoke_result_t<F, value_type, typename std::remove_cvref_t<decltype(*std::ranges::begin(rng))>>>
inlineconstexpr

matrix map with range

Maps a function over the matrix and another range object, returning the mapped matrix. Returns an empty matrix if this is empty.

Template Parameters
Rngconcept: std::ranges::input_range
Fconcept: std::copy_constructible
Parameters
rngtype Rng&&
functype F
Returns
constexpr matrix<std::invoke_result_t<F, value_type, typename std::remove_cvref_t<decltype(*std::ranges::begin(rng))>>

◆ max_size()

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::max_size ( ) const -> size_type
inlineconstexprnoexcept

Max matrix Size.

Returns the maximum number of elements that can be stored in the matrix per the allocator.

Returns
constexpr size_type

◆ num_columns()

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::num_columns ( ) const -> size_type
inlineconstexprnoexcept

Number of Columns.

Returns the number of columns of the matrix.

Returns
constexpr size_type

◆ num_rows()

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::num_rows ( ) const -> size_type
inlineconstexprnoexcept

Number of rows.

Returns the number of rows of the matrix.

Returns
constexpr size_type

◆ operator()() [1/2]

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::operator() ( size_type  row,
size_type  column 
) -> reference
inlineconstexpr

Point based element access operator.

Provides point access to Matrices elements. Overloads the invocation operator. Utilises the at() method.

Parameters
columntype: size_type
rowtype: size_type
Returns
constexpr reference

◆ operator()() [2/2]

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::operator() ( size_type  row,
size_type  column 
) const -> const_reference
inlineconstexpr

Point based element access operator.

Provides point access to Matrices elements. Overloads the invocation operator. Utilises the at() method.

Parameters
columntype: size_type
rowtype: size_type
Returns
constexpr const_reference

◆ operator=() [1/3]

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::operator= ( const matrix< T, Alloc > &  other) -> matrix&
inlineconstexpr

Copy Assignment.

Copies the contents of another matrix into this matrix and returns///this. If self assignment occurs then///this is returned immediately.

Parameters
othertype: const matrix&
Returns
constexpr matrix&

◆ operator=() [2/3]

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::operator= ( matrix< T, Alloc > &&  other) -> matrix&
inlineconstexprnoexcept

Move Assignment.

Moves the ownership of other's resources to this matrix and leaves the other matrix in a default constructed state. Returns///this. If self assignment occurs then///this is returned immediately.

Parameters
othertype: matrix&&
Returns
constexpr matrix&

◆ operator=() [3/3]

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::operator= ( std::initializer_list< std::initializer_list< value_type >>  list) -> matrix&
inlineconstexpr

Initialiser List Assignment.

Uses std::initializer_list to create a matrix from an initializer list of initializer lists. Elements ownership is moved to the Matrices memory.

Exceptions
std::invalid_argument
Parameters
listtype: [std::initializer_list<std::initializer_list<value_type>>]
Returns
constexpr matrix&

◆ rbegin() [1/2]

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::rbegin ( ) const -> const_reverse_iterator
inlineconstexprnoexcept

Reverse Begin Iterator (const)

Constant iterator to the reversed beginning of the Matrices data.

Returns
constexpr const_reverse_iterator

◆ rbegin() [2/2]

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::rbegin ( ) -> reverse_iterator
inlineconstexprnoexcept

Reverse Begin Iterator.

Iterator to the reversed beginning of the Matrices data.

Returns
constexpr reverse_iterator

◆ rend() [1/2]

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::rend ( ) const -> const_reverse_iterator
inlineconstexprnoexcept

Reverse End Iterator (const)

Constant iterator to the reversed end of the Matrices data.

Returns
constexpr const_reverse_iterator

◆ rend() [2/2]

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::rend ( ) -> reverse_iterator
inlineconstexprnoexcept

Reverse End Iterator.

Iterator to the reversed end of the Matrices data.

Returns
constexpr reverse_iterator

◆ reshape()

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::reshape ( size_type  new_rows,
size_type  new_columns 
) -> void
inlineconstexpr

Reshape current matrix elements to new dimensions.

Reshapes the current Matrices dimensions while guaranteeing that no reallocation occurs. Elements are preserved but reordered.

Exceptions
std::length_error
Parameters
new_rowstype: size_type
new_columnstype: size_type

◆ resize() [1/2]

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::resize ( size_type  new_rows,
size_type  new_columns 
) -> void
inlineconstexpr

Resizes the matrix memory.

Parameters
new_rowstype: size_type
new_columnstype: size_type

◆ resize() [2/2]

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::resize ( size_type  new_rows,
size_type  new_columns,
const_reference  fill_value 
) -> void
inlineconstexpr

Resizes Matrices memory.

Resizes the matrix to a new shape of new_rows x new_columns. Resizing will cause reallocation to a new memory block if the new shape is larger or smaller than the current shape. For larger shape, previous values are copied to the new sequential memory location which will reshuffle the data's layout. New memory is given the value of fill_value. A smaller resize shape will result in elements past the new shape's sequential extent to be destroyed and deallocated. If the overall memory size remains the same, the data is only reshaped.

Exceptions
std::length_error
Parameters
new_rowstype: size_type
new_columnstype: size_type
fill_valuetype: const_reference

◆ shape()

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::shape ( ) const -> std::tuple<size_type, size_type>
inlineconstexprnoexcept

Dimensions.

Returns a tuple of the Matrices shape.

Returns
constexpr std::tuple<size_type, size_type>

◆ size()

template<typename T , typename Alloc = std::allocator<T>>
constexpr auto cxl::matrix< T, Alloc >::size ( ) const -> size_type
inlineconstexprnoexcept

matrix Size

Returns the overall size of the matrix.

Returns
constexpr size_type

◆ swap()

template<typename T , typename Alloc = std::allocator<T>>
void cxl::matrix< T, Alloc >::swap ( matrix< T, Alloc > &  other)
inlinenoexcept

Swaps two Matrices of the same type.

Swaps the contents of two Matrices with the same underlying value and allocator types. The swap is performed by moving ownership of the matrices resources.

Parameters
othertype: matrix&

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