7#include <batmat/config.hpp>
8#include <guanaqo/mat-view.hpp>
19template <
class IntConst>
20 requires requires {
typename IntConst::value_type; }
22 using type =
typename IntConst::value_type;
48template <
class I = index_t,
class S = std::
integral_constant<I, 1>,
class D = I,
49 class L = DefaultStr
ide, StorageOrder O = StorageOrder::ColMajor>
60 static constexpr std::integral_constant<index_type, 1>
inner_stride{};
64 }, std::integral_constant<index_t, S::value>, index_t>;
103 const auto d =
static_cast<I
>(
depth);
104 return (d + bs - 1) / bs;
108 [[nodiscard, gnu::always_inline]]
constexpr auto row_stride()
const {
110 return std::integral_constant<index_type, 1>{};
116 [[nodiscard, gnu::always_inline]]
constexpr auto col_stride()
const {
120 return std::integral_constant<index_type, 1>{};
125 return n + (bs - n % bs) % bs;
141 if constexpr (std::is_same_v<layer_stride_type, DefaultStride>)
158 return s * (l - offset) + offset;
165 if constexpr (
requires { standard_stride_type::value; })
constexpr auto cols(const Matrix< T, I, S, D, O, A > &v)
typename integral_value_type< T >::type integral_value_type_t
constexpr auto data(Matrix< T, I, S, D, O, A > &v)
constexpr auto outer_stride(const Matrix< T, I, S, D, O, A > &v)
constexpr auto rows(const Matrix< T, I, S, D, O, A > &v)
typename IntConst::value_type type
constexpr auto depth(const Matrix< T, I, S, D, O, A > &v)
constexpr index_type num_batches() const
batch_size_type batch_size
constexpr Layout(PlainLayout p={})
constexpr index_type ceil_depth(index_type n) const
Round up the given size n to a multiple of batch_size.
T & operator()(T *data, index_type l, index_type r, index_type c) const
constexpr auto get_layer_stride() const
static standard_stride_type convert_to_standard_stride(auto s)
constexpr auto col_stride() const
The column stride of the matrices, i.e.
constexpr index_type floor_depth() const
Round down the depth to a multiple of batch_size.
layer_stride_type layer_stride
static constexpr bool is_column_major
constexpr index_type inner_size() const
static constexpr bool is_row_major
constexpr auto row_stride() const
The row stride of the matrices, i.e.
static constexpr std::integral_constant< index_type, 1 > inner_stride
index_type size() const
Total number of elements in the view (excluding padding).
constexpr bool has_full_outer_stride() const
batch_size_type batch_size
constexpr index_type floor_depth(index_type n) const
Round down the given size n to a multiple of batch_size.
constexpr bool has_full_layer_stride() const
constexpr index_type layer_index(index_type l, index_type s) const
guanaqo::MatrixView< T, I, standard_stride_type, storage_order > operator()(T *data, index_type l) const
constexpr index_type layer_index(index_type l) const
constexpr index_type ceil_depth() const
Round up the depth to a multiple of batch_size.
static constexpr StorageOrder storage_order
std::conditional_t< requires { S::value; }, std::integral_constant< index_t, S::value >, index_t > standard_stride_type
index_type padded_size() const
constexpr bool has_full_inner_stride() const
layer_stride_type layer_stride
constexpr index_type outer_size() const