Vulpes  0.1.0
Versatile and parallel compUtational Library for high-order discontinuous Polytopal Element Simulations
Loading...
Searching...
No Matches
vmath.hpp File Reference
#include <gmpxx.h>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <type_traits>
#include <Eigen/Dense>
Include dependency graph for vmath.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  vulpes::vmath::is_gnump< T >
 Type trait to check if a type is one of the GNU Multiple Precision (GMP) classes (mpf_class, mpq_class, or mpz_class). More...
struct  vulpes::vmath::is_pseudoaritmetic< T >
 Type trait to check if a type is either a GMP class or a built-in arithmetic type. More...
struct  vulpes::vmath::is_pseudofloating< T >
 Type trait to check if a type is either the GMP floating-point class (mpf_class) or a built-in floating-point type. More...

Namespaces

namespace  vulpes
namespace  vulpes::vmath

Functions

template<typename U, typename V, typename = std::enable_if_t<std::is_unsigned_v<V> && std::is_integral_v<V>>>
constexpr U vulpes::vmath::upow (U base, V exp, U result=U(1))
 Computes the unsigned power of a number.
template<typename U, typename V, typename = std::enable_if_t<std::is_signed_v<V> && std::is_integral_v<V>>>
constexpr U vulpes::vmath::ipow (U base, V exp, U result=U(1))
 Computes the signed power of a number.
template<typename U, typename V, typename = std::enable_if_t<std::is_integral_v<V>>>
constexpr U vulpes::vmath::pow (U base, V exp, U result=U(1))
 Computes the power of a number.
template<typename T, typename = std::enable_if_t<is_pseudoaritmetic<T>::value>>
T vulpes::vmath::abs (const T &value)
 Computes the absolute value of a number.
template<typename T, typename = std::enable_if_t<is_pseudoaritmetic<T>::value>>
T vulpes::vmath::sqrt (const T &value)
template<typename T, typename = std::enable_if_t<is_pseudofloating<T>::value>>
constexpr T vulpes::vmath::pi ()
 Returns the value of pi.
template<typename T, typename = std::enable_if_t<is_pseudofloating<T>::value>>
constexpr T vulpes::vmath::epsilon (const T &instance=T(0))
 Returns the machine epsilon for floating-point types or a rough approximation for GMP types.
template<typename T, typename = std::enable_if_t<is_pseudofloating<T>::value>>
std::size_t vulpes::vmath::precision (const T &instance)
 Returns the precision of the input value in bits.
template<typename V, typename U, typename = std::enable_if_t< is_pseudoaritmetic<U>::value && is_pseudoaritmetic<V>::value>>
V vulpes::vmath::to (const U &src)
 Converts a value of one pseudo-arithmetic type to another.
template<typename T, typename = std::enable_if_t<is_pseudoaritmetic<T>::value>>
constexpr T vulpes::vmath::factorial (T n)
 Computes the factorial of a pseudo-arithmetic number iteratively.
template<typename T, typename = std::enable_if_t<is_pseudoaritmetic<T>::value>>
T vulpes::vmath::gamma (const T &value)
template<typename T, typename = std::enable_if_t<std::is_integral_v<T>>>
constexpr int64_t vulpes::vmath::pow1 (T exp)
 Computes (-1)^exp.
template<typename T, typename = std::enable_if_t<std::is_integral_v<T>>>
constexpr T vulpes::vmath::binomial (T n, T k)
template<typename T, int Options>
T vulpes::vmath::sarrus_det (const Eigen::Matrix< T, 3, 3, Options > &mat)
 Computes the determinant of a 3x3 matrix using Sarrus' rule.
template<typename T, int Dim, int Options>
T vulpes::vmath::determinant (const Eigen::Matrix< T, Dim, Dim, Options > &mat)
 Computes the determinant of a 2x2 or 3x3 matrix.
template<typename T, int Dim, int Options>
T vulpes::vmath::area (const Eigen::Matrix< T, Dim, Dim - 1, Options > &mat)
template<typename FloatType, typename IndexType>
void vulpes::vmath::newellNormal (const FloatType *vertices_data, const IndexType *face_indices_data, IndexType num_face_vertices, FloatType *out_normal)
 Accumulates the unnormalized normal of a polygon using Newell's method.