ac-library-hs-1.2.6.0: Data structures and algorithms
Safe HaskellSafe-Inferred
LanguageGHC2021

AtCoder.Extra.ModInt64

Description

ModInt for 64 bit modulus values.

Since: 1.2.6.0

Synopsis

ModInt64

newtype ModInt64 a Source #

Word64 value that treats the modular arithmetic.

Since: 1.2.6.0

Constructors

ModInt64 

Fields

Instances

Instances details
Vector Vector (ModInt64 a) Source #

Since: 1.2.6.0

Instance details

Defined in AtCoder.Extra.ModInt64

Methods

basicUnsafeFreeze :: Mutable Vector s (ModInt64 a) -> ST s (Vector (ModInt64 a))

basicUnsafeThaw :: Vector (ModInt64 a) -> ST s (Mutable Vector s (ModInt64 a))

basicLength :: Vector (ModInt64 a) -> Int

basicUnsafeSlice :: Int -> Int -> Vector (ModInt64 a) -> Vector (ModInt64 a)

basicUnsafeIndexM :: Vector (ModInt64 a) -> Int -> Box (ModInt64 a)

basicUnsafeCopy :: Mutable Vector s (ModInt64 a) -> Vector (ModInt64 a) -> ST s ()

elemseq :: Vector (ModInt64 a) -> ModInt64 a -> b -> b

MVector MVector (ModInt64 a) Source #

Since: 1.2.6.0

Instance details

Defined in AtCoder.Extra.ModInt64

KnownNat p => Bounded (ModInt64 p) Source #

Since: 1.2.6.0

Instance details

Defined in AtCoder.Extra.ModInt64

KnownNat p => Enum (ModInt64 p) Source #

Since: 1.2.6.0

Instance details

Defined in AtCoder.Extra.ModInt64

KnownNat p => Num (ModInt64 p) Source #

Since: 1.2.6.0

Instance details

Defined in AtCoder.Extra.ModInt64

KnownNat a => Read (ModInt64 a) Source #

Since: 1.2.6.0

Instance details

Defined in AtCoder.Extra.ModInt64

KnownNat p => Fractional (ModInt64 p) Source #

Since: 1.2.6.0

Instance details

Defined in AtCoder.Extra.ModInt64

KnownNat p => Integral (ModInt64 p) Source #

Since: 1.2.6.0

Instance details

Defined in AtCoder.Extra.ModInt64

KnownNat p => Real (ModInt64 p) Source #

Since: 1.2.6.0

Instance details

Defined in AtCoder.Extra.ModInt64

Methods

toRational :: ModInt64 p -> Rational #

KnownNat a => Show (ModInt64 a) Source #

Since: 1.2.6.0

Instance details

Defined in AtCoder.Extra.ModInt64

Methods

showsPrec :: Int -> ModInt64 a -> ShowS #

show :: ModInt64 a -> String #

showList :: [ModInt64 a] -> ShowS #

KnownNat a => Eq (ModInt64 a) Source #

Since: 1.2.6.0

Instance details

Defined in AtCoder.Extra.ModInt64

Methods

(==) :: ModInt64 a -> ModInt64 a -> Bool #

(/=) :: ModInt64 a -> ModInt64 a -> Bool #

KnownNat a => Ord (ModInt64 a) Source #

Since: 1.2.6.0

Instance details

Defined in AtCoder.Extra.ModInt64

Methods

compare :: ModInt64 a -> ModInt64 a -> Ordering #

(<) :: ModInt64 a -> ModInt64 a -> Bool #

(<=) :: ModInt64 a -> ModInt64 a -> Bool #

(>) :: ModInt64 a -> ModInt64 a -> Bool #

(>=) :: ModInt64 a -> ModInt64 a -> Bool #

max :: ModInt64 a -> ModInt64 a -> ModInt64 a #

min :: ModInt64 a -> ModInt64 a -> ModInt64 a #

Prim (ModInt64 a) Source #

Since: 1.2.6.0

Instance details

Defined in AtCoder.Extra.ModInt64

Unbox (ModInt64 a) Source #

Since: 1.2.6.0

Instance details

Defined in AtCoder.Extra.ModInt64

newtype MVector s (ModInt64 a) Source #

Since: 1.2.6.0

Instance details

Defined in AtCoder.Extra.ModInt64

newtype Vector (ModInt64 a) Source #

Since: 1.2.6.0

Instance details

Defined in AtCoder.Extra.ModInt64

Constructors

Safe constructors

new :: forall a. KnownNat a => Int -> ModInt64 a Source #

\(O(1)\) Creates a ModInt64 from an Int value taking the mod.

Since: 1.2.6.0

new64 :: forall a. KnownNat a => Word64 -> ModInt64 a Source #

\(O(1)\) Creates a ModInt64 from a Word64 value taking the mod.

Since: 1.2.6.0

Unsafe constructor

unsafeNew :: KnownNat a => Word64 -> ModInt64 a Source #

\(O(1)\) Creates ModInt64 from a Montgomery form with no validation.

Since: 1.2.6.0

Accessors

Modulus value

modulus :: forall a. KnownNat a => ModInt64 a -> Int Source #

\(O(1)\) Retrieve the mod from a ModInt64 object.

Complecity

  • \(O(1)\)

Since: 1.2.6.0

Internal value

val :: forall a. KnownNat a => ModInt64 a -> Int Source #

\(O(1)\) Returns the internal value in Int.

Complecity

  • \(O(1)\)

Since: 1.2.6.0

val64 :: forall a. KnownNat a => ModInt64 a -> Word64 Source #

\(O(1)\) Returns the internal value in Word64.

Complecity

  • \(O(1)\)

Since: 1.2.6.0

Operators

pow :: forall a. (HasCallStack, KnownNat a) => ModInt64 a -> Int -> ModInt64 a Source #

\(O(\log n\) Returns \(x^n\). The implementation is a bit more efficient than ^.

Constraints

  • \(0 \le n\)

Since: 1.2.6.0

inv :: forall a. (HasCallStack, KnownNat a) => ModInt64 a -> ModInt64 a Source #

Returns \(y\) such that \(xy \equiv 1\) holds.

Constraints

  • The value must not be zero.

Since: 1.2.6.0