stator
A math, geometry, and utility library
Classes | Namespaces | Typedefs | Functions
constants.hpp File Reference
#include <ratio>

Go to the source code of this file.

Classes

struct  sym::C< Num, Denom >
 A class representing a compile-time rational constant (i.e., std::ratio). More...
 
struct  sym::detail::C_wrap< stdratio >
 Conversion operator from std::ratio to C. More...
 
struct  sym::Factorial< i >
 Symbolic Factorial function. More...
 
struct  sym::Factorial< 0 >
 
struct  sym::Factorial< 1 >
 
struct  sym::InvFactorial< i >
 Symbolic Inverse factorial function. More...
 
struct  sym::is_C< T >
 Compile time type-test for compile-time constants C. More...
 
struct  sym::is_C< C< N, D > >
 
struct  sym::is_whole_factor< C_arg, factor, offset >
 

Namespaces

 sym
 The stator symbolic math library.
 
 sym::detail
 Namespace containing the details of the implmentation for general stator components.
 

Typedefs

typedef detail::C_wrap< stator::constant_ratio::e >::type sym::e
 A symbolic/compile-time rational approximation of $\mathrm{e}$. More...
 
typedef C< 0 > sym::Null
 A symbolic representation of zero. More...
 
typedef detail::C_wrap< stator::constant_ratio::pi >::type sym::pi
 A symbolic/compile-time rational approximation of $\pi$. More...
 
typedef C< 1 > sym::Unity
 A symbolic representation of one. More...
 

Functions

template<std::intmax_t num, std::intmax_t den>
constexpr C<(1 - 2 *(num< 0)) *num,(1 - 2 *(den< 0)) *den > sym::abs (const C< num, den > &a)
 
template<std::intmax_t num, std::intmax_t den>
auto sym::cos (const C< num, den > &a) -> STATOR_AUTORETURN(cos_Cimpl(a, detail::select_overload
 
template<std::intmax_t num, std::intmax_t den, typename = typename std::enable_if<is_whole_factor<std::ratio<num, den>, pi>::value>::type>
constexpr Unity sym::cos_Cimpl (const C< num, den > &a, detail::choice< 0 >)
 
template<std::intmax_t num, std::intmax_t den, typename = typename std::enable_if<is_whole_factor<std::ratio<num, den>, pi, decltype(pi() / C<2>())>::value>::type>
constexpr Null sym::cos_Cimpl (const C< num, den > &a, detail::choice< 0 >)
 
template<std::intmax_t n1, std::intmax_t d1, std::intmax_t n2, std::intmax_t d2>
constexpr auto sym::operator* (C< n1, d1 >, C< n2, d2 >) -> STATOR_AUTORETURN((typename detail::C_wrap< std::ratio_multiply< std::ratio< n1, d1 >, std::ratio< n2, d2 > > >::type()))
 
template<class T , typename = typename std::enable_if<!is_C<T>::value>::type>
Null sym::operator* (const T &, Null)
 
template<class T , typename = typename std::enable_if<!is_C<T>::value>::type>
Null sym::operator* (Null, const T &)
 
template<class T , typename = typename std::enable_if<!is_C<T>::value>::type>
auto sym::operator* (const T &a, Unity) -> STATOR_AUTORETURN(a)
 
template<class T , typename = typename std::enable_if<!is_C<T>::value>::type>
auto sym::operator* (Unity, const T &a) -> STATOR_AUTORETURN(a)
 
template<std::intmax_t n1, std::intmax_t d1, std::intmax_t n2, std::intmax_t d2>
constexpr auto sym::operator+ (C< n1, d1 >, C< n2, d2 >) -> STATOR_AUTORETURN((typename detail::C_wrap< std::ratio_add< std::ratio< n1, d1 >, std::ratio< n2, d2 > > >::type()))
 
template<class T , typename = typename std::enable_if<!is_C<T>::value>::type>
sym::operator+ (const T &l, Null)
 
template<class T , typename = typename std::enable_if<!is_C<T>::value>::type>
sym::operator+ (Null, const T &r)
 
template<std::intmax_t n1, std::intmax_t d1, std::intmax_t n2, std::intmax_t d2>
constexpr auto sym::operator- (C< n1, d1 >, C< n2, d2 >) -> STATOR_AUTORETURN((typename detail::C_wrap< std::ratio_subtract< std::ratio< n1, d1 >, std::ratio< n2, d2 > > >::type()))
 
template<class T , typename = typename std::enable_if<!is_C<T>::value>::type>
sym::operator- (const T &l, Null)
 
template<class T , typename = typename std::enable_if<!is_C<T>::value>::type>
auto sym::operator- (Null, const T &r) -> STATOR_AUTORETURN(-r)
 
template<std::intmax_t n1, std::intmax_t d1, std::intmax_t n2, std::intmax_t d2>
constexpr auto sym::operator/ (C< n1, d1 >, C< n2, d2 >) -> STATOR_AUTORETURN((typename detail::C_wrap< std::ratio_divide< std::ratio< n1, d1 >, std::ratio< n2, d2 > > >::type()))
 
template<std::intmax_t Num, std::intmax_t Denom>
std::ostream & sym::operator<< (std::ostream &os, const C< Num, Denom >)
 Output operator for compile-time constant (C types). More...
 
std::ostream & sym::operator<< (std::ostream &os, const C< 1, 4 >)
 Output operator specialised for one quarter. More...
 
std::ostream & sym::operator<< (std::ostream &os, const C< 1, 2 >)
 Output operator specialised for one half. More...
 
std::ostream & sym::operator<< (std::ostream &os, const C< 3, 4 >)
 Output operator specialised for three quarters. More...
 
std::ostream & sym::operator<< (std::ostream &os, const pi)
 Specialized output operator for $\pi$. More...
 
template<class T >
std::ostream & sym::operator<< (std::ostream &os, const std::complex< T > &c)
 
template<std::intmax_t n1, std::intmax_t d1, std::intmax_t n2, std::intmax_t d2>
constexpr bool sym::operator== (const C< n1, d1 > &, const C< n2, d2 > &)
 
template<std::intmax_t num, std::intmax_t den>
auto sym::sin (const C< num, den > &a) -> STATOR_AUTORETURN(sin_Cimpl(a, detail::select_overload
 
template<std::intmax_t num, std::intmax_t den, typename = typename std::enable_if<is_whole_factor<std::ratio<num, den>, pi>::value>::type>
constexpr Null sym::sin_Cimpl (const C< num, den > &a, detail::choice< 0 >)
 
template<std::intmax_t num, std::intmax_t den, typename = typename std::enable_if<is_whole_factor<std::ratio<num, den>, pi, decltype(pi() / C<2>())>::value>::type>
constexpr Unity sym::sin_Cimpl (const C< num, den > &a, detail::choice< 0 >)