![]() |
batmat
develop
Batched linear algebra routines
|
#include <batmat/matrix/layout.hpp>
Shape and strides describing a batch of matrices, independent of any storage.
| I | Index and size type. Usually std::ptrdiff_t or int. |
| S | Inner stride type (batch size). Usually std::integral_constant<I, N> for some N. |
| D | Batch depth type. Usually equal to S for a single batch, or I for a dynamic depth. |
| L | Layer stride type. Usually DefaultStride (which implies that the layer stride is equal to outer_stride * outer_size()), or I for a dynamic layer stride. Dynamic strides are used for subviews of views with a larger outer_size(). |
| O | Matrix storage order, RowMajor or ColMajor. |
Definition at line 50 of file layout.hpp.
Compile-time properties | |
| using | index_type = I |
| using | batch_size_type = S |
| using | depth_type = D |
| using | layer_stride_type = L |
| using | standard_stride_type |
| static constexpr StorageOrder | storage_order = O |
| static constexpr bool | is_column_major = O == StorageOrder::ColMajor |
| static constexpr bool | is_row_major = O == StorageOrder::RowMajor |
| static constexpr std::integral_constant< index_type, 1 > | inner_stride {} |
Layout description | |
| depth_type | depth |
| index_type | rows |
| index_type | cols |
| index_type | outer_stride |
| batch_size_type | batch_size |
| layer_stride_type | layer_stride |
Initialization | |
| constexpr | Layout (PlainLayout p={}) |
Classes | |
| struct | PlainLayout |
Public Member Functions | |
| constexpr index_type | outer_size () const |
| constexpr index_type | inner_size () const |
| constexpr index_type | num_batches () const |
| constexpr auto | row_stride () const |
| The row stride of the matrices, i.e. | |
| constexpr auto | col_stride () const |
| The column stride of the matrices, i.e. | |
| constexpr index_type | ceil_depth (index_type n) const |
Round up the given size n to a multiple of batch_size. | |
| constexpr index_type | ceil_depth () const |
| Round up the depth to a multiple of batch_size. | |
| constexpr index_type | floor_depth (index_type n) const |
Round down the given size n to a multiple of batch_size. | |
| constexpr index_type | floor_depth () const |
| Round down the depth to a multiple of batch_size. | |
| constexpr auto | get_layer_stride () const |
| constexpr bool | has_full_layer_stride () const |
| constexpr bool | has_full_outer_stride () const |
| constexpr bool | has_full_inner_stride () const |
| constexpr index_type | layer_index (index_type l, index_type s) const |
| constexpr index_type | layer_index (index_type l) const |
| template<class T> | |
| guanaqo::MatrixView< T, I, standard_stride_type, storage_order > | operator() (T *data, index_type l) const |
| template<class T> | |
| T & | operator() (T *data, index_type l, index_type r, index_type c) const |
| index_type | size () const |
| Total number of elements in the view (excluding padding). | |
| index_type | padded_size () const |
Static Public Member Functions | |
| static standard_stride_type | convert_to_standard_stride (auto s) |
| struct batmat::matrix::Layout::PlainLayout |
| Class Members | ||
|---|---|---|
| depth_type | depth = guanaqo::default_stride<depth_type>::value | |
| index_type | rows = 0 | |
| index_type | cols = rows == 0 ? 0 : 1 | |
| index_type | outer_stride = is_row_major ? cols : rows | |
| batch_size_type | batch_size | |
| layer_stride_type | layer_stride | |
| using batmat::matrix::Layout< I, S, D, L, O >::index_type = I |
Definition at line 53 of file layout.hpp.
| using batmat::matrix::Layout< I, S, D, L, O >::batch_size_type = S |
Definition at line 54 of file layout.hpp.
| using batmat::matrix::Layout< I, S, D, L, O >::depth_type = D |
Definition at line 55 of file layout.hpp.
| using batmat::matrix::Layout< I, S, D, L, O >::layer_stride_type = L |
Definition at line 56 of file layout.hpp.
| using batmat::matrix::Layout< I, S, D, L, O >::standard_stride_type |
Definition at line 62 of file layout.hpp.
|
inlineconstexpr |
Definition at line 93 of file layout.hpp.
|
inlinenodiscardconstexpr |
Definition at line 99 of file layout.hpp.
|
inlinenodiscardconstexpr |
Definition at line 100 of file layout.hpp.
|
inlinenodiscardconstexpr |
Definition at line 101 of file layout.hpp.
|
inlinenodiscardconstexpr |
The row stride of the matrices, i.e.
the distance between elements in consecutive rows in a given column. Should be multiplied by the batch size to get the actual number of elements.
Definition at line 108 of file layout.hpp.
|
inlinenodiscardconstexpr |
The column stride of the matrices, i.e.
the distance between elements in consecutive columns in a given row. Should be multiplied by the batch size to get the actual number of elements.
Definition at line 116 of file layout.hpp.
|
inlinenodiscardconstexpr |
Round up the given size n to a multiple of batch_size.
Definition at line 123 of file layout.hpp.
|
inlinenodiscardconstexpr |
Round up the depth to a multiple of batch_size.
Definition at line 128 of file layout.hpp.
|
inlinenodiscardconstexpr |
Round down the given size n to a multiple of batch_size.
Definition at line 132 of file layout.hpp.
|
inlinenodiscardconstexpr |
Round down the depth to a multiple of batch_size.
Definition at line 137 of file layout.hpp.
|
inlinenodiscardconstexpr |
Definition at line 140 of file layout.hpp.
|
inlinenodiscardconstexpr |
Definition at line 146 of file layout.hpp.
|
inlinenodiscardconstexpr |
Definition at line 150 of file layout.hpp.
|
inlinenodiscardconstexpr |
Definition at line 153 of file layout.hpp.
|
inlinenodiscardconstexpr |
Definition at line 154 of file layout.hpp.
|
inlinenodiscardconstexpr |
Definition at line 160 of file layout.hpp.
|
inlinestatic |
Definition at line 164 of file layout.hpp.
|
inlinenodiscard |
Definition at line 173 of file layout.hpp.
|
inlinenodiscard |
Definition at line 181 of file layout.hpp.
|
inlinenodiscard |
Total number of elements in the view (excluding padding).
Definition at line 187 of file layout.hpp.
|
inlinenodiscard |
Definition at line 188 of file layout.hpp.
|
staticconstexpr |
Definition at line 57 of file layout.hpp.
|
staticconstexpr |
Definition at line 58 of file layout.hpp.
|
staticconstexpr |
Definition at line 59 of file layout.hpp.
|
staticconstexpr |
Definition at line 60 of file layout.hpp.
| depth_type batmat::matrix::Layout< I, S, D, L, O >::depth |
Definition at line 70 of file layout.hpp.
| index_type batmat::matrix::Layout< I, S, D, L, O >::rows |
Definition at line 71 of file layout.hpp.
| index_type batmat::matrix::Layout< I, S, D, L, O >::cols |
Definition at line 72 of file layout.hpp.
| index_type batmat::matrix::Layout< I, S, D, L, O >::outer_stride |
Definition at line 73 of file layout.hpp.
| batch_size_type batmat::matrix::Layout< I, S, D, L, O >::batch_size |
Definition at line 74 of file layout.hpp.
| layer_stride_type batmat::matrix::Layout< I, S, D, L, O >::layer_stride |
Definition at line 75 of file layout.hpp.