|
LMCAS
Lamina Computer Algebra System
|
模整数类,封装模 p 下的算术运算 更多...
#include <modular_arithmetic.hpp>
Public 成员函数 | |
| ModInt () | |
| 默认构造,值为 0,模为 2 | |
| ModInt (int64_t v, int64_t p) | |
| 构造模整数 | |
| ModInt | inverse () const |
| 求模逆元 | |
| bool | is_zero () const |
| 判断是否为零 | |
| int64_t | modulus () const |
| 获取模数 | |
| bool | operator!= (const ModInt &other) const |
| 判不等 | |
| ModInt | operator* (const ModInt &other) const |
| 模乘法 | |
| ModInt | operator+ (const ModInt &other) const |
| 模加法 | |
| ModInt | operator- () const |
| 取负 | |
| ModInt | operator- (const ModInt &other) const |
| 模减法 | |
| ModInt | operator/ (const ModInt &other) const |
| 模除法(乘以逆元) | |
| bool | operator< (const ModInt &other) const |
| 小于比较(先比模数,再比值) | |
| bool | operator== (const ModInt &other) const |
| 判等 | |
| bool | operator> (const ModInt &other) const |
| 大于比较 | |
| int64_t | value () const |
| 获取当前值 | |
静态 Public 成员函数 | |
| static ModInt | pow (ModInt base, int64_t exp) |
| 模幂运算 | |
Private 成员函数 | |
| void | require_same_modulus (const ModInt &other) const |
Private 属性 | |
| int64_t | mod_ |
| int64_t | val_ |
模整数类,封装模 p 下的算术运算
在文件 modular_arithmetic.hpp 第 126 行定义.
|
inline |
默认构造,值为 0,模为 2
在文件 modular_arithmetic.hpp 第 138 行定义.
被这些函数引用 LMCAS::crt_checked(), inverse(), LMCAS::multi_crt(), LMCAS::multi_crt_checked(), operator!=(), operator*(), operator+(), operator-(), operator-(), operator/(), operator<(), operator==(), operator>(), pow() , 以及 require_same_modulus().
|
inline |
构造模整数
| v | 整数值(自动取模归约到 [0, p)) |
| p | 模数 |
在文件 modular_arithmetic.hpp 第 145 行定义.
|
inline |
求模逆元
| std::domain_error | 若值为 0 或不可逆 |
在文件 modular_arithmetic.hpp 第 224 行定义.
引用了 ModInt(), LMCAS::extended_gcd(), mod_, LMCAS::t , 以及 val_.
被这些函数引用 operator/() , 以及 pow().
|
inline |
|
inline |
|
inline |
判不等
在文件 modular_arithmetic.hpp 第 201 行定义.
引用了 ModInt().
模乘法
在文件 modular_arithmetic.hpp 第 174 行定义.
引用了 ModInt(), mod_, require_same_modulus() , 以及 val_.
模加法
在文件 modular_arithmetic.hpp 第 160 行定义.
引用了 ModInt(), mod_, require_same_modulus() , 以及 val_.
|
inline |
模减法
在文件 modular_arithmetic.hpp 第 167 行定义.
引用了 ModInt(), mod_, require_same_modulus() , 以及 val_.
模除法(乘以逆元)
在文件 modular_arithmetic.hpp 第 186 行定义.
|
inline |
|
inline |
|
inline |
大于比较
在文件 modular_arithmetic.hpp 第 212 行定义.
引用了 ModInt().
模幂运算
| base | 底数 |
| exp | 指数(可为负,负指数先求逆) |
在文件 modular_arithmetic.hpp 第 243 行定义.
引用了 ModInt(), LMCAS::exp(), inverse() , 以及 mod_.
|
inlineprivate |
在文件 modular_arithmetic.hpp 第 130 行定义.
被这些函数引用 operator*(), operator+() , 以及 operator-().
|
inline |
|
private |
在文件 modular_arithmetic.hpp 第 128 行定义.
被这些函数引用 ModInt(), ModInt(), inverse(), modulus(), operator*(), operator+(), operator-(), operator-(), operator<(), operator==(), pow() , 以及 require_same_modulus().
|
private |
在文件 modular_arithmetic.hpp 第 127 行定义.
被这些函数引用 ModInt(), ModInt(), inverse(), is_zero(), operator*(), operator+(), operator-(), operator-(), operator<(), operator==() , 以及 value().