28template <MdspecLike MutableMdspec, MdspecLike ConstMdspec,
class StoragePolicy>
29 requires(std::same_as<typename MutableMdspec::extents_type, typename ConstMdspec::extents_type> &&
30 std::same_as<std::remove_const_t<typename MutableMdspec::element_type>,
31 std::remove_const_t<typename ConstMdspec::element_type>> &&
32 std::is_const_v<typename ConstMdspec::element_type> &&
requires { StoragePolicy::backend_selector(); })
46 : mutable_mdspec_(
std::move(mutable_mdspec)), const_mdspec_(
std::move(const_mdspec))
52 return storage_policy::backend_selector();
65 return mutable_mdspec_;
76 [[nodiscard]]
static constexpr std::size_t
rank() noexcept {
return extents_type::rank(); }
79 [[nodiscard]]
constexpr auto extents() const noexcept ->
extents_type const& {
return const_mdspec_.extents(); }
84 return const_mdspec_.extent(axis);
91 return const_mdspec_.stride(axis);
95 template <
class... Index>
99 return mutable_mdspec_[indices...];
103 template <
class... Index>
107 return const_mdspec_[indices...];
111 [[no_unique_address]] mutable_mdspec_type mutable_mdspec_;
112 [[no_unique_address]] const_mdspec_type const_mdspec_;
TensorView materialization over writable and read-only mdspec values.
Definition mdspec_tensor_view.hpp:33
typename mutable_mdspec_type::extents_type extents_type
Definition mdspec_tensor_view.hpp:41
static constexpr std::size_t rank() noexcept
Return the static dense-block rank.
Definition mdspec_tensor_view.hpp:76
StoragePolicy storage_policy
Definition mdspec_tensor_view.hpp:37
typename mutable_mdspec_type::element_type element_type
Definition mdspec_tensor_view.hpp:39
static constexpr auto backend_selector() noexcept -> backend_selector_type
Return the dense storage policy's default backend selector.
Definition mdspec_tensor_view.hpp:50
constexpr decltype(auto) operator[](Index... indices) const
Evaluate one element when read-only metadata is immediate.
Definition mdspec_tensor_view.hpp:105
constexpr auto extent(std::size_t axis) const noexcept -> index_type
Return one dense-block extent.
Definition mdspec_tensor_view.hpp:82
constexpr auto mdspan() &-> mutable_mdspec_type
Return the writable mdspan when the metadata is immediate.
Definition mdspec_tensor_view.hpp:62
constexpr decltype(auto) operator[](Index... indices)
Evaluate or assign one element when writable metadata is immediate.
Definition mdspec_tensor_view.hpp:97
constexpr MdspecTensorView(mutable_mdspec_type mutable_mdspec, const_mdspec_type const_mdspec)
Construct a tensor view from writable and read-only metadata.
Definition mdspec_tensor_view.hpp:45
constexpr auto mdspec() const &-> const_mdspec_type
Return read-only immediate or descriptor-backed metadata.
Definition mdspec_tensor_view.hpp:59
constexpr auto mdspec() &-> mutable_mdspec_type
Return writable immediate or descriptor-backed metadata.
Definition mdspec_tensor_view.hpp:56
std::remove_cv_t< element_type > value_type
Definition mdspec_tensor_view.hpp:40
constexpr auto extents() const noexcept -> extents_type const &
Return the dense-block extents.
Definition mdspec_tensor_view.hpp:79
constexpr auto stride(std::size_t axis) const -> index_type
Return one dense-block stride when the mapping is strided.
Definition mdspec_tensor_view.hpp:88
MutableMdspec mutable_mdspec_type
Definition mdspec_tensor_view.hpp:35
constexpr auto mdspan() const &-> const_mdspec_type
Return the read-only mdspan when the metadata is immediate.
Definition mdspec_tensor_view.hpp:69
typename extents_type::index_type index_type
Definition mdspec_tensor_view.hpp:42
ConstMdspec const_mdspec_type
Definition mdspec_tensor_view.hpp:36
std::remove_cvref_t< decltype(storage_policy::backend_selector())> backend_selector_type
Definition mdspec_tensor_view.hpp:38
A readable type implementing the mdspan observers and multidimensional subscript contract.
Definition mdspan/concepts.hpp:291
An mdspec-like type whose mapping exposes multidimensional strides.
Definition mdspan/concepts.hpp:427
Definition async/async.hpp:26
Concepts for tensor-level objects that resolve mdspan kernel operands.