pub struct Modint<const MOD: u32>(pub u32);

Tuple Fields§

§0: u32

Implementations§

source§

impl<const MOD: u32> Modint<MOD>

source

pub fn new(n: u32) -> Self

source

pub fn rational_reconstruction(&self) -> Option<(usize, usize)>

Trait Implementations§

source§

impl<const MOD: u32> Add<Modint<MOD>> for Modint<MOD>

§

type Output = Modint<MOD>

The resulting type after applying the + operator.
source§

fn add(self, rhs: Self) -> Self

Performs the + operation. Read more
source§

impl<const MOD: u32> Add<usize> for Modint<MOD>

§

type Output = Modint<MOD>

The resulting type after applying the + operator.
source§

fn add(self, rhs: usize) -> Self

Performs the + operation. Read more
source§

impl<const MOD: u32> AddAssign<Modint<MOD>> for Modint<MOD>

source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
source§

impl<const MOD: u32> AddAssign<usize> for Modint<MOD>

source§

fn add_assign(&mut self, rhs: usize)

Performs the += operation. Read more
source§

impl<const MOD: u32> Clone for Modint<MOD>

source§

fn clone(&self) -> Modint<MOD>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<const MOD: u32> Debug for Modint<MOD>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<const MOD: u32> Default for Modint<MOD>

source§

fn default() -> Modint<MOD>

Returns the “default value” for a type. Read more
source§

impl<const MOD: u32> Display for Modint<MOD>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<const MOD: u32> Div<Modint<MOD>> for Modint<MOD>

§

type Output = Modint<MOD>

The resulting type after applying the / operator.
source§

fn div(self, rhs: Self) -> Self

Performs the / operation. Read more
source§

impl<const MOD: u32> Div<usize> for Modint<MOD>

§

type Output = Modint<MOD>

The resulting type after applying the / operator.
source§

fn div(self, rhs: usize) -> Self

Performs the / operation. Read more
source§

impl<const MOD: u32> DivAssign<Modint<MOD>> for Modint<MOD>

source§

fn div_assign(&mut self, rhs: Self)

Performs the /= operation. Read more
source§

impl<const MOD: u32> DivAssign<usize> for Modint<MOD>

source§

fn div_assign(&mut self, rhs: usize)

Performs the /= operation. Read more
source§

impl<const MOD: u32> Fp for Modint<MOD>

source§

fn pow(&self, rhs: u32) -> Self

source§

fn inv(&self) -> Self

source§

impl<const MOD: u32> From<i32> for Modint<MOD>

source§

fn from(value: i32) -> Self

Converts to this type from the input type.
source§

impl<const MOD: u32> From<i64> for Modint<MOD>

source§

fn from(value: i64) -> Self

Converts to this type from the input type.
source§

impl<const MOD: u32> From<isize> for Modint<MOD>

source§

fn from(value: isize) -> Self

Converts to this type from the input type.
source§

impl<const MOD: u32> From<u32> for Modint<MOD>

source§

fn from(value: u32) -> Self

Converts to this type from the input type.
source§

impl<const MOD: u32> From<u64> for Modint<MOD>

source§

fn from(value: u64) -> Self

Converts to this type from the input type.
source§

impl<const MOD: u32> From<usize> for Modint<MOD>

source§

fn from(value: usize) -> Self

Converts to this type from the input type.
source§

impl<const MOD: u32> FromStr for Modint<MOD>

§

type Err = ParseIntError

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl<const MOD: u32> Hash for Modint<MOD>

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<const MOD: u32> Mul<Modint<MOD>> for Modint<MOD>

§

type Output = Modint<MOD>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Self) -> Self

Performs the * operation. Read more
source§

impl<const MOD: u32> Mul<usize> for Modint<MOD>

§

type Output = Modint<MOD>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: usize) -> Self

Performs the * operation. Read more
source§

impl<const MOD: u32> MulAssign<Modint<MOD>> for Modint<MOD>

source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
source§

impl<const MOD: u32> MulAssign<usize> for Modint<MOD>

source§

fn mul_assign(&mut self, rhs: usize)

Performs the *= operation. Read more
source§

impl NTTFriendly<Modint<MOD998>, Modint<MOD998>> for M998

source§

fn order() -> u32

M = 2^k * m + 1 を満たすような k
source§

fn rem() -> u32

M = 2^k * m + 1 を満たすような m
source§

fn root() -> Self

原始根
source§

fn root_pow2m(a: u32) -> Self

2^m 乗根
source§

impl<const MOD: u32> Neg for Modint<MOD>

§

type Output = Modint<MOD>

The resulting type after applying the - operator.
source§

fn neg(self) -> Self

Performs the unary - operation. Read more
source§

impl NumProbability<Modint<MOD107>, Modint<MOD107>> for M107

source§

const MOD: usize = 1_000_000_007usize

source§

impl NumProbability<Modint<MOD998>, Modint<MOD998>> for M998

source§

const MOD: usize = 998_244_353usize

source§

impl<const MOD: u32> One for Modint<MOD>

source§

fn one() -> Self

source§

fn is_one(&self) -> boolwhere Self: PartialEq,

source§

impl<const MOD: u32> PartialEq<Modint<MOD>> for Modint<MOD>

source§

fn eq(&self, other: &Modint<MOD>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<const MOD: u32> PartialEq<usize> for Modint<MOD>

source§

fn eq(&self, other: &usize) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<const MOD: u32> Product<Modint<MOD>> for Modint<MOD>

source§

fn product<I: Iterator<Item = Modint<MOD>>>(iter: I) -> Self

Method which takes an iterator and generates Self from the elements by multiplying the items.
source§

impl<const MOD: u32> Sub<Modint<MOD>> for Modint<MOD>

§

type Output = Modint<MOD>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Self) -> Self

Performs the - operation. Read more
source§

impl<const MOD: u32> Sub<usize> for Modint<MOD>

§

type Output = Modint<MOD>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: usize) -> Self

Performs the - operation. Read more
source§

impl<const MOD: u32> SubAssign<Modint<MOD>> for Modint<MOD>

source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
source§

impl<const MOD: u32> SubAssign<usize> for Modint<MOD>

source§

fn sub_assign(&mut self, rhs: usize)

Performs the -= operation. Read more
source§

impl<const MOD: u32> Sum<Modint<MOD>> for Modint<MOD>

source§

fn sum<I: Iterator<Item = Modint<MOD>>>(iter: I) -> Self

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl<const MOD: u32> Zero for Modint<MOD>

source§

fn zero() -> Self

source§

fn is_zero(&self) -> boolwhere Self: PartialEq,

source§

impl<const MOD: u32> Copy for Modint<MOD>

source§

impl<const MOD: u32> Eq for Modint<MOD>

source§

impl<const MOD: u32> StructuralEq for Modint<MOD>

source§

impl<const MOD: u32> StructuralPartialEq for Modint<MOD>

Auto Trait Implementations§

§

impl<const MOD: u32> RefUnwindSafe for Modint<MOD>

§

impl<const MOD: u32> Send for Modint<MOD>

§

impl<const MOD: u32> Sync for Modint<MOD>

§

impl<const MOD: u32> Unpin for Modint<MOD>

§

impl<const MOD: u32> UnwindSafe for Modint<MOD>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V