pub struct PadicRing { /* private fields */ }Expand description
The p-adic integers known modulo p^N, with N fixed at construction.
This is a finite-precision context, not the infinite ring Z_p disguised
as exact. Every element is a canonical FLINT-backed residue modulo p^N,
so its coefficient storage is bounded before allocation by the context’s
Self::modulus. Arithmetic preserves the same absolute precision cap.
Implementations§
Source§impl PadicRing
impl PadicRing
Sourcepub fn coefficient_frobenius(&self, exponent: u64) -> PadicRingFrobenius
pub fn coefficient_frobenius(&self, exponent: u64) -> PadicRingFrobenius
Checked coefficient Frobenius power, the identity on Z_p coefficients.
Source§impl PadicRing
impl PadicRing
Sourcepub fn precision_restriction(
&self,
target_absolute_precision: u64,
) -> Result<PadicRingRestriction, PadicRestrictionError>
pub fn precision_restriction( &self, target_absolute_precision: u64, ) -> Result<PadicRingRestriction, PadicRestrictionError>
Construct a first-class restriction to a coarser fixed-cap ring.
Sourcepub fn divide_uniformizer_exact(
&self,
value: &PadicElement,
exponent: u64,
) -> Result<PadicElement, PadicUniformizerDivisionError>
pub fn divide_uniformizer_exact( &self, value: &PadicElement, exponent: u64, ) -> Result<PadicElement, PadicUniformizerDivisionError>
Divide by p^exponent, requiring the quotient to remain integral.
Source§impl PadicRing
impl PadicRing
Sourcepub fn new<T: Into<Integer>>(
prime: T,
absolute_precision: u64,
) -> Result<Self, PadicContextError>
pub fn new<T: Into<Integer>>( prime: T, absolute_precision: u64, ) -> Result<Self, PadicContextError>
Construct fixed-cap p-adic integers known modulo p^N.
Sourcepub fn absolute_precision(&self) -> u64
pub fn absolute_precision(&self) -> u64
Immutable absolute precision cap N.
Sourcepub fn modulus(&self) -> &Integer
pub fn modulus(&self) -> &Integer
Storage modulus p^N; every element has a representative in
[0, p^N), giving the promised per-element coefficient bound.
Sourcepub fn residue_field(&self) -> &FiniteField
pub fn residue_field(&self) -> &FiniteField
Prime residue field F_p.
Sourcepub fn element<T: Into<Integer>>(&self, value: T) -> PadicElement
pub fn element<T: Into<Integer>>(&self, value: T) -> PadicElement
Embed an integer as a value known modulo p^N.
Sourcepub fn to_json(&self) -> Result<String, NoetherError>
pub fn to_json(&self) -> Result<String, NoetherError>
Serialize the fixed prime and absolute precision as canonical typed JSON.
Sourcepub fn from_json(value: &str) -> Result<Self, NoetherError>
pub fn from_json(value: &str) -> Result<Self, NoetherError>
Deserialize and revalidate a fixed-precision p-adic ring context.
Sourcepub fn residue(
&self,
value: &PadicElement,
) -> Result<FiniteFieldElement, ContextMismatchError>
pub fn residue( &self, value: &PadicElement, ) -> Result<FiniteFieldElement, ContextMismatchError>
Reduce a p-adic integer to its prime residue field.
Sourcepub fn teichmuller(
&self,
value: &FiniteFieldElement,
) -> Result<PadicElement, ContextMismatchError>
pub fn teichmuller( &self, value: &FiniteFieldElement, ) -> Result<PadicElement, ContextMismatchError>
Lift a residue-field element to its Teichmüller representative modulo
p^N, characterized by [a]^p = [a] and [a] mod p = a.
Sourcepub fn hensel_lift(
&self,
polynomial: &Polynomial<Self>,
residue_root: &FiniteFieldElement,
) -> Result<PadicElement, HenselLiftError>
pub fn hensel_lift( &self, polynomial: &Polynomial<Self>, residue_root: &FiniteFieldElement, ) -> Result<PadicElement, HenselLiftError>
Lift a simple root modulo p to a root at this context’s full precision.
The polynomial must be univariate over this exact PadicRing, the
supplied value must be a root in its residue field, and the derivative
must be nonzero there. The returned value is checked to annihilate the
polynomial modulo p^N; unmet hypotheses fail closed.
Sourcepub fn restrict(
&self,
value: &PadicElement,
requested_absolute_precision: u64,
) -> Result<PadicElement, PadicRestrictionError>
pub fn restrict( &self, value: &PadicElement, requested_absolute_precision: u64, ) -> Result<PadicElement, PadicRestrictionError>
Discard high p-adic digits explicitly, producing a value in the
distinct context (p, requested_absolute_precision).
Trait Implementations§
Source§impl CoefficientFrobeniusContext for PadicRing
impl CoefficientFrobeniusContext for PadicRing
Source§type Frobenius = PadicRingFrobenius
type Frobenius = PadicRingFrobenius
Source§fn coefficient_frobenius(&self, exponent: u64) -> Self::Frobenius
fn coefficient_frobenius(&self, exponent: u64) -> Self::Frobenius
Source§fn residue_characteristic(&self) -> &Integer
fn residue_characteristic(&self) -> &Integer
Source§impl<'de> Deserialize<'de> for PadicRing
impl<'de> Deserialize<'de> for PadicRing
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 FiniteContext for PadicRing
impl FiniteContext for PadicRing
Source§impl PrecisionContext for PadicRing
impl PrecisionContext for PadicRing
Source§impl Ring for PadicRing
impl Ring for PadicRing
Source§type Element = PadicElement
type Element = PadicElement
Source§fn contains(&self, value: &Self::Element) -> bool
fn contains(&self, value: &Self::Element) -> bool
Source§fn add(
&self,
a: &Self::Element,
b: &Self::Element,
) -> Result<Self::Element, ContextMismatchError>
fn add( &self, a: &Self::Element, b: &Self::Element, ) -> Result<Self::Element, ContextMismatchError>
Source§fn sub(
&self,
a: &Self::Element,
b: &Self::Element,
) -> Result<Self::Element, ContextMismatchError>
fn sub( &self, a: &Self::Element, b: &Self::Element, ) -> Result<Self::Element, ContextMismatchError>
Source§fn mul(
&self,
a: &Self::Element,
b: &Self::Element,
) -> Result<Self::Element, ContextMismatchError>
fn mul( &self, a: &Self::Element, b: &Self::Element, ) -> Result<Self::Element, ContextMismatchError>
Source§fn neg(
&self,
value: &Self::Element,
) -> Result<Self::Element, ContextMismatchError>
fn neg( &self, value: &Self::Element, ) -> Result<Self::Element, ContextMismatchError>
Source§fn is_zero(&self, value: &Self::Element) -> bool
fn is_zero(&self, value: &Self::Element) -> bool
Source§fn sum_products(
&self,
products: &[(&Self::Element, &Self::Element)],
) -> Result<Self::Element, ContextMismatchError>
fn sum_products( &self, products: &[(&Self::Element, &Self::Element)], ) -> Result<Self::Element, ContextMismatchError>
Source§impl SemanticType for PadicRing
impl SemanticType for PadicRing
Source§const TYPE_ID: &'static str = "noether/numthy/PadicRing@1"
const TYPE_ID: &'static str = "noether/numthy/PadicRing@1"
Source§fn canonical_bytes(&self) -> Result<Vec<u8>, NoetherError>
fn canonical_bytes(&self) -> Result<Vec<u8>, NoetherError>
Source§fn describe() -> &'static TypeDescription
fn describe() -> &'static TypeDescription
Source§impl UnitInversion for PadicRing
impl UnitInversion for PadicRing
Source§impl ValuedRing for PadicRing
impl ValuedRing for PadicRing
Source§fn uniformizer(&self) -> Self::Element
fn uniformizer(&self) -> Self::Element
impl CommutativeRing for PadicRing
impl Eq for PadicRing
Auto Trait Implementations§
impl Freeze for PadicRing
impl RefUnwindSafe for PadicRing
impl Send for PadicRing
impl Sync for PadicRing
impl Unpin for PadicRing
impl UnwindSafe for PadicRing
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