src/cplib/modint/modint

    Dark Mode
Search:
Group by:
  Source   Edit

Procs

proc `$`(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
proc `*`(a, b: MontgomeryModint or BarrettModint): auto
  Source   Edit
proc `*`(a: MontgomeryModint or BarrettModint; b: SomeInteger): auto
  Source   Edit
proc `*`[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
proc `+`(a, b: MontgomeryModint or BarrettModint): auto
  Source   Edit
proc `+`(a: MontgomeryModint or BarrettModint; b: SomeInteger): auto
  Source   Edit
proc `+`[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
proc `-`(a, b: MontgomeryModint or BarrettModint): auto
  Source   Edit
proc `-`(a: MontgomeryModint or BarrettModint; b: SomeInteger): auto
  Source   Edit
proc `-`[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
proc `/`(a, b: MontgomeryModint or BarrettModint): auto
  Source   Edit
proc `/`(a: MontgomeryModint or BarrettModint; b: SomeInteger): auto
  Source   Edit
proc `/`[ModInt: MontgomeryModint or BarrettModint](a: ModInt; b: static int): auto
  Source   Edit
proc `/`[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
proc get_im(M: uint32): uint {....raises: [], tags: [].}
  Source   Edit
proc get_n2(M: uint32): uint32 {....raises: [], tags: [].}
  Source   Edit
proc get_r(M: uint32): uint32 {....raises: [], tags: [].}
  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
proc 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`gensym21: int): StaticBarrettModint[
    998244353'u32] {....raises: [], tags: [].}
  Source   Edit
converter tomodint998244353_montgomery(a`gensym16: int): StaticMontgomeryModint[
    998244353'u32] {....raises: [], tags: [].}
  Source   Edit
converter tomodint1000000007_barrett(a`gensym31: int): StaticBarrettModint[
    1000000007'u32] {....raises: [], tags: [].}
  Source   Edit
converter tomodint1000000007_montgomery(a`gensym17: int): StaticMontgomeryModint[
    1000000007'u32] {....raises: [], tags: [].}
  Source   Edit
converter tomodint_barrett(a`gensym41: int): DynamicBarrettModint[1'u32] {.
    ...raises: [], tags: [].}
  Source   Edit
converter tomodint_montgomery(a`gensym18: 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
macro get_param[M: static[uint32]](self: typedesc[StaticBarrettModint[M]]): untyped
  Source   Edit
macro get_param[M: static[uint32]](self: typedesc[StaticMontgomeryModint[M]]): untyped
  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 get_param(self: typedesc[DynamicBarrettModint]): tuple[M: uint32,
    im: uint]
  Source   Edit
template get_param(self: typedesc[DynamicMontgomeryModint]): tuple[
    M, r, n2: 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