Module winter_math::polynom[][src]

Expand description

Basic polynomial operations.

This module provides a set of function for basic polynomial operations, including:

  • Polynomial evaluation using Horner method.
  • Polynomial interpolation using Lagrange method.
  • Polynomial addition, subtraction, multiplication, and division.
  • Synthetic polynomial division for efficient division by polynomials of the form x^a - b.

In the context of this module any slice of field elements is considered to be a polynomial in reverse coefficient form. A few examples:

// p(x) = 2 * x + 1
let p = vec![BaseElement::new(1), BaseElement::new(2)];

// p(x) = 4 * x^2 + 3
let p = [BaseElement::new(3), BaseElement::ZERO, BaseElement::new(4)];

Functions

Returns a polynomial resulting from adding two polynomials together.

Returns the degree of the provided polynomial.

Returns a polynomial resulting from dividing one polynomial by another.

Evaluates a polynomial at a single point and returns the result.

Evaluates a polynomial at multiple points and returns a vector of results.

Returns a polynomial in coefficient form interpolated from a set of X and Y coordinates.

Returns a vector of polynomials interpolated from the provided X and Y coordinate batches.

Returns a polynomial resulting from multiplying two polynomials together.

Returns a polynomial resulting from multiplying a given polynomial by a scalar value.

Returns a polynomial with all leading ZERO coefficients removed.

Returns a polynomial resulting from subtracting one polynomial from another.

Returns a polynomial resulting from dividing a polynomial by a polynomial of special form.

Divides a polynomial by a polynomial of special form and saves the result into the original polynomial.