#include <ogdf/basic/Math.h>
|
| static int | binomial (int n, int k) |
| | Returns \(n \choose k\). More...
|
| |
| static double | binomial_d (int n, int k) |
| | Returns \(n \choose k\). More...
|
| |
| static int | factorial (int n) |
| | Returns n!. More...
|
| |
| static double | factorial_d (int n) |
| | Returns n!. More...
|
| |
| static int | floorLog2 (int v) |
| | A method to obtain the rounded down binary logarithm of an 32-bit integer. More...
|
| |
| template<typename T > |
| static T | gcd (T a, T b) |
| | Returns the greatest common divisor of two numbers. More...
|
| |
| template<class T , class INDEX = int> |
| static T | gcd (const Array< T, INDEX > &numbers) |
| | Returns the greatest common divisor of a list of numbers. More...
|
| |
| static void | getFraction (double d, int &num, int &denom, const double epsilon=5e-10, const int count=10) |
| | Converts a double to a fraction. More...
|
| |
| static double | harmonic (unsigned n) |
| | Returns the n-th harmonic number or 1.0 if n < 1. More...
|
| |
| template<typename T > |
| static T | lcm (T a, T b) |
| | Returns the least common multipler of two numbers. More...
|
| |
| template<typename T > |
| static T | log2 (T x) |
| | Returns the logarithm of x to the base 2. More...
|
| |
| static double | log4 (double x) |
| | Returns the logarithm of x to the base 4. More...
|
| |
| template<typename T > |
| static int | sgn (T val) |
| | Returns +1 for val > 0, 0 for val = 0, and -1 for val < 0. More...
|
| |
|
| static const double | gamma |
| | The Euler-Mascheroni constant gamma. More...
|
| |
| static const double | log_of_4 |
| | The constant log(4.0). More...
|
| |
| static const double | pi |
| | The constant \(\pi\). More...
|
| |
| static const double | pi_2 |
| | The constant \(\frac{\pi}{2}\). More...
|
| |
Definition at line 42 of file Math.h.
◆ binomial()
| static int ogdf::Math::binomial |
( |
int |
n, |
|
|
int |
k |
|
) |
| |
|
static |
◆ binomial_d()
| static double ogdf::Math::binomial_d |
( |
int |
n, |
|
|
int |
k |
|
) |
| |
|
static |
◆ factorial()
| static int ogdf::Math::factorial |
( |
int |
n | ) |
|
|
inlinestatic |
◆ factorial_d()
| static double ogdf::Math::factorial_d |
( |
int |
n | ) |
|
|
inlinestatic |
◆ floorLog2()
| static int ogdf::Math::floorLog2 |
( |
int |
v | ) |
|
|
inlinestatic |
A method to obtain the rounded down binary logarithm of an 32-bit integer.
- Parameters
-
| v | The number of which the binary logarithm is to be determined |
- Returns
- The rounded down logarithm base 2 if v is positive, -1 otherwise
- Deprecated:
- "Use std::ilogb(v)."
Definition at line 107 of file Math.h.
◆ gcd() [1/2]
template<typename T >
| static T ogdf::Math::gcd |
( |
T |
a, |
|
|
T |
b |
|
) |
| |
|
inlinestatic |
Returns the greatest common divisor of two numbers.
Definition at line 117 of file Math.h.
◆ gcd() [2/2]
template<class T , class INDEX = int>
| static T ogdf::Math::gcd |
( |
const Array< T, INDEX > & |
numbers | ) |
|
|
inlinestatic |
Returns the greatest common divisor of a list of numbers.
Definition at line 130 of file Math.h.
◆ getFraction()
| static void ogdf::Math::getFraction |
( |
double |
d, |
|
|
int & |
num, |
|
|
int & |
denom, |
|
|
const double |
epsilon = 5e-10, |
|
|
const int |
count = 10 |
|
) |
| |
|
inlinestatic |
Converts a double to a fraction.
Definition at line 147 of file Math.h.
◆ harmonic()
| static double ogdf::Math::harmonic |
( |
unsigned |
n | ) |
|
|
static |
Returns the n-th harmonic number or 1.0 if n < 1.
◆ lcm()
template<typename T >
| static T ogdf::Math::lcm |
( |
T |
a, |
|
|
T |
b |
|
) |
| |
|
inlinestatic |
Returns the least common multipler of two numbers.
Definition at line 140 of file Math.h.
◆ log2()
template<typename T >
| static T ogdf::Math::log2 |
( |
T |
x | ) |
|
|
inlinestatic |
Returns the logarithm of x to the base 2.
- Deprecated:
- "Use std::log2(x)."
Definition at line 60 of file Math.h.
◆ log4()
| static double ogdf::Math::log4 |
( |
double |
x | ) |
|
|
inlinestatic |
Returns the logarithm of x to the base 4.
Definition at line 66 of file Math.h.
◆ sgn()
template<typename T >
| static int ogdf::Math::sgn |
( |
T |
val | ) |
|
|
inlinestatic |
Returns +1 for val > 0, 0 for val = 0, and -1 for val < 0.
Definition at line 73 of file Math.h.
◆ gamma
| const double ogdf::Math::gamma |
|
static |
The Euler-Mascheroni constant gamma.
Definition at line 55 of file Math.h.
◆ log_of_4
| const double ogdf::Math::log_of_4 |
|
static |
The constant log(4.0).
Definition at line 52 of file Math.h.
◆ pi
| const double ogdf::Math::pi |
|
static |
The constant \(\pi\).
Definition at line 46 of file Math.h.
◆ pi_2
| const double ogdf::Math::pi_2 |
|
static |
The constant \(\frac{\pi}{2}\).
Definition at line 49 of file Math.h.
The documentation for this class was generated from the following file: