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<R: RingBase> RingValue<R>
impl<R: RingBase> RingValue<R>
Sourcepub const fn from(value: R) -> Self
pub const fn from(value: R) -> Self
Wraps the given RingBase
in a RingValue
.
This is a dedicated function instead of an implementation
of std::convert::From
so that we can declare it const
.
Sourcepub fn into(self) -> R
pub fn into(self) -> R
Unwraps the RingBase
.
The more common case would be to get a reference, which can
be done with RingStore::get_ring()
.
Source§impl<T: PrimitiveInt> RingValue<StaticRingBase<T>>
impl<T: PrimitiveInt> RingValue<StaticRingBase<T>>
Sourcepub const RING: StaticRing<T>
pub const RING: StaticRing<T>
The singleton ring instance of StaticRing
.
Source§impl<A: Allocator + Clone> RingValue<RustBigintRingBase<A>>
impl<A: Allocator + Clone> RingValue<RustBigintRingBase<A>>
Sourcepub fn new_with_alloc(allocator: A) -> RustBigintRing<A>
Available on crate feature unstable-enable
only.
pub fn new_with_alloc(allocator: A) -> RustBigintRing<A>
unstable-enable
only.§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.
Source§impl RingValue<RustBigintRingBase>
impl RingValue<RustBigintRingBase>
Sourcepub const RING: RustBigintRing
pub const RING: RustBigintRing
Default instance of RustBigintRing
, the ring of arbitrary-precision integers.
Source§impl<C: RingStore, J: RingStore> RingValue<ZnBase<C, J>>where
C::Type: ZnRing + CanHomFrom<J::Type>,
J::Type: IntegerRing,
<C::Type as ZnRing>::IntegerRingBase: IntegerRing + CanIsoFromTo<J::Type>,
impl<C: RingStore, J: RingStore> RingValue<ZnBase<C, J>>where
C::Type: ZnRing + CanHomFrom<J::Type>,
J::Type: IntegerRing,
<C::Type as ZnRing>::IntegerRingBase: IntegerRing + CanIsoFromTo<J::Type>,
Source§impl<J: RingStore> RingValue<ZnBase<RingValue<ZnBase>, J>>
impl<J: RingStore> RingValue<ZnBase<RingValue<ZnBase>, J>>
pub fn create_from_primes(primes: Vec<i64>, large_integers: J) -> Self
Source§impl<C: RingStore, J: RingStore, A: Allocator + Clone> RingValue<ZnBase<C, J, A>>where
C::Type: ZnRing + CanHomFrom<J::Type>,
J::Type: IntegerRing,
<C::Type as ZnRing>::IntegerRingBase: IntegerRing + CanIsoFromTo<J::Type>,
impl<C: RingStore, J: RingStore, A: Allocator + Clone> RingValue<ZnBase<C, J, A>>where
C::Type: ZnRing + CanHomFrom<J::Type>,
J::Type: IntegerRing,
<C::Type as ZnRing>::IntegerRingBase: IntegerRing + CanIsoFromTo<J::Type>,
Sourcepub fn new_with_alloc(
summands: Vec<C>,
large_integers: J,
element_allocator: A,
) -> Self
Available on crate feature unstable-enable
only.
pub fn new_with_alloc( summands: Vec<C>, large_integers: J, element_allocator: A, ) -> Self
unstable-enable
only.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
.
§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.
Source§impl<C: RingStore, J: RingStore, A: Allocator + Clone> RingValue<ZnBase<C, J, A>>where
C::Type: ZnRing + CanHomFrom<J::Type>,
J::Type: IntegerRing,
<C::Type as ZnRing>::IntegerRingBase: IntegerRing + CanIsoFromTo<J::Type>,
impl<C: RingStore, J: RingStore, A: Allocator + Clone> RingValue<ZnBase<C, J, A>>where
C::Type: ZnRing + CanHomFrom<J::Type>,
J::Type: IntegerRing,
<C::Type as ZnRing>::IntegerRingBase: IntegerRing + CanIsoFromTo<J::Type>,
Sourcepub fn from_congruence<I>(&self, el: I) -> ZnEl<C, A>where
I: IntoIterator<Item = El<C>>,
pub fn from_congruence<I>(&self, el: I) -> ZnEl<C, A>where
I: IntoIterator<Item = El<C>>,
Given values ai
for each component ring Z/miZ
, computes the unique element in this
ring Z/nZ
that is congruent to ai
modulo mi
. The “opposite” function is Zn::get_congruence()
.
Sourcepub fn get_congruence<'a>(
&self,
el: &'a ZnEl<C, A>,
) -> impl 'a + VectorView<El<C>>
pub fn get_congruence<'a>( &self, el: &'a ZnEl<C, A>, ) -> impl 'a + VectorView<El<C>>
Given a
in Z/nZ
, returns the vector whose i
-th entry is a mod mi
, where the mi
are the
moduli of the component rings of this ring.
Source§impl<R: RingStore> RingValue<DensePolyRingBase<R>>
impl<R: RingStore> RingValue<DensePolyRingBase<R>>
Source§impl<R: RingStore, A: Allocator + Clone, C: ConvolutionAlgorithm<R::Type>> RingValue<DensePolyRingBase<R, A, C>>
impl<R: RingStore, A: Allocator + Clone, C: ConvolutionAlgorithm<R::Type>> RingValue<DensePolyRingBase<R, A, C>>
Sourcepub fn new_with_convolution(
base_ring: R,
unknown_name: &'static str,
element_allocator: A,
convolution_algorithm: C,
) -> Self
Available on crate feature unstable-enable
only.
pub fn new_with_convolution( base_ring: R, unknown_name: &'static str, element_allocator: A, convolution_algorithm: C, ) -> Self
unstable-enable
only.§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.
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<R, V> RingValue<FreeAlgebraImplBase<R, V>>
impl<R, V> RingValue<FreeAlgebraImplBase<R, V>>
Sourcepub fn new(base_ring: R, rank: usize, x_pow_rank: V) -> Self
pub fn new(base_ring: R, rank: usize, x_pow_rank: V) -> Self
Creates a new FreeAlgebraImpl
ring as extension of the given base ring.
The created ring is R[X]/(X^rank - sum_i x_pow_rank[i] X^i)
.
Source§impl<R, V, A, C> RingValue<FreeAlgebraImplBase<R, V, A, C>>
impl<R, V, A, C> RingValue<FreeAlgebraImplBase<R, V, A, C>>
Sourcepub fn new_with_convolution(
base_ring: R,
rank: usize,
x_pow_rank: V,
gen_name: &'static str,
element_allocator: A,
convolution: C,
) -> Self
Available on crate feature unstable-enable
only.
pub fn new_with_convolution( base_ring: R, rank: usize, x_pow_rank: V, gen_name: &'static str, element_allocator: A, convolution: C, ) -> Self
unstable-enable
only.§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.
Source§impl RingValue<GaloisFieldBase<RingValue<AsFieldBase<RingValue<FreeAlgebraImplBase<RingValue<AsFieldBase<RingValue<ZnBase>>>, SparseMapVector<RingValue<AsFieldBase<RingValue<ZnBase>>>>>>>>>>
impl RingValue<GaloisFieldBase<RingValue<AsFieldBase<RingValue<FreeAlgebraImplBase<RingValue<AsFieldBase<RingValue<ZnBase>>>, SparseMapVector<RingValue<AsFieldBase<RingValue<ZnBase>>>>>>>>>>
Sourcepub fn new(p: i64, degree: usize) -> Self
pub fn new(p: i64, degree: usize) -> Self
Creates a new instance of the finite/galois field GF(p^degree)
.
If you need more options for configuration, consider using GaloisField::new_with_convolution()
or
the most general GaloisField::create()
.
§Example
let F25 = GaloisField::new(5, 2);
let generator = F25.canonical_gen();
let norm = F25.mul_ref_fst(&generator, F25.pow(F25.clone_el(&generator), 5));
let inclusion = F25.inclusion();
// the norm must be an element of the prime field
assert!(F25.base_ring().elements().any(|x| {
F25.eq_el(&norm, &inclusion.map(x))
}));
Source§impl<R, A, C> RingValue<GaloisFieldBase<RingValue<AsFieldBase<RingValue<FreeAlgebraImplBase<R, SparseMapVector<R>, A, C>>>>>>where
R: RingStore + Clone,
R::Type: ZnRing + Field + SelfIso + CanHomFrom<StaticRingBase<i64>>,
C: ConvolutionAlgorithm<R::Type>,
A: Allocator + Clone,
impl<R, A, C> RingValue<GaloisFieldBase<RingValue<AsFieldBase<RingValue<FreeAlgebraImplBase<R, SparseMapVector<R>, A, C>>>>>>where
R: RingStore + Clone,
R::Type: ZnRing + Field + SelfIso + CanHomFrom<StaticRingBase<i64>>,
C: ConvolutionAlgorithm<R::Type>,
A: Allocator + Clone,
Sourcepub fn new_with_convolution(
base_field: R,
degree: usize,
allocator: A,
convolution_algorithm: C,
) -> Self
Available on crate feature unstable-enable
only.
pub fn new_with_convolution( base_field: R, degree: usize, allocator: A, convolution_algorithm: C, ) -> Self
unstable-enable
only.Creates a new instance of a finite/galois field, as given-degree extension of the given base ring. The base ring must have prime characteristic.
If you need to specify the minimal polynomial used, see also GaloisField::create()
.
§Example
Sometimes it is useful to have the base ring also be a field. This can e.g. be achieved by
#![feature(allocator_api)]
let F25 = GaloisField::new_with_convolution(Zn::new(5).as_field().ok().unwrap(), 2, Global, STANDARD_CONVOLUTION);
let generator = F25.canonical_gen();
let norm = F25.mul_ref_fst(&generator, F25.pow(F25.clone_el(&generator), 5));
let inclusion = F25.inclusion();
// the norm must be an element of the prime field
assert!(F25.base_ring().elements().any(|x| {
F25.eq_el(&norm, &inclusion.map(x))
}));
§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.
Source§impl<Impl> RingValue<GaloisFieldBase<Impl>>where
Impl: RingStore,
Impl::Type: Field + FreeAlgebra + FiniteRing,
<<Impl::Type as RingExtension>::BaseRing as RingStore>::Type: ZnRing + Field,
impl<Impl> RingValue<GaloisFieldBase<Impl>>where
Impl: RingStore,
Impl::Type: Field + FreeAlgebra + FiniteRing,
<<Impl::Type as RingExtension>::BaseRing as RingStore>::Type: ZnRing + Field,
Sourcepub fn create(base: Impl) -> Self
Available on crate feature unstable-enable
only.
pub fn create(base: Impl) -> Self
unstable-enable
only.Most generic function to create a finite/galois field.
It allows specifying all associated data. Note also that the passed implementation
must indeed be a field, and this is not checked at runtime. Passing a non-field
is impossible, unless AsFieldBase::promise_is_field()
is used.
§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.
Source§impl RingValue<NumberFieldBase<RingValue<AsFieldBase<RingValue<FreeAlgebraImplBase<RingValue<RationalFieldBase<RingValue<MPZBase>>>, Vec<<<RingValue<RationalFieldBase<RingValue<MPZBase>>> as RingStore>::Type as RingBase>::Element>>>>>, RingValue<MPZBase>>>
impl RingValue<NumberFieldBase<RingValue<AsFieldBase<RingValue<FreeAlgebraImplBase<RingValue<RationalFieldBase<RingValue<MPZBase>>>, Vec<<<RingValue<RationalFieldBase<RingValue<MPZBase>>> as RingStore>::Type as RingBase>::Element>>>>>, RingValue<MPZBase>>>
Sourcepub fn try_new<P>(poly_ring: P, generating_poly: &El<P>) -> Option<Self>where
P: RingStore,
P::Type: PolyRing,
<P::Type as RingExtension>::BaseRing: RingStore<Type = BigIntRingBase>,
Available on crate feature unstable-enable
only.
pub fn try_new<P>(poly_ring: P, generating_poly: &El<P>) -> Option<Self>where
P: RingStore,
P::Type: PolyRing,
<P::Type as RingExtension>::BaseRing: RingStore<Type = BigIntRingBase>,
unstable-enable
only.If the given polynomial is irreducible, returns the number field generated
by it (with a root of the polynomial as canonical generator). Otherwise,
None
is returned.
If the given polynomial is not integral or not monic, consider using
NumberField::try_adjoin_root()
instead.
§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.
Sourcepub fn new<P>(poly_ring: P, generating_poly: &El<P>) -> Selfwhere
P: RingStore,
P::Type: PolyRing,
<P::Type as RingExtension>::BaseRing: RingStore<Type = BigIntRingBase>,
Available on crate feature unstable-enable
only.
pub fn new<P>(poly_ring: P, generating_poly: &El<P>) -> Selfwhere
P: RingStore,
P::Type: PolyRing,
<P::Type as RingExtension>::BaseRing: RingStore<Type = BigIntRingBase>,
unstable-enable
only.Given a monic, integral and irreducible polynomial, returns the number field generated by it (with a root of the polynomial as canonical generator).
Panics if the polynomial is not irreducible.
If the given polynomial is not integral or not monic, consider using
NumberField::adjoin_root()
instead.
§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.
Sourcepub fn try_adjoin_root<P>(
poly_ring: P,
generating_poly: &El<P>,
) -> Option<(Self, El<Self>)>where
P: RingStore,
P::Type: PolyRing,
<P::Type as RingExtension>::BaseRing: RingStore<Type = RationalFieldBase<BigIntRing>>,
Available on crate feature unstable-enable
only.
pub fn try_adjoin_root<P>(
poly_ring: P,
generating_poly: &El<P>,
) -> Option<(Self, El<Self>)>where
P: RingStore,
P::Type: PolyRing,
<P::Type as RingExtension>::BaseRing: RingStore<Type = RationalFieldBase<BigIntRing>>,
unstable-enable
only.If the given polynopmial is irreducible, computes the number field generated
by one of its roots, and returns it together with the root (which is not necessarily
the canonical generator of the number field). Otherwise, None
is returned.
§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.
Sourcepub fn adjoin_root<P>(poly_ring: P, generating_poly: &El<P>) -> (Self, El<Self>)where
P: RingStore,
P::Type: PolyRing,
<P::Type as RingExtension>::BaseRing: RingStore<Type = RationalFieldBase<BigIntRing>>,
Available on crate feature unstable-enable
only.
pub fn adjoin_root<P>(poly_ring: P, generating_poly: &El<P>) -> (Self, El<Self>)where
P: RingStore,
P::Type: PolyRing,
<P::Type as RingExtension>::BaseRing: RingStore<Type = RationalFieldBase<BigIntRing>>,
unstable-enable
only.§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.
Source§impl<Impl, I> RingValue<NumberFieldBase<Impl, I>>where
Impl: RingStore,
Impl::Type: Field + FreeAlgebra,
<Impl::Type as RingExtension>::BaseRing: RingStore<Type = RationalFieldBase<I>>,
I: RingStore,
I::Type: IntegerRing,
impl<Impl, I> RingValue<NumberFieldBase<Impl, I>>where
Impl: RingStore,
Impl::Type: Field + FreeAlgebra,
<Impl::Type as RingExtension>::BaseRing: RingStore<Type = RationalFieldBase<I>>,
I: RingStore,
I::Type: IntegerRing,
Sourcepub fn create(implementation: Impl) -> Self
Available on crate feature unstable-enable
only.
pub fn create(implementation: Impl) -> Self
unstable-enable
only.Creates a new number field with the given underlying implementation.
Requires that all coefficients of the generating polynomial are integral.
§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.
Sourcepub fn into_choose_complex_embedding(self) -> ComplexEmbedding<Self, Impl, I>
Available on crate feature unstable-enable
only.
pub fn into_choose_complex_embedding(self) -> ComplexEmbedding<Self, Impl, I>
unstable-enable
only.§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.
Sourcepub fn choose_complex_embedding<'a>(
&'a self,
) -> ComplexEmbedding<&'a Self, Impl, I>
Available on crate feature unstable-enable
only.
pub fn choose_complex_embedding<'a>( &'a self, ) -> ComplexEmbedding<&'a Self, Impl, I>
unstable-enable
only.§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.
Source§impl<R> RingValue<MultivariatePolyRingImplBase<R>>where
R: RingStore,
impl<R> RingValue<MultivariatePolyRingImplBase<R>>where
R: RingStore,
Source§impl<R, A> RingValue<MultivariatePolyRingImplBase<R, A>>
impl<R, A> RingValue<MultivariatePolyRingImplBase<R, A>>
Sourcepub fn new_with_mult_table(
base_ring: R,
variable_count: usize,
max_supported_deg: u16,
max_multiplication_table: (u16, u16),
allocator: A,
) -> Self
Available on crate feature unstable-enable
only.
pub fn new_with_mult_table( base_ring: R, variable_count: usize, max_supported_deg: u16, max_multiplication_table: (u16, u16), allocator: A, ) -> Self
unstable-enable
only.Creates a new instance of the ring base_ring[X0, ..., Xn]
where n = variable_count - 1
.
The can represent all monomials up to the given degree, and will panic should an operation produce a monomial that exceeds this degree.
Furthermore, max_multiplication_table = (d1, d2)
configures for which monomials a multiplication
table is precomputed. In particular, a multiplication table is precomputed for all products where
one summand has degree <= d2
and the other summand has degree <= d1
. Note that d1 <= d2
is
required.
§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.
Source§impl RingValue<Real64Base>
impl RingValue<Real64Base>
Sourcepub const RING: RingValue<Real64Base>
pub const RING: RingValue<Real64Base>
The singleton ring instance of Real64
.
Source§impl<I> RingValue<RationalFieldBase<I>>
impl<I> RingValue<RationalFieldBase<I>>
Source§impl<R> RingValue<AsLocalPIRBase<R>>
impl<R> RingValue<AsLocalPIRBase<R>>
Source§impl<R> RingValue<AsLocalPIRBase<R>>
impl<R> RingValue<AsLocalPIRBase<R>>
Sourcepub fn from_field(ring: R) -> Self
Available on crate feature unstable-enable
only.
pub fn from_field(ring: R) -> Self
unstable-enable
only.§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.
Source§impl<R> RingValue<AsLocalPIRBase<R>>
impl<R> RingValue<AsLocalPIRBase<R>>
Sourcepub fn from_localpir(ring: R) -> Self
Available on crate feature unstable-enable
only.
pub fn from_localpir(ring: R) -> Self
unstable-enable
only.§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.
Source§impl<R> RingValue<AsLocalPIRBase<R>>
impl<R> RingValue<AsLocalPIRBase<R>>
Sourcepub fn from_as_field(ring: AsField<R>) -> Self
Available on crate feature unstable-enable
only.
pub fn from_as_field(ring: AsField<R>) -> Self
unstable-enable
only.§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.
Source§impl<R> RingValue<FractionFieldImplBase<R>>
impl<R> RingValue<FractionFieldImplBase<R>>
Trait Implementations§
Source§impl<'de, R> Deserialize<'de> for RingValue<R>where
R: Deserialize<'de> + RingBase,
impl<'de, R> Deserialize<'de> for RingValue<R>where
R: Deserialize<'de> + RingBase,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<R: RingBase> RingStore for RingValue<R>
impl<R: RingBase> RingStore for RingValue<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>)
Source§fn fma(&self, lhs: &El<Self>, rhs: &El<Self>, summand: El<Self>) -> El<Self>
fn fma(&self, lhs: &El<Self>, rhs: &El<Self>, summand: El<Self>) -> El<Self>
RingBase::fma()
Source§fn coerce<S>(&self, from: &S, el: El<S>) -> 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.Source§fn sum<I>(&self, els: I) -> El<Self>where
I: IntoIterator<Item = El<Self>>,
fn sum<I>(&self, els: I) -> El<Self>where
I: IntoIterator<Item = El<Self>>,
Source§fn try_sum<I, E>(&self, els: I) -> Result<El<Self>, E>
fn try_sum<I, E>(&self, els: I) -> Result<El<Self>, E>
RingStore::sum()
if the producer of the ring elements
can fail, in which case summation is aborted and the error returned.Source§fn prod<I>(&self, els: I) -> El<Self>where
I: IntoIterator<Item = El<Self>>,
fn prod<I>(&self, els: I) -> El<Self>where
I: IntoIterator<Item = El<Self>>,
Source§fn pow(&self, x: El<Self>, power: usize) -> El<Self>
fn pow(&self, x: El<Self>, power: usize) -> El<Self>
Source§fn pow_gen<R: RingStore>(
&self,
x: El<Self>,
power: &El<R>,
integers: R,
) -> El<Self>where
R::Type: IntegerRing,
fn pow_gen<R: RingStore>(
&self,
x: El<Self>,
power: &El<R>,
integers: R,
) -> El<Self>where
R::Type: IntegerRing,
IntegerRing
. Read moreSource§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 moreSource§fn format_within<'a>(
&'a self,
value: &'a El<Self>,
within: EnvBindingStrength,
) -> RingElementDisplayWrapper<'a, Self>
fn format_within<'a>( &'a self, value: &'a El<Self>, within: EnvBindingStrength, ) -> RingElementDisplayWrapper<'a, Self>
std::fmt::Display
, to use as formatting parameter. As opposed to
RingStore::format()
, this function takes an additional argument to
specify the context the result is printed in, which is used to determine
whether to put the value in parenthesis or not. Read moreSource§fn println(&self, value: &El<Self>)
fn println(&self, value: &El<Self>)
Source§fn characteristic<I: RingStore + Copy>(&self, ZZ: I) -> Option<El<I>>where
I::Type: IntegerRing,
fn characteristic<I: RingStore + Copy>(&self, ZZ: I) -> Option<El<I>>where
I::Type: IntegerRing,
impl<R: Copy + RingBase> Copy for RingValue<R>
Auto Trait Implementations§
impl<R> Freeze for RingValue<R>where
R: Freeze,
impl<R> RefUnwindSafe for RingValue<R>where
R: RefUnwindSafe,
impl<R> Send for RingValue<R>where
R: Send,
impl<R> Sync for RingValue<R>where
R: Sync,
impl<R> Unpin for RingValue<R>where
R: Unpin,
impl<R> UnwindSafe for RingValue<R>where
R: UnwindSafe,
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<R> DivisibilityRingStore for R
impl<R> DivisibilityRingStore for R
Source§impl<R> EuclideanRingStore for R
impl<R> EuclideanRingStore for R
Source§impl<R> FiniteRingStore for R
impl<R> FiniteRingStore for R
Source§fn elements<'a>(&'a self) -> <Self::Type as FiniteRing>::ElementsIter<'a>
fn elements<'a>(&'a self) -> <Self::Type as FiniteRing>::ElementsIter<'a>
Source§fn size<I: IntegerRingStore + Copy>(&self, ZZ: I) -> Option<El<I>>where
I::Type: IntegerRing,
fn size<I: IntegerRingStore + Copy>(&self, ZZ: I) -> Option<El<I>>where
I::Type: IntegerRing,
FiniteRing::size()
.Source§impl<R> FreeAlgebraStore for R
impl<R> FreeAlgebraStore for R
Source§fn canonical_gen(&self) -> El<Self>
fn canonical_gen(&self) -> El<Self>
Source§fn wrt_canonical_basis<'a>(
&'a self,
el: &'a El<Self>,
) -> <Self::Type as FreeAlgebra>::VectorRepresentation<'a>
fn wrt_canonical_basis<'a>( &'a self, el: &'a El<Self>, ) -> <Self::Type as FreeAlgebra>::VectorRepresentation<'a>
Source§fn from_canonical_basis<V>(&self, vec: V) -> El<Self>where
V: IntoIterator<Item = El<<Self::Type as RingExtension>::BaseRing>>,
V::IntoIter: DoubleEndedIterator,
fn from_canonical_basis<V>(&self, vec: V) -> El<Self>where
V: IntoIterator<Item = El<<Self::Type as RingExtension>::BaseRing>>,
V::IntoIter: DoubleEndedIterator,
Source§fn from_canonical_basis_extended<V>(&self, vec: V) -> El<Self>
fn from_canonical_basis_extended<V>(&self, vec: V) -> El<Self>
Source§fn generating_poly<P, H>(&self, poly_ring: P, hom: H) -> El<P>where
P: PolyRingStore,
P::Type: PolyRing,
H: Homomorphism<<<Self::Type as RingExtension>::BaseRing as RingStore>::Type, <<P::Type as RingExtension>::BaseRing as RingStore>::Type>,
fn generating_poly<P, H>(&self, poly_ring: P, hom: H) -> El<P>where
P: PolyRingStore,
P::Type: PolyRing,
H: Homomorphism<<<Self::Type as RingExtension>::BaseRing as RingStore>::Type, <<P::Type as RingExtension>::BaseRing as RingStore>::Type>,
f(X)
such that this ring is isomorphic
to R[X]/(f(X))
, where R
is the base ring.Source§fn as_field(self) -> Result<AsField<Self>, Self>where
Self::Type: DivisibilityRing,
<<Self::Type as RingExtension>::BaseRing as RingStore>::Type: Field + FactorPolyField,
fn as_field(self) -> Result<AsField<Self>, Self>where
Self::Type: DivisibilityRing,
<<Self::Type as RingExtension>::BaseRing as RingStore>::Type: Field + FactorPolyField,
crate::field::FieldStore
. Read moreSource§fn poly_repr<P, H>(&self, to: P, el: &El<Self>, hom: H) -> El<P>where
P: PolyRingStore,
P::Type: PolyRing,
H: Homomorphism<<<Self::Type as RingExtension>::BaseRing as RingStore>::Type, <<P::Type as RingExtension>::BaseRing as RingStore>::Type>,
fn poly_repr<P, H>(&self, to: P, el: &El<Self>, hom: H) -> El<P>where
P: PolyRingStore,
P::Type: PolyRing,
H: Homomorphism<<<Self::Type as RingExtension>::BaseRing as RingStore>::Type, <<P::Type as RingExtension>::BaseRing as RingStore>::Type>,
y
, i.e. the polynomial f(X)
of degree at most
FreeAlgebraStore::rank()
such that f(x) = y
, where y
is the canonical generator of this ring, as given by
FreeAlgebraStore::canonical_gen()
.Source§fn discriminant(&self) -> El<<Self::Type as RingExtension>::BaseRing>
fn discriminant(&self) -> El<<Self::Type as RingExtension>::BaseRing>
(Tr(a^(i + j)))
,
where a
is the canonical generator of this ring extension. Read moreSource§fn charpoly<P, H>(&self, el: &El<Self>, poly_ring: P, hom: H) -> El<P>where
P: RingStore,
P::Type: PolyRing,
<<P::Type as RingExtension>::BaseRing as RingStore>::Type: LinSolveRing,
H: Homomorphism<<<Self::Type as RingExtension>::BaseRing as RingStore>::Type, <<P::Type as RingExtension>::BaseRing as RingStore>::Type>,
fn charpoly<P, H>(&self, el: &El<Self>, poly_ring: P, hom: H) -> El<P>where
P: RingStore,
P::Type: PolyRing,
<<P::Type as RingExtension>::BaseRing as RingStore>::Type: LinSolveRing,
H: Homomorphism<<<Self::Type as RingExtension>::BaseRing as RingStore>::Type, <<P::Type as RingExtension>::BaseRing as RingStore>::Type>,
FreeAlgebra::charpoly()
.Source§fn with_wrapped_generator<'a, F, const M: usize>(
&'a self,
f: F,
) -> [El<Self>; M]
fn with_wrapped_generator<'a, F, const M: usize>( &'a self, f: F, ) -> [El<Self>; M]
RingElementWrapper
, for more
natural creation of ring elements.Source§impl<R> HashableElRingStore for R
impl<R> HashableElRingStore for R
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 moreSource§impl<R> LinSolveRingStore for R
impl<R> LinSolveRingStore for R
Source§fn solve_right<V1, V2, V3>(
&self,
lhs: SubmatrixMut<'_, V1, El<Self>>,
rhs: SubmatrixMut<'_, V2, El<Self>>,
out: SubmatrixMut<'_, V3, El<Self>>,
) -> SolveResultwhere
V1: AsPointerToSlice<El<Self>>,
V2: AsPointerToSlice<El<Self>>,
V3: AsPointerToSlice<El<Self>>,
fn solve_right<V1, V2, V3>(
&self,
lhs: SubmatrixMut<'_, V1, El<Self>>,
rhs: SubmatrixMut<'_, V2, El<Self>>,
out: SubmatrixMut<'_, V3, El<Self>>,
) -> SolveResultwhere
V1: AsPointerToSlice<El<Self>>,
V2: AsPointerToSlice<El<Self>>,
V3: AsPointerToSlice<El<Self>>,
lhs * X = rhs
. Read moreSource§fn solve_right_with<V1, V2, V3, A>(
&self,
lhs: SubmatrixMut<'_, V1, El<Self>>,
rhs: SubmatrixMut<'_, V2, El<Self>>,
out: SubmatrixMut<'_, V3, El<Self>>,
allocator: A,
) -> SolveResultwhere
V1: AsPointerToSlice<El<Self>>,
V2: AsPointerToSlice<El<Self>>,
V3: AsPointerToSlice<El<Self>>,
A: Allocator,
fn solve_right_with<V1, V2, V3, A>(
&self,
lhs: SubmatrixMut<'_, V1, El<Self>>,
rhs: SubmatrixMut<'_, V2, El<Self>>,
out: SubmatrixMut<'_, V3, El<Self>>,
allocator: A,
) -> SolveResultwhere
V1: AsPointerToSlice<El<Self>>,
V2: AsPointerToSlice<El<Self>>,
V3: AsPointerToSlice<El<Self>>,
A: Allocator,
lhs * X = rhs
. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R> PrincipalIdealRingStore for R
impl<R> PrincipalIdealRingStore for R
Source§fn extended_ideal_gen(
&self,
lhs: &El<Self>,
rhs: &El<Self>,
) -> (El<Self>, El<Self>, El<Self>)
fn extended_ideal_gen( &self, lhs: &El<Self>, rhs: &El<Self>, ) -> (El<Self>, El<Self>, El<Self>)
Source§fn annihilator(&self, val: &El<Self>) -> El<Self>
fn annihilator(&self, val: &El<Self>) -> El<Self>
Source§impl<R> RingExtensionStore for R
impl<R> RingExtensionStore for R
Source§fn into_inclusion(self) -> Inclusion<Self>
fn into_inclusion(self) -> Inclusion<Self>
R -> self
.