Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2ᵐ + 1 - 3, k, 2ᵐ ⁺ ¹ - 3 - k] shortenedMDS code #254

Draft
wants to merge 81 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
edf28dd
adding Reed-Solomon codes to the ECC Module
Apr 4, 2024
04d0dc6
Polishing up tests
Apr 4, 2024
cba1d52
Ordinary view of generator and full test
Apr 4, 2024
258fc30
using Nemo Finite Fields
Apr 6, 2024
af5b078
adding references, polishing up
Apr 6, 2024
d00cb31
adding message polynomial, parity check polynomial, codeword polynomi…
Apr 6, 2024
deb9750
Removing j from RS(paramaters list), n and k are sufficient
Apr 6, 2024
dd91a68
Final Furbish
Apr 6, 2024
1274610
Adding Tests of BCH codes
Apr 7, 2024
3028039
classical BCH codes
Apr 7, 2024
e6a2637
Merge branch 'master' into rs
Fe-r-oz Apr 9, 2024
3b74bac
Merge branch 'master' into rs
Fe-r-oz Apr 14, 2024
323caf3
Proper lower and upper bounds for n and t for BCH codes
Apr 14, 2024
36a3194
solving merge conflicts
Apr 14, 2024
34ff28b
Update src/ecc/codes/classical/reedsolomon.jl
Fe-r-oz Apr 18, 2024
88bb42d
Update src/ecc/codes/classical/bch.jl
Fe-r-oz Apr 18, 2024
976dd45
Update src/ecc/codes/classical/bch.jl
Fe-r-oz Apr 18, 2024
9589c42
Merge branch 'master' into rs
Fe-r-oz Apr 19, 2024
ae952de
parity check matrix for BCH
Apr 19, 2024
bd282a1
parity check matrix for BCH
Apr 19, 2024
1f27743
solving conflicts
Apr 19, 2024
de21bc9
improving docstring of g(x), adding parity_check function for BCH code
Apr 19, 2024
34f4d2c
improving docstring for BCH
Apr 19, 2024
1e83ab1
separating BCH and Reed Solomon codes: clean-up
Apr 19, 2024
b6f1209
adding the binary expansion of Reed-Solomon codes along with proper d…
Apr 22, 2024
9103c0c
improving docstring
Apr 22, 2024
15f7331
Adding more tests and important check during binary expansion of Fiel…
Apr 27, 2024
28b63c8
adding docstring to tests along with MacWilliams 1977 paper on Error …
Apr 27, 2024
352d85e
Polising up docstring
Apr 27, 2024
b2bd424
Adding Test Throws and polishing docstring
Apr 28, 2024
53c11f9
Merge branch 'master' into rs
Fe-r-oz Apr 28, 2024
e4f31f5
adding pre code-review suggestions from BCH
May 3, 2024
18843f9
Resolved merge conflicts
May 3, 2024
91e4201
adding pre-code review suggestions from BCH
May 3, 2024
0799c54
stylistic changes in docstring
May 3, 2024
50fc5a4
matrices unicode docstring
May 3, 2024
6c64a6d
adding more tests to Reed-Solomon and setting it up for code review
May 4, 2024
452ceb6
improving indentation in test file
Fe-r-oz May 5, 2024
d926bd9
improving indentation in src file
Fe-r-oz May 5, 2024
6fa1dbf
adding code review suggestions: m, t in place of derived n, k. Adding…
May 5, 2024
dea157e
Polishing up: setting up for code review
May 5, 2024
62c1e54
use feasible values for small test time because of large matrices
May 5, 2024
8151497
Matrices Alignment in docstrings
May 7, 2024
f2bc298
Merge branch 'master' into rs
Fe-r-oz May 12, 2024
8305085
minor cleanup
May 12, 2024
6f960e2
minor cleanups
May 12, 2024
a0e712e
polishing up docstring
May 12, 2024
cb896ba
tightening docstring and minor cleanups
May 12, 2024
9de59a6
Setting up for review
May 12, 2024
327f854
Testing that Reed-Solomon codes exactly meet the Singleton Bound, add…
May 12, 2024
a0962a1
Adding Test that Reed-Solomon codes are cyclic
May 13, 2024
e3582a7
Minor Cleanup
May 13, 2024
768000a
Removing Redundancy: Cleaning Up
May 15, 2024
65bb3fa
fixing minor typo
May 17, 2024
249bd41
Update src/ecc/codes/classical/reedsolomon.jl
Fe-r-oz May 20, 2024
503abcf
Update src/ecc/codes/classical/reedsolomon.jl
Fe-r-oz May 20, 2024
e64adae
Update src/ecc/codes/classical/reedsolomon.jl
Fe-r-oz May 20, 2024
6307c3d
Update src/ecc/codes/classical/reedsolomon.jl
Fe-r-oz May 20, 2024
d06a274
Update src/ecc/codes/classical/reedsolomon.jl
Fe-r-oz May 20, 2024
6245ce6
Update src/ecc/codes/classical/reedsolomon.jl
Fe-r-oz May 20, 2024
d9338b6
Update src/ecc/codes/classical/reedsolomon.jl
Fe-r-oz May 20, 2024
5914d9a
code suggestions
May 20, 2024
e97594f
Merge branch 'rs' of https://github.com/Fe-r-oz/QuantumClifford.jl in…
May 20, 2024
58288b3
code review suggestions
May 20, 2024
1fbffd2
adding doctest
May 20, 2024
b05dfdc
Adding code suggestions
May 20, 2024
2ea910e
improving doctest
May 20, 2024
82a18f0
setting up; working on doctest
May 20, 2024
cb48529
Adding CodeReview suggestions
May 20, 2024
00035bb
Introducing Signigicant changes: ExtendedReedSolomonMDS codes
May 20, 2024
b1995d8
setting up for review
May 20, 2024
48b78c5
minor cleanup
May 20, 2024
95f0e7f
skip changelog
May 20, 2024
05c1b21
Significantly Improving Docstring
May 21, 2024
1a25aa5
[Feature]: classical ShortenedMDS codes to the ECC Module
Jun 6, 2024
3ef70df
Merge branch 'master' into rs
Fe-r-oz Jun 29, 2024
77548ab
code review suggestions
Jun 29, 2024
aa45746
Merge branch 'rs' of https://github.com/Fe-r-oz/QuantumClifford.jl in…
Jun 29, 2024
228590e
fix docs formatting
Jun 29, 2024
b593646
fix rendering
Jun 29, 2024
fe26c08
Cleanup
Jun 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions docs/src/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -386,3 +386,58 @@ @article{knill1996concatenated
journal={arXiv preprint quant-ph/9608012},
year={1996}
}

