|
MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
|
Namespaces | |
| namespace | adl |
Classes | |
| struct | theta_row |
| theta_m for m = 3, 5, 7, 9, 13 at unit roundoff u = 2^-t, generated by tools/expm_theta.py and rounded toward zero. More... | |
Functions | |
| template<typename R> | |
| std::size_t | table_index () |
| Index into theta_table of the table expm uses for magnitude type R: the first (largest u) whose u = 2^-t does not exceed R's unit roundoff. | |
| template<typename R> | |
| void | split_pow2 (R &x, long &e) |
| x = mant * 2^e with mant in [1, 2), for x > 0. Leaves a non-finite x alone. | |
| template<typename R> | |
| R | pow2 (long k) |
| 2^k in R, by repeated doubling or halving. | |
| template<typename R, typename T> | |
| std::array< long, 5 > | ell_log2 (const mat::dense2D< T > &A, R normA, R u) |
| For each degree m: the smallest integer L with 2^L >= |c_{2m+1}| ||(|A|)^(2m+1)||_1 / (||A||_1 u), or a large negative number when that quantity is zero. | |
| int | ell (long L, int m, int s) |
| template<typename T, typename R> | |
| std::vector< T > | pade_coefficients (int m) |
| Coefficients of p_m(x) = sum_j b_j x^j, normalized to b_0 = 1: b_j = b_{j-1} (m - j + 1) / (j (2m - j + 1)). | |
| template<typename T> | |
| void | combine (mat::dense2D< T > &Y, const T &c0, std::initializer_list< std::pair< T, const mat::dense2D< T > * > > terms) |
| Y = c0 I + sum_i c[i] M[i]. | |
| template<typename T, typename R> | |
| void | scale_by (mat::dense2D< T > &Y, const R &f, int k) |
| Y = Y * f, repeated k times (f a power of two, so each step is exact unless it underflows; applying it k times keeps f itself in range). | |
| template<typename T> | |
| void | set_triangular_exact (mat::dense2D< T > &X, const std::vector< T > &d, const std::vector< T > &t) |
| Al-Mohy & Higham (2009), Code Fragment 2.1: overwrite the diagonal and first superdiagonal of X with exp of those of the upper triangular 2^-j A, where d and t hold 2^-j times A's diagonal and superdiagonal. | |
Variables | |
| constexpr std::array< int, 5 > | degrees {3, 5, 7, 9, 13} |
| constexpr theta_row | theta_table [] |
| constexpr std::array< double, 5 > | leading_coefficient |
| |c_{2m+1}|, the leading coefficient of the backward-error series h_{2m+1}(x) = log(e^-x r_m(x)), rounded up: (m!)^2 / ((2m)! | |
| constexpr int | loop_cap = 1 << 14 |
| void mtl::detail::expm_impl::combine | ( | mat::dense2D< T > & | Y, |
| const T & | c0, | ||
| std::initializer_list< std::pair< T, const mat::dense2D< T > * > > | terms ) |
Y = c0 I + sum_i c[i] M[i].
|
inline |
| std::array< long, 5 > mtl::detail::expm_impl::ell_log2 | ( | const mat::dense2D< T > & | A, |
| R | normA, | ||
| R | u ) |
For each degree m: the smallest integer L with 2^L >= |c_{2m+1}| ||(|A|)^(2m+1)||_1 / (||A||_1 u), or a large negative number when that quantity is zero.
This is the logarithm behind Al-Mohy & Higham's ell(A, m): once A is scaled by 2^-s the quantity shrinks by 2^-(2m s), so ell(2^-s A, m) = max(0, ceil((L - 2m s) / (2m))).
One sweep of row vectors e^T |A|^k, k = 1 .. 27, serves all five degrees. The vector is renormalized to [1, 2) after every product and its scale kept as a power of two, so a large ||A|| cannot overflow it.
| std::vector< T > mtl::detail::expm_impl::pade_coefficients | ( | int | m | ) |
Coefficients of p_m(x) = sum_j b_j x^j, normalized to b_0 = 1: b_j = b_{j-1} (m - j + 1) / (j (2m - j + 1)).
| R mtl::detail::expm_impl::pow2 | ( | long | k | ) |
2^k in R, by repeated doubling or halving.
| void mtl::detail::expm_impl::scale_by | ( | mat::dense2D< T > & | Y, |
| const R & | f, | ||
| int | k ) |
Y = Y * f, repeated k times (f a power of two, so each step is exact unless it underflows; applying it k times keeps f itself in range).
| void mtl::detail::expm_impl::set_triangular_exact | ( | mat::dense2D< T > & | X, |
| const std::vector< T > & | d, | ||
| const std::vector< T > & | t ) |
Al-Mohy & Higham (2009), Code Fragment 2.1: overwrite the diagonal and first superdiagonal of X with exp of those of the upper triangular 2^-j A, where d and t hold 2^-j times A's diagonal and superdiagonal.
| void mtl::detail::expm_impl::split_pow2 | ( | R & | x, |
| long & | e ) |
x = mant * 2^e with mant in [1, 2), for x > 0. Leaves a non-finite x alone.
| std::size_t mtl::detail::expm_impl::table_index | ( | ) |
Index into theta_table of the table expm uses for magnitude type R: the first (largest u) whose u = 2^-t does not exceed R's unit roundoff.
|
inlineconstexpr |
|
inlineconstexpr |
|c_{2m+1}|, the leading coefficient of the backward-error series h_{2m+1}(x) = log(e^-x r_m(x)), rounded up: (m!)^2 / ((2m)!
(2m+1)!).
|
inlineconstexpr |
|
inlineconstexpr |