xerus
a general purpose tensor library
math.h File Reference

Header file for some additional math functions. More...

#include <limits>
#include <cmath>
#include "standard.h"
#include "sfinae.h"

Go to the source code of this file.

Namespaces

 xerus
 The main namespace of xerus.
 
 xerus::misc
 Collection of classes and functions that provide elementary functionality that is not special to xerus as a tensor library.
 

Functions

template<class T , typename std::enable_if< std::is_floating_point< T >::value, bool >::type = true>
bool xerus::misc::approx_equal (T _a, T _b, T _eps=4 *std::numeric_limits< T >::epsilon()) noexcept
 : Checks whether the relative difference between _a and _b (i.e. |a-b|/(|a|/2+|b|/2)) is smaller than _eps. More...
 
template<class T , typename std::enable_if<!std::is_floating_point< T >::value, bool >::type = true>
bool xerus::misc::approx_equal (T _a, T _b)
 : Checks whether _a and _b are equal (for non floating point types). More...
 
template<class T >
constexpr bool xerus::misc::hard_equal (const T _a, const T _b) noexcept
 : Checks for hard equality ( == operator) without compiler warnings. More...
 
template<class T >
constexpr bool xerus::misc::hard_not_equal (const T _a, const T _b) noexcept
 : Checks for hard inequality ( != operator) without compiler warnings. More...
 
template<class T >
constexpr T xerus::misc::pow (const T &_base, const uint32 _exp) noexcept
 : Calculates _base^_exp by binary exponentiation More...
 
template<class T >
constexpr T xerus::misc::pow (const T &_base, const uint64 _exp) noexcept
 : Calculates _base^_exp by binary exponentiation More...
 
template<class T >
constexpr T xerus::misc::pow (const T &_base, const int64 _exp) noexcept
 : Calculates _base^_exp by binary exponentiation More...
 
template<class T >
constexpr T xerus::misc::pow (const T &_base, const int32 _exp) noexcept
 : Calculates _base^_exp by binary exponentiation More...
 
template<class T >
constexpr int xerus::misc::sgn (const T _value) noexcept
 : Calculates the signum (-1, 0, 1) of a given value. More...
 
template<class T >
constexpr T xerus::misc::sqr (const T &_a) noexcept
 : Calculates _a*_a. More...
 

Detailed Description

Header file for some additional math functions.

Definition in file math.h.