Skip to main content

TowerLevel

Trait TowerLevel 

Source
pub trait TowerLevel: Field + Sealed {
    type Repr: Copy;

    const LOG_BITS: usize;

    // Required methods
    fn from_repr(r: Self::Repr) -> Self;
    fn to_repr(self) -> Self::Repr;
    fn mul_alpha(self) -> Self;
    fn from_le_byte_iter(bytes: impl Iterator<Item = u8>) -> Self;
    fn cantor_basis(i: usize) -> Self;
}
Expand description

One level of the Wiedemann tower, GF(2^(2^k)), in whichever basis carries it.

The tower fixes each level as an abstract field, not as a set of bit patterns.

An implementation may hold its elements in any F_2-basis of that field. What it may not do is report a Cantor basis other than the image of the tower’s own.

That is what makes every transform agree whichever representation runs it.

Required Associated Constants§

Source

const LOG_BITS: usize

The k in GF(2^(2^k)).

Required Associated Types§

Source

type Repr: Copy

The backing integer of an element.

Required Methods§

Source

fn from_repr(r: Self::Repr) -> Self

Build an element from a bit pattern, discarding the bits above 2^LOG_BITS.

Source

fn to_repr(self) -> Self::Repr

The bit pattern of this element, zero above 2^LOG_BITS.

Source

fn mul_alpha(self) -> Self

Multiply by the tower’s generator X_{k−1} of this level over the one below.

Source

fn from_le_byte_iter(bytes: impl Iterator<Item = u8>) -> Self

Build an element from the next RawDataSerializable::NUM_BYTES bytes of a little-endian byte stream, discarding the bits above 2^LOG_BITS.

§Panics

Panics if the stream ends before a whole element has been read.

Source

fn cantor_basis(i: usize) -> Self

The i-th vector of the Cantor basis of this level.

§Panics

Panics if i is at least the bit width 2^LOG_BITS of this level.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§