pub struct BetaValues<F: Field> {
pub values: Vec<BetaValueType<F>>,
}Expand description
A struct that holds the claim and the relevant bound values for the beta equality MLE. Rather than storing the entire beta table, we simply store the points in the claim that are still “unbound”, and the points that have been bound using the [Thaler13] definition of a beta table.
Beta tables are used to “linearize” an expression that we wish to evaluate
over a claimed point (g_0, ..., g_n). Therefore we create an MLE that
evaluates to 1 at this point and 0 at every other point, which is a
beta table. This would be a table of size 2^n.
Instead, we represent the beta MLE \beta(g_0, ..., g_{n-1}; x_0, ..., x_{n-1}) by mapping each
index i that participates in this MLE to either g_i, if x_i has not yet been bound, or to
(1 - r_i)*(1 - g_i) + r_i*g_i, if x_i has already been bound to r_i. Indices in the range
{0, 1, ..., n-1} which are not part of this MLE are called “unassigned” and they don’t map to
any value.
Fields§
§values: Vec<BetaValueType<F>>Map from each index to a beta value type
Implementations§
Source§impl<F: Field> BetaValues<F>
impl<F: Field> BetaValues<F>
Sourcepub fn new(layer_claim_vars_and_index: Vec<(usize, F)>) -> Self
pub fn new(layer_claim_vars_and_index: Vec<(usize, F)>) -> Self
Constructs a new beta table using a vector of the challenge points in a claim along with it’s corresponding round index as a tuple.
Sourcepub fn beta_update(&mut self, round_index: usize, challenge: F)
pub fn beta_update(&mut self, round_index: usize, challenge: F)
Updates the given value of beta using a new challenge point. Simply
(1 - r_i)*(1 - g_i) + (r_i * g_i) for an index i, previous claim
challenge point g_i and current challenge r_i.
We remove it from the unbound hashmap and add it to the bound hashmap.
Sourcepub fn get_updated_value(&self, index: usize) -> Option<F>
pub fn get_updated_value(&self, index: usize) -> Option<F>
obtain the value at an index if it is updated do not check for out of bound
Sourcepub fn get_unbound_value(&self, index: usize) -> Option<F>
pub fn get_unbound_value(&self, index: usize) -> Option<F>
obtain the value at an index if it is unbounded
Sourcepub fn is_fully_bounded(&self) -> bool
pub fn is_fully_bounded(&self) -> bool
determine if no entry is unbound
Sourcepub fn fold_updated_values(&self) -> F
pub fn fold_updated_values(&self) -> F
obtain product of all updated values
Sourcepub fn get_relevant_beta_unbound_and_bound(
&self,
mle_indices: &[MleIndex<F>],
round_index: usize,
computes_evals: bool,
) -> (Vec<F>, Vec<F>)
pub fn get_relevant_beta_unbound_and_bound( &self, mle_indices: &[MleIndex<F>], round_index: usize, computes_evals: bool, ) -> (Vec<F>, Vec<F>)
Given a vector of mle indices, returns the relevant beta bound and
unbound values we need. if the index is Indexed(usize), then we grab
the unbound value and if it is Bound(usize, chal) we grab the
bound value.
Sourcepub fn compute_beta_over_two_challenges(
challenge_one: &[F],
challenge_two: &[F],
) -> F
pub fn compute_beta_over_two_challenges( challenge_one: &[F], challenge_two: &[F], ) -> F
Takes two challenge points and computes the fully bound beta equality value.
Sourcepub fn compute_beta_over_challenge_and_index(challenge: &[F], idx: usize) -> F
pub fn compute_beta_over_challenge_and_index(challenge: &[F], idx: usize) -> F
Computes the value of \beta(challenge; b), where b is the binary
representation of idx.
Sourcepub fn new_beta_equality_mle(
layer_claim_vars: Vec<F>,
) -> MultilinearExtension<F>
pub fn new_beta_equality_mle( layer_claim_vars: Vec<F>, ) -> MultilinearExtension<F>
Returns the full beta equality table as defined in [Thaler13], so over
n challenge points it returns a table of size 2^n. This is when we
do still need the entire beta table. Essentially this is an MLE whose coefficients represent
whether the index is equal to the random challenge point.
Trait Implementations§
Source§impl<F: Clone + Field> Clone for BetaValues<F>
impl<F: Clone + Field> Clone for BetaValues<F>
Source§fn clone(&self) -> BetaValues<F>
fn clone(&self) -> BetaValues<F>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<F: Debug + Field> Debug for BetaValues<F>
impl<F: Debug + Field> Debug for BetaValues<F>
Source§impl<'de, F> Deserialize<'de> for BetaValues<F>where
F: Field,
impl<'de, F> Deserialize<'de> for BetaValues<F>where
F: Field,
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>,
Auto Trait Implementations§
impl<F> Freeze for BetaValues<F>
impl<F> RefUnwindSafe for BetaValues<F>where
F: RefUnwindSafe,
impl<F> Send for BetaValues<F>
impl<F> Sync for BetaValues<F>
impl<F> Unpin for BetaValues<F>where
F: Unpin,
impl<F> UnwindSafe for BetaValues<F>where
F: 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,
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.