pub struct ShiftIndPartialEval<F: Field> { /* private fields */ }
Expand description

Represents MLE of shift indicator $f_{b, o}(X, Y)$ on $2*b$ variables partially evaluated at $Y = r$

§Formal Definition

Let $x, y \in {0, 1}^b$ If ShiftVariant is CircularLeft: * $f(x, y) = 1$ if ${y} - {o} \equiv {x} (\text{mod } 2^b)$ * $f(x, y) = 0$ otw

Else if ShiftVariant is LogicalLeft:

  • $f(x, y) = 1$ if ${y} - {o} \equiv {x}$
  • $f(x, y) = 0$ otw

Else, ShiftVariant is LogicalRight:

  • $f(x, y) = 1$ if ${y} + {o} \equiv {x}$
  • $f(x, y) = 0$ otw

where:

  • ${x}$ is the integer representation of the hypercube point $x \in {0, 1}^b$,
  • $b$ is the block size parameter’
  • $o$ is the shift offset parameter.

Observe $\forall x \in {0, 1}^b$, there is at most one $y \in {0, 1}^b$ s.t. $f(x, y) = 1$

§Intuition

Consider the lexicographic ordering of each point on the $b$-variate hypercube into a $2^b$ length array. Thus, we can give each element on the hypercube a unique index $\in {0, \ldots, 2^b - 1}$ Let $x, y \in {0, 1}^{b}$ be s.t. ${x} = i$ and ${y} = j$ $f(x, y) = 1$ iff: * taking $o$ steps from $j$ gets you to $i$ (wrap around if ShiftVariant is Circular + direction of steps depending on ShiftVariant’s direction)

§Note

CircularLeft corresponds to the shift indicator in Section 4.3. LogicalLeft corresponds to the shift prime indicator in Section 4.3. LogicalRight corresponds to the shift double prime indicator in Section 4.3.

§Example

Let $b$ = 2, $o$ = 1, variant = CircularLeft. The hypercube points (0, 0), (1, 0), (0, 1), (1, 1) can be lexicographically ordered into an array [(0, 0), (1, 0), (0, 1), (1, 1)] Then, by considering the index of each hypercube point in the above array, we observe: * $f((0, 0), (1, 0)) = 1$ because $1 - 1 = 0$ mod $4$ * $f((1, 0), (0, 1)) = 1$ because $2 - 1 = 1$ mod $4$ * $f((0, 1), (1, 1)) = 1$ because $3 - 1 = 2$ mod $4$ * $f((1, 1), (0, 0)) = 1$ because $0 - 1 = 3$ mod $4$ and every other pair of $b$-variate hypercube points $x, y \in {0, 1}^{b}$ is s.t. f(x, y) = 0. Using these shift params, if f = [[a_i, b_i, c_i, d_i]_i], then shifted_f = [[b_i, c_i, d_i, a_i]_i]

§Example

Let $b$ = 2, $o$ = 1, variant = LogicalLeft. The hypercube points (0, 0), (1, 0), (0, 1), (1, 1) can be lexicographically ordered into an array [(0, 0), (1, 0), (0, 1), (1, 1)] Then, by considering the index of each hypercube point in the above array, we observe: * $f((0, 0), (1, 0)) = 1$ because $1 - 1 = 0$ * $f((1, 0), (0, 1)) = 1$ because $2 - 1 = 1$ * $f((0, 1), (1, 1)) = 1$ because $3 - 1 = 2$ and every other pair of $b$-variate hypercube points $x, y \in {0, 1}^{b}$ is s.t. f(x, y) = 0. Using these shift params, if f = [[a_i, b_i, c_i, d_i]_i], then shifted_f = [[b_i, c_i, d_i, 0]_i]

§Example

