pub struct Poly { /* private fields */ }Expand description
A univariate polynomial in the prime field.
Implementations§
Source§impl Poly
impl Poly
Sourcepub fn random<R: Rng>(degree: usize, rng: &mut R) -> Self
pub fn random<R: Rng>(degree: usize, rng: &mut R) -> Self
Creates a random polynomial.
§Panics
Panics if the degree is too large for the coefficients to fit into a Vec.
Sourcepub fn try_random<R: Rng>(degree: usize, rng: &mut R) -> Result<Self>
pub fn try_random<R: Rng>(degree: usize, rng: &mut R) -> Result<Self>
Creates a random polynomial. This constructor is identical to the Poly::random()
constructor in every way except that this constructor will return an Err where
try_random would return an error.
Sourcepub fn interpolate<T, U, I>(samples_repr: I) -> Self
pub fn interpolate<T, U, I>(samples_repr: I) -> Self
Returns the unique polynomial f of degree samples.len() - 1 with the given values
(x, f(x)).
Sourcepub fn commitment(&self) -> Commitment
pub fn commitment(&self) -> Commitment
Returns the corresponding commitment.
Trait Implementations§
Source§impl<B: Borrow<Poly>> AddAssign<B> for Poly
impl<B: Borrow<Poly>> AddAssign<B> for Poly
Source§fn add_assign(&mut self, rhs: B)
fn add_assign(&mut self, rhs: B)
Performs the
+= operation. Read moreSource§impl Debug for Poly
A debug statement where the coeff vector of prime field elements has been redacted.
impl Debug for Poly
A debug statement where the coeff vector of prime field elements has been redacted.
Source§impl<'de> Deserialize<'de> for Poly
impl<'de> Deserialize<'de> for Poly
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Poly
Source§impl From<Poly> for SecretKeySet
impl From<Poly> for SecretKeySet
Source§fn from(poly: Poly) -> SecretKeySet
fn from(poly: Poly) -> SecretKeySet
Converts to this type from the input type.
Source§impl From<Vec<Fr>> for Poly
Creates a new Poly instance from a vector of prime field elements representing the
coefficients of the polynomial.
impl From<Vec<Fr>> for Poly
Creates a new Poly instance from a vector of prime field elements representing the
coefficients of the polynomial.
Source§impl<B: Borrow<Self>> MulAssign<B> for Poly
impl<B: Borrow<Self>> MulAssign<B> for Poly
Source§fn mul_assign(&mut self, rhs: B)
fn mul_assign(&mut self, rhs: B)
Performs the
*= operation. Read moreSource§impl MulAssign<Fr> for Poly
impl MulAssign<Fr> for Poly
Source§fn mul_assign(&mut self, rhs: Fr)
fn mul_assign(&mut self, rhs: Fr)
Performs the
*= operation. Read moreimpl StructuralPartialEq for Poly
Auto Trait Implementations§
impl Freeze for Poly
impl RefUnwindSafe for Poly
impl Send for Poly
impl Sync for Poly
impl Unpin for Poly
impl UnsafeUnpin for Poly
impl UnwindSafe for Poly
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more