Skip to content

Commit

Permalink
Save inverse on quotient numerator
Browse files Browse the repository at this point in the history
  • Loading branch information
spapinistarkware committed Mar 25, 2024
1 parent c91c9ca commit 5f6376d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 75 deletions.
5 changes: 3 additions & 2 deletions src/core/backend/cpu/quotients.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ pub fn accumulate_row_quotients(
for (column_index, sampled_value) in &sample.column_indices_and_values {
let column = &columns[*column_index];
let value = column[row];
let linear_term = complex_conjugate_line(sample.point, *sampled_value, domain_point);
numerator = numerator * random_coeff + value - linear_term;
let current_numerator =
complex_conjugate_line(domain_point, value, sample.point, *sampled_value);
numerator = numerator * random_coeff + current_numerator;
}

let denominator = pair_vanishing(
Expand Down
37 changes: 21 additions & 16 deletions src/core/constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,23 @@ pub fn point_vanishing<F: ExtensionOf<BaseField>, EF: ExtensionOf<F>>(
h.y / (EF::one() + h.x)
}

/// Evaluates a point on a line between a point and its complex conjugate.
/// Relies on the fact that every polynomial F over the base field holds:
/// F(p*) == F(p)* (* being the complex conjugate).
/// Evaluates a linear function in (domain_point.y, domain_value).
/// This function vanishes on the points
/// (complex_point.y, complex_value),
/// (complex_point.y.conjugate(), complex_value.conjugate()),
pub fn complex_conjugate_line(
point: CirclePoint<SecureField>,
value: SecureField,
p: CirclePoint<BaseField>,
domain_point: CirclePoint<BaseField>,
domain_value: BaseField,
complex_point: CirclePoint<SecureField>,
complex_value: SecureField,
) -> SecureField {
// TODO(AlonH): This assertion will fail at a probability of 1 to 2^62. Use a better solution.
assert_ne!(
point.y,
point.y.complex_conjugate(),
"Cannot evaluate a line with a single point ({point:?})."
let (x0, y0) = (domain_point.y, domain_value);
let (x1, y1) = (complex_point.y, complex_value);
let (x2, y2) = (
complex_point.y.complex_conjugate(),
complex_value.complex_conjugate(),
);
value
+ (value.complex_conjugate() - value) * (-point.y + p.y)
/ (point.complex_conjugate().y - point.y)
x0 * (y1 - y2) + x1 * (y2 - y0) + x2 * (y0 - y1)
}

#[cfg(test)]
Expand Down Expand Up @@ -205,8 +205,13 @@ mod tests {
// Compute the quotient polynomial.
let mut quotient_polynomial_values = Vec::with_capacity(large_domain_size as usize);
for point in large_domain.iter() {
let line = complex_conjugate_line(vanish_point, vanish_point_value, point);
let mut value = polynomial.eval_at_point(point.into_ef()) - line;
let line = complex_conjugate_line(
point,
polynomial.eval_at_point(point),
vanish_point,
vanish_point_value,
);
let mut value = polynomial.eval_at_point(point) - line;
value /= pair_vanishing(
vanish_point,
vanish_point.complex_conjugate(),
Expand Down
1 change: 0 additions & 1 deletion src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ pub mod constraints;
pub mod fft;
pub mod fields;
pub mod fri;
pub mod oods;
pub mod poly;
pub mod proof_of_work;
pub mod prover;
Expand Down
56 changes: 0 additions & 56 deletions src/core/oods.rs

This file was deleted.

0 comments on commit 5f6376d

Please sign in to comment.