Let $b$ = 2, $o$ = 1, variant = LogicalRight. The hypercube points (0, 0), (1, 0), (0, 1), (1, 1) can be lexicographically ordered into an array [(0, 0), (1, 0), (0, 1), (1, 1)] Then, by considering the index of each hypercube point in the above array, we observe: * $f((1, 0), (0, 0)) = 1$ because $0 + 1 = 1$ * $f((0, 1), (1, 0)) = 1$ because $1 + 1 = 2$ * $f((1, 1), (0, 1)) = 1$ because $2 + 1 = 3$ and every other pair of $b$-variate hypercube points $x, y \in {0, 1}^{b}$ is s.t. f(x, y) = 0. Using these shift params, if f = [[a_i, b_i, c_i, d_i]_i], then shifted_f = [[0, a_i, b_i, c_i]_i]

Implementations§

source§

impl<F: Field> ShiftIndPartialEval<F>

source

pub fn new( block_size: usize, shift_offset: usize, shift_variant: ShiftVariant, r: Vec<F> ) -> Result<Self, Error>

source

pub fn multilinear_extension<P>(&self) -> Result<MultilinearExtension<P>, Error>
where P: PackedFieldIndexable<Scalar = F>,

Evaluates this partially evaluated circular shift indicator MLE $f(X, r)$ over the entire $b$-variate hypercube

Trait Implementations§

source§

impl<F: Clone + Field> Clone for ShiftIndPartialEval<F>

source§

fn clone(&self) -> ShiftIndPartialEval<F>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<F: Debug + Field> Debug for ShiftIndPartialEval<F>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<F: TowerField> MultivariatePoly<F> for ShiftIndPartialEval<F>

source§

fn n_vars(&self) -> usize

The number of variables.
source§

fn degree(&self) -> usize

Total degree of the polynomial.
source§

fn evaluate(&self, query: &[F]) -> Result<F, Error>

Evaluate the polynomial at a point in the extension field.
source§

fn binary_tower_level(&self) -> usize

Returns the maximum binary tower level of all constants in the arithmetic expression.

Auto Trait Implementations§

§

impl<F> Freeze for ShiftIndPartialEval<F>
where <F as WithUnderlier>::Underlier: PackScalar<F> + UnderlierType + Sync + Send + Zeroable + NoUninit + Random + Copy + Clone + ConstantTimeEq + Eq + PartialEq + Default + Debug + Sized + 'static, F: WithUnderlier + Zeroable + InvertOrZero + Square + for<'a> MulAssign<&'a F> + for<'a> SubAssign<&'a F> + for<'a> AddAssign<&'a F> + MulAssign + SubAssign + AddAssign + for<'a> Product<&'a F> + for<'a> Sum<&'a F> + for<'a> Mul<&'a F, Output = F, Output = F> + for<'a> Sub<&'a F, Output = F, Output = F> + for<'a> Add<&'a F, Output = F, Output = F> + Product + Sum + Mul + Sub + Add + Neg<Output = F> + Debug + Sync + Send + Default + Clone + Copy + Eq + PartialEq + 'static,

§

impl<F> RefUnwindSafe for ShiftIndPartialEval<F>
where <F as WithUnderlier>::Underlier: PackScalar<F> + UnderlierType + Sync + Send + Zeroable + NoUninit + Random + Copy + Clone + ConstantTimeEq + Eq + PartialEq + Default + Debug + Sized + 'static, F: WithUnderlier + Zeroable + InvertOrZero + Square + for<'a> MulAssign<&'a F> + for<'a> SubAssign<&'a F> + for<'a> AddAssign<&'a F> + MulAssign + SubAssign + AddAssign + for<'a> Product<&'a F> + for<'a> Sum<&'a F> + for<'a> Mul<&'a F, Output = F, Output = F> + for<'a> Sub<&'a F, Output = F, Output = F> + for<'a> Add<&'a F, Output = F, Output = F> + Product + Sum + Mul + Sub + Add + Neg<Output = F> + Debug + Sync + Send + Default + Clone + Copy + Eq + PartialEq + 'static + RefUnwindSafe,

§

