10namespace detail::cpu_reference
12template <
class S,
class... P>
13concept LuPrecisionArgs = (has_runtime_precision_v<S> &&
sizeof...(P) == 1 && (std::same_as<P, Precision> && ...)) ||
14 (!has_runtime_precision_v<S> &&
sizeof...(P) == 0);
18template <MutableRankedMdspecLike<2> A,
class... P>
19 requires HostWritableMdspec<A> && RealOrComplex<typename A::value_type> &&
20 detail::cpu_reference::LuPrecisionArgs<
typename A::value_type, P...>
29template <MutableRankedMdspecLike<2> A,
class... P>
31 detail::cpu_reference::LuPrecisionArgs<
typename A::value_type, P...>
36 detail::require_lu_shape(a, pivots.size());
37 detail::require_solve_options(options);
38 using S =
typename A::value_type;
41 auto s = access.mdspan();
42 if constexpr (has_runtime_precision_v<S>)
47 if (!detail::solve_matrix_is_finite(s))
53 auto ws = work.mdspan();
54 if (!detail::solve_matrix_is_finite(ws))
60 detail::cpu_reference::lu_factor(ws, pivots, norms, info, converted, scalar_at_precision<R>(0,
p));
65 return detail::cpu_reference::lu_factor(s, pivots, norms, info, options, R{});
69template <RankedMdspecLike<2> A, MutableRankedMdspecLike<2> B,
class... P>
71 std::same_as<typename A::value_type, typename B::value_type> &&
72 detail::cpu_reference::LuPrecisionArgs<
typename A::value_type, P...>
81template <RankedMdspecLike<2> A, MutableRankedMdspecLike<2> B,
class... P>
83 std::same_as<typename A::value_type, typename B::value_type> &&
84 detail::cpu_reference::LuPrecisionArgs<
typename A::value_type, P...>
88 detail::require_lu_solve_shape(a, pivots, b);
89 using S =
typename A::value_type;
95 auto as = aa.mdspan();
96 auto bs = ba.mdspan();
97 if constexpr (has_runtime_precision_v<S>)
100 if (!detail::solve_matrix_is_finite(bs))
108 auto ws = work.mdspan();
109 if (!detail::solve_matrix_is_finite(ws))
114 detail::cpu_reference::lu_solve(as, pivots, ws, info);
119 return detail::cpu_reference::lu_solve(as, pivots, bs, info);
RAII leases that resolve device descriptors and tensor views to mdspans.
Exact arithmetic or an explicit binary working precision.
Definition core/precision.hpp:13
constexpr bit_count_type bit_count() const
Number of binary significand bits.
Definition core/precision.hpp:43
Mdspec metadata supporting host read acquisition.
Definition access.hpp:688
Mutable mdspec metadata supporting host write acquisition.
Definition access.hpp:694
Concept for types that are either real or complex.
Definition scalar_concepts.hpp:87
typename make_real< T >::type make_real_t
Alias for the underlying real-valued type of T.
Definition scalar_traits.hpp:168
void unpack(Tensor const &source, Span &target)
Definition packed_matrix.hpp:33
auto pack(Span const &span, Precision p, bool read=true)
Definition packed_matrix.hpp:19
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
@ nonfinite_input
An input coefficient or RHS component was nonfinite; both workspaces are preserved.
@ nonfinite_result
A factor, solution, reduction, or required magnitude became nonfinite.
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
Definition data_table.cpp:8
auto acquire_host_read_access_sync(Mdspan const &mdspan)
Acquire a directly host-accessible read-only mdspan.
Definition access.hpp:616
auto acquire_host_write_access_sync(Mdspan &mdspan)
Acquire a directly host-accessible writable mdspan.
Definition access.hpp:626
Logical host packing for value-converting BLAS and LAPACK adapters.
Backend value for the reference host CPU dense linalg oracle.
Definition backend_selector.hpp:55
Original matrix norms after conversion to factor precision.
Definition lu_info.hpp:20
Diagnostics written by a completed numerical attempt, independent of dispatch.
Definition solve_info.hpp:41
Real-scalar pivot policy for a square linear solve.
Definition solve_info.hpp:62
Real relative_pivot_tolerance
Reject nonzero pivots at or below this fraction of the original maximum entry magnitude.
Definition solve_info.hpp:64
Fixed-output packed LU factorization with zero-based row-swap pivots.
Definition operation_tags.hpp:165
Solve using read-only packed LU factors, overwriting an existing RHS.
Definition operation_tags.hpp:171