pub trait FundamentalDiscriminant: Discriminant {
// Provided method
fn inject<E: Element>(&self, element: impl Element, p: &impl Encoding) -> E
where Self: NegativeDiscriminant { ... }
}Expand description
A fundamental (square-free) discriminant.
Provided Methods§
Sourcefn inject<E: Element>(&self, element: impl Element, p: &impl Encoding) -> Ewhere
Self: NegativeDiscriminant,
Available on crate feature alloc only.
fn inject<E: Element>(&self, element: impl Element, p: &impl Encoding) -> Ewhere
Self: NegativeDiscriminant,
alloc only.Take an element of the class group with fundamental discriminant and apply the injection such that it is mapped to an element of the class group with non-fundamental discriminant.
This implements Algorithm 2, GoToNonMaxOrder. We specify it as follows for primitive forms
of fundamental negative discriminants:
fn inject(a, b, c, p) {
discriminant = (b * b) - (4 * a * c)
(a, b) = coprime_form(a, b, c, p)
return reduce(a, b * p, discriminant * p * p)
}This is slightly different in that we do not specify the reduction of $b \mod 2 a$. Instead,
we assume the existence of a reduction function, reduce, which inputs the a, b
coefficients of an unreduced form and its discriminant before yielding a reduced form.
The resulting form is primitive however. First, the input is bound to be primitive. Second,
coprime_form yields an equivalent form, where equivalence preserves primitivity. Finally,
coprime_form yields a form whose a coefficient is coprime to p, so scaling the b
coefficient by p won’t affect the greatest common divisor of a, b.
This function MAY panic or return an incorrect result if element is not of this
discriminant. This function runs in time only variable to the discriminant, the length of the
encoding of p, and E::a_b_c_discriminant (which may be implemented in constant-time).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".