Struct feanor_math::ring::RingRef

source ·
pub struct RingRef<'a, R: RingBase + ?Sized> { /* private fields */ }
Expand description

The second most basic crate::ring::RingStore. Similarly to crate::ring::RingValue it is just a no-op container.

§Why do we need this in addition to crate::ring::RingValue?

The role of RingRef is much more niche than the role of crate::ring::RingValue. However, it might happen that we want to implement crate::ring::RingBase-functions (or traits on the same level, e.g. crate::ring::CanHomFrom, crate::divisibility::DivisibilityRing), and use more high-level techniques for that (e.g. complex algorithms, for example crate::algorithms::eea or crate::algorithms::sqr_mul). In this case, we only have a reference to a crate::ring::RingBase object, but require a crate::ring::RingStore object to use the algorithm.

Implementations§

source§

impl<'a, R: RingBase + ?Sized> RingRef<'a, R>

source

pub const fn new(value: &'a R) -> Self

Trait Implementations§

source§

impl<'a, R: RingBase + ?Sized> Clone for RingRef<'a, R>

source§

fn clone(&self) -> Self

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<'a, R: RingBase + ?Sized> RingStore for RingRef<'a, R>

§

type Type = R

source§

fn get_ring(&self) -> &R

source§

fn clone_el(&self, val: &El<Self>) -> El<Self>

source§

fn add_assign_ref(&self, lhs: &mut El<Self>, rhs: &El<Self>)

source§

fn add_assign(&self, lhs: &mut El<Self>, rhs: El<Self>)

source§

fn sub_assign_ref(&self, lhs: &mut El<Self>, rhs: &El<Self>)

source§

fn sub_self_assign(&self, lhs: &mut El<Self>, rhs: El<Self>)

source§

fn sub_self_assign_ref(&self, lhs: &mut El<Self>, rhs: &El<Self>)

source§

fn negate_inplace(&self, lhs: &mut El<Self>)

source§

fn mul_assign(&self, lhs: &mut El<Self>, rhs: El<Self>)

source§

fn mul_assign_ref(&self, lhs: &mut El<Self>, rhs: &El<Self>)

source§

fn zero(&self) -> El<Self>

source§

fn one(&self) -> El<Self>

source§

fn neg_one(&self) -> El<Self>

source§

fn eq_el(&self, lhs: &El<Self>, rhs: &El<Self>) -> bool

source§

fn is_zero(&self, value: &El<Self>) -> bool

source§

fn is_one(&self, value: &El<Self>) -> bool

source§

fn is_neg_one(&self, value: &El<Self>) -> bool

source§

fn is_commutative(&self) -> bool

source§

fn is_noetherian(&self) -> bool

source§

fn negate(&self, value: El<Self>) -> El<Self>

source§

fn sub_assign(&self, lhs: &mut El<Self>, rhs: El<Self>)

source§

fn add_ref(&self, lhs: &El<Self>, rhs: &El<Self>) -> El<Self>

source§

fn add_ref_fst(&self, lhs: &El<Self>, rhs: El<Self>) -> El<Self>

source§

fn add_ref_snd(&self, lhs: El<Self>, rhs: &El<Self>) -> El<Self>

source§

fn add(&self, lhs: El<Self>, rhs: El<Self>) -> El<Self>

source§

fn sub_ref(&self, lhs: &El<Self>, rhs: &El<Self>) -> El<Self>

source§

fn sub_ref_fst(&self, lhs: &El<Self>, rhs: El<Self>) -> El<Self>

source§

fn sub_ref_snd(&self, lhs: El<Self>, rhs: &El<Self>) -> El<Self>

source§

fn sub(&self, lhs: El<Self>, rhs: El<Self>) -> El<Self>

source§

fn mul_ref(&self, lhs: &El<Self>, rhs: &El<Self>) -> El<Self>

source§

fn mul_ref_fst(&self, lhs: &El<Self>, rhs: El<Self>) -> El<Self>

source§

fn mul_ref_snd(&self, lhs: El<Self>, rhs: &El<Self>) -> El<Self>

source§

fn mul(&self, lhs: El<Self>, rhs: El<Self>) -> El<Self>

source§

fn square(&self, value: &mut El<Self>)

source§

fn coerce<S>(&self, from: &S, el: El<S>) -> El<Self>
where S: RingStore, Self::Type: CanHomFrom<S::Type>,

source§

fn into_identity(self) -> Identity<Self>

Returns the identity map self -> self.
source§

fn identity<'a>(&'a self) -> Identity<&'a Self>

Returns the identity map self -> self.
source§

fn into_can_hom<S>(self, from: S) -> Result<CanHom<S, Self>, (S, Self)>
where Self: Sized, S: RingStore, Self::Type: CanHomFrom<S::Type>,