impl<F> Send for ShiftIndPartialEval<F>
where <F as WithUnderlier>::Underlier: PackScalar<F> + UnderlierType + Sync + Send + Zeroable + NoUninit + Random + Copy + Clone + ConstantTimeEq + Eq + PartialEq + Default + Debug + Sized + 'static, F: WithUnderlier + Zeroable + InvertOrZero + Square + for<'a> MulAssign<&'a F> + for<'a> SubAssign<&'a F> + for<'a> AddAssign<&'a F> + MulAssign + SubAssign + AddAssign + for<'a> Product<&'a F> + for<'a> Sum<&'a F> + for<'a> Mul<&'a F, Output = F, Output = F> + for<'a> Sub<&'a F, Output = F, Output = F> + for<'a> Add<&'a F, Output = F, Output = F> + Product + Sum + Mul + Sub + Add + Neg<Output = F> + Debug + Sync + Send + Default + Clone + Copy + Eq + PartialEq + 'static,

§

impl<F> Sync for ShiftIndPartialEval<F>
where <F as WithUnderlier>::Underlier: PackScalar<F> + UnderlierType + Sync + Send + Zeroable + NoUninit + Random + Copy + Clone + ConstantTimeEq + Eq + PartialEq + Default + Debug + Sized + 'static, F: WithUnderlier + Zeroable + InvertOrZero + Square + for<'a> MulAssign<&'a F> + for<'a> SubAssign<&'a F> + for<'a> AddAssign<&'a F> + MulAssign + SubAssign + AddAssign + for<'a> Product<&'a F> + for<'a> Sum<&'a F> + for<'a> Mul<&'a F, Output = F, Output = F> + for<'a> Sub<&'a F, Output = F, Output = F> + for<'a> Add<&'a F, Output = F, Output = F> + Product + Sum + Mul + Sub + Add + Neg<Output = F> + Debug + Sync + Send + Default + Clone + Copy + Eq + PartialEq + 'static,

§

impl<F> Unpin for ShiftIndPartialEval<F>
where <F as WithUnderlier>::Underlier: PackScalar<F> + UnderlierType + Sync + Send + Zeroable + NoUninit + Random + Copy + Clone + ConstantTimeEq + Eq + PartialEq + Default + Debug + Sized + 'static, F: WithUnderlier + Zeroable + InvertOrZero + Square + for<'a> MulAssign<&'a F> + for<'a> SubAssign<&'a F> + for<'a> AddAssign<&'a F> + MulAssign + SubAssign + AddAssign + for<'a> Product<&'a F> + for<'a> Sum<&'a F> + for<'a> Mul<&'a F, Output = F, Output = F> + for<'a> Sub<&'a F, Output = F, Output = F> + for<'a> Add<&'a F, Output = F, Output = F> + Product + Sum + Mul + Sub + Add + Neg<Output = F> + Debug + Sync + Send + Default + Clone + Copy + Eq + PartialEq + 'static + Unpin,

§

impl<F> UnwindSafe for ShiftIndPartialEval<F>
where <F as WithUnderlier>::Underlier: PackScalar<F> + UnderlierType + Sync + Send + Zeroable + NoUninit + Random + Copy + Clone + ConstantTimeEq + Eq + PartialEq + Default + Debug + Sized + 'static, F: WithUnderlier + Zeroable + InvertOrZero + Square + for<'a> MulAssign<&'a F> + for<'a> SubAssign<&'a F> + for<'a> AddAssign<&'a F> + MulAssign + SubAssign + AddAssign + for<'a> Product<&'a F> + for<'a> Sum<&'a F> + for<'a> Mul<&'a F, Output = F, Output = F> + for<'a> Sub<&'a F, Output = F, Output = F> + for<'a> Add<&'a F, Output = F, Output = F> + Product + Sum + Mul + Sub + Add + Neg<Output = F> + Debug + Sync + Send + Default + Clone + Copy + Eq + PartialEq + 'static + UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more