Universal Numbers Library C++ API
sw::universal -- header-only custom arithmetic types (posit, cfloat, lns, fixpnt, dd/qd, and more)
Loading...
Searching...
No Matches
generators.hpp File Reference
#include <cmath>
#include <cstdint>
#include <algorithm>
#include <limits>
#include <universal/number/bisection/bisection_fwd.hpp>

Classes

struct  sw::universal::ArithmeticMean
 Arithmetic mean: f(a,b) = (a+b)/2 Used by Unary, Fibonacci, and as the fraction interpolator for IEEE-like and Posit-like representations. More...
struct  sw::universal::GeometricMean
 Geometric mean: f(a,b) = sqrt(a*b) Used by LNS and FP representations. More...
struct  sw::universal::HyperMean
 Hyper mean: bridges bracketing and refinement. More...
struct  sw::universal::UnaryGenerator
 Unary: g(x) = x + 1, sequence = 1, 2, 3, 4, ... Simplest possible generator. More...
struct  sw::universal::EliasGammaGenerator
 Elias gamma: g(x) = 2x, sequence = 1, 2, 4, 8, ... Exponential bracketing with base 2. More...
struct  sw::universal::EliasDeltaGenerator
 Elias delta: g(x) = 2x^2, sequence = 1, 2, 8, 128, ... Super-exponential bracketing. More...
struct  sw::universal::PositGenerator< m >
 Posit(m): g(x) = b*x where b = 2^(2^m) Posit(0): b=2, Posit(1): b=4, Posit(2): b=16, Posit(3): b=256. More...
struct  sw::universal::FibonacciGenerator
 Fibonacci: g(x) = round(phi * x), sequence = 1, 2, 3, 5, 8, 13, ... More...
struct  sw::universal::EliasOmegaGenerator
 Elias omega: g(x) = 2^x, sequence via tetration: 1, 2, 4, 16, 65536, ... The fastest-growing generator in the paper. More...
struct  sw::universal::GoldenRatioGenerator
 Golden ratio: g(x) = phi * x, sequence = 1, phi, phi^2, phi^3, ... Represents integers as sums of Fibonacci numbers. More...
struct  sw::universal::URRGenerator
 URR (Universal Representation of Reals): g(x) = max(2, x^2) Hamada's representation. More...
struct  sw::universal::LNSGenerator< m >
 LNS(m): Logarithmic number system with m-bit exponent. More...
struct  sw::universal::NaturalPositRefinement< m >
 Natural refinement: uses the Kolmogorov mean derived from the cumulative distribution function of the number system. More...

Namespaces

namespace  sw
 required std libraries
namespace  sw::universal

Typedefs

template<unsigned nbits, typename bt = uint8_t, typename AuxReal = double>
using sw::universal::bisection_unary = bisection<UnaryGenerator, ArithmeticMean, nbits, bt, AuxReal>
 bisection_unary<nbits>: Unary coding with arithmetic mean refinement
template<unsigned nbits, typename bt = uint8_t, typename AuxReal = double>
using sw::universal::bisection_elias_gamma = bisection<EliasGammaGenerator, HyperMean, nbits, bt, AuxReal>
 bisection_elias_gamma<nbits>: Elias gamma with hyper mean refinement
template<unsigned nbits, typename bt = uint8_t, typename AuxReal = double>
using sw::universal::bisection_elias_delta = bisection<EliasDeltaGenerator, HyperMean, nbits, bt, AuxReal>
 bisection_elias_delta<nbits>: Elias delta with hyper mean refinement
template<unsigned nbits, unsigned m = 0, typename bt = uint8_t, typename AuxReal = double>
using sw::universal::bisection_posit = bisection<PositGenerator<m>, HyperMean, nbits, bt, AuxReal>
 bisection_posit<nbits, m>: Posit(m) with hyper mean refinement
template<unsigned nbits, typename bt = uint8_t, typename AuxReal = double>
using sw::universal::bisection_fibonacci = bisection<FibonacciGenerator, ArithmeticMean, nbits, bt, AuxReal>
 bisection_fibonacci<nbits>: Fibonacci coding with arithmetic mean refinement
template<unsigned nbits, typename bt = uint8_t, typename AuxReal = double>
using sw::universal::bisection_lns = bisection<EliasGammaGenerator, GeometricMean, nbits, bt, AuxReal>
 bisection_lns<nbits>: LNS-like coding with geometric mean refinement (uses Elias gamma generator = base 2, like LNS with 1-bit exponent)
template<unsigned nbits, typename bt = uint8_t, typename AuxReal = double>
using sw::universal::bisection_elias_omega = bisection<EliasOmegaGenerator, HyperMean, nbits, bt, AuxReal>
 bisection_elias_omega<nbits>: Elias omega with hyper mean refinement
template<unsigned nbits, typename bt = uint8_t, typename AuxReal = double>
using sw::universal::bisection_golden = bisection<GoldenRatioGenerator, ArithmeticMean, nbits, bt, AuxReal>
 bisection_golden<nbits>: Golden ratio base with arithmetic mean.
template<unsigned nbits, typename bt = uint8_t, typename AuxReal = double>
using sw::universal::bisection_urr = bisection<URRGenerator, HyperMean, nbits, bt, AuxReal>
 bisection_urr<nbits>: Hamada's URR with hyper mean
template<unsigned nbits, unsigned m = 3, typename bt = uint8_t, typename AuxReal = double>
using sw::universal::bisection_lns_m = bisection<LNSGenerator<m>, GeometricMean, nbits, bt, AuxReal>
 bisection_lns_m<nbits, m>: LNS(m) with geometric mean refinement
template<unsigned nbits, unsigned m = 0, typename bt = uint8_t, typename AuxReal = double>
using sw::universal::bisection_natposit = bisection<PositGenerator<m>, NaturalPositRefinement<m>, nbits, bt, AuxReal>
 bisection_natposit<nbits, m>: NaturalPosit with smooth density