|
Stratax
Scientific computing containers and operations
|
#include <Matrix.hpp>
Public Types | |
| using | value_type = T |
| template<typename U> | |
| using | rebind = Matrix<U> |
Public Member Functions | |
| Matrix () | |
| Creates a default rank-2 empty matrix. | |
| Matrix (std::size_t rows, std::size_t cols) | |
| Creates a rank-2 matrix with the given number of rows and columns. | |
| Matrix (const core::Shape &shape) | |
| Creates a matrix from a validated rank-2 shape. | |
| Matrix (std::size_t rows, std::size_t cols, const T &value) | |
| Creates a matrix and fills it with a value. | |
| Matrix (std::initializer_list< std::initializer_list< T > > list) | |
| Creates a matrix from a nested initializer list. | |
| Matrix (const Matrix &)=default | |
| Creates a copy of another matrix. | |
| Matrix (Matrix &&) noexcept=default | |
| Transfers ownership from another matrix. | |
| Matrix & | operator= (const Matrix &)=default |
| Replaces this matrix with a copy of another matrix. | |
| Matrix & | operator= (Matrix &&) noexcept=default |
| Replaces this matrix by taking ownership from another matrix. | |
| ~Matrix ()=default | |
| Destroys the matrix. | |
| std::size_t | size () const noexcept |
| Returns the total number of elements in the matrix. | |
| bool | empty () const noexcept |
| Returns whether the matrix contains no elements. | |
| std::size_t | rows () const noexcept |
| Returns the number of rows. | |
| std::size_t | cols () const noexcept |
| Returns the number of columns. | |
| const stratax::core::Shape & | shape () const noexcept |
| Returns the matrix shape. | |
| const stratax::core::Strides & | strides () const noexcept |
| Returns the matrix strides. | |
| std::size_t | rank () const noexcept |
| Returns the matrix rank. | |
| T & | operator() (std::size_t row, std::size_t col) |
| Returns an element by row and column with bounds checking. | |
| const T & | operator() (std::size_t row, std::size_t col) const |
| Returns an element by row and column with bounds checking. | |
| T & | operator[] (std::size_t index) noexcept |
| Returns a flat element without bounds checking. | |
| const T & | operator[] (std::size_t index) const noexcept |
| Returns a flat element without bounds checking. | |
| T & | at (std::size_t row, std::size_t col) |
| Returns an element by row and column. | |
| const T & | at (std::size_t row, std::size_t col) const |
| Returns an element by row and column. | |
| T & | front () |
| Returns the first element. | |
| const T & | front () const |
| Returns the first element as a const reference. | |
| T & | back () |
| Returns the last element. | |
| const T & | back () const |
| Returns the last element as a const reference. | |
| T * | data () noexcept |
| Returns the raw data pointer. | |
| const T * | data () const noexcept |
| Returns the raw data pointer as a const pointer. | |
| T * | begin () noexcept |
| Returns an iterator to the first element. | |
| const T * | begin () const noexcept |
| Returns a const iterator to the first element. | |
| const T * | cbegin () const noexcept |
| Returns a const iterator to the first element. | |
| T * | end () noexcept |
| Returns an iterator one past the last element. | |
| const T * | end () const noexcept |
| Returns a const iterator one past the last element. | |
| const T * | cend () const noexcept |
| Returns a const iterator one past the last element. | |
| std::reverse_iterator< T * > | rbegin () noexcept |
| Returns a reverse iterator to the last element. | |
| std::reverse_iterator< const T * > | rbegin () const noexcept |
| Returns a const reverse iterator to the last element. | |
| std::reverse_iterator< const T * > | crbegin () const noexcept |
| Returns a const reverse iterator to the last element. | |
| std::reverse_iterator< T * > | rend () noexcept |
| Returns a reverse iterator before the first element. | |
| std::reverse_iterator< const T * > | rend () const noexcept |
| Returns a const reverse iterator before the first element. | |
| std::reverse_iterator< const T * > | crend () const noexcept |
| Returns a const reverse iterator before the first element. | |
| void | fill (const T &value) |
| Fills every element with the same value. | |
| void | swap (Matrix &other) noexcept |
| Swaps the contents of two matrices. | |
Definition at line 28 of file Matrix.hpp.
Definition at line 39 of file Matrix.hpp.
| using stratax::container::Matrix< T >::value_type = T |
Definition at line 36 of file Matrix.hpp.
|
inline |
Creates a default rank-2 empty matrix.
The default matrix has shape (0, 0) and owns no element storage.
Definition at line 46 of file Matrix.hpp.
|
inline |
Creates a rank-2 matrix with the given number of rows and columns.
| rows | Number of rows. |
| cols | Number of columns. |
Definition at line 54 of file Matrix.hpp.
|
inlineexplicit |
Creates a matrix from a validated rank-2 shape.
| shape | Source shape. |
| Exceptions::DimensionError | If the shape is not rank 2. |
Definition at line 68 of file Matrix.hpp.
|
inline |
Creates a matrix and fills it with a value.
| rows | Number of rows. |
| cols | Number of columns. |
| value | Value to copy into each element. |
Definition at line 85 of file Matrix.hpp.
|
inline |
Creates a matrix from a nested initializer list.
Rows are interpreted in row-major order and must all have the same length.
| list | Row-major source values. |
| Exceptions::StrataxError | If the rows are not rectangular. |
Definition at line 101 of file Matrix.hpp.
|
default |
Creates a copy of another matrix.
|
defaultnoexcept |
Transfers ownership from another matrix.
|
default |
Destroys the matrix.
|
inline |
Returns an element by row and column.
| row | Row index. |
| col | Column index. |
| Exceptions::IndexError | If either index is out of bounds. |
Definition at line 293 of file Matrix.hpp.
|
inline |
Returns an element by row and column.
| row | Row index. |
| col | Column index. |
| Exceptions::IndexError | If either index is out of bounds. |
Definition at line 307 of file Matrix.hpp.
|
inline |
Returns the last element.
| Exceptions::IndexError | If the matrix is empty. |
Definition at line 350 of file Matrix.hpp.
|
inline |
Returns the last element as a const reference.
| Exceptions::IndexError | If the matrix is empty. |
Definition at line 366 of file Matrix.hpp.
|
inlinenodiscardnoexcept |
Returns a const iterator to the first element.
Definition at line 411 of file Matrix.hpp.
|
inlinenodiscardnoexcept |
Returns an iterator to the first element.
Definition at line 401 of file Matrix.hpp.
|
inlinenodiscardnoexcept |
Returns a const iterator to the first element.
Definition at line 421 of file Matrix.hpp.
|
inlinenodiscardnoexcept |
Returns a const iterator one past the last element.
Definition at line 451 of file Matrix.hpp.
|
inlinenodiscardnoexcept |
Returns the number of columns.
Definition at line 191 of file Matrix.hpp.
Referenced by stratax::container::Matrix< U >::operator()(), stratax::container::Matrix< U >::operator()(), stratax::container::operator<<(), and slice().
|
inlinenodiscardnoexcept |
Returns a const reverse iterator to the last element.
Definition at line 481 of file Matrix.hpp.
|
inlinenodiscardnoexcept |
Returns a const reverse iterator before the first element.
Definition at line 511 of file Matrix.hpp.
|
inlinenodiscardnoexcept |
Returns the raw data pointer as a const pointer.
Definition at line 391 of file Matrix.hpp.
|
inlinenodiscardnoexcept |
Returns the raw data pointer.
Definition at line 381 of file Matrix.hpp.
|
inlinenodiscardnoexcept |
Returns whether the matrix contains no elements.
Definition at line 171 of file Matrix.hpp.
Referenced by stratax::container::Matrix< U >::back(), stratax::container::Matrix< U >::back(), stratax::container::Matrix< U >::front(), and stratax::container::Matrix< U >::front().
|
inlinenodiscardnoexcept |
Returns a const iterator one past the last element.
Definition at line 441 of file Matrix.hpp.
|
inlinenodiscardnoexcept |
Returns an iterator one past the last element.
Definition at line 431 of file Matrix.hpp.
|
inline |
Fills every element with the same value.
| value | Value to assign to each element. |
Definition at line 521 of file Matrix.hpp.
|
inline |
Returns the first element.
| Exceptions::IndexError | If the matrix is empty. |
Definition at line 318 of file Matrix.hpp.
|
inline |
Returns the first element as a const reference.
| Exceptions::IndexError | If the matrix is empty. |
Definition at line 334 of file Matrix.hpp.
|
inline |
Returns an element by row and column with bounds checking.
| row | Row index. |
| col | Column index. |
| Exceptions::IndexError | If either index is out of bounds. |
Definition at line 235 of file Matrix.hpp.
|
inline |
Returns an element by row and column with bounds checking.
| row | Row index. |
| col | Column index. |
| Exceptions::IndexError | If either index is out of bounds. |
Definition at line 251 of file Matrix.hpp.
|
default |
Replaces this matrix with a copy of another matrix.
|
defaultnoexcept |
Replaces this matrix by taking ownership from another matrix.
|
inlinenoexcept |
Returns a flat element without bounds checking.
| index | Flat element index. |
Definition at line 279 of file Matrix.hpp.
|
inlinenoexcept |
Returns a flat element without bounds checking.
| index | Flat element index. |
Definition at line 266 of file Matrix.hpp.
|
inlinenodiscardnoexcept |
Returns the matrix rank.
Definition at line 221 of file Matrix.hpp.
|
inlinenodiscardnoexcept |
Returns a const reverse iterator to the last element.
Definition at line 471 of file Matrix.hpp.
|
inlinenodiscardnoexcept |
Returns a reverse iterator to the last element.
Definition at line 461 of file Matrix.hpp.
|
inlinenodiscardnoexcept |
Returns a const reverse iterator before the first element.
Definition at line 501 of file Matrix.hpp.
|
inlinenodiscardnoexcept |
Returns a reverse iterator before the first element.
Definition at line 491 of file Matrix.hpp.
|
inlinenodiscardnoexcept |
Returns the number of rows.
Definition at line 181 of file Matrix.hpp.
Referenced by stratax::container::Matrix< U >::operator()(), stratax::container::Matrix< U >::operator()(), stratax::container::operator<<(), and slice().
|
inlinenoexcept |
Returns the matrix shape.
Definition at line 201 of file Matrix.hpp.
Referenced by astype().
|
inlinenodiscardnoexcept |
Returns the total number of elements in the matrix.
Definition at line 161 of file Matrix.hpp.
Referenced by astype().
|
inlinenoexcept |
Returns the matrix strides.
Definition at line 211 of file Matrix.hpp.
|
inlinenoexcept |
Swaps the contents of two matrices.
| other | Matrix to exchange state with. |
Definition at line 531 of file Matrix.hpp.
Referenced by stratax::container::Matrix< U >::swap().