24namespace detail::cpu_reference
26template <
class Mdspan, std::size_t... Axis>
27consteval bool conjugate_element_is_assignable(std::index_sequence<Axis...>)
29 using span_type = std::remove_cvref_t<Mdspan>;
30 using index_type =
typename span_type::index_type;
32 span.operator[](((void)Axis, index)...) =
33 uni20::conj(
static_cast<typename span_type::value_type
>(
span.operator[](((
void)Axis, index)...)));
37template <
class Mdspan, std::size_t... Axis>
38void conjugate_element(Mdspan&
span, std::array<
typename Mdspan::index_type, Mdspan::rank()>
const& index,
39 std::index_sequence<Axis...>)
41 using value_type =
typename Mdspan::value_type;
42 auto&& element =
span.operator[](index[Axis]...);
46template <std::
size_t Axis,
class Mdspan>
47void conjugate_elements(Mdspan&
span, std::array<
typename Mdspan::index_type, Mdspan::rank()>& index)
49 if constexpr (Axis == Mdspan::rank())
51 conjugate_element(
span, index, std::make_index_sequence<Mdspan::rank()>{});
55 using index_type =
typename Mdspan::index_type;
56 for (
index_type i = 0; i < static_cast<index_type>(
span.extent(Axis)); ++i)
59 conjugate_elements<Axis + 1>(
span, index);
65template <uni20::MutableMdspanLike Mdspan>
consteval auto conjugate_acceptance()
67 using span_type = std::remove_cvref_t<Mdspan>;
69 conjugate_element_is_assignable<span_type>(std::make_index_sequence<span_type::rank()>{}))
82 using span_type = std::remove_cvref_t<Mdspan>;
85 using value_type =
typename span_type::value_type;
86 cpu::detail::transform_strided<true>(
span,
91 std::array<
typename span_type::index_type, span_type::rank()> index{};
92 conjugate_elements<0>(
span, index);
99template <uni20::MutableMdspecLike Mdspan>
104 constexpr auto acceptance = detail::cpu_reference::conjugate_acceptance<span_type>();
112template <uni20::MutableMdspecLike Mdspan>
117 auto span = access.mdspan();
118 return detail::cpu_reference::conjugate(
span);
RAII leases that resolve device descriptors and tensor views to mdspans.
Mutable mdspec metadata supporting host write acquisition.
Definition access.hpp:694
Mutable mdspan-like types whose layout reports they are always strided.
Definition mdspan/concepts.hpp:421
Concept for numeric scalar types (integer, real, or complex).
Definition scalar_concepts.hpp:81
locale_t value
Definition data_table.cpp:49
Operation-tag backend dispatch over tensor-view operands.
uni20::complex< T > conj(detail::standard_complex< T > x)
Returns the complex conjugate for complex-valued scalars.
Definition math.hpp:70
Scalar math helper utilities.
Mdspan concept and accessor extensions for Uni20.
Definition linalg/async.hpp:28
KernelAttempt try_kernel(BlasBackend, gemm_op const &, C &c, S const &alpha, A &a, B &b, S const &beta)
Pack logical host values and execute GEMM through value-preserving provider conversion.
Definition linalg/backends/blas/binary80.hpp:30
KernelAttempt
Result of one runtime kernel backend attempt.
Definition kernel_attempt.hpp:27
constexpr KernelAcceptance< KernelTypeAcceptance::no > kernel_types_no
Report that a backend rejects the argument types.
Definition dispatch_error.hpp:34
consteval auto kernel_accepts_types(BlasBackend, gemm_op const &, C &, S const &, A &, B &, S const &)
Accept host-readable native binary80 operands, including transforming accessors.
Definition linalg/backends/blas/binary80.hpp:19
constexpr KernelAcceptance< KernelTypeAcceptance::yes > kernel_types_yes
Report that a backend accepts every instance of the argument types.
Definition dispatch_error.hpp:40
typename optional_traits< T >::value_type value_type
Definition data_table.hpp:42
std::remove_cvref_t< decltype(std::declval< detail::host_write_mdspan_lease_t< Mdspec > & >().mdspan())> host_write_mdspan_t
Writable mdspan type resolved by host descriptor acquisition.
Definition access.hpp:684
std::ptrdiff_t index_type
Definition types.hpp:19
auto acquire_host_write_access_sync(Mdspan &mdspan)
Acquire a directly host-accessible writable mdspan.
Definition access.hpp:626
std::size_t span
Definition presentation.cpp:2017
Backend value for the reference host CPU dense linalg oracle.
Definition backend_selector.hpp:55
Accessor-respecting in-place scalar conjugation operation tag.
Definition operation_tags.hpp:39
Concepts for tensor-level objects that resolve mdspan kernel operands.