pub trait InterpolateArbitrary<F: Field>: Matrix<F> {
// Provided methods
fn interpolate_arbitrary_point<EF: ExtensionField<F>>(
&self,
x_coords: &[F],
point: EF,
) -> Option<Vec<EF>> { ... }
fn interpolate_arbitrary_with_precomputation<EF: ExtensionField<F>>(
&self,
weights: &[F],
diff_invs: &[EF],
) -> Vec<EF> { ... }
fn recover_coefficients(&self, x_coords: &[F]) -> Option<RowMajorMatrix<F>> { ... }
}Expand description
Lagrange interpolation over arbitrary evaluation domains.
General-domain counterpart of the structured-domain trait.
Blanket-implemented for every matrix over a field — just import and call.
Provided Methods§
Sourcefn interpolate_arbitrary_point<EF: ExtensionField<F>>(
&self,
x_coords: &[F],
point: EF,
) -> Option<Vec<EF>>
fn interpolate_arbitrary_point<EF: ExtensionField<F>>( &self, x_coords: &[F], point: EF, ) -> Option<Vec<EF>>
Evaluates every column polynomial at point via barycentric interpolation.
Each row holds evaluations at the corresponding domain point.
§Performance
O(n^2) weight computation + O(n * width) evaluation.
§Returns
Noneif any domain points coincide.- The matching row directly when the target equals a domain point.
Sourcefn interpolate_arbitrary_with_precomputation<EF: ExtensionField<F>>(
&self,
weights: &[F],
diff_invs: &[EF],
) -> Vec<EF>
fn interpolate_arbitrary_with_precomputation<EF: ExtensionField<F>>( &self, weights: &[F], diff_invs: &[EF], ) -> Vec<EF>
Evaluates every column polynomial at a target point with precomputed data.
Hot path: O(n * width) per call when weights are reused across targets.
§Safety
- The evaluation point
zmust not equal any domain pointx_i. weights[i]must be the barycentric weight forx_i, i.e.1 / prod_{j != i} (x_i - x_j).diff_invs[i]must be1 / (z - x_i).
§Panics
Debug-panics if the slices differ in length from the matrix height.
Sourcefn recover_coefficients(&self, x_coords: &[F]) -> Option<RowMajorMatrix<F>>
fn recover_coefficients(&self, x_coords: &[F]) -> Option<RowMajorMatrix<F>>
Recovers coefficient vectors for every column via batched Newton interpolation.
Each row of self holds evaluations at the corresponding domain point.
Returns an n * width matrix where row i holds degree-i coefficients.
§Performance
- O(n^2 * width) field operations.
- O(n + width) auxiliary memory, zero allocations inside the main loop.
§Returns
None if any domain points coincide.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".