pub struct Hom<G: AffineRepr>(pub Vec<G>);Tuple Fields§
§0: Vec<G>First n-k elements for multiples of P_i and next n for g. This holds the vector of
bases such that the inner product of this vector and vector Y given P_i
Implementations§
Source§impl<G: AffineRepr> Hom<G>
impl<G: AffineRepr> Hom<G>
Sourcepub fn new(
g: G,
P: G,
k: usize,
n: usize,
i: usize,
) -> Result<Self, CompSigmaError>
pub fn new( g: G, P: G, k: usize, n: usize, i: usize, ) -> Result<Self, CompSigmaError>
For k known openings of n total commitments, the homomorphism for the commitment at index i is
g * t_i + P_i * -\sum_{j in 1..n-k}(a_j*i^j)
For g * t_i, the bases will be a vector [0, 0, ..., g, 0, ..., 0] of size n with g at index i and rest as 0
For P_i * \sum_{j in 1..n-k}(a_j*i^j), its equal to P_i * -a_1 * i + P_2 * -a_2 * i^2 + ... + P_i * -a_{n-k} * i^{n-k}
which is equal to (P_i * -i) * a_1 + (P_i * -i^2) * a_2 + ... + (P_i * -i^{n-k}) * a_{n-k}. Thus the bases for it
can be written as vector [(P_i * -i), (P_i * -i^2), ..., (P_i * -i^{n-k})] of size n-k.
Thus the final bases are [(P_i * -i), (P_i * -i^2), ..., (P_i * -i^{n-k}), 0, 0, ..., g, 0, ..., 0] of size 2*n-k
Trait Implementations§
Source§impl<G: AffineRepr> Homomorphism<<G as AffineRepr>::ScalarField> for Hom<G>
impl<G: AffineRepr> Homomorphism<<G as AffineRepr>::ScalarField> for Hom<G>
type Output = G
fn eval(&self, x: &[G::ScalarField]) -> Result<Self::Output, CompSigmaError>
fn scale(&self, scalar: &G::ScalarField) -> Self
fn add(&self, other: &Self) -> Result<Self, CompSigmaError>
fn split_in_half(&self) -> (Self, Self)
fn size(&self) -> usize
fn pad(&self, new_size: u32) -> Self
Auto Trait Implementations§
impl<G> Freeze for Hom<G>
impl<G> RefUnwindSafe for Hom<G>where
G: RefUnwindSafe,
impl<G> Send for Hom<G>
impl<G> Sync for Hom<G>
impl<G> Unpin for Hom<G>where
G: Unpin,
impl<G> UnwindSafe for Hom<G>where
G: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more