Uni20
Asynchronous tensor and runtime library.
Loading...
Searching...
No Matches
scalar_concepts.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "scalar_traits.hpp"
4#include "types.hpp"
5
6namespace uni20
7{
8
9namespace detail
10{
11template <typename T>
12inline constexpr bool has_builtin_blas_real_backend_v = std::same_as<T, float> || std::same_as<T, double>;
13
14template <typename T> inline constexpr bool has_builtin_lapack_real_backend_v = has_builtin_blas_real_backend_v<T>;
15
16template <typename T> inline constexpr bool has_mplapack_blas_real_backend_v = false;
17
18template <typename T>
19inline constexpr bool has_builtin_blas_complex_backend_v = std::same_as<T, cfloat> || std::same_as<T, cdouble>;
20
21template <typename T> inline constexpr bool has_mplapack_blas_complex_backend_v = false;
22
23template <typename T> inline constexpr bool has_mplapack_lapack_real_backend_v = false;
24
25template <typename T>
26inline constexpr bool has_builtin_lapack_complex_backend_v = std::same_as<T, cfloat> || std::same_as<T, cdouble>;
27
28template <typename T> inline constexpr bool has_mplapack_lapack_complex_backend_v = false;
29
30#if UNI20_HAS_MPLAPACK_FLOAT128
31#if defined(MPLAPACK_BINARY128_MODE) && (MPLAPACK_BINARY128_MODE != MPLAPACK_BINARY128_MODE_LDBL)
32template <> inline constexpr bool has_mplapack_blas_real_backend_v<uni20::float128> = true;
33
34template <> inline constexpr bool has_mplapack_blas_complex_backend_v<uni20::complex<uni20::float128>> = true;
35#endif
36
37template <> inline constexpr bool has_mplapack_lapack_real_backend_v<uni20::float128> = true;
38
39template <> inline constexpr bool has_mplapack_lapack_complex_backend_v<uni20::complex<uni20::float128>> = true;
40#endif
41
42template <typename T>
43inline constexpr bool has_blas_real_backend_v =
44 has_builtin_blas_real_backend_v<T> || has_mplapack_blas_real_backend_v<T>;
45
46template <typename T>
47inline constexpr bool has_blas_complex_backend_v =
48 has_builtin_blas_complex_backend_v<T> || has_mplapack_blas_complex_backend_v<T>;
49
50template <typename T>
51inline constexpr bool has_lapack_real_backend_v =
52 has_builtin_lapack_real_backend_v<T> || has_mplapack_lapack_real_backend_v<T>;
53
54template <typename T>
55inline constexpr bool has_lapack_complex_backend_v =
56 has_builtin_lapack_complex_backend_v<T> || has_mplapack_lapack_complex_backend_v<T>;
57} // namespace detail
58
62template <typename T>
63concept Integer = is_integer_v<T>;
64
68template <typename T>
69concept Real = is_real_v<T>;
70
74template <typename T>
75concept Complex = is_complex_v<T>;
76
80template <typename T>
81concept Scalar = is_scalar_v<T>;
82
86template <typename T>
88
92template <typename T>
93concept BlasReal = Real<T> && detail::has_blas_real_backend_v<T>;
94
98template <typename T>
99concept BlasComplex = Complex<T> && detail::has_blas_complex_backend_v<T>;
100
104template <typename T>
106
114template <typename T>
115concept LapackReal = Real<T> && detail::has_lapack_real_backend_v<T>;
116
122template <typename T>
123concept LapackComplex = Complex<T> && detail::has_lapack_complex_backend_v<T>;
124
132template <typename T>
134
140template <typename T>
142
146template <typename T>
148
152template <typename T>
153concept ScalarValued = is_scalar_valued_v<T>;
154
158template <typename T>
159concept IntegerScalarValued = is_integer_scalar_valued_v<T>;
160
164template <typename T>
165concept RealScalarValued = is_real_scalar_valued_v<T>;
166
170template <typename T>
171concept ComplexScalarValued = is_complex_scalar_valued_v<T>;
172
176template <typename T>
177concept RealOrComplexScalarValued = is_real_or_complex_scalar_valued_v<T>;
178
179} // namespace uni20
Complex scalar types supported by the configured raw-pointer BLAS wrappers.
Definition scalar_concepts.hpp:99
Real scalar types supported by the configured raw-pointer BLAS wrappers.
Definition scalar_concepts.hpp:93
Scalar types supported by the configured raw-pointer BLAS wrappers.
Definition scalar_concepts.hpp:105
Concept for scalar-valued types whose scalar_t<T> is a complex scalar.
Definition scalar_concepts.hpp:171
Concept for complex scalar types.
Definition scalar_concepts.hpp:75
Concept for scalar-valued types whose scalar_t<T> is an integer scalar.
Definition scalar_concepts.hpp:159
Concept for integer scalar types (excluding char and bool).
Definition scalar_concepts.hpp:63
Concept for real precisions whose Uni20 complex scalar has LAPACK coverage.
Definition scalar_concepts.hpp:141
Complex scalar types supported by the configured raw-pointer LAPACK wrappers.
Definition scalar_concepts.hpp:123
Concept for real or complex scalar fields with real LAPACK coverage.
Definition scalar_concepts.hpp:133
Real scalar types supported by the configured raw-pointer LAPACK wrappers.
Definition scalar_concepts.hpp:115
Concept for scalar types with a configured dense LAPACK backend.
Definition scalar_concepts.hpp:147
Concept for scalar-valued types whose scalar_t<T> is real or complex.
Definition scalar_concepts.hpp:177
Concept for types that are either real or complex.
Definition scalar_concepts.hpp:87
Concept for scalar-valued types whose scalar_t<T> is a real scalar.
Definition scalar_concepts.hpp:165
Concept for real scalar types (float, double, etc.).
Definition scalar_concepts.hpp:69
Concept for scalar types or types whose recursive value_type resolves to a scalar.
Definition scalar_concepts.hpp:153
Concept for numeric scalar types (integer, real, or complex).
Definition scalar_concepts.hpp:81
Definition async/async.hpp:26