Trait ark_ff::fields::CyclotomicMultSubgroup
source · pub trait CyclotomicMultSubgroup: Field {
const INVERSE_IS_FAST: bool = false;
// Provided methods
fn cyclotomic_square(&self) -> Self { ... }
fn cyclotomic_square_in_place(&mut self) -> &mut Self { ... }
fn cyclotomic_inverse(&self) -> Option<Self> { ... }
fn cyclotomic_inverse_in_place(&mut self) -> Option<&mut Self> { ... }
fn cyclotomic_exp(&self, e: impl AsRef<[u64]>) -> Self { ... }
fn cyclotomic_exp_in_place(&mut self, e: impl AsRef<[u64]>) { ... }
}
Expand description
Fields that have a cyclotomic multiplicative subgroup, and which can leverage efficient inversion and squaring algorithms for elements in this subgroup. If a field has multiplicative order p^d - 1, the cyclotomic subgroups refer to subgroups of order φ_n(p), for any n < d, where φ_n is the n-th cyclotomic polynomial.
Note
Note that this trait is unrelated to the Group
trait from the ark_ec
crate. That trait
denotes an additive group, while this trait denotes a multiplicative group.
Provided Associated Constants§
sourceconst INVERSE_IS_FAST: bool = false
const INVERSE_IS_FAST: bool = false
Is the inverse fast to compute? For example, in quadratic extensions, the inverse
can be computed at the cost of negating one coordinate, which is much faster than
standard inversion.
By default this is false
, but should be set to true
for quadratic extensions.
Provided Methods§
sourcefn cyclotomic_square(&self) -> Self
fn cyclotomic_square(&self) -> Self
Compute a square in the cyclotomic subgroup. By default this is computed using Field::square
, but for
degree 12 extensions, this can be computed faster than normal squaring.
Warning
This method should be invoked only when self
is in the cyclotomic subgroup.
sourcefn cyclotomic_square_in_place(&mut self) -> &mut Self
fn cyclotomic_square_in_place(&mut self) -> &mut Self
Square self
in place. By default this is computed using
Field::square_in_place
, but for degree 12 extensions,
this can be computed faster than normal squaring.
Warning
This method should be invoked only when self
is in the cyclotomic subgroup.
sourcefn cyclotomic_inverse(&self) -> Option<Self>
fn cyclotomic_inverse(&self) -> Option<Self>
Compute the inverse of self
. See Self::INVERSE_IS_FAST
for details.
Returns None
if self.is_zero()
, and Some
otherwise.
Warning
This method should be invoked only when self
is in the cyclotomic subgroup.
sourcefn cyclotomic_inverse_in_place(&mut self) -> Option<&mut Self>
fn cyclotomic_inverse_in_place(&mut self) -> Option<&mut Self>
Compute the inverse of self
. See Self::INVERSE_IS_FAST
for details.
Returns None
if self.is_zero()
, and Some
otherwise.
Warning
This method should be invoked only when self
is in the cyclotomic subgroup.
sourcefn cyclotomic_exp(&self, e: impl AsRef<[u64]>) -> Self
fn cyclotomic_exp(&self, e: impl AsRef<[u64]>) -> Self
Compute a cyclotomic exponentiation of self
with respect to e
.
Warning
This method should be invoked only when self
is in the cyclotomic subgroup.
sourcefn cyclotomic_exp_in_place(&mut self, e: impl AsRef<[u64]>)
fn cyclotomic_exp_in_place(&mut self, e: impl AsRef<[u64]>)
Set self
to be the result of exponentiating self
by e
,
using efficient cyclotomic algorithms.
Warning
This method should be invoked only when self
is in the cyclotomic subgroup.