[−][src]Struct g2poly::G2PolyProd
The result of multiplying two G2Poly
This type is used to represent the result of multiplying two G2Poly
s. Since this could
overflow when relying on just a u64
, this type uses an internal u128
. The only operation
implemented on this type is %
which reduces the result back to a
G2Poly
.
let a = G2Poly(0xff_00_00_00_00_00_00_00); assert_eq!(a * a, G2PolyProd(0x55_55_00_00_00_00_00_00_00_00_00_00_00_00_00_00)); assert_eq!(a * a % G2Poly(0b100), G2Poly(0));
Methods
impl G2PolyProd
[src]
pub fn to_poly(self) -> G2Poly
[src]
Convert to G2Poly
Panics
Panics, if the internal representation exceeds the maximum value for G2Poly.
Example
let a = G2Poly(0x40_00_00_00_00_00_00_00) * G2Poly(2); assert_eq!(G2Poly(0x80_00_00_00_00_00_00_00), a.to_poly()); // Next line would panics! // (G2Poly(0x40_00_00_00_00_00_00_00) * G2Poly(4)).to_poly();
pub fn try_to_poly(self) -> Option<G2Poly>
[src]
Convert to G2Poly if possible
In case the value would not fit into G2Poly
, return None
Example
assert_eq!((G2Poly(0x40_00_00_00_00_00_00_00) * G2Poly(2)).try_to_poly(), Some(G2Poly(0x80_00_00_00_00_00_00_00))); assert_eq!((G2Poly(0x40_00_00_00_00_00_00_00) * G2Poly(4)).try_to_poly(), None);
Trait Implementations
impl PartialEq<G2PolyProd> for G2PolyProd
[src]
fn eq(&self, other: &G2PolyProd) -> bool
[src]
fn ne(&self, other: &G2PolyProd) -> bool
[src]
impl Clone for G2PolyProd
[src]
fn clone(&self) -> G2PolyProd
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Ord for G2PolyProd
[src]
fn cmp(&self, other: &G2PolyProd) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
[src]
clamp
)Restrict a value to a certain interval. Read more
impl Eq for G2PolyProd
[src]
impl Copy for G2PolyProd
[src]
impl PartialOrd<G2PolyProd> for G2PolyProd
[src]
fn partial_cmp(&self, other: &G2PolyProd) -> Option<Ordering>
[src]
fn lt(&self, other: &G2PolyProd) -> bool
[src]
fn le(&self, other: &G2PolyProd) -> bool
[src]
fn gt(&self, other: &G2PolyProd) -> bool
[src]
fn ge(&self, other: &G2PolyProd) -> bool
[src]
impl Debug for G2PolyProd
[src]
impl Rem<G2Poly> for G2PolyProd
[src]
type Output = G2Poly
The resulting type after applying the %
operator.
fn rem(self, rhs: G2Poly) -> G2Poly
[src]
Calculate the polynomial remainder of the product of polynomials
When calculating a % b this computes the value of r in
a = q * b + r
such that |r| < |b|.
Example
let a = G2Poly(0x12_34_56_78_9A_BC_DE); let m = G2Poly(0x00_00_00_01_00_00); assert!((a * a % m).degree().expect("Positive degree") < m.degree().expect("Positive degree")); assert_eq!(G2Poly(0b0101_0001_0101_0100), a * a % m);
Auto Trait Implementations
impl Send for G2PolyProd
impl Sync for G2PolyProd
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut 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,