13#include <cuda/std/complex>
27 requires std::is_trivially_copyable_v<uni20::complex<Real>>
34 : components_(
reinterpret_cast<Real*
>(storage) + 2 * offset)
48 components_[0] =
value.real();
49 components_[1] =
value.imag();
62 auto const* components =
reinterpret_cast<Real const*
>(&
value);
63 components_[0] = components[0];
64 components_[1] = components[1];
77template <
class ElementType>
78 requires std::is_trivially_copyable_v<ElementType>
102template <
class Real>
struct CudaPointerAccessor<
uni20::detail::standard_complex<Real>>
106 using reference = CudaComplexReference<Real>;
125template <
class Real>
struct CudaPointerAccessor<
uni20::detail::standard_complex<Real> const>
129 using reference = ::cuda::std::complex<Real>;
136 auto const* components =
reinterpret_cast<Real const*
>(
handle) + 2 *
offset;
137 return reference{components[0], components[1]};
151 template <
class Real>
153 -> ::cuda::std::complex<Real>
155 return ::cuda::std::conj(
value);
158 template <
class Real>
160 -> ::cuda::std::complex<Real>
162 using execution_type = ::cuda::std::complex<Real>;
163 return ::cuda::std::conj(
static_cast<execution_type
>(
value));
169 requires std::is_trivially_copyable_v<uni20::complex<Real>>
192template <
class ElementType>
193 requires(!std::is_const_v<ElementType>)
215template <
class ElementType>
216inline constexpr bool enable_accessor_in_domain<cuda::CudaPointerAccessor<ElementType>,
cuda_access_domain> =
true;
219inline constexpr bool enable_accessor_in_domain<cuda::CudaConjugatingPointerAccessor<Real>,
cuda_access_domain> =
true;
Assignable CUDA execution proxy over one persistent complex value.
Definition cuda_accessor.hpp:28
UNI20_HOST_DEVICE constexpr CudaComplexReference(logical_type *storage, std::size_t offset) noexcept
Definition cuda_accessor.hpp:33
UNI20_HOST_DEVICE constexpr CudaComplexReference & operator=(execution_type const &value) noexcept
Store a CUDA execution value componentwise.
Definition cuda_accessor.hpp:46
UNI20_HOST_DEVICE constexpr CudaComplexReference & operator=(CudaComplexReference const &value) noexcept
Copy the observed value rather than rebinding the proxy.
Definition cuda_accessor.hpp:54
uni20::complex< Real > logical_type
Definition cuda_accessor.hpp:30
UNI20_HOST_DEVICE constexpr CudaComplexReference(CudaComplexReference const &) noexcept=default
::cuda::std::complex< Real > execution_type
Definition cuda_accessor.hpp:31
UNI20_HOST_DEVICE constexpr CudaComplexReference & operator=(logical_type const &value) noexcept
Store a host logical value componentwise.
Definition cuda_accessor.hpp:60
Project compiler annotations shared by host and device code.
#define UNI20_HOST_DEVICE
Definition compiler_attributes.hpp:12
Concept for real scalar types (float, double, etc.).
Definition scalar_concepts.hpp:69
cuda::ResourceLease< HandleSlot > handle
Definition cublas/execution.cpp:33
locale_t value
Definition data_table.cpp:49
typename detail::complex_type< Real >::type complex
Project-level complex scalar spelling.
Definition types.hpp:66
Mdspan concept and accessor extensions for Uni20.
Definition cublas/execution.hpp:18
UNI20_HOST_DEVICE constexpr auto const_accessor(CudaPointerAccessor< ElementType > const &)
Produce a read-only CUDA pointer accessor without a generic lvalue adaptor.
Definition cuda_accessor.hpp:194
Definition async/async.hpp:26
Named CUDA-callable complex conjugation operation.
Definition cuda_accessor.hpp:150
UNI20_HOST_DEVICE constexpr auto operator()(CudaComplexReference< Real > value) const noexcept -> ::cuda::std::complex< Real >
Definition cuda_accessor.hpp:159
UNI20_HOST_DEVICE constexpr auto operator()(::cuda::std::complex< Real > value) const noexcept -> ::cuda::std::complex< Real >
Definition cuda_accessor.hpp:152
Read-only CUDA accessor that conjugates persistent complex storage.
Definition cuda_accessor.hpp:171
::cuda::std::complex< Real > reference
Definition cuda_accessor.hpp:174
element_type * data_handle_type
Definition cuda_accessor.hpp:173
UNI20_HOST_DEVICE constexpr data_handle_type offset(data_handle_type handle, offset_type offset) const noexcept
Definition cuda_accessor.hpp:184
uni20::complex< Real > const element_type
Definition cuda_accessor.hpp:172
UNI20_HOST_DEVICE constexpr reference access(data_handle_type handle, offset_type offset) const noexcept
Definition cuda_accessor.hpp:178
std::size_t offset_type
Definition cuda_accessor.hpp:176
Accessor for a CUDA mdspan whose device pointer has been leased.
Definition cuda_accessor.hpp:80
UNI20_HOST_DEVICE constexpr reference access(data_handle_type handle, offset_type offset) const noexcept
Definition cuda_accessor.hpp:87
UNI20_HOST_DEVICE constexpr data_handle_type offset(data_handle_type handle, offset_type offset) const noexcept
Definition cuda_accessor.hpp:93
element_type & reference
Definition cuda_accessor.hpp:83
std::size_t offset_type
Definition cuda_accessor.hpp:85
element_type * data_handle_type
Definition cuda_accessor.hpp:82
CudaPointerAccessor offset_policy
Definition cuda_accessor.hpp:84
ElementType element_type
Definition cuda_accessor.hpp:81
Execution domain in which CUDA device code may evaluate an accessor.
Definition mdspan/concepts.hpp:78
uni20::complex< Real > type
Definition cuda_accessor.hpp:211
Map an execution expression type to its backend-neutral logical value type.
Definition types.hpp:127
uni20::complex< Real > type
Definition cuda_accessor.hpp:206
Trait for extracting the element type from a proxy reference.
Definition types.hpp:102