Minimum Distance
Computing the minimum distance of a linear code is NP-hard, so this library exposes three distinct kinds of routine and it is important not to confuse them. See the minimum distance tutorial for guidance on choosing among them.
Exact algorithms return the true minimum distance and cache it on the code. These are enumeration-based methods built on bit-packed Gray-code sweeps with Brouwer-Zimmermann style pruning across disjoint information sets, and they are the only functions here whose output is a proof.
Probabilistic algorithms are information-set decoding searches. Each one returns the weight of the lowest-weight codeword it found, which is an upper bound on the distance, together with a witness. They never certify a lower bound, so a returned value equal to the true distance is not distinguishable from an unlucky run without further information.
Heuristic algorithms are local searches such as genetic algorithms and ant colony optimization. Like the probabilistic methods they yield upper bounds, and they are intended for codes far too large for the exact methods.
Bounds discovered by any of these are recorded on the code, so a later call to an exact algorithm can start from a better upper bound.
Exact algorithms
CodingTheory.generate_automorphisms — Method
generate_automorphisms(
C::AbstractLinearCode
) -> Vector{Vector{Int64}}
Return known coordinate-permutation generators for C. An empty vector means that no family-specific generators are currently implemented.
CodingTheory.heuristic_info_set_selection — Method
heuristic_info_set_selection(
C::AbstractLinearCode
) -> Symbol
Selects the most mathematically efficient information set algorithm based on the code's length, dimension, and algebraic structure.
CodingTheory.information_sets — Function
information_sets(
G::Union{Nemo.FqMatrix, Nemo.fpMatrix, Hecke.SMat, SparseArrays.SparseMatrixCSC};
...
) -> Tuple{Vector{Any}, Vector{Any}, Vector{Int64}}
information_sets(
G::Union{Nemo.FqMatrix, Nemo.fpMatrix, Hecke.SMat, SparseArrays.SparseMatrixCSC},
alg::Symbol;
permute,
only_A
) -> Tuple{Vector{Any}, Vector{Any}, Vector{Int64}}
Return the systematic matrices, associated column permutations, and ranks produced from G by the selected information-set algorithm. When only_A is true, return only each nonsystematic block in the matrix collection; when permute is true, move each selected information set to the front.
CodingTheory.minimum_distance — Method
minimum_distance(
C::AbstractLinearCode;
alg,
info_set_alg,
auts,
verbose
) -> Union{Nothing, Tuple{Any, Any}}
Return the minimum distance of the linear code if known, otherwise computes it using the dynamically optimal algorithm or the explicit algorithm of alg.
CodingTheory.minimum_distance_zssmp — Method
minimum_distance_zssmp(
C::AbstractLinearCode;
verbose,
kwargs...
) -> Union{Nothing, Tuple{Any, Any}}
Executes the ZSSMP attack from Joundan et al. (2019). Extracts the fixed subcodes for known automorphisms and runs the highly optimized Brouwer–Zimmermann engines on the drastically reduced dimension k_sub.
Probabilistic algorithms
CodingTheory.logbinomial — Method
logbinomial(n::Int64, k::Int64) -> Float64
Safely computes log(n choose k) using the Gamma function to prevent BigInt overflow. Return -Inf if k < 0 or k > n.
CodingTheory.probabilistic_minimum_distance_bjmm — Method
probabilistic_minimum_distance_bjmm(
C::AbstractLinearCode;
confidence,
p,
ϵ1,
l1,
l2,
verbose
) -> Tuple{Any, Any}
Return an upper bound on the minimum distance and a codeword witnessing that bound, as found by the Becker–Joux–May–Meurer (BJMM) algorithm. If the search fails, return (n, zeros(Int, n)).
CodingTheory.probabilistic_minimum_distance_lee_brickell — Method
probabilistic_minimum_distance_lee_brickell(
C::AbstractLinearCode;
confidence,
p,
verbose
) -> Tuple{Any, Any}
Return an upper bound on the minimum distance and a codeword witnessing that bound, as found by the Lee–Brickell algorithm at the target confidence level. If the search fails, return (n, zeros(Int, n)).
CodingTheory.probabilistic_minimum_distance_lee_brickell — Method
probabilistic_minimum_distance_lee_brickell(
G::Matrix{Int64};
confidence,
p,
verbose
) -> Tuple{Int64, Vector{Int64}}
Return an upper bound on the minimum distance and a codeword witnessing that bound, as found by the Lee–Brickell algorithm. If the search fails, return (n, zeros(Int, n)).
CodingTheory.probabilistic_minimum_distance_leon — Method
probabilistic_minimum_distance_leon(
C::AbstractLinearCode;
confidence,
p,
l,
verbose
) -> Tuple{Any, Any}
Return an upper bound on the minimum distance and a codeword witnessing that bound, as found by Leon's algorithm at the target confidence level. If the search fails, return (n, zeros(Int, n)).
CodingTheory.probabilistic_minimum_distance_mmt — Method
probabilistic_minimum_distance_mmt(
C::AbstractLinearCode;
confidence,
p,
l1,
l2,
verbose
) -> Tuple{Any, Any}
Return an upper bound on the minimum distance and a codeword witnessing that bound, as found by the May–Meurer–Thomae (MMT) four-way merge tree. If the search fails, return (n, zeros(Int, n)).
CodingTheory.probabilistic_minimum_distance_prange — Method
probabilistic_minimum_distance_prange(
C::AbstractLinearCode;
confidence,
verbose
) -> Tuple{Any, Any}
CodingTheory.probabilistic_minimum_distance_stern — Method
probabilistic_minimum_distance_stern(
G::Matrix{Int64};
confidence,
p,
l,
verbose
) -> Tuple{Int64, Vector{Int64}}
Return an upper bound on the minimum distance and a codeword witnessing that bound, as found by Stern's algorithm. If the search fails, return (n, zeros(Int, n)).
CodingTheory.probabilistic_minimum_distance_stern_DOOM — Method
probabilistic_minimum_distance_stern_DOOM(
C::AbstractLinearCode;
confidence,
p,
l,
verbose
) -> Tuple{Any, Any}
Return an upper bound on the minimum distance and a codeword witnessing that bound, as found by Sendrier's DOOM framework applied to Stern's algorithm. If the search fails, return (n, zeros(Int, n)).
DOOM targets an error vector of weight w-1 by simultaneously checking all n columns of the parity-check matrix, drastically reducing the required number of iterations compared to standard Stern.
Heuristic algorithms
CodingTheory.heuristic_minimum_distance_aco — Method
heuristic_minimum_distance_aco(
C::AbstractLinearCode;
y_max,
m_ants,
verbose
) -> Tuple{Any, Any}
Executes a standalone Ant Colony Optimization algorithm (Bouzkraoui et al., 2018) to estimate the minimum distance of a linear code. Return (d_upper_bound, witness). Note that this is a probabilistic metaheuristic and does NOT mathematically guarantee the true minimum distance.
CodingTheory.heuristic_minimum_distance_ga — Method
heuristic_minimum_distance_ga(
C::AbstractLinearCode;
max_gens,
pop_size,
verbose
) -> Tuple{Any, Any}
Executes a standalone Genetic Algorithm (Askali et al., 2013) to estimate the minimum distance of a linear code. Return (d_upper_bound, witness). Note that this is a probabilistic metaheuristic and does NOT mathematically guarantee the true minimum distance.
CodingTheory.heuristic_minimum_distance_gga_order — Method
heuristic_minimum_distance_gga_order(
C::AbstractLinearCode;
max_gens,
pop_size,
verbose
) -> Tuple{Any, Any}
Executes the GGA-Order metaheuristic (Cuéllar et al., 2020) to estimate the minimum distance. Explores the permutation space S_n rather than the discrete message space F_q^k. Return (d_upper_bound, witness). Does NOT mathematically guarantee the true minimum distance.
CodingTheory.heuristic_minimum_distance_irons — Method
heuristic_minimum_distance_irons(
C::AbstractLinearCode;
num_iters,
p_max,
verbose
) -> Tuple{Any, Any}
Implements the non-binary probabilistic algorithm (Algorithm 5) from Irons (2005). Randomly selects combinations of up to p_max rows of the generator matrix and evaluates their weights. Extremely fast Monte Carlo estimation for generic non-binary codes.
CodingTheory.heuristic_minimum_distance_nncs — Method
heuristic_minimum_distance_nncs(
C::AbstractLinearCode;
verbose
) -> Tuple{Any, Any}
Implements the Nearest Nonzero Codeword Search (NNCS) using the Bit-Reversing noise pattern from Hu et al. (2004). Uses an OSD-0 (Order Statistic Decoding) hard-decision erasure strategy tailored for LDPC codes.
CodingTheory.heuristic_weight_distribution_hirotomo — Method
heuristic_weight_distribution_hirotomo(
C::AbstractLinearCode,
target_w::Int64;
t_iters
) -> Dict{Int64, Float64}
Return a Dict of weight to estimated count for the low-weight part of the weight distribution $A_w$ of an LDPC code, using the method of Hirotomo et al. (2005). Stern's algorithm is run t_iters times to populate the frequency spectrum $B_w$, and the multiplicity is estimated by dividing by Stern's success probability $\pi_w$.