A reference to a sub-space of a tensor. More...
#include <tagged.hpp>
Public Member Functions | |
const range_t & | range () const |
The range corresponding to the sub-space. | |
template<tag ... TL2> requires (sizeof...(TL2) < sizeof...(TL)) && impl::subset_selector< tag_list< TL2...>, tag_list< TL...>> | |
auto | operator[] (const index_class< TL2 ... > &i) const |
Extract a sub-space of this sub-space. | |
template<tag ... TL2> requires (sizeof...(TL2) == sizeof...(TL)) && impl::subset_selector< tag_list< TL2...>, tag_list< TL...>> | |
E & | operator[] (const index_class< TL2 ... > &i) const |
Access an element of this sub-space. | |
E * | data () const |
A pointer to the beginning of the array containing the sub-space data. | |
E * | flat_data () const |
A pointer to the element at the position defined by the lowermost index values of all dimensions of the tensor_view. | |
template<tag T2> | |
std::size_t | dim_size () const |
Return the sub-space size in a dimension specified by a tag. | |
template<std::size_t I2> | |
std::size_t | dim_size () const |
Return the sub-space size in a dimension specified by an index. | |
Static Public Member Functions | |
template<tag T2> requires impl::has_static_multiplier< pick< selector<T2>, TL...>> | |
static constexpr std::size_t | dim_multiplier () |
Return the multiplier associated with the dimension specified by a tag. | |
template<std::size_t I2> requires impl::has_static_multiplier< pick_index< I2, TL...>> | |
static constexpr std::size_t | dim_multiplier () |
Return the multiplier associated with the dimension specified by an index. | |
Static Public Attributes | |
static constexpr std::size_t | dimensions = sizeof...(TL) |
The number of dimensions of this tensor-view. | |
A reference to a sub-space of a tensor.
The tensor_view type shall newer be used directly because the tag list is used to pass layout information from the tensor_class being referenced.
Instead, always use an auto
variable to store tensor_view returned from an operator
[]
E | Element type, possibly const |
...TL | Tag list |
|
inline |
A pointer to the beginning of the array containing the sub-space data.
Available only if the tensor_view is single-dimensional and the dimension corresponds to the right-most tag of the tensor_class being referenced (i.e. when the data elements of the view are stored contiguously)
|
inlinestaticconstexpr |
Return the multiplier associated with the dimension specified by a tag.
The multiplier must be used to multiply the value of a 0-based (non-tagged) index in the specified dimension when accessing the elements using the pointer returned by flat_data
T2 | Selector tag |
|
inlinestaticconstexpr |
Return the multiplier associated with the dimension specified by an index.
The multiplier must be used to multiply the value of a 0-based (non-tagged) index in the specified dimension when accessing the elements using the pointer returned by flat_data
I2 | Dimension index |
|
inline |
Return the sub-space size in a dimension specified by a tag.
T2 | Selector tag |
|
inline |
Return the sub-space size in a dimension specified by an index.
I2 | 0-based dimension index |
|
inline |
A pointer to the element at the position defined by the lowermost index values of all dimensions of the tensor_view.
It is the responsibility of the user to properly analyze the layout of the data using the dimensions, dim_size, and dim_multiplier members
|
inline |
Extract a sub-space of this sub-space.
The new sub-space is defined by fixing one or more indexes defined by the tagged (multi-dimensional) index argument to the operator
...TL2 | Tag list |
i | A (multi-)tagged index |
|
inline |
Access an element of this sub-space.
...TL2 | Tag list |
i | A (multi-)tagged index covering (in any order) all the dimensions of this tensor_view |
|
inline |
The range corresponding to the sub-space.