Skip to main content

BinaryCode

Struct BinaryCode 

Source
pub struct BinaryCode { /* private fields */ }
Expand description

A binary linear code [n, k, d].

k-dimensional subspace of GF(2)^n with minimum distance d.

Implementations§

Source§

impl BinaryCode

Source

pub fn from_generator(matrix: GF2Matrix) -> Result<Self, EnumerativeError>

Create a code from its generator matrix.

The matrix is reduced to RREF. Its rank determines k.

Source

pub fn from_parity_check(h: GF2Matrix) -> Result<Self, EnumerativeError>

Create a code from its parity check matrix H.

The code is C = ker(H).

Source

pub fn parameters(&self) -> (usize, usize, usize)

Code parameters [n, k, d].

Source

pub fn length(&self) -> usize

Code length n.

Source

pub fn dimension(&self) -> usize

Code dimension k.

Source

pub fn minimum_distance(&self) -> usize

Minimum distance d (minimum Hamming weight of nonzero codewords).

Source

pub fn generator_matrix(&self) -> &GF2Matrix

Generator matrix.

Source

pub fn parity_check_matrix(&self) -> GF2Matrix

Parity check matrix H such that H * c = 0 for all codewords c.

Source

pub fn dual(&self) -> BinaryCode

The dual code C^⊥.

Source

pub fn is_self_dual(&self) -> bool

Whether the code is self-dual (C = C^⊥).

Source

pub fn codewords(&self) -> Vec<GF2Vector>

Enumerate all 2^k codewords.

Source

pub fn encode(&self, message: &GF2Vector) -> GF2Vector

Encode a k-bit message into an n-bit codeword.

Source

pub fn syndrome(&self, received: &GF2Vector) -> GF2Vector

Syndrome of a received vector.

Source

pub fn matroid(&self) -> Matroid

The column matroid of the generator matrix.

Source

pub fn weight_enumerator(&self) -> Vec<u64>

Weight enumerator coefficients A_0, A_1, …, A_n.

A_i = number of codewords of Hamming weight i.

Source

pub fn weight_distribution(&self) -> Vec<u64>

Weight distribution: A_i = number of codewords of Hamming weight i.

Source

pub fn dual_weight_enumerator(&self) -> Vec<Rational64>

MacWilliams identity: dual weight enumerator computed from transform.

W_{C⊥}[j] = (1/2^k) · Σ_i W_C[i] · K_j(i; n) where K_j(i; n) is the Krawtchouk polynomial.

Trait Implementations§

Source§

impl Clone for BinaryCode

Source§

fn clone(&self) -> BinaryCode

Returns a duplicate 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 Debug for BinaryCode

Source§

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

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

impl PartialEq for BinaryCode

Source§

fn eq(&self, other: &BinaryCode) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for BinaryCode

Source§

impl StructuralPartialEq for BinaryCode

Auto Trait Implementations§

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

Source§

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

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.