Returns the canonical homomorphism from -> self, if it exists, moving both rings into the CanHom object.
source§

fn into_can_iso<S>(self, from: S) -> Result<CanIso<S, Self>, (S, Self)>
where Self: Sized, S: RingStore, Self::Type: CanIsoFromTo<S::Type>,

Returns the canonical isomorphism from -> self, if it exists, moving both rings into the CanHom object.
source§

fn can_hom<'a, S>(&'a self, from: &'a S) -> Option<CanHom<&'a S, &'a Self>>
where S: RingStore, Self::Type: CanHomFrom<S::Type>,

Returns the canonical homomorphism from -> self, if it exists.
source§

fn can_iso<'a, S>(&'a self, from: &'a S) -> Option<CanIso<&'a S, &'a Self>>
where S: RingStore, Self::Type: CanIsoFromTo<S::Type>,

Returns the canonical isomorphism from -> self, if it exists.
source§

fn into_int_hom(self) -> IntHom<Self>

Returns the homomorphism Z -> self that exists for any ring.
source§

fn int_hom<'a>(&'a self) -> IntHom<&'a Self>

Returns the homomorphism Z -> self that exists for any ring.
source§

fn sum<I>(&self, els: I) -> El<Self>
where I: Iterator<Item = El<Self>>,

source§

fn prod<I>(&self, els: I) -> El<Self>
where I: Iterator<Item = El<Self>>,

source§

fn pow(&self, x: El<Self>, power: usize) -> El<Self>

source§

fn pow_gen<R: IntegerRingStore>( &self, x: El<Self>, power: &El<R>, integers: R, ) -> El<Self>
where R::Type: IntegerRing,

source§

fn format<'a>( &'a self, value: &'a El<Self>, ) -> RingElementDisplayWrapper<'a, Self>

Returns an object that represents the given ring element and implements std::fmt::Display, to use as formatting parameter. Read more
source§

fn println(&self, value: &El<Self>)

source§

fn characteristic<I: IntegerRingStore>(&self, ZZ: &I) -> Option<El<I>>
where I::Type: IntegerRing,

source§

impl<'a, R: RingBase + ?Sized> Copy for RingRef<'a, R>

Auto Trait Implementations§

§

impl<'a, R> Freeze for RingRef<'a, R>
where R: ?Sized,

§

impl<'a, R> RefUnwindSafe for RingRef<'a, R>
where R: RefUnwindSafe + ?Sized,

§

impl<'a, R> Send for RingRef<'a, R>
where R: Sync + ?Sized,

§

impl<'a, R> Sync for RingRef<'a, R>
where R: Sync + ?Sized,

§

impl<'a, R> Unpin for RingRef<'a, R>
where R: ?Sized,

§

impl<'a, R> UnwindSafe for RingRef<'a, R>
where R: RefUnwindSafe + ?Sized,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<R> DivisibilityRingStore for R

source§

fn checked_left_div(&self, lhs: &El<Self>, rhs: &El<Self>) -> Option<El<Self>>

source§

fn is_unit(&self, x: &El<Self>) -> bool

source§

fn checked_div(&self, lhs: &El<Self>, rhs: &El<Self>) -> Option<El<Self>>

source§

fn invert(&self, el: &El<Self>) -> Option<El<Self>>

source§

impl<R> ExtensionFieldStore for R

source§

impl<R> FiniteRingStore for R
where R: RingStore, <R as RingStore>::Type: FiniteRing,

source§

fn elements<'a>(&'a self) -> <Self::Type as FiniteRing>::ElementsIter<'a>

source§

fn random_element<G: FnMut() -> u64>(&self, rng: G) -> El<Self>

source§

fn size<I: IntegerRingStore>(&self, ZZ: &I) -> Option<El<I>>
where I::Type: IntegerRing,

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

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 T
where 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, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<R> ZnRingStore for R
where R: RingStore, <R as RingStore>::Type: ZnRing,

source§

fn integer_ring(&self) -> &<Self::Type as ZnRing>::Integers

source§

fn modulus(&self) -> &El<<Self::Type as ZnRing>::Integers>

source§

fn smallest_positive_lift( &self, el: El<Self>, ) -> El<<Self::Type as ZnRing>::Integers>

source§

fn smallest_lift(&self, el: El<Self>) -> El<<Self::Type as ZnRing>::Integers>

source§

fn any_lift(&self, el: El<Self>) -> El<<Self::Type as ZnRing>::Integers>

source§

fn is_field(&self) -> bool

source§

fn as_field(self) -> Result<RingValue<AsFieldBase<Self>>, Self>
where Self: Sized,