Skip to main content

Sign

Struct Sign 

Source
pub struct Sign<E: IntegerElement, Bd: Bound, const BLK: usize, K: SymbolCode = u16> { /* private fields */ }
Expand description

Weights in {-1, +1}, one bit per element, with no table at all.

The Packed<Grid<2>,8> spelling of the same decode (CK-13) tabulates but can never answer Enumerable::as_index_stream: a packed byte’s index is a mixed-radix decomposition of it, so the tabulated traversal builds the index stream it gathers from. Measured, that build is a fifth to a third of the work at a one-row tile (ANALYSIS.md, “What the missing index stream costs the sign composition”). This tier spells the same decode with the code being the index — Code = u16, one bit per element of the block — so the operand’s own memory is the stream and there is nothing to build. CK-11 pins the two spellings byte for byte.

The codebook is the constant {-1, +1}, so there is nothing to borrow and no lifetime: the decode is a bit test. Bit t of the code is element t; set is +1, clear is -1, low bit first — the order Packed reads its sub-codes in (CK-03), so a Sign code spells the block the composition spells from the same byte value. The convention is normative: the encoder side is out of tree, and this decode is the whole contract with it.

Implementations§

Source§

impl<E: IntegerElement, Bd: Bound, const BLK: usize, K: SymbolCode> Sign<E, Bd, BLK, K>

Source

pub const fn new() -> Option<Self>

The one non-existence check: an alphabet that does not admit +-1 has no sign codec. Decided at construction, before any arithmetic, like every other non-existence in this library (C6).

Trait Implementations§

Source§

impl<E: Clone + IntegerElement, Bd: Clone + Bound, const BLK: usize, K: Clone + SymbolCode> Clone for Sign<E, Bd, BLK, K>

Source§

fn clone(&self) -> Sign<E, Bd, BLK, K>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<E: IntegerElement, Bd: Bound, const BLK: usize, K: SymbolCode> Codec<E, Bd> for Sign<E, Bd, BLK, K>

Source§

const MAX_BLOCK: usize = BLK

The most alphabet elements one code can produce. Read more
Source§

const TIER: TierId = TierId::Sign

Which tier this is, for reports and for the kappa manifest.
Source§

type Code = K

The stored code type. Read more
Source§

fn decode_element(&self, code: Self::Code, i: usize) -> Alphabet<E, Bd>

Decode element i of the block code names. Total for every i. Read more
Source§

const IS_FIXED_WIDTH: bool = true

Is decode_len always MAX_BLOCK? Read more
Source§

fn decode_len(&self, _code: Self::Code) -> usize

How many elements code actually produces. Read more
Source§

fn decode_into(&self, code: Self::Code, out: &mut [Alphabet<E, Bd>]) -> usize

Decode one code, returning how many elements were written. Read more
Source§

fn decode_seq(&self, codes: &[Self::Code], out: &mut [Alphabet<E, Bd>]) -> usize

Bulk path, returning how many elements were written in total.
Source§

impl<E: Copy + IntegerElement, Bd: Copy + Bound, const BLK: usize, K: Copy + SymbolCode> Copy for Sign<E, Bd, BLK, K>

Source§

impl<E: Debug + IntegerElement, Bd: Debug + Bound, const BLK: usize, K: Debug + SymbolCode> Debug for Sign<E, Bd, BLK, K>

Source§

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

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

impl<E: IntegerElement, Bd: Bound, const BLK: usize, K: SymbolCode> Enumerable<E, Bd> for Sign<E, Bd, BLK, K>

Source§

const CODE_SPACE: usize

The number of distinct codes. Read more
Source§

const SIGN_BIT_BOOK: bool = true

Whether the decoded book is the sign bit-decomposition: CODE_SPACE is a power of two and book[c][t] == 2 * bit(c, t) - 1 for every code c and every t below its log. Read more
Source§

fn code_at(index: usize) -> Self::Code

The index-th code. Total for index < CODE_SPACE.
Source§

fn index_of(code: Self::Code) -> usize

Where code sits in the enumeration. Read more
Source§

fn as_index_stream(codes: &[K]) -> Option<IndexStream<'_>>

The stored code stream, read as the index stream it already is. Read more

Auto Trait Implementations§

§

impl<E, Bd, const BLK: usize, K> Freeze for Sign<E, Bd, BLK, K>

§

impl<E, Bd, const BLK: usize, K> RefUnwindSafe for Sign<E, Bd, BLK, K>

§

impl<E, Bd, const BLK: usize, K> Send for Sign<E, Bd, BLK, K>

§

impl<E, Bd, const BLK: usize, K> Sync for Sign<E, Bd, BLK, K>

§

impl<E, Bd, const BLK: usize, K> Unpin for Sign<E, Bd, BLK, K>

§

impl<E, Bd, const BLK: usize, K> UnsafeUnpin for Sign<E, Bd, BLK, K>

§

impl<E, Bd, const BLK: usize, K> UnwindSafe for Sign<E, Bd, BLK, K>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.