23namespace detail::cpu_reference
27template <uni20::MutableRankedMdspanLike<2> MatrixMdspan, uni20::Scalar Scalar>
consteval auto matrix_set_acceptance()
29 using matrix_scalar = std::remove_cv_t<typename MatrixMdspan::element_type>;
30 if constexpr (std::same_as<matrix_scalar, Scalar> &&
31 requires(MatrixMdspan& matrix,
typename MatrixMdspan::index_type index, Scalar
value) {
32 matrix.operator[](index, index) =
value;
44template <
class MatrixMdspan,
class Scalar>
47 using matrix_type = std::remove_cvref_t<MatrixMdspan>;
48 using index_type =
typename matrix_type::index_type;
60 PANIC(
"invalid MatrixRegion", std::to_underlying(op.region));
65 for (
index_type col = 0; col < matrix.extent(1); ++col)
67 if (selected(
row, col))
69 matrix[
row, col] =
row == col ? diagonal : off_diagonal;
78template <uni20::MutableRankedMdspecLike<2> MatrixMdspan, uni20::Scalar Scalar>
84 constexpr auto acceptance = detail::cpu_reference::matrix_set_acceptance<matrix_span, Scalar>();
92template <uni20::MutableRankedMdspecLike<2> MatrixMdspan, uni20::Scalar Scalar>
98 auto matrix_span = matrix_access.mdspan();
99 return detail::cpu_reference::set_matrix(op, matrix_span, diagonal, off_diagonal);
RAII leases that resolve device descriptors and tensor views to mdspans.
Mutable mdspec metadata supporting host write acquisition.
Definition access.hpp:694
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.
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
void set_matrix(BackendSelector selector, async::Async< MatrixTensor > &matrix, Diagonal &&diagonal, OffDiagonal &&off_diagonal, MatrixRegion region=MatrixRegion::All)
Schedule structured matrix initialization through an explicit selector.
Definition async/matrix_set.hpp:58
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
@ Upper
Entries with row <= column, including the diagonal.
@ All
All entries, including rectangular portions of the matrix.
@ Lower
Entries with row >= column, including the diagonal.
constexpr KernelAcceptance< KernelTypeAcceptance::yes > kernel_types_yes
Report that a backend accepts every instance of the argument types.
Definition dispatch_error.hpp:40
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
Backend value for the reference host CPU dense linalg oracle.
Definition backend_selector.hpp:55
Structured dense matrix initialization operation tag.
Definition operation_tags.hpp:219
Concepts for tensor-level objects that resolve mdspan kernel operands.
#define PANIC(...)
Definition trace.hpp:382