Types
DynamicBarrettModint[M] = object a: uint32
- Source Edit
DynamicMontgomeryModint[M] = object a: uint32
- Source Edit
modint998244353_barrett = StaticBarrettModint[998244353'u32]
- Source Edit
modint998244353_montgomery = StaticMontgomeryModint[998244353'u32]
- Source Edit
modint1000000007_barrett = StaticBarrettModint[1000000007'u32]
- Source Edit
modint1000000007_montgomery = StaticMontgomeryModint[1000000007'u32]
- Source Edit
modint_barrett = DynamicBarrettModint[1'u32]
- Source Edit
StaticBarrettModint[M] = object a: uint32
- Source Edit
StaticMontgomeryModint[M] = object a: uint32
- Source Edit
Procs
func `$`(a: MontgomeryModint or BarrettModint): string
- Source Edit
proc `*=`[T: BarrettModint](a: var T; b: T or SomeInteger)
- Source Edit
proc `*=`[T: MontgomeryModint](a: var T; b: T or SomeInteger)
- Source Edit
func `*`(a, b: MontgomeryModint or BarrettModint): auto
- Source Edit
func `*`(a: MontgomeryModint or BarrettModint; b: SomeInteger): auto
- Source Edit
func `*`[ModInt: MontgomeryModint or BarrettModint](a: SomeInteger; b: Modint): auto
- Source Edit
proc `+=`[T: BarrettModint](a: var T; b: T or SomeInteger)
- Source Edit
proc `+=`[T: MontgomeryModint](a: var T; b: T or SomeInteger)
- Source Edit
func `+`(a, b: MontgomeryModint or BarrettModint): auto
- Source Edit
func `+`(a: MontgomeryModint or BarrettModint; b: SomeInteger): auto
- Source Edit
func `+`[ModInt: MontgomeryModint or BarrettModint](a: SomeInteger; b: Modint): auto
- Source Edit
proc `-=`[T: BarrettModint](a: var T; b: T or SomeInteger)
- Source Edit
proc `-=`[T: MontgomeryModint](a: var T; b: T or SomeInteger)
- Source Edit
func `-`(a, b: MontgomeryModint or BarrettModint): auto
- Source Edit
func `-`(a: MontgomeryModint or BarrettModint; b: SomeInteger): auto
- Source Edit
func `-`[ModInt: MontgomeryModint or BarrettModint](a: SomeInteger; b: Modint): auto
- Source Edit
proc `-`[T: BarrettModint](a: T): T
- Source Edit
proc `-`[T: MontgomeryModint](a: T): T
- Source Edit
proc `/=`[T: BarrettModint](a: var T; b: T or SomeInteger)
- Source Edit
proc `/=`[T: MontgomeryModint](a: var T; b: T or SomeInteger)
- Source Edit
func `/`(a, b: MontgomeryModint or BarrettModint): auto
- Source Edit
func `/`(a: MontgomeryModint or BarrettModint; b: SomeInteger): auto
- Source Edit
proc `/`[ModInt: MontgomeryModint or BarrettModint](a: ModInt; b: static int): auto
- Source Edit
func `/`[ModInt: MontgomeryModint or BarrettModint](a: SomeInteger; b: Modint): auto
- Source Edit
proc calc_mul(a, b: culonglong): culonglong {.importcpp: "calc_mul(#, #)", nodecl, inline, ...raises: [], tags: [].}
- Source Edit
proc estimate_rational(a: MontgomeryModint or BarrettModint; ub: int = isqrt(typeof(a).mod)): string
- Source Edit
func get_param[M: static[uint32]](self: typedesc[DynamicBarrettModint[M]]): ptr [ tuple[M, im: uint]]
- Source Edit
func get_param[M: static[uint32]](self: typedesc[DynamicMontgomeryModint[M]]): ptr [ tuple[M, r, n2: uint32]]
- Source Edit
proc init(T: typedesc[BarrettModint]; a: T:type or SomeInteger): auto
- Source Edit
proc init(T: typedesc[MontgomeryModint]; a: T:type or SomeInteger): auto
- Source Edit
proc inv[T: BarrettModint](x: T): T
- Source Edit
proc inv[T: MontgomeryModint](x: T): T
- Source Edit
func pow(a: MontgomeryModint or BarrettModint; n: int): auto
- Source Edit
proc rem(T: typedesc[BarrettModint]; a: uint): uint32
- Source Edit
proc setMod[T: static[uint32]](self: typedesc[DynamicBarrettModint[T]]; M: SomeInteger or SomeUnsignedInt)
- Source Edit
proc setMod[T: static[uint32]](self: typedesc[DynamicMontgomeryModint[T]]; M: SomeInteger or SomeUnsignedInt)
- Source Edit
proc val(a: BarrettModint): int
- Source Edit
proc val[T: MontgomeryModint](a: T): int
- Source Edit
Converters
converter tomodint998244353_barrett(a`gensym17: int): StaticBarrettModint[ 998244353'u32] {....raises: [], tags: [].}
- Source Edit
converter tomodint998244353_montgomery(a`gensym14: int): StaticMontgomeryModint[ 998244353'u32] {....raises: [], tags: [].}
- Source Edit
converter tomodint1000000007_barrett(a`gensym27: int): StaticBarrettModint[ 1000000007'u32] {....raises: [], tags: [].}
- Source Edit
converter tomodint1000000007_montgomery(a`gensym15: int): StaticMontgomeryModint[ 1000000007'u32] {....raises: [], tags: [].}
- Source Edit
converter tomodint_barrett(a`gensym37: int): DynamicBarrettModint[1'u32] {. ...raises: [], tags: [].}
- Source Edit
converter tomodint_montgomery(a`gensym16: int): DynamicMontgomeryModint[1'u32] {. ...raises: [], tags: [].}
- Source Edit
Macros
macro declarDynamicBarrettModint(name, id)
- Source Edit
macro declarDynamicMontgomeryModint(name, id)
- Source Edit
macro declarStaticBarrettModint(name, M)
- Source Edit
macro declarStaticMontgomeryModint(name, M)
- Source Edit
Templates
template `mod`[T: BarrettModint](self: typedesc[T] or T): int32
- Source Edit
template `mod`[T: MontgomeryModint](self: typedesc[T] or T): int32
- Source Edit
template get_M(T: typedesc[BarrettModint]): uint
- Source Edit
template get_M(T: typedesc[MontgomeryModint]): uint32
- Source Edit
template umod[T: BarrettModint](self: typedesc[T] or T): uint32
- Source Edit
template umod[T: MontgomeryModint](self: typedesc[T] or T): uint32
- Source Edit