10#if UNI20_HAS_MPLAPACK_MPREAL
13#if UNI20_HAS_MPLAPACK_FLOAT80
19namespace condition_detail
23#if UNI20_HAS_MPLAPACK_MPREAL || UNI20_HAS_MPLAPACK_FLOAT80
24 requires(std::size_t n, std::span<S const> a, make_real_t<S>
const&
norm, Precision
p) {
34 "LU condition estimation requires the one- or infinity-norm");
37template <
class S,
class... P>
38concept PrecisionArgs = (has_runtime_precision_v<S> &&
sizeof...(P) == 1 && (std::same_as<P, Precision> && ...)) ||
39 (!has_runtime_precision_v<S> &&
sizeof...(P) == 0);
51 std::vector<blas_int> iwork(std::size_t(n), blas_int{});
59 lapack::detail::check_invalid_argument(
"gecon", info);
66template <RankedMdspecLike<2> A,
class... P>
78template <RankedMdspecLike<2> A,
class... P>
84 using S =
typename A::value_type;
86 auto p = condition_detail::working_precision<S>(precision...);
87 require_precision<S>(
p);
90 ERROR_IF(a.extent(0) != a.extent(1),
"LU condition estimation requires square factors");
91 ERROR_IF(original_norm < 0,
"original matrix norm must be nonnegative");
92 auto n = std::size_t(a.extent(0));
98 output = scalar_at_precision<R>(1,
p);
101 R
norm = scalar_at_precision<R>(original_norm,
p);
111#if UNI20_HAS_MPLAPACK_MPREAL || UNI20_HAS_MPLAPACK_FLOAT80
118 output = std::move(result);
Synchronous packed-array boundary to the serial MPFR/MPC provider.
Safe conversion helpers for the configured signed BLAS integer ABI.
Exact arithmetic or an explicit binary working precision.
Definition core/precision.hpp:13
General-purpose owning tensor with immediate or deferred mdspan metadata.
Definition basic_tensor.hpp:109
auto extent(size_type axis) const noexcept
Return one tensor extent.
Definition basic_tensor.hpp:720
storage_type & storage() noexcept
Access the owned storage container.
Definition basic_tensor.hpp:542
Concept for complex scalar types.
Definition scalar_concepts.hpp:75
Mdspec metadata supporting host read acquisition.
Definition access.hpp:688
Concept for scalar types with a configured dense LAPACK backend.
Definition scalar_concepts.hpp:147
Concept for real scalar types (float, double, etc.).
Definition scalar_concepts.hpp:69
Definition backends/lapack/lu_rcond.hpp:22
Definition backends/lapack/lu_rcond.hpp:38
Operation-tag backend dispatch over tensor-view operands.
typename make_real< T >::type make_real_t
Alias for the underlying real-valued type of T.
Definition scalar_traits.hpp:168
constexpr bool isfinite(I const &x) noexcept
Returns whether an integer scalar is finite.
Definition math.hpp:121
Checked LAPACK wrappers over provider-specific unchecked overloads.
Shared helpers for LAPACK operation-tag backend adapters.
constexpr blas_int try_blas_int(Value value) noexcept
Convert a non-negative integer to blas_int, or return the negative invalid sentinel.
Definition blas_int.hpp:28
constexpr bool is_valid_blas_int(blas_int value) noexcept
Return whether a non-throwing BLAS integer conversion succeeded.
Definition blas_int.hpp:25
blas_int gecon(char norm, blas_int n, uni20::float128 const *a, blas_int lda, uni20::float128 anorm, uni20::float128 &rcond, uni20::float128 *work, blas_int *iwork)
Definition mplapack/general.hpp:172
char norm_code(MatrixNorm norm)
Definition backends/lapack/lu_rcond.hpp:31
Precision working_precision()
Definition backends/lapack/lu_rcond.hpp:40
make_real_t< S > native_gecon(DenseMatrix< S > const &a, make_real_t< S > norm, char code)
Definition backends/lapack/lu_rcond.hpp:43
constexpr std::optional< std::size_t > try_size_product(std::size_t left, std::size_t right) noexcept
Multiply allocation extents without wrapping std::size_t.
Definition linalg/backends/lapack/common.hpp:69
auto pack(Span const &span, Precision p, bool read=true)
Definition packed_matrix.hpp:19
auto values(Tensor &tensor)
Definition packed_matrix.hpp:29
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_result
A factor, solution, reduction, or required magnitude became nonfinite.
MatrixNorm
Matrix norm selected by matrix_norm_op.
Definition operation_tags.hpp:119
@ One
Induced one-norm: largest column sum of entry magnitudes.
@ Infinity
Induced infinity-norm: largest row sum of entry magnitudes.
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::maybe > kernel_types_maybe
Report that runtime operand values determine backend acceptance.
Definition dispatch_error.hpp:37
float80 gecon(std::size_t n, std::span< float80 const > a, float80 const &anorm, char norm, Precision p)
Estimate reciprocal condition from packed successful LU and the original matrix norm.
Definition binary80.cpp:290
Definition data_table.cpp:8
mpreal norm(mpcomplex const &z)
Definition mpcomplex.hpp:494
auto acquire_host_read_access_sync(Mdspan const &mdspan)
Acquire a directly host-accessible read-only mdspan.
Definition access.hpp:616
Logical host packing for value-converting BLAS and LAPACK adapters.
Backend family for configured dense LAPACK kernels, including MPLAPACK scalar adapters.
Definition backend_selector.hpp:20
Diagnostics written by a completed numerical attempt, independent of dispatch.
Definition solve_info.hpp:41
Reciprocal condition estimate from successful packed LU and an original matrix norm.
Definition operation_tags.hpp:142
MatrixNorm norm
Definition operation_tags.hpp:144
Project-level numeric limits customization point.
Definition numeric_limits.hpp:16
#define ERROR_IF(cond,...)
Definition trace.hpp:389