Struct feanor_math::ring::RingValue
source · pub struct RingValue<R: RingBase> { /* private fields */ }Expand description
The most fundamental crate::ring::RingStore. It is basically
a no-op container, i.e. stores a crate::ring::RingBase object
by value, and allows accessing it.
§Why is this necessary?
In fact, that we need this trait is just the result of a technical detail. We cannot implement
impl<R: RingBase> RingStore for R {}
impl<'a, R: RingStore> RingStore for &;a R {}since this might cause conflicting implementations. Instead, we implement
impl<R: RingBase> RingStore for RingValue<R> {}
impl<'a, R: RingStore> RingStore for &;a R {}This causes some inconvenience, as now we cannot chain
crate::ring::RingStore in the case of crate::ring::RingValue.
Furthermore, this trait will be necessary everywhere -
to define a reference to a ring of type A, we now have to
write &RingValue<A>.
To simplify this, we propose to use the following simple pattern: Create your ring type as
struct ABase { ... }
impl RingBase for ABase { ... } and then provide a type alias
type A = RingValue<ABase>;Implementations§
source§impl<T: PrimitiveInt> RingValue<StaticRingBase<T>>
impl<T: PrimitiveInt> RingValue<StaticRingBase<T>>
pub const RING: StaticRing<T> = _
source§impl RingValue<RustBigintRingBase>
impl RingValue<RustBigintRingBase>
pub const RING: RustBigintRing = _
source§impl<I: IntegerRingStore> RingValue<ZnBase<I>>where
I::Type: IntegerRing,
impl<I: IntegerRingStore> RingValue<ZnBase<I>>where
I::Type: IntegerRing,
source§impl<J: IntegerRingStore> RingValue<ZnBase<RingValue<ZnBase>, J>>where
J::Type: IntegerRing,
ZnBase: CanHomFrom<J::Type>,
StaticRingBase<i64>: CanIsoFromTo<J::Type>,
impl<J: IntegerRingStore> RingValue<ZnBase<RingValue<ZnBase>, J>>where
J::Type: IntegerRing,
ZnBase: CanHomFrom<J::Type>,
StaticRingBase<i64>: CanIsoFromTo<J::Type>,
pub fn from_primes(large_integers: J, primes: Vec<u64>) -> Self
source§impl<J: IntegerRingStore> RingValue<ZnBase<RingValue<ZnBase>, J>>where
J::Type: IntegerRing,
ZnBase: CanHomFrom<J::Type>,
StaticRingBase<i64>: CanIsoFromTo<J::Type>,
impl<J: IntegerRingStore> RingValue<ZnBase<RingValue<ZnBase>, J>>where
J::Type: IntegerRing,
ZnBase: CanHomFrom<J::Type>,
StaticRingBase<i64>: CanIsoFromTo<J::Type>,
pub fn create_from_primes(large_integers: J, primes: Vec<u64>) -> Self
source§impl<C: ZnRingStore, J: IntegerRingStore, M: MemoryProvider<El<C>>> RingValue<ZnBase<C, J, M>>where
C::Type: ZnRing + CanHomFrom<J::Type>,
J::Type: IntegerRing,
<C::Type as ZnRing>::IntegerRingBase: IntegerRing + CanIsoFromTo<J::Type>,
impl<C: ZnRingStore, J: IntegerRingStore, M: MemoryProvider<El<C>>> RingValue<ZnBase<C, J, M>>where
C::Type: ZnRing + CanHomFrom<J::Type>,
J::Type: IntegerRing,
<C::Type as ZnRing>::IntegerRingBase: IntegerRing + CanIsoFromTo<J::Type>,
sourcepub fn new(summands: Vec<C>, large_integers: J, memory_provider: M) -> Self
pub fn new(summands: Vec<C>, large_integers: J, memory_provider: M) -> Self
Creates a new ring for Z/nZ with n = m1 ... mr where the mi are the moduli
of the given component rings. Furthermore, the corresponding large integer ring must be
provided, which has to be able to store values of size at least n^3.
source§impl<R: RingStore> RingValue<DensePolyRingBase<R>>
impl<R: RingStore> RingValue<DensePolyRingBase<R>>
source§impl<R: RingStore> RingValue<SparsePolyRingBase<R>>
impl<R: RingStore> RingValue<SparsePolyRingBase<R>>
source§impl RingValue<Complex64Base>
impl RingValue<Complex64Base>
pub const RING: Self = _
pub const I: Complex64El = _
source§impl RingValue<Complex64Base>
impl RingValue<Complex64Base>
pub fn abs(&self, val: Complex64El) -> f64
pub fn conjugate(&self, val: Complex64El) -> Complex64El
pub fn exp(&self, exp: Complex64El) -> Complex64El
pub fn closest_gaussian_int(&self, val: Complex64El) -> (i64, i64)
pub fn ln_main_branch(&self, val: Complex64El) -> Complex64El
pub fn is_absolute_approx_eq( &self, lhs: Complex64El, rhs: Complex64El, absolute_threshold: f64, ) -> bool
pub fn is_relative_approx_eq( &self, lhs: Complex64El, rhs: Complex64El, relative_limit: f64, ) -> bool
pub fn is_approx_eq( &self, lhs: Complex64El, rhs: Complex64El, precision: u64, ) -> bool
pub fn from_f64(&self, x: f64) -> Complex64El
pub fn root_of_unity(&self, i: i64, n: i64) -> Complex64El
pub fn re(&self, x: Complex64El) -> f64
pub fn im(&self, x: Complex64El) -> f64
source§impl RingValue<Real64Base>
impl RingValue<Real64Base>
pub const RING: RingValue<Real64Base> = _
source§impl<R, V, M> RingValue<FreeAlgebraImplBase<R, V, M>>
impl<R, V, M> RingValue<FreeAlgebraImplBase<R, V, M>>
pub const fn new( base_ring: R, x_pow_rank: V, memory_provider: M, ) -> FreeAlgebraImpl<R, V, M>
source§impl<R, V, M> RingValue<FreeAlgebraImplBase<R, V, M>>
impl<R, V, M> RingValue<FreeAlgebraImplBase<R, V, M>>
source§impl<R, O, M, const N: usize> RingValue<MultivariatePolyRingImplBase<R, O, M, N>>
impl<R, O, M, const N: usize> RingValue<MultivariatePolyRingImplBase<R, O, M, N>>
source§impl<I> RingValue<RationalFieldBase<I>>
impl<I> RingValue<RationalFieldBase<I>>
Trait Implementations§
source§impl<R: RingBase> RingStore for RingValue<R>
impl<R: RingBase> RingStore for RingValue<R>
type Type = R
fn get_ring(&self) -> &R
source§fn add_assign_ref(&self, lhs: &mut El<Self>, rhs: &El<Self>)
fn add_assign_ref(&self, lhs: &mut El<Self>, rhs: &El<Self>)
source§fn add_assign(&self, lhs: &mut El<Self>, rhs: El<Self>)
fn add_assign(&self, lhs: &mut El<Self>, rhs: El<Self>)
source§fn sub_assign_ref(&self, lhs: &mut El<Self>, rhs: &El<Self>)
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>)
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>)
fn sub_self_assign_ref(&self, lhs: &mut El<Self>, rhs: &El<Self>)
source§fn negate_inplace(&self, lhs: &mut El<Self>)
fn negate_inplace(&self, lhs: &mut El<Self>)
source§fn mul_assign(&self, lhs: &mut El<Self>, rhs: El<Self>)
fn mul_assign(&self, lhs: &mut El<Self>, rhs: El<Self>)
source§fn mul_assign_ref(&self, lhs: &mut El<Self>, rhs: &El<Self>)
fn mul_assign_ref(&self, lhs: &mut El<Self>, rhs: &El<Self>)
source§fn zero(&self) -> El<Self>
fn zero(&self) -> El<Self>
RingBase::zero()source§fn one(&self) -> El<Self>
fn one(&self) -> El<Self>
RingBase::one()source§fn is_neg_one(&self, value: &El<Self>) -> bool
fn is_neg_one(&self, value: &El<Self>) -> bool
source§fn is_commutative(&self) -> bool
fn is_commutative(&self) -> bool
source§fn is_noetherian(&self) -> bool
fn is_noetherian(&self) -> bool
source§fn sub_assign(&self, lhs: &mut El<Self>, rhs: El<Self>)
fn sub_assign(&self, lhs: &mut El<Self>, rhs: El<Self>)
fn coerce<S>(&self, from: &S, el: El<S>) -> El<Self>
source§fn into_identity(self) -> Identity<Self>
fn into_identity(self) -> Identity<Self>
self -> self.source§fn into_can_hom<S>(self, from: S) -> Result<CanHom<S, Self>, (S, Self)>
fn into_can_hom<S>(self, from: S) -> Result<CanHom<S, Self>, (S, Self)>
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)>
fn into_can_iso<S>(self, from: S) -> Result<CanIso<S, Self>, (S, Self)>
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>>
fn can_hom<'a, S>(&'a self, from: &'a S) -> Option<CanHom<&'a S, &'a Self>>
from -> self, if it exists.source§fn can_iso<'a, S>(&'a self, from: &'a S) -> Option<CanIso<&'a S, &'a Self>>
fn can_iso<'a, S>(&'a self, from: &'a S) -> Option<CanIso<&'a S, &'a Self>>
from -> self, if it exists.source§fn into_int_hom(self) -> IntHom<Self>
fn into_int_hom(self) -> IntHom<Self>
Z -> self that exists for any ring.source§fn int_hom<'a>(&'a self) -> IntHom<&'a Self>
fn int_hom<'a>(&'a self) -> IntHom<&'a Self>
Z -> self that exists for any ring.fn sum<I>(&self, els: I) -> El<Self>
fn prod<I>(&self, els: I) -> El<Self>
fn pow(&self, x: El<Self>, power: usize) -> El<Self>
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>
fn format<'a>( &'a self, value: &'a El<Self>, ) -> RingElementDisplayWrapper<'a, Self>
std::fmt::Display, to use as formatting parameter. Read more