43template<
typename T,
int size>
44inline typename std::enable_if<size == 1, T>::type
nextPower2(T x) {
50template<
typename T,
int size>
51inline typename std::enable_if<size != 1, T>::type
nextPower2(T x) {
53 return x | (x >> size / 2);
59constexpr double pi = 3.14159265358979323846;
62constexpr double pi_2 = 1.57079632679489661923;
65constexpr double pi_180 = 0.01745329251994329576;
68constexpr double one_rad = 57.29577951308232087679;
74constexpr double gamma = 0.57721566490153286061;
79 return internal::nextPower2<T, sizeof(T) * 8>(x - 1) + 1;
83template<
typename T,
typename...
Args>
121 return (T(0) <
val) - (
val < T(0));
165 return std::ilogb(v);
182template<
class T,
class INDEX =
int>
201 const int count = 10) {
209 while (
d > epsilon && i++ <
count) {
221 std::swap(num,
denom);
227template<
class Container>
234template<
class Container>
241template<
class Container>
244 static_cast<typename Container::value_type
>(0));
248template<
class Container>
256template<
class Container>
260 for (
auto value :
values) {
261 double d = value -
mean;
268template<
class Container>
Declaration and implementation of Array class and Array algorithms.
Basic declarations, included by all source files.
An array that keeps track of the number of inserted elements; also usable as an efficient stack.
The parameterized class Array implements dynamic arrays of type E.
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
#define OGDF_DEPRECATED(reason)
Mark a class / member / function as deprecated.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
std::enable_if< size==1, T >::type nextPower2(T x)
double harmonic(unsigned n)
Returns the n-th harmonic number or 1.0 if n < 1.
void updateMin(T &min, const T &newValue)
Stores the minimum of min and newValue in min.
const double log_of_4
The constant log(4.0).
double standardDeviation(const Container &values, double mean)
Returns the standard deviation of an iterable container of given values.
constexpr double gamma
The Euler-Mascheroni constant gamma.
int floorLog2(int v)
A method to obtain the rounded down binary logarithm of v.
constexpr double pi
The constant .
constexpr double pi_180
The constant .
T lcm(T a, T b)
Returns the least common multipler of two numbers.
int sgn(T val)
Returns +1 for val > 0, 0 for val = 0, and -1 for val < 0.
double log4(double x)
Returns the logarithm of x to the base 4.
int factorial(int n)
Returns n!.
T gcd(T a, T b)
Returns the greatest common divisor of two numbers.
double degreesToRadians(const double &angleInDegrees)
Converts an angle from degrees to radians.
void updateMax(T &max, const T &newValue)
Stores the maximum of max and newValue in max.
Container::value_type minValue(const Container &values)
Returns the minimum of an iterable container of given values.
T log2(T x)
Returns the logarithm of x to the base 2.
constexpr double one_rad
The constant .
double binomial_d(int n, int k)
Returns .
constexpr double pi_2
The constant .
void getFraction(double d, int &num, int &denom, const double epsilon=5e-10, const int count=10)
Converts a double to a fraction.
int binomial(int n, int k)
Returns .
double factorial_d(int n)
Returns n!.
double radiansToDegrees(const double &angleInRadians)
Converts an angle from radians to degrees.
Container::value_type maxValue(const Container &values)
Returns the maximum of an iterable container of given values.
T nextPower2(T x)
Returns the smallest power of 2 that is no less than the given (integral) argument.
double mean(const Container &values)
Returns the mean of an iterable container of given values.
The namespace for all OGDF objects.