Leonardus
|
Collection of numeric algorithms. More...
Functions | |
__int128 | xgcd (__int128 p_a, __int128 p_b, __int128 &p_s, __int128 &p_t) |
Extended Euclidean algorithm. More... | |
bool | isint128 (std::string p_str) |
Is the string a 128 bit integer. More... | |
bool | isint128 (const mpz_t p_x) |
Is the multiple precision integer a 128 bit integer. More... | |
int32_t | rand (uint32_t *seed) |
ISO C rand_r() for 32 bit. More... | |
Collection of numeric algorithms.
bool algo::isint128 | ( | const mpz_t | p_x | ) |
Is the multiple precision integer a 128 bit integer.
[in] | p_x | mpz_t to check |
bool algo::isint128 | ( | std::string | p_str | ) |
Is the string a 128 bit integer.
[in] | p_str | String to check |
int32_t algo::rand | ( | uint32_t * | seed | ) |
ISO C rand_r() for 32 bit.
[in,out] | seed | ... random generator seed. |
__int128 algo::xgcd | ( | __int128 | p_a, |
__int128 | p_b, | ||
__int128 & | p_s, | ||
__int128 & | p_t | ||
) |
Extended Euclidean algorithm.
Calculates the gcd of both input integers and additionally calculates a pair of Bézout coefficients s and t such that gcd(a,b) = s*a + t*b.
[in] | p_a | first input number |
[in] | p_b | second input number |
[out] | p_s | a Bézout coefficient of p_a |
[out] | p_t | a Bézout coefficient of p_b |