Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
AtCoder.Internal.Barrett
Description
Fast modular multiplication for Word32
by barrett reduction.
Reference: https://en.wikipedia.org/wiki/Barrett_reduction
Example
>>>
let bt = new32 10 -- mod 10
>>>
umod bt
10
>>>
mulMod bt 7 7
9
Since: 1.0.0.0
Barrett
Fast modular multiplication by barrett reduction. Reference: https://en.wikipedia.org/wiki/Barrett_reduction
Since: 1.0.0.0
Constructors
new32 :: Word32 -> Barrett Source #
Creates barret reduction for modulus \(m\) from a Word32
value.
Since: 1.0.0.0
new64 :: Word64 -> Barrett Source #
Creates barret reduction for modulus \(m\) from a Word64
value.
Since: 1.0.0.0