pub trait DomainContext {
type Field: BinaryField;
// Required methods
fn log_domain_size(&self) -> usize;
fn subspace(&self, i: usize) -> BinarySubspace<Self::Field>;
fn twiddle(&self, layer: usize, block: usize) -> Self::Field;
}
Expand description
Provides information about the domains $S^{(i)}$ and the associated twiddle factors.
Needed by the NTT and by FRI.
Required Associated Types§
type Field: BinaryField
Required Methods§
Sourcefn log_domain_size(&self) -> usize
fn log_domain_size(&self) -> usize
Base 2 logarithm of the size of $S^{(0)}$, i.e., $\ell$.
In other words: Index of the first layer that can not be computed anymore. I.e., number of the latest layer that can be computed, plus one. Layers are indexed starting from 0.
If you intend to call the NTT with skip_late = 0
, then this should be equal to the base 2
logarithm of the number of scalars in the input.
Sourcefn subspace(&self, i: usize) -> BinarySubspace<Self::Field>
fn subspace(&self, i: usize) -> BinarySubspace<Self::Field>
Returns the binary subspace with dimension $i$.
In DP24, this subspace is referred to as $S^{(\ell - i)}$, where $\ell$ is the maximum
domain size of the NTT, i.e., self.log_domain_size()
. We choose to reverse the indexing
order with respect to the paper because it is more natural in code that the $i$th subspace
has dimension $i$.
§Preconditions
i
must be less than or equal toself.log_domain_size()
Implementations on Foreign Types§
Source§impl<T: DomainContext> DomainContext for &T
Make it so that references to a [DomainContext
implement DomainContext
themselves.
impl<T: DomainContext> DomainContext for &T
Make it so that references to a [DomainContext
implement DomainContext
themselves.
This is useful, for example, if you need two objects that each want to own a
DomainContext
, but you don’t want to clone the DomainContext
.