35# include <gtest/gtest.h>
43#if defined(__SIZEOF_INT128__)
50 static_assert(
kCtx3.mod() == 3);
51 static_assert(
kCtx9.mod() == 9);
58 for (
size_t i = 0; i < values.
size(); ++i)
60 <<
"mod=" <<
mod <<
" value=" << values[i];
85 <<
"mod=" <<
mod <<
" lhs=" <<
lhs <<
" rhs=" <<
rhs;
103 for (
size_t j = 0; j <
bases.size(); ++j)
104 for (
size_t k = 0;
k < exponents.
size(); ++
k)
111 <<
"mod=" <<
mod <<
" base=" << base <<
" exp=" <<
exp;
127 {9ULL, 998244353ULL, 469762049ULL, 1004535809ULL};
129 for (
size_t i = 0; i <
mods.size(); ++i)
140 {9ULL, 998244353ULL, 469762049ULL, 1004535809ULL};
142 for (
size_t i = 0; i <
mods.size(); ++i)
148 std::mt19937_64
rng(mod);
150 for (
size_t sample = 0; sample < 128; ++sample)
158 <<
"mod=" <<
mod <<
" lhs=" <<
lhs <<
" rhs=" <<
rhs;
166 {9ULL, 998244353ULL, 469762049ULL, 1004535809ULL};
168 {0
ULL, 1ULL, 2ULL, 7ULL, 31ULL, 123456ULL};
170 for (
size_t i = 0; i <
mods.size(); ++i)
Simple dynamic array with automatic resizing and functional operations.
constexpr size_t size() const noexcept
Return the number of elements stored in the stack.
__gmp_expr< T, __gmp_unary_expr< __gmp_expr< T, U >, __gmp_exp_function > > exp(const __gmp_expr< T, U > &expr)
Safe modular arithmetic, extended Euclidean algorithm, and Chinese Remainder Theorem.
Main namespace for Aleph-w library functions.
Divide_Conquer_DP_Result< Cost > divide_and_conquer_partition_dp(const size_t groups, const size_t n, Transition_Cost_Fn transition_cost, const Cost inf=dp_optimization_detail::default_inf< Cost >())
Optimize partition DP using divide-and-conquer optimization.
uint64_t mod_exp(uint64_t base, uint64_t exp, const uint64_t m)
Modular exponentiation.
uint64_t mod_mul(uint64_t a, uint64_t b, uint64_t m)
Safe 64-bit modular multiplication.
double mod(double a, double b)