Aerobus v1.2
|
main namespace for all publicly exposed types or functions More...
Namespaces | |
namespace | internal |
internal implementations, subject to breaking changes without notice | |
namespace | known_polynomials |
families of well known polynomials such as Hermite or Bernstein | |
namespace | libm |
holds mathematical functions (such as cosine or sin), correct to epsilon | |
Classes | |
struct | arithmetic_helpers |
struct | arithmetic_helpers< double > |
struct | arithmetic_helpers< float > |
struct | ContinuedFraction |
represents a continued fraction a0 + \(\frac{1}{a_1+\frac{1}{a_2 + \ldots}}\) More... | |
struct | ContinuedFraction< a0 > |
Specialization for only one coefficient, technically just 'a0'. More... | |
struct | ContinuedFraction< a0, rest... > |
specialization for multiple coefficients (strictly more than one) More... | |
struct | ConwayPolynomial |
struct | double_double |
struct | Embed |
embedding - struct forward declaration More... | |
struct | Embed< i32, i64 > |
embeds i32 into i64 More... | |
struct | Embed< polynomial< Small >, polynomial< Large > > |
embeds polynomial<Small> into polynomial<Large> More... | |
struct | Embed< q32, q64 > |
embeds q32 into q64 More... | |
struct | Embed< Quotient< Ring, X >, Ring > |
embeds Quotient<Ring, X> into Ring More... | |
struct | Embed< Ring, FractionField< Ring > > |
embeds values from Ring to its field of fractions More... | |
struct | Embed< zpz< x >, i32 > |
embeds zpz values into i32 More... | |
struct | i32 |
32 bits signed integers, seen as a algebraic ring with related operations More... | |
struct | i64 |
64 bits signed integers, seen as a algebraic ring with related operations More... | |
struct | is_prime |
checks if n is prime More... | |
struct | meta_libm |
struct | polynomial |
struct | Quotient |
Quotient ring by the principal ideal generated by 'X' With i32 as Ring and i32::val<2> as X, Quotient is Z/2Z. More... | |
struct | type_list |
Empty pure template struct to handle type list. More... | |
struct | type_list<> |
specialization for empty type list More... | |
struct | zpz |
congruence classes of integers modulo p (32 bits) More... | |
Concepts | |
concept | IsRing |
Concept to express R is a Ring. | |
concept | IsEuclideanDomain |
Concept to express R is an euclidean domain. | |
concept | IsField |
Concept to express R is a field. | |
Typedefs | |
template<typename T , typename A , typename B > | |
using | gcd_t = typename internal::gcd< T >::template type< A, B > |
computes the greatest common divisor or A and B | |
template<typename... vals> | |
using | vadd_t = typename internal::vadd< vals... >::type |
adds multiple values (v1 + v2 + ... + vn) vals must have same "enclosing_type" and "enclosing_type" must have an add_t binary operator | |
template<typename... vals> | |
using | vmul_t = typename internal::vmul< vals... >::type |
multiplies multiple values (v1 + v2 + ... + vn) vals must have same "enclosing_type" and "enclosing_type" must have an mul_t binary operator | |
template<typename val > | |
using | abs_t = std::conditional_t< val::enclosing_type::template pos_v< val >, val, typename val::enclosing_type::template sub_t< typename val::enclosing_type::zero, val > > |
computes absolute value of 'val' val must be a 'value' in a Ring satisfying 'IsEuclideanDomain' concept | |
template<typename Ring > | |
using | FractionField = typename internal::FractionFieldImpl< Ring >::type |
Fraction field of an euclidean domain, such as Q for Z. | |
template<typename X , typename Y > | |
using | add_t = typename X::enclosing_type::template add_t< X, Y > |
generic addition | |
template<typename X , typename Y > | |
using | sub_t = typename X::enclosing_type::template sub_t< X, Y > |
generic subtraction | |
template<typename X , typename Y > | |
using | mul_t = typename X::enclosing_type::template mul_t< X, Y > |
generic multiplication | |
template<typename X , typename Y > | |
using | div_t = typename X::enclosing_type::template div_t< X, Y > |
generic division | |
using | q32 = FractionField< i32 > |
32 bits rationals rationals with 32 bits numerator and denominator | |
using | fpq32 = FractionField< polynomial< q32 > > |
rational fractions with 32 bits rational coefficients rational fractions with rationals coefficients (32 bits numerator and denominator) | |
using | q64 = FractionField< i64 > |
64 bits rationals rationals with 64 bits numerator and denominator | |
using | pi64 = polynomial< i64 > |
polynomial with 64 bits integers coefficients | |
using | pq64 = polynomial< q64 > |
polynomial with 64 bits rationals coefficients | |
using | fpq64 = FractionField< polynomial< q64 > > |
polynomial with 64 bits rational coefficients | |
template<typename Ring , typename v1 , typename v2 > | |
using | makefraction_t = typename FractionField< Ring >::template val< v1, v2 > |
helper type : the rational V1/V2 in the field of fractions of Ring | |
template<typename v > | |
using | embed_int_poly_in_fractions_t = typename Embed< polynomial< typename v::ring_type >, polynomial< FractionField< typename v::ring_type > > >::template type< v > |
embed a polynomial with integers coefficients into rational coefficients polynomials | |
template<int64_t p, int64_t q> | |
using | make_q64_t = typename q64::template simplify_t< typename q64::val< i64::inject_constant_t< p >, i64::inject_constant_t< q > > > |
helper type : make a fraction from numerator and denominator | |
template<int32_t p, int32_t q> | |
using | make_q32_t = typename q32::template simplify_t< typename q32::val< i32::inject_constant_t< p >, i32::inject_constant_t< q > > > |
helper type : make a fraction from numerator and denominator | |
template<typename Ring , typename v1 , typename v2 > | |
using | addfractions_t = typename FractionField< Ring >::template add_t< v1, v2 > |
helper type : adds two fractions | |
template<typename Ring , typename v1 , typename v2 > | |
using | mulfractions_t = typename FractionField< Ring >::template mul_t< v1, v2 > |
helper type : multiplies two fractions | |
template<typename Ring , auto... xs> | |
using | make_int_polynomial_t = typename polynomial< Ring >::template val< typename Ring::template inject_constant_t< xs >... > |
make a polynomial with coefficients in Ring | |
template<typename Ring , auto... xs> | |
using | make_frac_polynomial_t = typename polynomial< FractionField< Ring > >::template val< typename FractionField< Ring >::template inject_constant_t< xs >... > |
make a polynomial with coefficients in FractionField<Ring> | |
template<typename T , size_t i> | |
using | factorial_t = typename internal::factorial< T, i >::type |
computes factorial(i), as type | |
template<typename T , size_t k, size_t n> | |
using | combination_t = typename internal::combination< T, k, n >::type |
computes binomial coefficient (k among n) as type | |
template<typename T , size_t n> | |
using | bernoulli_t = typename internal::bernoulli< T, n >::type |
nth bernoulli number as type in T | |
template<typename T , size_t n> | |
using | bell_t = typename internal::bell_helper< T, n >::type |
Bell numbers. | |
template<typename T , int k> | |
using | alternate_t = typename internal::alternate< T, k >::type |
(-1)^k as type in T | |
template<typename T , int n, int k> | |
using | stirling_1_signed_t = typename internal::stirling_1_helper< T, n, k >::type |
Stirling number of first king (signed) – as types. | |
template<typename T , int n, int k> | |
using | stirling_1_unsigned_t = abs_t< typename internal::stirling_1_helper< T, n, k >::type > |
Stirling number of first king (unsigned) – as types. | |
template<typename T , int n, int k> | |
using | stirling_2_t = typename internal::stirling_2_helper< T, n, k >::type |
Stirling number of second king – as types. | |
template<typename T , typename p , size_t n> | |
using | pow_t = typename internal::pow< T, p, n >::type |
p^n (as 'val' type in T) | |
template<typename T , template< typename, size_t index > typename coeff_at, size_t deg> | |
using | taylor = typename internal::make_taylor_impl< T, coeff_at, internal::make_index_sequence_reverse< deg+1 > >::type |
template<typename Integers , size_t deg> | |
using | exp = taylor< Integers, internal::exp_coeff, deg > |
\(e^x\) | |
template<typename Integers , size_t deg> | |
using | expm1 = typename polynomial< FractionField< Integers > >::template sub_t< exp< Integers, deg >, typename polynomial< FractionField< Integers > >::one > |
\(e^x - 1\) | |
template<typename Integers , size_t deg> | |
using | lnp1 = taylor< Integers, internal::lnp1_coeff, deg > |
\(\ln(1+x)\) | |
template<typename Integers , size_t deg> | |
using | atan = taylor< Integers, internal::atan_coeff, deg > |
\(\arctan(x)\) | |
template<typename Integers , size_t deg> | |
using | sin = taylor< Integers, internal::sin_coeff, deg > |
\(\sin(x)\) | |
template<typename Integers , size_t deg> | |
using | sinh = taylor< Integers, internal::sh_coeff, deg > |
\(\sinh(x)\) | |
template<typename Integers , size_t deg> | |
using | cosh = taylor< Integers, internal::cosh_coeff, deg > |
\(\cosh(x)\) hyperbolic cosine | |
template<typename Integers , size_t deg> | |
using | cos = taylor< Integers, internal::cos_coeff, deg > |
\(\cos(x)\) cosinus | |
template<typename Integers , size_t deg> | |
using | geometric_sum = taylor< Integers, internal::geom_coeff, deg > |
\(\frac{1}{1-x}\) zero development of \(\frac{1}{1-x}\) | |
template<typename Integers , size_t deg> | |
using | asin = taylor< Integers, internal::asin_coeff, deg > |
\(\arcsin(x)\) arc sinus | |
template<typename Integers , size_t deg> | |
using | asinh = taylor< Integers, internal::asinh_coeff, deg > |
\(\mathrm{arcsinh}(x)\) arc hyperbolic sinus | |
template<typename Integers , size_t deg> | |
using | atanh = taylor< Integers, internal::atanh_coeff, deg > |
\(\mathrm{arctanh}(x)\) arc hyperbolic tangent | |
template<typename Integers , size_t deg> | |
using | tan = taylor< Integers, internal::tan_coeff, deg > |
\(\tan(x)\) tangent | |
template<typename Integers , size_t deg> | |
using | tanh = taylor< Integers, internal::tanh_coeff, deg > |
\(\tanh(x)\) hyperbolic tangent | |
using | PI_fraction = ContinuedFraction< 3, 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2, 2, 2, 1 > |
using | E_fraction = ContinuedFraction< 2, 1, 2, 1, 1, 4, 1, 1, 6, 1, 1, 8, 1, 1, 10, 1, 1, 12, 1, 1, 14, 1, 1 > |
approximation of \(e\) | |
using | SQRT2_fraction = ContinuedFraction< 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 > |
approximation of \(\sqrt{2}\) | |
using | SQRT3_fraction = ContinuedFraction< 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 > |
approximation of | |
Functions | |
template<typename T > | |
T * | aligned_malloc (size_t count, size_t alignment) |
brief Conway polynomials tparam p characteristic of the | field (prime number) @tparam n degree of extension template< int p |
Variables | |
template<typename T , size_t i> | |
constexpr T::inner_type | factorial_v = internal::factorial<T, i>::value |
computes factorial(i) as value in T | |
template<typename T , size_t k, size_t n> | |
constexpr T::inner_type | combination_v = internal::combination<T, k, n>::value |
computes binomial coefficients (k among n) as value | |
template<typename FloatType , typename T , size_t n> | |
constexpr FloatType | bernoulli_v = internal::bernoulli<T, n>::template value<FloatType> |
nth bernoulli number as value in FloatType | |
template<typename T , size_t k> | |
constexpr T::inner_type | alternate_v = internal::alternate<T, k>::value |
(-1)^k as value from T | |
main namespace for all publicly exposed types or functions
using aerobus::abs_t = typedef std::conditional_t< val::enclosing_type::template pos_v<val>, val, typename val::enclosing_type::template sub_t<typename val::enclosing_type::zero, val> > |
computes absolute value of 'val' val must be a 'value' in a Ring satisfying 'IsEuclideanDomain' concept
val | a value in a RIng, such as i64::val<-2> |
using aerobus::add_t = typedef typename X::enclosing_type::template add_t<X, Y> |
generic addition
X | a value in a ring providing add_t operator |
Y | a value in same ring |
using aerobus::addfractions_t = typedef typename FractionField<Ring>::template add_t<v1, v2> |
helper type : adds two fractions
Ring | |
v1 | belongs to FractionField<Ring> |
v2 | belongs to FranctionField<Ring> |
using aerobus::alternate_t = typedef typename internal::alternate<T, k>::type |
(-1)^k as type in T
T | Ring type, aerobus::i64 for example |
using aerobus::asin = typedef taylor<Integers, internal::asin_coeff, deg> |
\(\arcsin(x)\) arc sinus
Integers | Ring type (for example i64) |
deg | taylor approximation degree |
using aerobus::asinh = typedef taylor<Integers, internal::asinh_coeff, deg> |
\(\mathrm{arcsinh}(x)\) arc hyperbolic sinus
Integers | Ring type (for example i64) |
deg | taylor approximation degree |
using aerobus::atan = typedef taylor<Integers, internal::atan_coeff, deg> |
\(\arctan(x)\)
Integers | Ring type (for example i64) |
deg | taylor approximation degree |
using aerobus::atanh = typedef taylor<Integers, internal::atanh_coeff, deg> |
\(\mathrm{arctanh}(x)\) arc hyperbolic tangent
Integers | Ring type (for example i64) |
deg | taylor approximation degree |
using aerobus::bell_t = typedef typename internal::bell_helper<T, n>::type |
Bell numbers.
T | ring type, such as aerobus::i64 |
n | index |
using aerobus::bernoulli_t = typedef typename internal::bernoulli<T, n>::type |
nth bernoulli number as type in T
T | Ring type (i64) |
n |
using aerobus::combination_t = typedef typename internal::combination<T, k, n>::type |
computes binomial coefficient (k among n) as type
T | Ring type (i32 for example) |
using aerobus::cos = typedef taylor<Integers, internal::cos_coeff, deg> |
\(\cos(x)\) cosinus
Integers | Ring type (for example i64) |
deg | taylor approximation degree |
using aerobus::cosh = typedef taylor<Integers, internal::cosh_coeff, deg> |
\(\cosh(x)\) hyperbolic cosine
Integers | Ring type (for example i64) |
deg | taylor approximation degree |
using aerobus::div_t = typedef typename X::enclosing_type::template div_t<X, Y> |
generic division
X | a value in a a euclidean domain |
Y | a value in same Euclidean domain |
using aerobus::E_fraction = typedef ContinuedFraction<2, 1, 2, 1, 1, 4, 1, 1, 6, 1, 1, 8, 1, 1, 10, 1, 1, 12, 1, 1, 14, 1, 1> |
approximation of \(e\)
using aerobus::embed_int_poly_in_fractions_t = typedef typename Embed< polynomial<typename v::ring_type>, polynomial<FractionField<typename v::ring_type> >>::template type<v> |
embed a polynomial with integers coefficients into rational coefficients polynomials
Lives in polynomial<FractionField<Ring>>
Ring | Integers |
a | value in polynomial<Ring> |
using aerobus::exp = typedef taylor<Integers, internal::exp_coeff, deg> |
\(e^x\)
Integers | Ring type (for example i64) |
deg | taylor approximation degree |
using aerobus::expm1 = typedef typename polynomial<FractionField<Integers> >::template sub_t< exp<Integers, deg>, typename polynomial<FractionField<Integers> >::one> |
\(e^x - 1\)
T | Ring type (for example i64) |
deg | taylor approximation degree |
using aerobus::factorial_t = typedef typename internal::factorial<T, i>::type |
computes factorial(i), as type
T | Ring type (e.g. i32) |
i |
using aerobus::fpq32 = typedef FractionField<polynomial<q32> > |
rational fractions with 32 bits rational coefficients rational fractions with rationals coefficients (32 bits numerator and denominator)
using aerobus::fpq64 = typedef FractionField<polynomial<q64> > |
polynomial with 64 bits rational coefficients
using aerobus::FractionField = typedef typename internal::FractionFieldImpl<Ring>::type |
Fraction field of an euclidean domain, such as Q for Z.
Ring |
using aerobus::gcd_t = typedef typename internal::gcd<T>::template type<A, B> |
computes the greatest common divisor or A and B
T | Ring type (must be euclidean domain) |
using aerobus::geometric_sum = typedef taylor<Integers, internal::geom_coeff, deg> |
\(\frac{1}{1-x}\) zero development of \(\frac{1}{1-x}\)
Integers | Ring type (for example i64) |
deg | taylor approximation degree |
using aerobus::lnp1 = typedef taylor<Integers, internal::lnp1_coeff, deg> |
\(\ln(1+x)\)
T | Ring type (for example i64) |
deg | taylor approximation degree |
using aerobus::make_frac_polynomial_t = typedef typename polynomial<FractionField<Ring> >::template val< typename FractionField<Ring>::template inject_constant_t<xs>...> |
make a polynomial with coefficients in FractionField<Ring>
Ring | integers |
...xs | values |
using aerobus::make_int_polynomial_t = typedef typename polynomial<Ring>::template val< typename Ring::template inject_constant_t<xs>...> |
make a polynomial with coefficients in Ring
Ring | integers |
...xs | coefficients |
using aerobus::make_q32_t = typedef typename q32::template simplify_t< typename q32::val<i32::inject_constant_t<p>, i32::inject_constant_t<q> >> |
helper type : make a fraction from numerator and denominator
p | numerator |
q | denominator |
using aerobus::make_q64_t = typedef typename q64::template simplify_t< typename q64::val<i64::inject_constant_t<p>, i64::inject_constant_t<q> >> |
helper type : make a fraction from numerator and denominator
p | numerator |
q | denominator |
using aerobus::makefraction_t = typedef typename FractionField<Ring>::template val<v1, v2> |
helper type : the rational V1/V2 in the field of fractions of Ring
Ring | the base ring |
v1 | value 1 in Ring |
v2 | value 2 in Ring |
using aerobus::mul_t = typedef typename X::enclosing_type::template mul_t<X, Y> |
generic multiplication
X | a value in a ring providing mul_t operator |
Y | a value in same ring |
using aerobus::mulfractions_t = typedef typename FractionField<Ring>::template mul_t<v1, v2> |
helper type : multiplies two fractions
Ring | |
v1 | belongs to FractionField<Ring> |
v2 | belongs to FranctionField<Ring> |
using aerobus::pi64 = typedef polynomial<i64> |
polynomial with 64 bits integers coefficients
using aerobus::PI_fraction = typedef ContinuedFraction<3, 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2, 2, 2, 1> |
representation of \(\pi\) as a continued fraction
using aerobus::pow_t = typedef typename internal::pow<T, p, n>::type |
p^n (as 'val' type in T)
T | (some ring type, such as aerobus::i64) |
p | must be an instantiation of T::val |
n | power |
using aerobus::pq64 = typedef polynomial<q64> |
polynomial with 64 bits rationals coefficients
using aerobus::q32 = typedef FractionField<i32> |
32 bits rationals rationals with 32 bits numerator and denominator
using aerobus::q64 = typedef FractionField<i64> |
64 bits rationals rationals with 64 bits numerator and denominator
using aerobus::sin = typedef taylor<Integers, internal::sin_coeff, deg> |
\(\sin(x)\)
Integers | Ring type (for example i64) |
deg | taylor approximation degree |
using aerobus::sinh = typedef taylor<Integers, internal::sh_coeff, deg> |
\(\sinh(x)\)
Integers | Ring type (for example i64) |
deg | taylor approximation degree |
using aerobus::SQRT2_fraction = typedef ContinuedFraction<1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2> |
approximation of \(\sqrt{2}\)
using aerobus::SQRT3_fraction = typedef ContinuedFraction<1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2> |
approximation of
using aerobus::stirling_1_signed_t = typedef typename internal::stirling_1_helper<T, n, k>::type |
Stirling number of first king (signed) – as types.
T | (ring type, such as aerobus::i64) |
n | (integer) |
k | (integer) |
using aerobus::stirling_1_unsigned_t = typedef abs_t<typename internal::stirling_1_helper<T, n, k>::type> |
Stirling number of first king (unsigned) – as types.
T | (ring type, such as aerobus::i64) |
n | (integer) |
k | (integer) |
using aerobus::stirling_2_t = typedef typename internal::stirling_2_helper<T, n, k>::type |
Stirling number of second king – as types.
T | (ring type, such as aerobus::i64) |
n | (integer) |
k | (integer) |
using aerobus::sub_t = typedef typename X::enclosing_type::template sub_t<X, Y> |
generic subtraction
X | a value in a ring providing sub_t operator |
Y | a value in same ring |
using aerobus::tan = typedef taylor<Integers, internal::tan_coeff, deg> |
\(\tan(x)\) tangent
Integers | Ring type (for example i64) |
deg | taylor approximation degree |
using aerobus::tanh = typedef taylor<Integers, internal::tanh_coeff, deg> |
\(\tanh(x)\) hyperbolic tangent
Integers | Ring type (for example i64) |
deg | taylor approximation degree |
using aerobus::taylor = typedef typename internal::make_taylor_impl< T, coeff_at, internal::make_index_sequence_reverse<deg + 1> >::type |
T | Used Ring type (aerobus::i64 for example) |
coeff_at | - implementation giving the 'value' (seen as type in FractionField<T> |
deg |
using aerobus::vadd_t = typedef typename internal::vadd<vals...>::type |
adds multiple values (v1 + v2 + ... + vn) vals must have same "enclosing_type" and "enclosing_type" must have an add_t binary operator
...vals |
using aerobus::vmul_t = typedef typename internal::vmul<vals...>::type |
multiplies multiple values (v1 + v2 + ... + vn) vals must have same "enclosing_type" and "enclosing_type" must have an mul_t binary operator
...vals |
T * aerobus::aligned_malloc | ( | size_t | count, |
size_t | alignment | ||
) |
'portable' aligned allocation of count elements of type T
T | the type of elements to store |
count | the number of elements |
alignment | boundary |
brief Conway polynomials tparam p characteristic of the aerobus::field | ( | prime | number | ) |
|
inlineconstexpr |
(-1)^k as value from T
T | Ring type, aerobus::i64 for example, then result will be an int64_t |
|
inlineconstexpr |
nth bernoulli number as value in FloatType
FloatType | (double or float for example) |
T | (aerobus::i64 for example) |
n |
|
inlineconstexpr |
computes binomial coefficients (k among n) as value
T | (aerobus::i32 for example) |
k | |
n |
|
inlineconstexpr |
computes factorial(i) as value in T
T | (aerobus::i64 for example) |
i |