[−][src]Enum modtype::cartridges::Multiplicative
A Cartridge
which does not assume moduluses are primes.
use num::CheckedDiv as _; #[modtype::use_modtype] type Z = modtype::ModType<modtype::cartridges::Multiplicative<u32>, 57u32>; assert_eq!(Z(56) * Z(56), Z(1)); assert_eq!(Z(1).checked_div(&Z(13)), Some(Z(22))); // 13・22 ≡ 1 (mod 57)
Variants
Infallible(Infallible, PhantomData<fn() -> T>)
Trait Implementations
impl<T: UnsignedPrimitive> Cartridge for Multiplicative<T>
[src]
type Target = T
type AssumePrimeModulus = False
type AssumeAlwaysAdjusted = True
type Equality = True
type Order = True
type Deref = True
type PartialAddition = True
type PartialSubtraction = True
type PartialMultiplication = True
type PartialDivision = True
type FlexibleRhs = False
fn sqrt(_: T, _: T) -> Option<T>
[src]
fn div(_: T, _: T, _: T) -> T
[src]
fn new<T: PrimInt>(raw: T, modulus: T) -> T
[src]
Implementation for [From
]<Self::Target>
and modtype{, ::thread_local}::ModType::new
. Read more
fn should_adjust<T: PrimInt>(raw: T, modulus: T) -> bool
[src]
Whether to call Self::
[adjust
]. Read more
fn adjust<T: PrimInt>(raw: &mut T, modulus: T)
[src]
Make *raw
*raw % modulus
. Read more
fn adjusted<T: PrimInt>(raw: T, modulus: T) -> T
[src]
Make raw
raw % modulus
. Read more
fn from_u8(value: u8, modulus: Self::Target) -> Self::Target
[src]
Implementation for [From
]::<
[u8
]>
and [FromPrimitive
]::
[from_u8
]. Read more
fn from_u16(value: u16, modulus: Self::Target) -> Self::Target
[src]
Implementation for [From
]::<
[u16
]>
and [FromPrimitive
]::
[from_u16
]. Read more
fn from_u32(value: u32, modulus: Self::Target) -> Self::Target
[src]
Implementation for [From
]::<
[u32
]>
and [FromPrimitive
]::
[from_u32
]. Read more
fn from_u64(value: u64, modulus: Self::Target) -> Self::Target
[src]
Implementation for [From
]::<
[u64
]>
and [FromPrimitive
]::
[from_u64
]. Read more
fn from_u128(value: u128, modulus: Self::Target) -> Self::Target
[src]
Implementation for [From
]::<
[u128
]>
and [FromPrimitive
]::
[from_u128
]. Read more
fn from_usize(value: usize, modulus: Self::Target) -> Self::Target
[src]
Implementation for [From
]::<
[usize
]>
and [FromPrimitive
]::
[from_usize
]. Read more
fn from_i8(value: i8, modulus: Self::Target) -> Self::Target where
Self::PartialSubtraction: IsTrue,
[src]
Self::PartialSubtraction: IsTrue,
Implementation for [From
]::<
[i8
]>
and [FromPrimitive
]::
[from_i8
]. Read more
fn from_i16(value: i16, modulus: Self::Target) -> Self::Target where
Self::PartialSubtraction: IsTrue,
[src]
Self::PartialSubtraction: IsTrue,
Implementation for [From
]::<
[i16
]>
and [FromPrimitive
]::
[from_i16
]. Read more
fn from_i32(value: i32, modulus: Self::Target) -> Self::Target where
Self::PartialSubtraction: IsTrue,
[src]
Self::PartialSubtraction: IsTrue,
Implementation for [From
]::<
[i32
]>
and [FromPrimitive
]::
[from_i32
]. Read more
fn from_i64(value: i64, modulus: Self::Target) -> Self::Target where
Self::PartialSubtraction: IsTrue,
[src]
Self::PartialSubtraction: IsTrue,
Implementation for [From
]::<
[i64
]>
and [FromPrimitive
]::
[from_i64
]. Read more
fn from_i128(value: i128, modulus: Self::Target) -> Self::Target where
Self::PartialSubtraction: IsTrue,
[src]
Self::PartialSubtraction: IsTrue,
Implementation for [From
]::<
[i128
]>
and [FromPrimitive
]::
[from_i128
]. Read more
fn from_isize(value: isize, modulus: Self::Target) -> Self::Target where
Self::PartialSubtraction: IsTrue,
[src]
Self::PartialSubtraction: IsTrue,
Implementation for [From
]::<
[isize
]>
and [FromPrimitive
]::
[from_isize
]. Read more
fn from_float_prim<F: FloatPrimitive>(
value: F,
modulus: Self::Target
) -> Self::Target where
Self::AssumePrimeModulus: IsTrue,
Self::PartialSubtraction: IsTrue,
Self::PartialMultiplication: IsTrue,
Self::PartialDivision: IsTrue,
[src]
value: F,
modulus: Self::Target
) -> Self::Target where
Self::AssumePrimeModulus: IsTrue,
Self::PartialSubtraction: IsTrue,
Self::PartialMultiplication: IsTrue,
Self::PartialDivision: IsTrue,
Implementation for [From
]::<
[f32
],
[f64
]>
and [FromPrimitive
]::{
[from_f32
],
[from_f64
]}
. Read more
fn from_biguint(value: BigUint, modulus: Self::Target) -> Self::Target
[src]
Implementation for [From
]<
[BigUint
]>
. Read more
fn from_bigint(value: BigInt, modulus: Self::Target) -> Self::Target where
Self::PartialSubtraction: IsTrue,
[src]
Self::PartialSubtraction: IsTrue,
Implementation for [From
]<
[BigInt
]>
. Read more
fn from_biguint_ratio(
value: Ratio<BigUint>,
modulus: Self::Target
) -> Self::Target where
Self::AssumePrimeModulus: IsTrue,
Self::PartialDivision: IsTrue,
[src]
value: Ratio<BigUint>,
modulus: Self::Target
) -> Self::Target where
Self::AssumePrimeModulus: IsTrue,
Self::PartialDivision: IsTrue,
Implementation for [From
]<
[Ratio
]<
[BigUint
]>>
. Read more
fn from_bigint_ratio(
value: Ratio<BigInt>,
modulus: Self::Target
) -> Self::Target where
Self::AssumePrimeModulus: IsTrue,
Self::PartialSubtraction: IsTrue,
Self::PartialDivision: IsTrue,
[src]
value: Ratio<BigInt>,
modulus: Self::Target
) -> Self::Target where
Self::AssumePrimeModulus: IsTrue,
Self::PartialSubtraction: IsTrue,
Self::PartialDivision: IsTrue,
Implementation for [From
]<
[Ratio
]<
[BigInt
]>>
. Read more
fn eq(lhs: Self::Target, rhs: Self::Target, modulus: Self::Target) -> bool where
Self::Equality: IsTrue,
[src]
Self::Equality: IsTrue,
Implementation for [PartialEq
]::
[eq
]. Read more
fn cmp(lhs: Self::Target, rhs: Self::Target, modulus: Self::Target) -> Ordering where
Self::Equality: IsTrue,
Self::Order: IsTrue,
[src]
Self::Equality: IsTrue,
Self::Order: IsTrue,
Implementation for [PartialOrd
]::
[partial_cmp
] and [Ord
]::
[cmp
]. Read more
fn fmt_display(
value: Self::Target,
modulus: Self::Target,
fmt: &mut Formatter
) -> Result
[src]
value: Self::Target,
modulus: Self::Target,
fmt: &mut Formatter
) -> Result
Implementation for [Display
]. Read more
fn fmt_debug(
value: Self::Target,
modulus: Self::Target,
_ty: &'static str,
fmt: &mut Formatter
) -> Result
[src]
value: Self::Target,
modulus: Self::Target,
_ty: &'static str,
fmt: &mut Formatter
) -> Result
Implementation for [Debug
]. Read more
fn from_str(
str: &str,
modulus: Self::Target
) -> Result<Self::Target, ParseIntError>
[src]
str: &str,
modulus: Self::Target
) -> Result<Self::Target, ParseIntError>
Implementation for [FromStr
]. Read more
fn neg(value: Self::Target, modulus: Self::Target) -> Self::Target where
Self::PartialSubtraction: IsTrue,
[src]
Self::PartialSubtraction: IsTrue,
Implementation for [Neg
]. Read more
fn add(
lhs: Self::Target,
rhs: Self::Target,
modulus: Self::Target
) -> Self::Target where
Self::PartialAddition: IsTrue,
[src]
lhs: Self::Target,
rhs: Self::Target,
modulus: Self::Target
) -> Self::Target where
Self::PartialAddition: IsTrue,
Implementation for [Add
]. Read more
fn sub(
lhs: Self::Target,
rhs: Self::Target,
modulus: Self::Target
) -> Self::Target where
Self::PartialSubtraction: IsTrue,
[src]
lhs: Self::Target,
rhs: Self::Target,
modulus: Self::Target
) -> Self::Target where
Self::PartialSubtraction: IsTrue,
Implementation for [Sub
]. Read more
fn mul(
lhs: Self::Target,
rhs: Self::Target,
modulus: Self::Target
) -> Self::Target where
Self::PartialMultiplication: IsTrue,
[src]
lhs: Self::Target,
rhs: Self::Target,
modulus: Self::Target
) -> Self::Target where
Self::PartialMultiplication: IsTrue,
Implementation for [Mul
]. Read more
fn rem(
_lhs: Self::Target,
rhs: Self::Target,
modulus: Self::Target
) -> Self::Target where
Self::PartialDivision: IsTrue,
[src]
_lhs: Self::Target,
rhs: Self::Target,
modulus: Self::Target
) -> Self::Target where
Self::PartialDivision: IsTrue,
Implementation for [Rem
]. Read more
fn inv(value: Self::Target, modulus: Self::Target) -> Self::Target where
Self::PartialDivision: IsTrue,
[src]
Self::PartialDivision: IsTrue,
Implementation for [Inv
]. Read more
fn from_str_radix(
str: &str,
radix: u32,
modulus: Self::Target
) -> Result<Self::Target, ParseIntError> where
Self::AssumePrimeModulus: IsTrue,
Self::Equality: IsTrue,
Self::Order: IsTrue,
Self::PartialAddition: IsTrue,
Self::PartialSubtraction: IsTrue,
Self::PartialMultiplication: IsTrue,
Self::PartialDivision: IsTrue,
[src]
str: &str,
radix: u32,
modulus: Self::Target
) -> Result<Self::Target, ParseIntError> where
Self::AssumePrimeModulus: IsTrue,
Self::Equality: IsTrue,
Self::Order: IsTrue,
Self::PartialAddition: IsTrue,
Self::PartialSubtraction: IsTrue,
Self::PartialMultiplication: IsTrue,
Self::PartialDivision: IsTrue,
Implementation for [Num
]. Read more
fn zero(_modulus: Self::Target) -> Self::Target where
Self::PartialAddition: IsTrue,
[src]
Self::PartialAddition: IsTrue,
Implementation for [Zero
]::
[zero
]. Read more
fn is_zero(value: Self::Target, modulus: Self::Target) -> bool where
Self::PartialAddition: IsTrue,
[src]
Self::PartialAddition: IsTrue,
Implementation for [Zero
]::
[is_zero
]. Read more
fn one(_modulus: Self::Target) -> Self::Target where
Self::PartialMultiplication: IsTrue,
[src]
Self::PartialMultiplication: IsTrue,
Implementation for [One
]::
[one
]. Read more
fn is_one(value: Self::Target, modulus: Self::Target) -> bool where
Self::Equality: IsTrue,
Self::PartialMultiplication: IsTrue,
[src]
Self::Equality: IsTrue,
Self::PartialMultiplication: IsTrue,
Implementation for [One
]::
[is_one
]. Read more
fn checked_neg(
value: Self::Target,
modulus: Self::Target
) -> Option<Self::Target> where
Self::PartialSubtraction: IsTrue,
[src]
value: Self::Target,
modulus: Self::Target
) -> Option<Self::Target> where
Self::PartialSubtraction: IsTrue,
Implementation for [CheckedNeg
]. Read more
fn checked_add(
lhs: Self::Target,
rhs: Self::Target,
modulus: Self::Target
) -> Option<Self::Target> where
Self::PartialAddition: IsTrue,
[src]
lhs: Self::Target,
rhs: Self::Target,
modulus: Self::Target
) -> Option<Self::Target> where
Self::PartialAddition: IsTrue,
Implementation for [CheckedAdd
]. Read more
fn checked_sub(
lhs: Self::Target,
rhs: Self::Target,
modulus: Self::Target
) -> Option<Self::Target> where
Self::PartialSubtraction: IsTrue,
[src]
lhs: Self::Target,
rhs: Self::Target,
modulus: Self::Target
) -> Option<Self::Target> where
Self::PartialSubtraction: IsTrue,
Implementation for [CheckedSub
]. Read more
fn checked_mul(
lhs: Self::Target,
rhs: Self::Target,
modulus: Self::Target
) -> Option<Self::Target> where
Self::PartialMultiplication: IsTrue,
[src]
lhs: Self::Target,
rhs: Self::Target,
modulus: Self::Target
) -> Option<Self::Target> where
Self::PartialMultiplication: IsTrue,
Implementation for [CheckedMul
]. Read more
fn checked_div(
lhs: Self::Target,
rhs: Self::Target,
modulus: Self::Target
) -> Option<Self::Target> where
Self::PartialDivision: IsTrue,
[src]
lhs: Self::Target,
rhs: Self::Target,
modulus: Self::Target
) -> Option<Self::Target> where
Self::PartialDivision: IsTrue,
Implementation for [CheckedDiv
]. Read more
fn checked_rem(
_lhs: Self::Target,
rhs: Self::Target,
modulus: Self::Target
) -> Option<Self::Target> where
Self::PartialDivision: IsTrue,
[src]
_lhs: Self::Target,
rhs: Self::Target,
modulus: Self::Target
) -> Option<Self::Target> where
Self::PartialDivision: IsTrue,
Implementation for [CheckedRem
]. Read more
fn pow_unsigned<E: UnsignedPrimitive>(
base: Self::Target,
exp: E,
modulus: Self::Target
) -> Self::Target where
Self::PartialMultiplication: IsTrue,
[src]
base: Self::Target,
exp: E,
modulus: Self::Target
) -> Self::Target where
Self::PartialMultiplication: IsTrue,
Implementation for [Pow
]<{
[u8
],
[u16
],
[u32
],
[u64
],
[u128
],
[usize
]}>
. Read more
fn pow_signed<E: SignedPrimitive>(
base: Self::Target,
exp: E,
modulus: Self::Target
) -> Self::Target where
Self::AssumePrimeModulus: IsTrue,
Self::PartialMultiplication: IsTrue,
Self::PartialDivision: IsTrue,
[src]
base: Self::Target,
exp: E,
modulus: Self::Target
) -> Self::Target where
Self::AssumePrimeModulus: IsTrue,
Self::PartialMultiplication: IsTrue,
Self::PartialDivision: IsTrue,
Implementation for [Pow
]<{
[i8
],
[i16
],
[i32
],
[i64
],
[i128
],
[isize
]}>
. Read more
Auto Trait Implementations
impl<T> Unpin for Multiplicative<T>
impl<T> Sync for Multiplicative<T>
impl<T> Send for Multiplicative<T>
impl<T> RefUnwindSafe for Multiplicative<T>
impl<T> UnwindSafe for Multiplicative<T>
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,