LMCAS
Lamina Computer Algebra System
载入中...
搜索中...
未找到
LMCAS::anonymous_namespace{bigint_number_theory.cpp} 命名空间参考

函数

BigInt binary_modular_power (const BigInt &base, const BigInt &exp, const BigInt &mod)

函数说明

◆ binary_modular_power()

BigInt LMCAS::anonymous_namespace{bigint_number_theory.cpp}::binary_modular_power ( const BigInt & base,
const BigInt & exp,
const BigInt & mod )

在文件 bigint_number_theory.cpp 第 7 行定义.

7 {
8 BigInt result = 1;
9 BigInt residue = base % mod;
10 if (residue.is_negative()) {
11 residue += mod;
12 }
13 BigInt exponent = exp;
14 while (!exponent.is_zero()) {
15 if (exponent.is_odd()) {
16 result = (result * residue) % mod;
17 }
18 residue = (residue * residue) % mod;
19 exponent >>= 1;
20 }
21 return result;
22}
ExprResult exp(const ExprPtr &expression, ComputationContext &context)
const ExprPtr & exponent

引用了 binary_modular_power(), LMCAS::exp() , 以及 LMCAS::exponent.

被这些函数引用 binary_modular_power().

函数调用图:
这是这个函数的调用关系图: