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
impl BinaryCode
Sourcepub fn from_generator(matrix: GF2Matrix) -> Result<Self, EnumerativeError>
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.
Sourcepub fn from_parity_check(h: GF2Matrix) -> Result<Self, EnumerativeError>
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).
Sourcepub fn parameters(&self) -> (usize, usize, usize)
pub fn parameters(&self) -> (usize, usize, usize)
Code parameters [n, k, d].
Sourcepub fn minimum_distance(&self) -> usize
pub fn minimum_distance(&self) -> usize
Minimum distance d (minimum Hamming weight of nonzero codewords).
Sourcepub fn generator_matrix(&self) -> &GF2Matrix
pub fn generator_matrix(&self) -> &GF2Matrix
Generator matrix.
Sourcepub fn parity_check_matrix(&self) -> GF2Matrix
pub fn parity_check_matrix(&self) -> GF2Matrix
Parity check matrix H such that H * c = 0 for all codewords c.
Sourcepub fn dual(&self) -> BinaryCode
pub fn dual(&self) -> BinaryCode
The dual code C^⊥.
Sourcepub fn is_self_dual(&self) -> bool
pub fn is_self_dual(&self) -> bool
Whether the code is self-dual (C = C^⊥).
Sourcepub fn encode(&self, message: &GF2Vector) -> GF2Vector
pub fn encode(&self, message: &GF2Vector) -> GF2Vector
Encode a k-bit message into an n-bit codeword.
Sourcepub fn weight_enumerator(&self) -> Vec<u64>
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.
Sourcepub fn weight_distribution(&self) -> Vec<u64>
pub fn weight_distribution(&self) -> Vec<u64>
Weight distribution: A_i = number of codewords of Hamming weight i.
Sourcepub fn dual_weight_enumerator(&self) -> Vec<Rational64> ⓘ
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
impl Clone for BinaryCode
Source§fn clone(&self) -> BinaryCode
fn clone(&self) -> BinaryCode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more