Declaration of numerical utilities.
Definition in file numutils.hpp.
#include <medusa/Config.hpp>
#include <medusa/bits/utils/assert.hpp>
#include <medusa/bits/types/Vec.hpp>
#include <medusa/bits/types/Range.hpp>
#include <cmath>
Go to the source code of this file.
Namespaces | |
mm | |
Root namespace for the whole library. | |
Functions | |
template<typename T > | |
int | mm::iceil (T x) |
Ceils a floating point to an integer. More... | |
template<typename T > | |
int | mm::ifloor (T x) |
Floors a floating point to an integer. More... | |
template<unsigned int exponent> | |
double | mm::ipow (double base) |
Compile time integer power, returns base raised to power exponent . More... | |
template<> | |
double | mm::ipow< 0 > (double) |
Compile time integer power (base case 0) More... | |
template<typename T > | |
T | mm::ipow (T b, int e) |
Compute non-negative integer power b^e . More... | |
template<typename T > | |
T | mm::ipowneg (T b, int e) |
Compute possibly negative integer power b^e . More... | |
template<typename T > | |
constexpr int | mm::signum (T x, std::false_type) |
Signum overload for unsigned types. More... | |
template<typename T > | |
constexpr int | mm::signum (T x, std::true_type) |
Signum overload for unsigned types. More... | |
template<typename T > | |
constexpr int | mm::signum (T x) |
Signum function: determines a sign of a number x . More... | |
template<int dim> | |
bool | mm::incrementCounter (Vec< int, dim > &counter, const Vec< int, dim > &limit) |
Increments a multi-dimensional counter with given limits. More... | |
template<int dim> | |
bool | mm::incrementCounter (Vec< int, dim > &counter, const Vec< int, dim > &low, const Vec< int, dim > &high) |
Increments a multi-dimensional counter with given upper and lower limits. More... | |
template<int dim> | |
bool | mm::incrementCyclicCounter (Vec< int, dim > &counter, const Vec< int, dim > &low, const Vec< int, dim > &high, const Vec< int, dim > &size) |
Increments a multi-dimensional counter with given upper and lower limits and global upper size, looping around to 0 if needed. More... | |
template<class scalar_t , int dim> | |
Range< Vec< scalar_t, dim > > | mm::linspace (const Vec< scalar_t, dim > &beg, const Vec< scalar_t, dim > &end, const Vec< int, dim > &counts, const Vec< bool, dim > include_boundary=true) |
Multidimensional clone of Matlab's linspace function. More... | |
template<class scalar_t , int dim> | |
Range< Vec< scalar_t, dim > > | mm::linspace (const Vec< scalar_t, dim > &beg, const Vec< scalar_t, dim > &end, const Vec< int, dim > &counts, bool include_boundary) |
Overload for bool argument of include_boundary . More... | |
template<typename scalar_t > | |
Range< scalar_t > | mm::linspace (scalar_t beg, scalar_t end, int count, bool include_boundary=true) |
Overload for 1 dimension. More... | |
template<typename function_t , typename input_t , typename output_t , bool verbose = false> | |
input_t | mm::bisection (const function_t &f, input_t lo, input_t hi, output_t target=0.0, input_t tolerance=1e-4, int max_iter=40) |
Solves f(x) = target using bisection. More... | |