|
SUNphi
1.0
|
Defines several template version of simple arithmetic operations. More...
#include <debug/OptimizationDiagnostic.hpp>Go to the source code of this file.
Functions | |
| template<typename T > | |
| T | SUNphi::safeModulo (const T &val, const T &mod) |
| template<typename T > | |
| T | SUNphi::sqr (const T &x) |
| Square of a number. | |
| template<typename T > | |
| T | SUNphi::sign (const T &x) |
| Sign of a number, +1 0 or -1. | |
| template<typename I1 , typename I2 > | |
| auto | SUNphi::greatestCommonDivisor (const I1 &_a, const I2 &_b) |
| Return greatest common divisor between a and b. More... | |
| template<typename I1 , typename I2 > | |
| auto | SUNphi::leastCommonMultiple (const I1 &a, const I2 &b) |
Return least common multiple between a and b. | |
Defines several template version of simple arithmetic operations.
Definition in file Arithmetic.hpp.
| auto SUNphi::greatestCommonDivisor | ( | const I1 & | _a, |
| const I2 & | _b | ||
| ) |
Return greatest common divisor between a and b.
Inner type to be used
Cast to I of _a
Cast to I of _b
Store temporarily a
Definition at line 71 of file Arithmetic.hpp.
| T SUNphi::safeModulo | ( | const T & | val, |
| const T & | mod | ||
| ) |
Modulo operator, based on remainder operator %
Valid on negative and positive numbers
Example:
Remainder
| val | Value of which to take the modulo |
| mod | Modulo |
Definition at line 26 of file Arithmetic.hpp.