Uni20
Asynchronous tensor and runtime library.
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
uni20::ReshapedTensor< Mdspan, StoragePolicy, BackendSelector > Class Template Reference

Tensor-level descriptor owning a reshaped mdspan and backend selector. More...

#include <reshape.hpp>

Inheritance diagram for uni20::ReshapedTensor< Mdspan, StoragePolicy, BackendSelector >:
[legend]
Collaboration diagram for uni20::ReshapedTensor< Mdspan, StoragePolicy, BackendSelector >:
[legend]

Public Types

using async_alias_tag = void
 
using backend_selector_type = BackendSelector
 
using const_accessor_type = const_accessor_t< typename mdspan_type::accessor_type >
 
using const_element_type = std::add_const_t< std::remove_const_t< element_type > >
 
using const_mdspan_type = stdex::mdspan< const_element_type, extents_type, layout_type, const_accessor_type >
 
using element_type = typename mdspan_type::element_type
 
using extents_type = typename mdspan_type::extents_type
 
using index_type = typename mdspan_type::index_type
 
using layout_type = typename mdspan_type::layout_type
 
using mapping_type = typename mdspan_type::mapping_type
 
using mdspan_type = Mdspan
 
using storage_policy = StoragePolicy
 
using value_type = typename mdspan_type::value_type
 

Public Member Functions

constexpr auto backend_selector () const -> backend_selector_type
 Return the source storage's backend selector.
 
constexpr auto extent (std::size_t axis) const noexcept -> index_type
 Return one reshaped extent.
 
constexpr auto extents () const noexcept -> extents_type const &
 Return the reshaped extents.
 
constexpr auto mdspan () &-> mdspan_type
 Resolve the stored reshaped mdspan descriptor for mutable access.
 
constexpr auto mdspan () const &-> const_mdspan_type
 Resolve the stored reshaped mdspan descriptor for read-only access.
 
template<class... Index>
requires (sizeof...(Index) == extents_type::rank())
constexpr decltype(auto) operator[] (Index... indices)
 Evaluate or assign one reshaped element according to accessor mutability.
 
template<class... Index>
requires detail::MdspanIndexPack<mdspan_type, Index...>
constexpr decltype(auto) operator[] (Index... indices) const
 Evaluate one reshaped element through the read-only accessor.
 
constexpr ReshapedTensor (mdspan_type span, backend_selector_type selector)
 Construct from a reshaped mdspan and source backend selector.
 

Detailed Description

template<MdspanLike Mdspan, class StoragePolicy, class BackendSelector>
class uni20::ReshapedTensor< Mdspan, StoragePolicy, BackendSelector >

Tensor-level descriptor owning a reshaped mdspan and backend selector.

The descriptor aliases the same element storage as its source. Mutability follows the preserved source accessor.

Member Typedef Documentation

◆ async_alias_tag

template<MdspanLike Mdspan, class StoragePolicy , class BackendSelector >
using uni20::ReshapedTensor< Mdspan, StoragePolicy, BackendSelector >::async_alias_tag = void

◆ backend_selector_type

template<MdspanLike Mdspan, class StoragePolicy , class BackendSelector >
using uni20::ReshapedTensor< Mdspan, StoragePolicy, BackendSelector >::backend_selector_type = BackendSelector

◆ const_accessor_type

template<MdspanLike Mdspan, class StoragePolicy , class BackendSelector >
using uni20::ReshapedTensor< Mdspan, StoragePolicy, BackendSelector >::const_accessor_type = const_accessor_t<typename mdspan_type::accessor_type>

◆ const_element_type

template<MdspanLike Mdspan, class StoragePolicy , class BackendSelector >
using uni20::ReshapedTensor< Mdspan, StoragePolicy, BackendSelector >::const_element_type = std::add_const_t<std::remove_const_t<element_type> >

◆ const_mdspan_type

template<MdspanLike Mdspan, class StoragePolicy , class BackendSelector >
using uni20::ReshapedTensor< Mdspan, StoragePolicy, BackendSelector >::const_mdspan_type = stdex::mdspan<const_element_type, extents_type, layout_type, const_accessor_type>

◆ element_type

template<MdspanLike Mdspan, class StoragePolicy , class BackendSelector >
using uni20::ReshapedTensor< Mdspan, StoragePolicy, BackendSelector >::element_type = typename mdspan_type::element_type

◆ extents_type

template<MdspanLike Mdspan, class StoragePolicy , class BackendSelector >
using uni20::ReshapedTensor< Mdspan, StoragePolicy, BackendSelector >::extents_type = typename mdspan_type::extents_type

◆ index_type

template<MdspanLike Mdspan, class StoragePolicy , class BackendSelector >
using uni20::ReshapedTensor< Mdspan, StoragePolicy, BackendSelector >::index_type = typename mdspan_type::index_type

◆ layout_type

template<MdspanLike Mdspan, class StoragePolicy , class BackendSelector >
using uni20::ReshapedTensor< Mdspan, StoragePolicy, BackendSelector >::layout_type = typename mdspan_type::layout_type

◆ mapping_type

template<MdspanLike Mdspan, class StoragePolicy , class BackendSelector >
using uni20::ReshapedTensor< Mdspan, StoragePolicy, BackendSelector >::mapping_type = typename mdspan_type::mapping_type

◆ mdspan_type

template<MdspanLike Mdspan, class StoragePolicy , class BackendSelector >
using uni20::ReshapedTensor< Mdspan, StoragePolicy, BackendSelector >::mdspan_type = Mdspan

◆ storage_policy

template<MdspanLike Mdspan, class StoragePolicy , class BackendSelector >
using uni20::ReshapedTensor< Mdspan, StoragePolicy, BackendSelector >::storage_policy = StoragePolicy

◆ value_type

template<MdspanLike Mdspan, class StoragePolicy , class BackendSelector >
using uni20::ReshapedTensor< Mdspan, StoragePolicy, BackendSelector >::value_type = typename mdspan_type::value_type

Constructor & Destructor Documentation

◆ ReshapedTensor()

template<MdspanLike Mdspan, class StoragePolicy , class BackendSelector >
constexpr uni20::ReshapedTensor< Mdspan, StoragePolicy, BackendSelector >::ReshapedTensor ( mdspan_type  span,
backend_selector_type  selector 
)
inlineconstexpr

Construct from a reshaped mdspan and source backend selector.

Member Function Documentation

◆ backend_selector()

template<MdspanLike Mdspan, class StoragePolicy , class BackendSelector >
constexpr auto uni20::ReshapedTensor< Mdspan, StoragePolicy, BackendSelector >::backend_selector ( ) const -> backend_selector_type
inlineconstexpr

Return the source storage's backend selector.

◆ extent()

template<MdspanLike Mdspan, class StoragePolicy , class BackendSelector >
constexpr auto uni20::ReshapedTensor< Mdspan, StoragePolicy, BackendSelector >::extent ( std::size_t  axis) const -> index_type
inlineconstexprnoexcept

Return one reshaped extent.

◆ extents()

template<MdspanLike Mdspan, class StoragePolicy , class BackendSelector >
constexpr auto uni20::ReshapedTensor< Mdspan, StoragePolicy, BackendSelector >::extents ( ) const -> extents_type const&
inlineconstexprnoexcept

Return the reshaped extents.

◆ mdspan() [1/2]

template<MdspanLike Mdspan, class StoragePolicy , class BackendSelector >
constexpr auto uni20::ReshapedTensor< Mdspan, StoragePolicy, BackendSelector >::mdspan ( ) & -> mdspan_type
inlineconstexpr

Resolve the stored reshaped mdspan descriptor for mutable access.

◆ mdspan() [2/2]

template<MdspanLike Mdspan, class StoragePolicy , class BackendSelector >
constexpr auto uni20::ReshapedTensor< Mdspan, StoragePolicy, BackendSelector >::mdspan ( ) const & -> const_mdspan_type
inlineconstexpr

Resolve the stored reshaped mdspan descriptor for read-only access.

◆ operator[]() [1/2]

template<MdspanLike Mdspan, class StoragePolicy , class BackendSelector >
template<class... Index>
requires (sizeof...(Index) == extents_type::rank())
constexpr decltype(auto) uni20::ReshapedTensor< Mdspan, StoragePolicy, BackendSelector >::operator[] ( Index...  indices)
inlineconstexpr

Evaluate or assign one reshaped element according to accessor mutability.

◆ operator[]() [2/2]

template<MdspanLike Mdspan, class StoragePolicy , class BackendSelector >
template<class... Index>
requires detail::MdspanIndexPack<mdspan_type, Index...>
constexpr decltype(auto) uni20::ReshapedTensor< Mdspan, StoragePolicy, BackendSelector >::operator[] ( Index...  indices) const
inlineconstexpr

Evaluate one reshaped element through the read-only accessor.


The documentation for this class was generated from the following file: