Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: rename UV/MVPolynomial to DenseUV/MVPolynomial #412

Merged
merged 1 commit into from
May 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
- [\#393](https://github.com/arkworks-rs/algebra/pull/393) (`ark-ec`, `ark-ff`) Rename `FpXParams` to `FpXConfig` and `FpXParamsWrapper` to `FpXConfigWrapper`.
- [\#396](https://github.com/arkworks-rs/algebra/pull/396) (`ark-ec`) Remove `mul_bits` feature, and remove default implementations of `mul` and `mul_by_cofactor_to_projective`.
- [\#408](https://github.com/arkworks-rs/algebra/pull/408) (`ark-ff`) Change the output of `Display` formatting for BigInt & Fp from hex to decimal.
- [\#412](https://github.com/arkworks-rs/algebra/pull/412) (`ark-poly`) rename UV/MVPolynomial to DenseUV/MVPolynomial

### Features

Expand Down
2 changes: 1 addition & 1 deletion ec/src/hashing/curve_maps/wb/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use core::marker::PhantomData;

use crate::{models::SWModelParameters, ModelParameters};
use ark_ff::batch_inversion;
use ark_poly::{univariate::DensePolynomial, Polynomial, UVPolynomial};
use ark_poly::{univariate::DensePolynomial, DenseUVPolynomial, Polynomial};

use crate::{
hashing::{map_to_curve_hasher::MapToCurve, HashToCurveError},
Expand Down
2 changes: 1 addition & 1 deletion poly-benches/benches/dense_uv_polynomial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ extern crate criterion;
use ark_ff::{FftField, Field};
use ark_poly::{
polynomial::univariate::{DensePolynomial, SparsePolynomial},
EvaluationDomain, GeneralEvaluationDomain, Polynomial, UVPolynomial,
DenseUVPolynomial, EvaluationDomain, GeneralEvaluationDomain, Polynomial,
};
use ark_poly_benches::size_range;
use ark_std::rand::Rng;
Expand Down
2 changes: 1 addition & 1 deletion poly-benches/benches/fft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ extern crate criterion;

use ark_ff::FftField;
use ark_poly::{
polynomial::{univariate::DensePolynomial, UVPolynomial},
polynomial::{univariate::DensePolynomial, DenseUVPolynomial},
EvaluationDomain, MixedRadixEvaluationDomain, Radix2EvaluationDomain,
};
use ark_poly_benches::size_range;
Expand Down
8 changes: 4 additions & 4 deletions poly/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ The `polynomial` module provides the following traits for defining polynomials i
Requires implementors to support common operations on polynomials,
such as `Add`, `Sub`, `Zero`, evaluation at a point, degree, etc,
and defines methods to serialize to and from the coefficient representation of the polynomial.
- [`UVPolynomial`](./src/polynomial/mod.rs#L43) :
- [`DenseUVPolynomial`](./src/polynomial/mod.rs#L43) :
Specifies that a `Polynomial` is actually a *univariate* polynomial.
- [`MVPolynomial`](./src/polynomial/mod.rs#L59):
- [`DenseMVPolynomial`](./src/polynomial/mod.rs#L59):
Specifies that a `Polynomial` is actually a *multivariate* polynomial.

This crate also provides the following data structures that implement these traits:

- [`univariate/DensePolynomial`](./src/polynomial/univariate/dense.rs#L22):
Represents degree `d` univariate polynomials via a list of `d + 1` coefficients.
This struct implements the [`UVPolynomial`](./src/polynomial/mod.rs#L43) trait.
This struct implements the [`DenseUVPolynomial`](./src/polynomial/mod.rs#L43) trait.
- [`univariate/SparsePolynomial`](./src/polynomial/univariate/sparse.rs#L15):
Represents degree `d` univariate polynomials via a list containing all non-zero monomials.
This should only be used when most coefficients of the polynomial are zero.
This struct implements the [`Polynomial`](./src/polynomial/mod.rs#L16) trait
(but *not* the `UVPolynomial` trait).
(but *not* the `DenseUVPolynomial` trait).
- [`multivariate/SparsePolynomial`](./src/polynomial/multivariate/sparse.rs#L21):
Represents multivariate polynomials via a list containing all non-zero monomials.

Expand Down
2 changes: 1 addition & 1 deletion poly/src/domain/radix2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ impl<F: FftField> EvaluationDomain<F> for Radix2EvaluationDomain<F> {
mod tests {
use crate::{
domain::Vec,
polynomial::{univariate::*, Polynomial, UVPolynomial},
polynomial::{univariate::*, DenseUVPolynomial, Polynomial},
EvaluationDomain, Radix2EvaluationDomain,
};
use ark_ff::{FftField, Field, One, UniformRand, Zero};
Expand Down
4 changes: 3 additions & 1 deletion poly/src/evaluations/univariate/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//! A univariate polynomial represented in evaluations form.

use crate::{univariate::DensePolynomial, EvaluationDomain, GeneralEvaluationDomain, UVPolynomial};
use crate::{
univariate::DensePolynomial, DenseUVPolynomial, EvaluationDomain, GeneralEvaluationDomain,
};
use ark_ff::{batch_inversion, FftField};
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize, SerializationError};
use ark_std::{
Expand Down
2 changes: 1 addition & 1 deletion poly/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub use evaluations::{
},
univariate::Evaluations,
};
pub use polynomial::{multivariate, univariate, MVPolynomial, Polynomial, UVPolynomial};
pub use polynomial::{multivariate, univariate, DenseMVPolynomial, DenseUVPolynomial, Polynomial};

#[cfg(test)]
mod test;
4 changes: 2 additions & 2 deletions poly/src/polynomial/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub trait Polynomial<F: Field>:
}

/// Describes the interface for univariate polynomials
pub trait UVPolynomial<F: Field>: Polynomial<F, Point = F> {
pub trait DenseUVPolynomial<F: Field>: Polynomial<F, Point = F> {
/// Constructs a new polynomial from a list of coefficients.
fn from_coefficients_slice(coeffs: &[F]) -> Self;

Expand All @@ -56,7 +56,7 @@ pub trait UVPolynomial<F: Field>: Polynomial<F, Point = F> {
}

/// Describes the interface for multivariate polynomials
pub trait MVPolynomial<F: Field>: Polynomial<F> {
pub trait DenseMVPolynomial<F: Field>: Polynomial<F> {
/// The type of the terms of `self`
type Term: multivariate::Term;

Expand Down
4 changes: 2 additions & 2 deletions poly/src/polynomial/multivariate/sparse.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! A sparse multivariate polynomial represented in coefficient form.
use crate::{
multivariate::{SparseTerm, Term},
MVPolynomial, Polynomial,
DenseMVPolynomial, Polynomial,
};
use ark_ff::{Field, Zero};
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize, SerializationError};
Expand Down Expand Up @@ -58,7 +58,7 @@ impl<F: Field> Polynomial<F> for SparsePolynomial<F, SparseTerm> {
}
}

impl<F: Field> MVPolynomial<F> for SparsePolynomial<F, SparseTerm> {
impl<F: Field> DenseMVPolynomial<F> for SparsePolynomial<F, SparseTerm> {
/// Returns the number of variables in `self`
fn num_vars(&self) -> usize {
self.num_vars
Expand Down
4 changes: 2 additions & 2 deletions poly/src/polynomial/univariate/dense.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! A dense univariate polynomial represented in coefficient form.
use crate::{
univariate::{DenseOrSparsePolynomial, SparsePolynomial},
EvaluationDomain, Evaluations, GeneralEvaluationDomain, Polynomial, UVPolynomial,
DenseUVPolynomial, EvaluationDomain, Evaluations, GeneralEvaluationDomain, Polynomial,
};
use ark_ff::{FftField, Field, Zero};
use ark_serialize::*;
Expand Down Expand Up @@ -94,7 +94,7 @@ impl<F: Field> DensePolynomial<F> {
}
}

impl<F: Field> UVPolynomial<F> for DensePolynomial<F> {
impl<F: Field> DenseUVPolynomial<F> for DensePolynomial<F> {
/// Constructs a new polynomial from a list of coefficients.
fn from_coefficients_slice(coeffs: &[F]) -> Self {
Self::from_coefficients_vec(coeffs.to_vec())
Expand Down
2 changes: 1 addition & 1 deletion poly/src/polynomial/univariate/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Work with sparse and dense polynomials.

use crate::{EvaluationDomain, Evaluations, Polynomial, UVPolynomial};
use crate::{DenseUVPolynomial, EvaluationDomain, Evaluations, Polynomial};
use ark_ff::{FftField, Field, Zero};
use ark_std::{borrow::Cow, convert::TryInto, vec::Vec};
use DenseOrSparsePolynomial::*;
Expand Down
2 changes: 1 addition & 1 deletion poly/src/polynomial/univariate/sparse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use crate::{
polynomial::Polynomial,
univariate::{DenseOrSparsePolynomial, DensePolynomial},
EvaluationDomain, Evaluations, UVPolynomial,
DenseUVPolynomial, EvaluationDomain, Evaluations,
};
use ark_ff::{FftField, Field, Zero};
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize, SerializationError};
Expand Down