mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-05 23:33:07 +00:00
Merge branch 'main' into fri-extension-field
This commit is contained in:
commit
37f6ee53cc
@ -267,7 +267,7 @@ pub trait Field:
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn rand() -> Self {
|
fn rand() -> Self {
|
||||||
Self::rand_from_rng(&mut OsRng)
|
Self::rand_from_rng(&mut rand::thread_rng())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn rand_vec(n: usize) -> Vec<Self> {
|
fn rand_vec(n: usize) -> Vec<Self> {
|
||||||
|
|||||||
@ -128,7 +128,13 @@ impl<F: Field> PolynomialCoeffs<F> {
|
|||||||
/// Computes the inverse of `self` modulo `x^n`.
|
/// Computes the inverse of `self` modulo `x^n`.
|
||||||
pub(crate) fn inv_mod_xn(&self, n: usize) -> Self {
|
pub(crate) fn inv_mod_xn(&self, n: usize) -> Self {
|
||||||
assert!(self.coeffs[0].is_nonzero(), "Inverse doesn't exist.");
|
assert!(self.coeffs[0].is_nonzero(), "Inverse doesn't exist.");
|
||||||
let mut h = self.padded(n);
|
|
||||||
|
let h = if self.len() < n {
|
||||||
|
self.padded(n)
|
||||||
|
} else {
|
||||||
|
self.clone()
|
||||||
|
};
|
||||||
|
|
||||||
let mut a = Self::empty();
|
let mut a = Self::empty();
|
||||||
a.coeffs.push(h.coeffs[0].inverse());
|
a.coeffs.push(h.coeffs[0].inverse());
|
||||||
for i in 0..log2_ceil(n) {
|
for i in 0..log2_ceil(n) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user