Aerobus v1.2
Loading...
Searching...
No Matches
Classes | Public Types | Static Public Member Functions | Static Public Attributes | List of all members
aerobus::polynomial< Ring >::val< coeffN, coeffs > Struct Template Reference

values (seen as types) in polynomial ring More...

#include <aerobus.h>

Public Types

using ring_type = Ring
 ring coefficients live in
 
using enclosing_type = polynomial< Ring >
 enclosing ring type
 
using aN = coeffN
 heavy weight coefficient (non zero)
 
using strip = val< coeffs... >
 remove largest coefficient
 
using is_zero_t = std::bool_constant<(degree==0) &&(aN::is_zero_t::value)>
 true_type if polynomial is constant zero
 
template<size_t index>
using coeff_at_t = typename coeff_at< index >::type
 type of coefficient at index
 
template<typename x >
using value_at_t = horner_reduction_t< val > ::template inner< 0, degree+1 > ::template type< typename Ring::zero, x >
 

Static Public Member Functions

static std::string to_string ()
 get a string representation of polynomial
 
template<typename arithmeticType >
static constexpr DEVICE INLINED arithmeticType eval (const arithmeticType &x)
 evaluates polynomial seen as a function operating on arithmeticType
 
template<typename arithmeticType >
static DEVICE INLINED arithmeticType compensated_eval (const arithmeticType &x)
 Evaluate polynomial on x using compensated horner scheme.
 

Static Public Attributes

static constexpr size_t degree = sizeof...(coeffs)
 degree of the polynomial
 
static constexpr bool is_zero_v = is_zero_t::value
 true if polynomial is constant zero
 

Detailed Description

template<typename Ring>
template<typename coeffN, typename... coeffs>
struct aerobus::polynomial< Ring >::val< coeffN, coeffs >

values (seen as types) in polynomial ring

Template Parameters
coeffNhigh degree coefficient
...coeffslower degree coefficients
Examples
examples/compensated_horner.cpp.

Member Typedef Documentation

◆ aN

template<typename Ring >
template<typename coeffN , typename... coeffs>
using aerobus::polynomial< Ring >::val< coeffN, coeffs >::aN = coeffN

heavy weight coefficient (non zero)

◆ coeff_at_t

template<typename Ring >
template<typename coeffN , typename... coeffs>
template<size_t index>
using aerobus::polynomial< Ring >::val< coeffN, coeffs >::coeff_at_t = typename coeff_at<index>::type

type of coefficient at index

Template Parameters
index

◆ enclosing_type

template<typename Ring >
template<typename coeffN , typename... coeffs>
using aerobus::polynomial< Ring >::val< coeffN, coeffs >::enclosing_type = polynomial<Ring>

enclosing ring type

◆ is_zero_t

template<typename Ring >
template<typename coeffN , typename... coeffs>
using aerobus::polynomial< Ring >::val< coeffN, coeffs >::is_zero_t = std::bool_constant<(degree == 0) && (aN::is_zero_t::value)>

true_type if polynomial is constant zero

◆ ring_type

template<typename Ring >
template<typename coeffN , typename... coeffs>
using aerobus::polynomial< Ring >::val< coeffN, coeffs >::ring_type = Ring

ring coefficients live in

◆ strip

template<typename Ring >
template<typename coeffN , typename... coeffs>
using aerobus::polynomial< Ring >::val< coeffN, coeffs >::strip = val<coeffs...>

remove largest coefficient

◆ value_at_t

template<typename Ring >
template<typename coeffN , typename... coeffs>
template<typename x >
using aerobus::polynomial< Ring >::val< coeffN, coeffs >::value_at_t = horner_reduction_t<val> ::template inner<0, degree + 1> ::template type<typename Ring::zero, x>

Member Function Documentation

◆ compensated_eval()

template<typename Ring >
template<typename coeffN , typename... coeffs>
template<typename arithmeticType >
static DEVICE INLINED arithmeticType aerobus::polynomial< Ring >::val< coeffN, coeffs >::compensated_eval ( const arithmeticType &  x)
inlinestatic

Evaluate polynomial on x using compensated horner scheme.

This is twice as accurate as simple eval (horner) but cannot be constexpr

Please note this makes no sense on integer types as arithmetic on integers is exact in IEEE

WARNING : this does not work with gcc with -O3 optimization level because gcc does illegal stuff with floating point arithmetic

Template Parameters
arithmeticTypefloat for example
Parameters
x

◆ eval()

template<typename Ring >
template<typename coeffN , typename... coeffs>
template<typename arithmeticType >
static constexpr DEVICE INLINED arithmeticType aerobus::polynomial< Ring >::val< coeffN, coeffs >::eval ( const arithmeticType &  x)
inlinestaticconstexpr

evaluates polynomial seen as a function operating on arithmeticType

Template Parameters
arithmeticTypeusually float or double
Parameters
xvalue
Returns
P(x)

◆ to_string()

template<typename Ring >
template<typename coeffN , typename... coeffs>
static std::string aerobus::polynomial< Ring >::val< coeffN, coeffs >::to_string ( )
inlinestatic

get a string representation of polynomial

Returns
something like a_n X^n + ... + a_1 X + a_0

Member Data Documentation

◆ degree

template<typename Ring >
template<typename coeffN , typename... coeffs>
constexpr size_t aerobus::polynomial< Ring >::val< coeffN, coeffs >::degree = sizeof...(coeffs)
staticconstexpr

degree of the polynomial

◆ is_zero_v

template<typename Ring >
template<typename coeffN , typename... coeffs>
constexpr bool aerobus::polynomial< Ring >::val< coeffN, coeffs >::is_zero_v = is_zero_t::value
staticconstexpr

true if polynomial is constant zero


The documentation for this struct was generated from the following file: