MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
Loading...
Searching...
No Matches
mtl::array::detail_shape Namespace Reference

Functions

template<std::size_t N>
constexpr bool same_layout (const shape< N > &sh, const std::array< std::size_t, N > &strides, const std::array< std::size_t, N > &dense)
 Whether strides lay the elements out as dense does.

Function Documentation

◆ same_layout()

template<std::size_t N>
bool mtl::array::detail_shape::same_layout ( const shape< N > & sh,
const std::array< std::size_t, N > & strides,
const std::array< std::size_t, N > & dense )
constexpr

Whether strides lay the elements out as dense does.

The stride of a dimension of extent 1 is never used, so it may be anything (a slice keeps its parent's), and an array with no elements is contiguous, as in NumPy (#856: a size-1 dimension with another stride made a dense array take the strided paths).