-
Notifications
You must be signed in to change notification settings - Fork 121
Closed
Description
We removed the SqrtField
trait in ff 0.7.0
, as all fields that we intend the Field
trait to apply to support a sqrt
operation (ff_derive
is able to derive implementations for p = 3 (mod 4)
and p = 1 (mod 16)
). More precisely, SqrtField
was a separate trait because Field
was previously implemented on the pairing::bls12_381::{Fq6, Fq12}
extension fields of BLS12-381, which didn't have square-root operations; these are not part of the bls12_381
crate's public API.
In #6, @hdevalence had separately suggested adding several sqrt-related operations to the then-existing SqrtField
trait:
pub trait SqrtField: FiniteField {
/// Computes sqrt(u/v)
fn sqrt_ratio(u: &Self, v: &Self) -> Self;
/// Computes 1/sqrt(self)
fn invsqrt(&self) -> Self {
Self::sqrt_ratio(&Self::one(), self)
}
/// Computes sqrt(self)
fn sqrt(&self) -> Self {
Self::sqrt_ratio(self, &Self::one())
}
}
If these would be sufficiently widely-useful, they could be added to the Field
trait. If not, we could consider re-introducing the SqrtField
trait.
Metadata
Metadata
Assignees
Labels
No labels