@article{dur1987automorphism,
title={The automorphism groups of Reed-Solomon codes},
author={D{\"u}r, Arne},
journal={Journal of Combinatorial Theory, Series A},
volume={44},
number={1},
pages={69--82},
year={1987},
publisher={Elsevier}
}

@book{tomlinson2017error,
title={Error-correction coding and decoding: bounds, codes, decoders, analysis and applications},
author={Tomlinson, Martin and Tjhai, Cen Jung and Ambroze, Marcel A and Ahmed, Mohammed and Jibril, Mubarak},
year={2017},
publisher={Springer Nature}
}

@book{macwilliams1977theory,
title={The theory of error-correcting codes},
author={MacWilliams, Florence Jessie and Sloane, Neil James Alexander},
volume={16},
year={1977},
publisher={Elsevier}
}

@book{peterson1972error,
title={Error-correcting codes},
author={Peterson, William Wesley and Weldon, Edward J},
year={1972},
publisher={MIT press}
}

@article{dorsch1974decoding,
title={A decoding algorithm for binary block codes and J-ary output channels (corresp.)},
author={Dorsch, B},
journal={IEEE Transactions on Information Theory},
volume={20},
number={3},
pages={391--394},
year={1974},
publisher={IEEE}
}

@article{seroussi1986mds,
title={On MDS extensions of generalized Reed-Solomon codes},
author={Seroussi, Gadiel and Roth, Ron M},
journal={IEEE Transactions on Information Theory},
volume={32},
number={3},
pages={349--354},
year={1986},
publisher={IEEE}
}
6 changes: 6 additions & 0 deletions docs/src/references.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ For classical code construction routines:
- [bose1960class](@cite)
- [bose1960further](@cite)
- [error2024lin](@cite)
- [dur1987automorphism](@cite)
- [tomlinson2017error](@cite)
- [macwilliams1977theory](@cite)
- [peterson1972error](@cite)
- [dorsch1974decoding](@cite)
- [seroussi1986mds](@cite)

# References

Expand Down
1 change: 1 addition & 0 deletions src/ecc/ECC.jl
Original file line number Diff line number Diff line change
Expand Up @@ -361,4 +361,5 @@ include("codes/surface.jl")
include("codes/concat.jl")
include("codes/classical/reedmuller.jl")
include("codes/classical/bch.jl")
include("codes/classical/shortenedmds.jl")
end #module
93 changes: 93 additions & 0 deletions src/ecc/codes/classical/shortenedmds.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
"""The family of `[2ᵐ + 1 - 3, k, 2ᵐ ⁺ ¹ - 3 - k]` Shortened Maximum Distance Separable `(ShortenedMDS)` codes are constructed from the `[2ᵐ + 1, k, 2ᵐ ⁺ ¹ - k]` Extended, Augmented Reed-Solomon codes from the corresponding first `x - 1` columns of latter's parity-check matrix, using `j = 0`, and setting `α₀, α₁, α₂, ..., αₓ ₋ ₁` to `α⁰, α¹, α², ..., αˣ ⁻ ¹` in the parity-check matrix.

Denoting the `x` field elements as `0, α⁰, α¹, α²,... αˣ ⁻ ¹`, the shortened field parity-check matrix (`HF`) is given as follows:

```
(α⁰)ʲ (α¹)ʲ (α²)ʲ ... (αˣ ⁻ ¹)ʲ
(α⁰)ʲ ⁺ ¹ (α¹)ʲ ⁺ ¹ (α²)ʲ ⁺ ¹ ... (αˣ ⁻ ¹)ʲ ⁺ ¹
(α⁰)ʲ ⁺ ² (α¹)ʲ ⁺ ² (α²)ʲ ⁺ ² ... (αˣ ⁻ ¹)ʲ ⁺ ²
(α⁰)ʲ ⁺ ˣ ⁻ ᵏ ⁻ ¹ (α¹)ʲ ⁺ ˣ ⁻ ᵏ ⁻ ¹ (α²)ʲ ⁺ ˣ ⁻ ᵏ ⁻ ¹ ... (αˣ ⁻ ¹)ʲ ⁺ ˣ ⁻ ᵏ ⁻ ¹
. . . ... .
. . . ... .
. . . ... .
(α⁰)ʲ ⁺ ˣ ⁻ ᵏ (α¹)ʲ ⁺ ˣ ⁻ ᵏ (α²)ʲ ⁺ ˣ ⁻ ᵏ . ... (αˣ ⁻ ¹)ʲ ⁺ ˣ ⁻ ᵏ
```

For significant coding gain, code length is typically restricted to less than 200 bits. Modified Dorsch decoder [dorsch1974decoding](@cite) is recommended for near maximum likelihood decoding.

Shortened MDS (`HF`) Matrix element expansion:
1. Row expansion: Each row of in the field parity-check matrix is replaced with an `m`-by-`m` field matrix defined over the base field `GF(2ᵐ)`.
2. Column expansion: Consequently, the elements in each column of expanded field parity-check matrix are converted to binary representations by substituting powers of a primitive element (`α`) in the Galois Field `GF(2ᵐ)` with their corresponding `m`-tuples over the Boolean Field `GF(2)`.

You might be interested in consulting [tomlinson2017error](@cite), [macwilliams1977theory](@cite), [peterson1972error](@cite), [seroussi1986mds](@cite), [dur1987automorphism](@cite) and [Extending MDS Codes](https://www.unb.ca/faculty-staff/directory/_resources/pdf/sase/alderson/mds-codes.pdf) as well.
"""
Fe-r-oz marked this conversation as resolved.
Show resolved Hide resolved
abstract type AbstractPolynomialCode <: ClassicalCode end

struct ShortenedMDS <: AbstractPolynomialCode
m::Int
t::Int

function ShortenedMDS(m, t)
if m < 3 || t < 0 || t >= 2 ^ (m - 1)
throw(ArgumentError("Invalid parameters: m and t must be non-negative. Also, m > 3 and t < 2 ^ (m - 1) in order to obtain a valid code."))
end
new(m, t)
end
end

"""
`parity_checks(ShortenedMDS(m, t))`
- `m`: The positive integer defining the degree of the finite (Galois) field, `GF(2ᵐ)`.
- `t`: The positive integer specifying the number of correctable errors.
"""
function parity_checks(rs::ShortenedMDS)
GF2ʳ, a = finite_field(2, rs.m, "a")
s_symbols = 3 # 3-level quantization.
x = 2 ^ rs.m + 1 - s_symbols
k = 2 ^ rs.m - 1 - 2 * rs.t
HField = Matrix{FqFieldElem}(undef, x - k + 1, x)
for j in 1:x
HField[1, j] = a ^ 0
end
for i in 1: x - k + 1
HField[i, 1] = a ^ 0
end
for i in 2:x - k + 1
for j in 2:x
HField[i, j] = (a ^ (j - 1)) ^ (i - 2)
end
end
HSeed = vcat(HField[1:1, :], HField[3:end, :])
HTemp2 = Matrix{FqFieldElem}(undef, rs.m, x)
HFieldExpanded = Matrix{FqFieldElem}(undef, rs.m * k, x)
g = 1
while g <= rs.m * k
for i in 1:x - k
for p in 1:rs.m
HTemp2[p:p, :] = reshape(HSeed[i, :].*a ^ (p - 1) , 1, :)
end
if g > rs.m * k
break
end
HFieldExpanded[g:g + rs.m - 1, :] .= HTemp2
g = g + rs.m
end
end
H = Matrix{Bool}(undef, rs.m * k, rs.m * x)
for i in 1:rs.m * k
for j in 1:x
col_start = (j - 1) * rs.m + 1
col_end = col_start + rs.m - 1
t_tuple = Bool[]
for k in 0:rs.m - 1
push!(t_tuple, !is_zero(coeff(HFieldExpanded[i, j], k)))
end
H[i, col_start:col_end] .= vec(t_tuple)
end
end
return H
end

code_n(rs::ShortenedMDS) = (2 ^ rs.m + 1 - 3) * rs.m

code_k(rs::ShortenedMDS) = (2 ^ rs.m - 1 - 2 * rs.t) * rs.m
1 change: 1 addition & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ end
@doset "ecc_gottesman"
@doset "ecc_reedmuller"
@doset "ecc_bch"
@doset "ecc_shortenedmds"
@doset "ecc_syndromes"
@doset "ecc_throws"
@doset "precompile"
Expand Down
22 changes: 10 additions & 12 deletions test/test_ecc_bch.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,21 @@ using QuantumClifford
using QuantumClifford.ECC
using QuantumClifford.ECC: AbstractECC, BCH, generator_polynomial
using Nemo: ZZ, residue_ring, matrix, finite_field, GF, minpoly, coeff, lcm, FqPolyRingElem, FqFieldElem, is_zero, degree, defining_polynomial, is_irreducible
include("utils_test_ecc.jl")

"""
- To prove that `t`-bit error correcting BCH code indeed has minimum distance of at least `2 * t + 1`, it is shown that no `2 * t` or fewer columns of its binary parity check matrix `H` sum to zero. A formal mathematical proof can be found on pages 168 and 169 of Ch6 of Error Control Coding by Lin, Shu and Costello, Daniel.
- The parameter `2 * t + 1` is usually called the designed distance of the `t`-bit error correcting BCH code.
"""
function check_designed_distance(matrix, t)
n_cols = size(matrix, 2)
for num_cols in 1:2 * t
for i in 1:n_cols - num_cols + 1
combo = matrix[:, i:(i + num_cols - 1)]
sum_cols = sum(combo, dims = 2)
if all(sum_cols .== 0)
return false # Minimum distance is not greater than `2 * t`.
end

@testset "Testing designed distance of BCH codes" begin
m_cases = [3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
for m in m_cases
for t in rand(1:m, 2)
d = 2 * t
@test check_designed_distance(parity_checks(BCH(m, t)), m, t, d, 0, 0) == true
end
end
return true # Minimum distance is at least `2 * t + 1`.
end

@testset "Testing properties of BCH codes" begin
Expand All @@ -29,7 +27,6 @@ end
n = 2 ^ m - 1
for t in rand(1:m, 2)
H = parity_checks(BCH(m, t))
@test check_designed_distance(H, t) == true
# n - k == degree of generator polynomial, `g(x)` == rank of binary parity check matrix, `H`.
mat = matrix(GF(2), parity_checks(BCH(m, t)))
computed_rank = rank(mat)
Expand Down Expand Up @@ -79,7 +76,8 @@ end

results = [57 51 45 39 36 30 24 18 16 10 7]
for (result, (m, t)) in zip(results, test_cases)
d = 2 * t
@test code_k(BCH(m, t)) == result
@test check_designed_distance(parity_checks(BCH(m, t)), t) == true
@test check_designed_distance(parity_checks(BCH(m, t)), m, t, d, 0, 0) == true
end
end
103 changes: 103 additions & 0 deletions test/test_ecc_shortenedmds.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
using Test
using LinearAlgebra
using Combinatorics
using QuantumClifford
using QuantumClifford.ECC
using QuantumClifford.ECC: AbstractECC, ShortenedMDS, generator_polynomial
using Nemo: finite_field, GF, FqFieldElem, FqPolyRingElem, coeff, is_zero, degree, matrix
include("utils_test_ecc.jl")

@testset "Testing ShortenedMDS code" begin

"""
- Employing `3-level` quantization of the channel bits and erasing entire symbols if any of their constituent bits are erased can improve the performance of RS codes. Shortened Maximum Distance Separable (MDS) codes have the following parameters - code length `(n)`, codesize `(k)` and minimum Hamming distance `(d)` represented by [n, k, d] as follows: [2 ^ (m) + 1 - 3, k, 2 ^ (m + 1) - 3 - k]. Thus, the designed minimum distance `d` is 2 ^ (m + 1) - s - k. Refer to chapter: 07, section: 03, pages: 172 to 175 [tomlinson2017error](@cite).
- The designed distance for binary expanded parity check matrix remains same as symbol based parity check matrix. According to [macwilliams1977theory](@cite), changing the basis `j` can increase the designed distance `(dmin)` of the resulting binary code.
"""

@testset "Testing designed distance of ShortenedMDS codes" begin
m_cases = [3, 4, 5, 6, 7, 8]
for m in m_cases
for t in rand(1:m - 1, 2)
s_symbols = 3 # Refer to chapter: 07, section: 03, pages: 172 to 175 [tomlinson2017error](@cite).
k = (2 ^ m - 1 - 2 * t) * m
d = 2 ^ (m + 1) - s_symbols - k
@test check_designed_distance(parity_checks(ShortenedMDS(m, t)), m, t, d, 0, 0) == true
end
end
end

@testset "Testing ShortenedMDS codes's properties" begin
m_cases = [3, 4, 5, 6, 7, 8]
for m in m_cases
for t in rand(1:m - 1, 2)
mat = matrix(GF(2), parity_checks(ShortenedMDS(m, t)))
computed_rank = rank(mat)
s_symbols = 3 # Refer to chapter: 07, section: 03, pages: 172 to 175 [tomlinson2017error](@cite).
k = (2 ^ m - 1 - 2 * t) * m
n = (2 ^ m + 1 - s_symbols) * m
@test computed_rank == n - k
end
end

# Example `(H₁₅₀₋₇₅`) taken from Eq. 7.9 of pg. 175 of [tomlinson2017error](@cite).
@test size(parity_checks(ShortenedMDS(5, 8))) == (75, 150)
H = Matrix{Bool}(undef, 75, 150)
H = parity_checks(ShortenedMDS(5, 8))
H₁₋₁ = [1 0 0 0 0 1 0 0 0 0 1 0 0 0 0;
0 1 0 0 0 0 1 0 0 0 0 1 0 0 0;
0 0 1 0 0 0 0 1 0 0 0 0 1 0 0;
0 0 0 1 0 0 0 0 1 0 0 0 0 1 0;
0 0 0 0 1 0 0 0 0 1 0 0 0 0 1;
1 0 0 0 0 0 1 0 0 0 0 0 1 0 0;
0 1 0 0 0 0 0 1 0 0 0 0 0 1 0;
0 0 1 0 0 0 0 0 1 0 0 0 0 0 1;
0 0 0 1 0 0 0 0 0 1 1 0 1 0 0;
0 0 0 0 1 1 0 1 0 0 0 1 0 1 0;
1 0 0 0 0 0 0 1 0 0 0 0 0 0 1;
0 1 0 0 0 0 0 0 1 0 1 0 1 0 0;
0 0 1 0 0 0 0 0 0 1 0 1 0 1 0;
0 0 0 1 0 1 0 1 0 0 0 0 1 0 1;
0 0 0 0 1 0 1 0 1 0 1 0 1 1 0;
1 0 0 0 0 0 0 0 1 0 0 1 0 1 0;
0 1 0 0 0 0 0 0 0 1 0 0 1 0 1;
0 0 1 0 0 1 0 1 0 0 1 0 1 1 0;
0 0 0 1 0 0 1 0 1 0 0 1 0 1 1;
0 0 0 0 1 0 0 1 0 1 1 0 0 0 1]
H₁₋₂ = [1 0 0 0 0 1 0 1 1 1 0 1 1 0 1;
0 1 0 0 0 1 1 1 1 1 1 0 0 1 0;
0 0 1 0 0 1 1 0 1 1 0 1 0 0 1;
0 0 0 1 0 1 1 0 0 1 1 0 0 0 0;
0 0 0 0 1 1 1 0 0 0 0 1 0 0 0]
H₁₋₃ = [1 0 0 0 0;
0 1 0 0 0;
0 0 1 0 0;
0 0 0 1 0;
0 0 0 0 1;
1 0 0 1 0;
0 1 0 0 1;
1 0 0 0 0;
0 1 0 0 0;
0 0 1 0 0;
1 1 0 1 0;
0 1 1 0 1;
1 0 0 1 0;
0 1 0 0 1;
1 0 0 0 0;
1 0 0 1 1;
1 1 1 0 1;
1 1 0 1 0;
0 1 1 0 1;
1 0 0 1 0]
H₁₋₄ = [0 0 0 1 0;
0 0 0 0 1;
1 0 1 0 0;
0 1 0 1 0;
0 0 1 0 1]

@test H[1:20, 1:15] == H₁₋₁
@test H[71:75, 1:15] == H₁₋₂
@test H[1:20, 146:150] == H₁₋₃
@test H[71:75, 146:150] == H₁₋₄
end

end
6 changes: 5 additions & 1 deletion test/test_ecc_throws.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
using Test
using QuantumClifford
using QuantumClifford.ECC: ReedMuller, BCH
using QuantumClifford.ECC: ReedMuller, BCH, ShortenedMDS

@test_throws ArgumentError ReedMuller(-1, 3)
@test_throws ArgumentError ReedMuller(1, 0)

@test_throws ArgumentError BCH(2, 2)
@test_throws ArgumentError BCH(3, 4)

@test_throws ArgumentError ShortenedMDS(2, 1)
@test_throws ArgumentError ShortenedMDS(3, 10)
@test_throws ArgumentError ShortenedMDS(-2, 1)
14 changes: 14 additions & 0 deletions test/utils_test_ecc.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""The designed distance of a classical linear code with parameters `[n, k, d]`, where `n` represents the code length, `k` denotes the code dimension, and `d` signifies the minimum Hamming distance. For polynomial codes, `t` indicates the degree of the generator polynomial, and `m` represents the extension degree for the finite Galois field `GF(2ᵐ)`."""
function check_designed_distance(matrix, m, t, d, n, k)
n_cols = size(matrix, 2)
for num_cols in 1:d
for i in 1:n_cols - num_cols + 1
combo = matrix[:, i:(i + num_cols - 1)]
sum_cols = sum(combo, dims = 2)
if all(sum_cols .== 0)
return false
end
end
end
return true
end
Loading