|
Uni20
Asynchronous tensor and runtime library.
|
Mdspan accessor over a compressed rank-N generalized diagonal. More...
#include <diagonal_accessor.hpp>
Classes | |
| struct | component_index_result |
| Decoded component coordinate for one logical mapping offset. More... | |
Public Types | |
| using | data_handle_type = diagonal_data_handle< element_type > |
| using | element_type = ElementType |
| using | extents_type = Extents |
| using | index_type = typename extents_type::index_type |
| using | offset_policy = diagonal_accessor |
| using | offset_type = std::size_t |
| using | reference = std::conditional_t< std::is_const_v< element_type >, value_type, diagonal_reference< value_type > > |
| using | value_type = std::remove_cv_t< ElementType > |
Public Member Functions | |
| UNI20_HOST_DEVICE constexpr reference | access (data_handle_type handle, offset_type offset) const |
| Read or write the logical element represented by an encoded offset. | |
| UNI20_HOST_DEVICE constexpr auto | component_index (data_handle_type handle, offset_type offset=0) const noexcept -> component_index_result |
| Decode whether a logical offset addresses a stored component and which one. | |
| UNI20_HOST_DEVICE constexpr auto | component_stride () const noexcept -> index_type |
| Return the physical offset between consecutive diagonal components. | |
| UNI20_HOST_DEVICE constexpr | diagonal_accessor ()=default |
| UNI20_HOST_DEVICE constexpr | diagonal_accessor (extents_type extents, index_type component_stride=1) |
| Construct an accessor for one logical index space and component stride. | |
| UNI20_HOST_DEVICE constexpr auto | extents () const noexcept -> extents_type const & |
| Return the extents used to decode logical offsets. | |
| UNI20_HOST_DEVICE constexpr data_handle_type | offset (data_handle_type handle, offset_type offset) const noexcept |
| Advance a logical handle without changing its original index space. | |
Mdspan accessor over a compressed rank-N generalized diagonal.
The associated mapping encodes logical tensor indices as offsets. This accessor decodes those offsets and addresses the compressed value only when every logical index is equal. Rectangular tensors store min(extents...) values.
| ElementType | Presented element type, possibly const-qualified. |
| Extents | Logical tensor extents used to decode mapping offsets. |
| using uni20::diagonal_accessor< ElementType, Extents >::data_handle_type = diagonal_data_handle<element_type> |
| using uni20::diagonal_accessor< ElementType, Extents >::element_type = ElementType |
| using uni20::diagonal_accessor< ElementType, Extents >::extents_type = Extents |
| using uni20::diagonal_accessor< ElementType, Extents >::index_type = typename extents_type::index_type |
| using uni20::diagonal_accessor< ElementType, Extents >::offset_policy = diagonal_accessor |
| using uni20::diagonal_accessor< ElementType, Extents >::offset_type = std::size_t |
| using uni20::diagonal_accessor< ElementType, Extents >::reference = std::conditional_t<std::is_const_v<element_type>, value_type, diagonal_reference<value_type> > |
| using uni20::diagonal_accessor< ElementType, Extents >::value_type = std::remove_cv_t<ElementType> |
|
constexprdefault |
|
inlineexplicitconstexpr |
Construct an accessor for one logical index space and component stride.
| extents | Full logical tensor extents. |
| component_stride | Offset between consecutive stored diagonal components. |
|
inlineconstexpr |
Read or write the logical element represented by an encoded offset.
|
inlineconstexprnoexcept |
Decode whether a logical offset addresses a stored component and which one.
|
inlineconstexprnoexcept |
Return the physical offset between consecutive diagonal components.
|
inlineconstexprnoexcept |
Return the extents used to decode logical offsets.
|
inlineconstexprnoexcept |
Advance a logical handle without changing its original index space.