pub struct LambdaHom<R: RingStore, S: RingStore, F>{ /* private fields */ }Expand description
A homomorphism between rings R -> S, with its action on elements
defined by a user-provided closure.
It is up to the user to ensure that the given closure indeed satisfies the ring homomorphism axioms:
- For
x, y in R, it should satisfyf(x) + f(y) = f(x + y) - For
x, y in R, it should satisfyf(x) * f(y) = f(x * y) - It should map
f(0) = 0andf(1) = 1
Hence, a LambdaHom should only be used if none of the builtin
homomorphisms can achieve the same result, since a function that does
not follow the above axioms will make algorithms misbehave, and can
lead to hard-to-debug errors.
Implementations§
Source§impl<R: RingStore, S: RingStore, F> LambdaHom<R, S, F>
impl<R: RingStore, S: RingStore, F> LambdaHom<R, S, F>
Sourcepub fn new(from: R, to: S, f: F) -> Self
pub fn new(from: R, to: S, f: F) -> Self
Creates a new LambdaHom from from to to, mapping elements as
specified by the given function.
It is up to the user to ensure that the given closure indeed satisfies the ring homomorphism axioms:
- For
x, y in R, it should satisfyf(x) + f(y) = f(x + y) - For
x, y in R, it should satisfyf(x) * f(y) = f(x * y) - It should map
f(0) = 0andf(1) = 1
Hence, a LambdaHom should only be used if none of the builtin
homomorphisms can achieve the same result, since a function that does
not follow the above axioms will make algorithms misbehave, and can
lead to hard-to-debug errors.
Sourcepub fn into_domain_codomain(self) -> (R, S)
Available on crate feature unstable-enable only.
pub fn into_domain_codomain(self) -> (R, S)
unstable-enable only.Returns the stored domain and codomain rings, consuming this object.
§Availability
This API is marked as unstable and is only available when the unstable-enable crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.
Trait Implementations§
impl<R, S, F> Copy for LambdaHom<R, S, F>
Source§impl<R: RingStore, S: RingStore, F> Homomorphism<<R as RingStore>::Type, <S as RingStore>::Type> for LambdaHom<R, S, F>
impl<R: RingStore, S: RingStore, F> Homomorphism<<R as RingStore>::Type, <S as RingStore>::Type> for LambdaHom<R, S, F>
Source§type CodomainStore = S
type CodomainStore = S
RingStore used by this object to store the codomain ring.Source§type DomainStore = R
type DomainStore = R
RingStore used by this object to store the domain ring.Source§fn codomain(&self) -> &Self::CodomainStore
fn codomain(&self) -> &Self::CodomainStore
Source§fn domain(&self) -> &Self::DomainStore
fn domain(&self) -> &Self::DomainStore
Source§fn map(&self, x: El<R>) -> <S::Type as RingBase>::Element
fn map(&self, x: El<R>) -> <S::Type as RingBase>::Element
Source§fn map_ref(&self, x: &El<R>) -> <S::Type as RingBase>::Element
fn map_ref(&self, x: &El<R>) -> <S::Type as RingBase>::Element
Source§fn mul_assign_map(&self, lhs: &mut Codomain::Element, rhs: Domain::Element)
fn mul_assign_map(&self, lhs: &mut Codomain::Element, rhs: Domain::Element)
Source§fn mul_assign_ref_map(&self, lhs: &mut Codomain::Element, rhs: &Domain::Element)
fn mul_assign_ref_map(&self, lhs: &mut Codomain::Element, rhs: &Domain::Element)
Source§fn mul_map(
&self,
lhs: Codomain::Element,
rhs: Domain::Element,
) -> Codomain::Element
fn mul_map( &self, lhs: Codomain::Element, rhs: Domain::Element, ) -> Codomain::Element
Source§fn fma_map(
&self,
lhs: &Codomain::Element,
rhs: &Domain::Element,
summand: Codomain::Element,
) -> Codomain::Element
fn fma_map( &self, lhs: &Codomain::Element, rhs: &Domain::Element, summand: Codomain::Element, ) -> Codomain::Element
lhs * rhs + summand, where rhs is mapped
into the ring via this homomorphism. Read moreSource§fn mul_ref_fst_map(
&self,
lhs: &Codomain::Element,
rhs: Domain::Element,
) -> Codomain::Element
fn mul_ref_fst_map( &self, lhs: &Codomain::Element, rhs: Domain::Element, ) -> Codomain::Element
Source§fn mul_ref_snd_map(
&self,
lhs: Codomain::Element,
rhs: &Domain::Element,
) -> Codomain::Element
fn mul_ref_snd_map( &self, lhs: Codomain::Element, rhs: &Domain::Element, ) -> Codomain::Element
Source§fn mul_ref_map(
&self,
lhs: &Codomain::Element,
rhs: &Domain::Element,
) -> Codomain::Element
fn mul_ref_map( &self, lhs: &Codomain::Element, rhs: &Domain::Element, ) -> Codomain::Element
Source§fn compose<F, PrevDomain: ?Sized + RingBase>(
self,
prev: F,
) -> ComposedHom<PrevDomain, Domain, Codomain, F, Self>where
Self: Sized,
F: Homomorphism<PrevDomain, Domain>,
fn compose<F, PrevDomain: ?Sized + RingBase>(
self,
prev: F,
) -> ComposedHom<PrevDomain, Domain, Codomain, F, Self>where
Self: Sized,
F: Homomorphism<PrevDomain, Domain>,
x -> self.map(prev.map(x)).Source§fn mul_assign_ref_map_through_hom<First: ?Sized + RingBase, H: Homomorphism<First, Domain>>(
&self,
lhs: &mut Codomain::Element,
rhs: &First::Element,
hom: H,
)
fn mul_assign_ref_map_through_hom<First: ?Sized + RingBase, H: Homomorphism<First, Domain>>( &self, lhs: &mut Codomain::Element, rhs: &First::Element, hom: H, )
Source§fn mul_assign_map_through_hom<First: ?Sized + RingBase, H: Homomorphism<First, Domain>>(
&self,
lhs: &mut Codomain::Element,
rhs: First::Element,
hom: H,
)
fn mul_assign_map_through_hom<First: ?Sized + RingBase, H: Homomorphism<First, Domain>>( &self, lhs: &mut Codomain::Element, rhs: First::Element, hom: H, )
Auto Trait Implementations§
impl<R, S, F> Freeze for LambdaHom<R, S, F>
impl<R, S, F> RefUnwindSafe for LambdaHom<R, S, F>
impl<R, S, F> Send for LambdaHom<R, S, F>
impl<R, S, F> Sync for LambdaHom<R, S, F>
impl<R, S, F> Unpin for LambdaHom<R, S, F>
impl<R, S, F> UnsafeUnpin for LambdaHom<R, S, F>
impl<R, S, F> UnwindSafe for LambdaHom<R, S, F>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more