Accessor wrapper to automatically apply a constant scaling factor to all accessed elements.
More...
|
| constexpr | scaled_accessor ()=default |
| | Default constructor.
|
| |
| template<class OtherNestedAccessor, constraints< std::enable_if_t< std::is_convertible< OtherNestedAccessor, NestedAccessor >::value > > = nullptr> |
| constexpr | scaled_accessor (scaled_accessor< ScalingFactor, OtherNestedAccessor > other) noexcept(std::is_nothrow_constructible< NestedAccessor, OtherNestedAccessor const & >::value &&std::is_nothrow_copy_constructible< ScalingFactor >::value) |
| | Converting constructor; implicit SFINAE overload for when the nested accessors are implicitly convertible.
|
| |
| template<class OtherNestedAccessor, constraints< std::enable_if_t< std::is_constructible< NestedAccessor, OtherNestedAccessor >::value >, std::enable_if_t<!std::is_convertible< OtherNestedAccessor, NestedAccessor >::value > > = nullptr> |
| constexpr | scaled_accessor (scaled_accessor< ScalingFactor, OtherNestedAccessor > other) noexcept(std::is_nothrow_constructible< NestedAccessor, OtherNestedAccessor const & >::value &&std::is_nothrow_copy_constructible< ScalingFactor >::value) |
| | Converting constructor; explicit SFINAE overload for when the nested accessors are explicitly constructible.
|
| |
| constexpr | scaled_accessor (ScalingFactor const &scale, NestedAccessor const &inner_accessor) noexcept(std::is_nothrow_copy_constructible< NestedAccessor >::value &&std::is_nothrow_copy_constructible< ScalingFactor >::value) |
| | Construct a scaled_accessor from a scaling factor and an instance of the nested accessor.
|
| |
| constexpr auto | access (data_handle_type handle, std::size_t index) const noexcept(noexcept(std::declval< ScalingFactor const & >() *typename NestedAccessor::element_type(std::declval< >()))) -> reference |
| | Obtain the element at the specified index, multiplied by the scaling factor.
|
| |
| | ARENE_IGNORE_CLANG ("-Wimplicit-int-float-conversion", "The noexcept specification is unevaluated so it can't lose information") |
| |
| | ARENE_IGNORE_CLANG ("-Wsign-conversion", "The noexcept specification is unevaluated so it can't lose information") |
| |
| constexpr auto | nested_accessor () const noexcept -> NestedAccessor const & |
| | Get the specific nested accessor used by this accessor.
|
| |
| constexpr auto | offset (data_handle_type handle, std::size_t index) const noexcept(noexcept(std::declval< NestedAccessor >().offset(handle, index))) -> typename offset_policy::data_handle_type |
| | apply an offset to a pointer
|
| |
| constexpr auto | scaling_factor () const noexcept -> ScalingFactor const & |
| | Get the specific scaling factor used by this accessor.
|
| |
template<class ScalingFactor, class NestedAccessor>
class arene::base::linalg::scaled_accessor< ScalingFactor, NestedAccessor >
Accessor wrapper to automatically apply a constant scaling factor to all accessed elements.
- Template Parameters
-
| ScalingFactor | Type of the scaling factor to use; must be a scalar in the linalg sense |
| NestedAccessor | Type of the underlying data accessor to use; must be an mdspan accessor policy |
Backport of std::linalg::scaled_accessor from C++26. Provides access to an underlying data array such that the elements of the array are automatically scaled by a constant factor before being returned.
- Note
- C++26 only requires
ScalingFactor to be semiregular, but we require it to be a linalg scalar since this class represents a combination of data access with linalg scalar multiplication.