@@ -21,25 +21,25 @@ function decode!(decoder::BeliefPropagationOSDDecoder, syndrome::AbstractVector)
21
21
bp_err, converged = decode! (decoder. bp_decoder, syndrome) # hard decisions
22
22
bp_log_probabs = decoder. bp_decoder. scratch. log_probabs # soft decisions
23
23
bp_probabs = exp .(bp_log_probabs)
24
- # sort colums by reliability, less reliable columns first
24
+ # sort columns by reliability, less reliable columns first
25
25
sort_by_reliability = sortperm (max .(bp_probabs, 1 .- bp_probabs), rev= true )
26
26
H_sorted = decoder. H[:, sort_by_reliability]
27
27
bp_err_sorted = bp_err[sort_by_reliability]
28
- # TODO an optmized version of OSD can be implemented when osd_order = 0, see Algorithm 2 in https://doi.org/10.22331/q-2021-11-22-585
28
+ # TODO an optimized version of OSD can be implemented when osd_order = 0, see Algorithm 2 in https://doi.org/10.22331/q-2021-11-22-585
29
29
err = osd (H_sorted, syndrome, bp_err_sorted, decoder. osd_order)
30
30
return err[invperm (sort_by_reliability)], converged # also return whether BP is converged
31
31
end
32
32
33
33
function osd (H, syndrome, bp_err, osd_order)
34
34
m, n = size (H)
35
- # diagnolize the submatrix corrsponding to idependent columns via Gaussian elimination
35
+ # diagnolize the submatrix corresponding to independent columns via Gaussian elimination
36
36
# first obtain the row canonical form
37
37
# and find least reliable indices, i.e., the first r pivot columns (assume H is rearranged by reliability)
38
38
least_reliable_rows = [] # row indices of pivot elements
39
39
least_reliable_cols = [] # column indices of pivot elements
40
40
r = 0 # compute rank of H
41
41
i, j = 1 , 1
42
- s = copy (syndrome) # tranform syndrom along with H in Gaussian elimination
42
+ s = copy (syndrome) # transform syndrome along with H in Gaussian elimination
43
43
44
44
while i <= m && j <= n
45
45
k = findfirst (H[i: end , j])
@@ -65,7 +65,7 @@ function osd(H, syndrome, bp_err, osd_order)
65
65
end
66
66
end
67
67
68
- # then obtain a diagnol submatrix on the least reliable part
68
+ # then obtain a diagonal submatrix on the least reliable part
69
69
for (i, j) in zip (reverse (least_reliable_rows), reverse (least_reliable_cols))
70
70
for ii in 1 : i- 1
71
71
if H[ii, j]
0 commit comments