19template <RealOrComplex S,
class Ops,
class Prototype>
20 requires(!std::is_reference_v<Prototype>) &&
21 KrylovVectorOps<Ops,
decltype(std::declval<Ops&>().allocate_like(std::declval<Prototype const&>())), S>
27 using vector_type =
decltype(std::declval<Ops&>().allocate_like(std::declval<Prototype const&>()));
34 require_precision<S>(precision);
36 if (ops.vector_dimension(prototype) != ops.problem_dimension())
37 throw std::invalid_argument(
"Krylov prototype does not belong to the vector space");
45template <RealOrComplex S,
class Ops,
class V>
46 requires requires(Ops& ops, V&& source) { ops.prototype_view(std::forward<V>(source)); }
49 using prototype_type =
decltype(ops.prototype_view(std::forward<V>(source)));
56template <RealOrComplex S,
class Ops,
class V>
57 requires(!has_runtime_precision_v<S>) &&
58 requires(Ops& ops, V&& source) { ops.prototype_view(std::forward<V>(source)); }
61 return krylov_space<S>(ops, std::forward<V>(source), native_precision<S>());
68template <RealOrComplex To, RealOrComplex From>
72 require_precision<To>(
p);
76 else if constexpr (has_runtime_precision_v<To>)
77 return scalar_at_precision<To>(
value,
p);
79 return static_cast<To
>(
value);
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
Concept for complex scalar types.
Definition scalar_concepts.hpp:75
locale_t value
Definition data_table.cpp:49
constexpr T & imag(detail::standard_complex< T > &z) noexcept
Provides mutable access to the imaginary component of a uni20::complex value.
Definition math.hpp:184
typename make_real< T >::type make_real_t
Alias for the underlying real-valued type of T.
Definition scalar_traits.hpp:168
constexpr T & real(detail::standard_complex< T > &z) noexcept
Provides mutable access to the real component of a uni20::complex value.
Definition math.hpp:173
To convert_scalar(From const &value, Precision p)
Definition vector_space.hpp:70
Definition block_tensor_vector.hpp:23
auto krylov_space(Ops &ops, V &&source, Precision p)
Bind vector operations and an allocation prototype to finite precision.
Definition vector_space.hpp:47
Definition data_table.cpp:8
An opaque vector space with one explicit arithmetic precision.
Definition vector_space.hpp:23
Ops & ops
Definition vector_space.hpp:28
void validate() const
Definition vector_space.hpp:32
S scalar_type
Definition vector_space.hpp:24
Precision precision
Definition vector_space.hpp:30
decltype(std::declval< Ops & >().allocate_like(std::declval< Prototype const & >())) vector_type
Definition vector_space.hpp:27
Prototype prototype_type
Definition vector_space.hpp:26
Prototype prototype
Definition vector_space.hpp:29
make_real_t< S > real_type
Definition vector_space.hpp:25