MTL5 -- Matrix Template Library C++ API
mtl:: -- C++20 header-only linear algebra for mixed-precision algorithm design
Loading...
Searching...
No Matches
ill_conditioned.hpp File Reference
#include <cmath>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <random>
#include <stdexcept>
#include <type_traits>
#include <utility>
#include <mtl/math/error_free.hpp>
#include <mtl/math/exact_accumulator.hpp>
#include <mtl/vec/dense_vector.hpp>

Classes

struct  mtl::generators::ill_conditioned_dot< T >
 An ill-conditioned dot product: x . More...
struct  mtl::generators::ill_conditioned_sum< T >
 An ill-conditioned sum: sum p rounded to nearest is s, and its achieved condition number sum |p_i| / |sum p_i| is cond. More...

Namespaces

namespace  mtl
namespace  mtl::generators
namespace  mtl::generators::ill_conditioned_detail

Functions

double mtl::generators::ill_conditioned_detail::rand01 (std::mt19937_64 &gen)
 Uniform on [0, 1): the top 53 bits of one 64-bit draw.
int mtl::generators::ill_conditioned_detail::mround (double v)
 Matlab's round: half away from zero.
template<typename A, typename B>
void mtl::generators::ill_conditioned_detail::permute (A &a, B &b, std::mt19937_64 &gen)
 Matlab's randperm applied to a pair of vectors: Fisher-Yates on the raw stream.
template<typename T>
T mtl::generators::ill_conditioned_detail::dot_exact (const vec::dense_vector< T > &x, const vec::dense_vector< T > &y, std::size_t m)
 x(0..m) . y(0..m), exactly, rounded to nearest: the paper's DotExact.
template<typename T = double>
requires math::exact_accumulable<T>
ill_conditioned_dot< T > mtl::generators::gen_dot (std::size_t n, double c, std::mt19937_64 &gen)
 GenDot (Algorithm 6.1): vectors x, y of length n >= 6 whose dot product has an anticipated condition number c >= 1.
template<typename T = double>
requires math::exact_accumulable<T>
ill_conditioned_dot< T > mtl::generators::gen_dot (std::size_t n, double c, std::uint64_t seed)
 GenDot from a seed.
template<typename T = double>
requires math::exact_accumulable<T>
ill_conditioned_sum< T > mtl::generators::gen_sum (std::size_t n, double c, std::mt19937_64 &gen)
 An ill-conditioned sum of even length n >= 12, the paper's way: GenDot of length n / 2 at condition number c, each product x_i y_i split exactly by two_product into hi + lo, the n summands permuted.
template<typename T = double>
requires math::exact_accumulable<T>
ill_conditioned_sum< T > mtl::generators::gen_sum (std::size_t n, double c, std::uint64_t seed)
 GenSum from a seed.