Skip to content

Commit 1582bba

Browse files
committed
Clean
1 parent 7bad8f8 commit 1582bba

File tree

6 files changed

+2
-216
lines changed

6 files changed

+2
-216
lines changed

Manifest.toml

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
julia_version = "1.11.3"
44
manifest_format = "2.0"
5-
project_hash = "6b1804c68d878bc0c57ff542fcb5042f0144569a"
5+
project_hash = "bbb0e5646f1748a2c6f584642f98e12c63222479"
66

77
[[deps.ASL_jll]]
88
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
@@ -65,12 +65,6 @@ version = "2.2.0"
6565
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
6666
version = "1.11.0"
6767

68-
[[deps.BenchmarkTools]]
69-
deps = ["Compat", "JSON", "Logging", "Printf", "Profile", "Statistics", "UUIDs"]
70-
git-tree-sha1 = "e38fbc49a620f5d0b660d7f543db1009fe0f8336"
71-
uuid = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
72-
version = "1.6.0"
73-
7468
[[deps.BinaryWrappers]]
7569
deps = ["JLLWrappers", "Scratch"]
7670
git-tree-sha1 = "7fea8f658689fa5062b23f4400eda888b7ae2aaa"
@@ -433,12 +427,6 @@ deps = ["Artifacts", "Libdl"]
433427
uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1"
434428
version = "2.28.6+0"
435429

436-
[[deps.Memoization]]
437-
deps = ["MacroTools"]
438-
git-tree-sha1 = "7dbf904fa6c4447bd1f1d316886bfbe29feacf45"
439-
uuid = "6fafb56a-5788-4b4e-91ca-c0cea6611c73"
440-
version = "0.2.2"
441-
442430
[[deps.Missings]]
443431
deps = ["DataAPI"]
444432
git-tree-sha1 = "ec4f7fbeab05d7747bdf98eb74d130a2a2ed298d"
@@ -588,10 +576,6 @@ deps = ["Unicode"]
588576
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
589577
version = "1.11.0"
590578

591-
[[deps.Profile]]
592-
uuid = "9abbd945-dff8-562f-b5e8-e1ebf5ef1b79"
593-
version = "1.11.0"
594-
595579
[[deps.ProgressMeter]]
596580
deps = ["Distributed", "Printf"]
597581
git-tree-sha1 = "8f6bc219586aef8baf0ff9a5fe16ee9c70cb65e4"
@@ -836,11 +820,6 @@ git-tree-sha1 = "42fd9023fef18b9b78c8343a4e2f3813ffbcefcb"
836820
uuid = "1c621080-faea-4a02-84b6-bbd5e436b8fe"
837821
version = "1.0.0"
838822

839-
[[deps.ThreadSafeDicts]]
840-
git-tree-sha1 = "300b753c0a786ea43fdafc26a4e50b87fb58cd50"
841-
uuid = "4239201d-c60e-5e0a-9702-85d713665ba7"
842-
version = "0.1.6"
843-
844823
[[deps.UUIDs]]
845824
deps = ["Random", "SHA"]
846825
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"

Project.toml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ authors = ["Eric Sabo <[email protected]>", "Ben Ide <[email protected]>"]
44
version = "0.1.0"
55

66
[deps]
7-
AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
87
AutoHashEquals = "15f4f7f2-30c1-5605-9d31-71845cf9641f"
9-
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
108
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
119
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
1210
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
@@ -15,15 +13,13 @@ FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
1513
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
1614
Hecke = "3e1990a7-5d81-5526-99ce-9ba3ff248f21"
1715
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
18-
Memoization = "6fafb56a-5788-4b4e-91ca-c0cea6611c73"
1916
Oscar = "f1435218-dba5-11e9-1e4d-f1a5fab5fc13"
2017
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
2118
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
2219
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
2320
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
2421
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
2522
TestItemRunner = "f8b46487-2199-4994-9208-9a1283c18c0a"
26-
ThreadSafeDicts = "4239201d-c60e-5e0a-9702-85d713665ba7"
2723

2824
[weakdeps]
2925
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
@@ -44,9 +40,7 @@ JuMPExt = ["JuMP", "GLPK"]
4440
MakieExt = ["Makie"]
4541

4642
[compat]
47-
AbstractAlgebra = "0.43.12"
4843
AutoHashEquals = "2.2.0"
49-
BenchmarkTools = "1.6.0"
5044
CairoMakie = "0.13.1"
5145
Colors = "0.13.0"
5246
Combinatorics = "1.0.2"
@@ -58,11 +52,9 @@ GraphMakie = "0.5.13"
5852
GraphPlot = "0.6.0"
5953
Graphs = "1.12.0"
6054
Makie = "0.19.11"
61-
Memoization = "0.2.2"
6255
NetworkLayout = "0.4.9"
6356
Oscar = "1.2.2"
6457
StatsBase = "0.34.4"
65-
ThreadSafeDicts = "0.1.6"
6658
WGLMakie = "0.8.15"
6759
julia = "≥ 1.10"
6860

ext/MakieExt/LDPC/codes.jl

Lines changed: 0 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -43,131 +43,6 @@ function CodingTheory.degree_distributions_plot(C::AbstractLDPCCode)
4343
return f
4444
end
4545

46-
# """
47-
# $TYPEDSIGNATURES
48-
49-
# Return a bar graph and a dictionary of (length, count) pairs for unique short
50-
# cycles in the Tanner graph of `C`. An empty graph and dictionary are returned
51-
# when there are no cycles.
52-
53-
# # Note
54-
# - Short cycles are defined to be those with lengths between ``g`` and ``2g - 2``,
55-
# where ``g`` is the girth.
56-
# - Run `using Makie` to activate this extension.
57-
# """
58-
# function CodingTheory.count_short_cycles_plot(C::AbstractLDPCCode)
59-
# if isempty(C.short_cycle_counts) || isempty(C.elementary_cycle_counts)
60-
# CodingTheory._count_cycles(C)
61-
# end
62-
63-
# len = length(C.short_cycle_counts)
64-
# x_data = [0 for _ in 1:len]
65-
# y_data = [0 for _ in 1:len]
66-
# index = 1
67-
# for (i, j) in C.short_cycle_counts
68-
# x_data[index] = i
69-
# y_data[index] = j
70-
# index += 1
71-
# end
72-
73-
# fig = Figure();
74-
# ax = Axis(fig[1, 1], xlabel = "Cycle Length", ylabel = "Occurrences",
75-
# title = "Short Cycle Counts")
76-
# barplot!(ax, x_data, y_data, bar_width = 1, xticks = x_data, yticks = y_data)
77-
# # fig = Plots.bar(x_data, y_data, bar_width = 1, xticks = x_data, yticks = y_data,
78-
# # legend = false, xlabel = "Cycle Length", ylabel = "Occurrences",
79-
# # title = "Short Cycle Counts")
80-
# display(fig)
81-
# return fig, C.short_cycle_counts
82-
# end
83-
84-
# """
85-
# $TYPEDSIGNATURES
86-
87-
# Return a bar graph and a dictionary of (length, count) pairs for unique elementary
88-
# cycles in the Tanner graph of `C`. An empty graph and dictionary are returned
89-
# when there are no cycles.
90-
91-
# # Note
92-
# - Elementary cycles do not contain the same vertex twice and are unable to be
93-
# decomposed into a sequence of shorter cycles.
94-
# - Run `using Makie` to activate this extension.
95-
# """
96-
# function CodingTheory.count_elementary_cycles_plot(C::AbstractLDPCCode)
97-
# if isempty(C.short_cycle_counts) || isempty(C.elementary_cycle_counts)
98-
# CodingTheory._count_cycles(C)
99-
# end
100-
101-
# len = length(C.elementary_cycle_counts)
102-
# x_data = [0 for _ in 1:len]
103-
# y_data = [0 for _ in 1:len]
104-
# index = 1
105-
# for (i, j) in C.elementary_cycle_counts
106-
# x_data[index] = i
107-
# y_data[index] = j
108-
# index += 1
109-
# end
110-
111-
# fig = Figure();
112-
# ax = Axis(fig[1, 1], xlabel = "Cycle Length", ylabel = "Occurrences",
113-
# title = "Elementary Cycle Counts")
114-
# barplot!(ax, x_data, y_data, bar_width = 1, xticks = x_data, yticks = y_data)
115-
# # fig = Plots.bar(x_data, y_data, bar_width = 1, xticks = x_data, yticks = y_data,
116-
# # legend = false, xlabel = "Cycle Length", ylabel = "Occurrences",
117-
# # title = "Elementary Cycle Counts")
118-
# display(fig)
119-
# return fig, C.elementary_cycle_counts
120-
# end
121-
122-
"""
123-
$TYPEDSIGNATURES
124-
125-
Return an interactive figure and data for the ACE spectrum of the Tanner graph of `C`.
126-
127-
# Note
128-
- Run `using Makie` to activate this extension.
129-
"""
130-
function CodingTheory.ACE_spectrum_plot(C::AbstractLDPCCode)
131-
# TODO: remove WGLMakie as a default use and only use for interactive plots
132-
fig = Figure();
133-
ax = Axis(fig[1, 1], xlabel = "ACE", ylabel = "Occurrences", title = "ACE Spectrum")
134-
sg = SliderGrid(fig[2, 1], (label = "Cycle Length", range = girth:2:2 * girth - 2,
135-
startvalue = 4))
136-
137-
x_max = maximum(reduce(vcat, vs_ACEs))
138-
y_max = 0
139-
counts = ACE_spectrum(C)
140-
X_data = Observable(Vector{Int}())
141-
Y_data = Observable(Vector{Int}())
142-
barplot!(ax, X_data, Y_data, bar_width = 1, xticks = X_data, yticks = Y_data)
143-
for (k, l) in enumerate(girth:2:2 * girth - 2)
144-
145-
ys = collect(values(counts[k]))
146-
y_max = maximum([y_max; ys])
147-
148-
on(sg.sliders[1].value) do val
149-
if to_value(val) == l
150-
X_data.val = collect(keys(counts[k]))
151-
Y_data.val = ys
152-
notify(X_data)
153-
notify(Y_data)
154-
end
155-
end
156-
end
157-
158-
GLMakie.limits!(0, x_max + 1, 0, y_max + 2)
159-
display(fig)
160-
return fig, counts
161-
end
162-
163-
mutable struct _ComputationGraphNode
164-
id::Int
165-
parent_id::Int
166-
lvl::Int
167-
vertex_number::Int
168-
type::Symbol
169-
end
170-
17146
# doesn't seem to be a point in making this dynamic with a slider, as it simply
17247
# continues in the same tree shape and no useful information is gained from watching it
17348
"""

src/CodingTheory.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ using StatsBase
2020
using Distributions
2121
using ProgressMeter
2222
using DocStringExtensions
23-
using Memoization
24-
using ThreadSafeDicts
2523

2624
import LinearAlgebra: tr, Adjoint, transpose, kron, diagm
2725
import Oscar: dual, factor, transpose, order, polynomial, nrows, ncols, degree,

src/iterators.jl

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,6 @@ struct SubsetGrayCode
1212
init_rank::UInt128 # iteration will start with the subset of this rank
1313
end
1414

15-
function SubsetGrayCode(n::Int, k::Int)
16-
init_rank = big(1)
17-
num_threads = 1
18-
return _subset_gray_code_from_num_threads(n, k, init_rank, num_threads)
19-
end
20-
21-
function _subset_gray_code_from_num_threads(n::Int, k::Int, init_rank::UInt128, num_threads::Int)
22-
bin = extended_binomial(n, k)
23-
if bin % num_threads != 0
24-
throw(ArgumentError("num_threads=$num_threads, must divide binomial($n $k)"))
25-
end
26-
len = fld(bin, num_threads)
27-
return SubsetGrayCode(n, k, len, init_rank)
28-
end
29-
30-
function _subset_gray_codes_from_num_threads(n::Int, k::Int, num_threads::Int)
31-
# This function splits a single iterator into several pieces.
32-
# The intended usage is to do the iteration with multiple threads
33-
bin = extended_binomial(n, k)
34-
i = 0
35-
len = fld(bin, num_threads)
36-
37-
itrs = fill(SubsetGrayCode(1,1,1,1), num_threads)
38-
for i in 0:num_threads - 1
39-
init_rank = 1 + i * len
40-
itrs[i+1] = SubsetGrayCode(n, k, len, init_rank)
41-
end
42-
return itrs
43-
end
44-
4515
Base.IteratorEltype(::SubsetGrayCode) = Base.HasEltype()
4616
Base.eltype(::SubsetGrayCode) = Array{Int, 1}
4717
Base.IteratorSize(::SubsetGrayCode) = Base.HasLength()
@@ -76,21 +46,12 @@ end
7646
Note that inds is part of the iterator's state inds only to prevent reallocation in each
7747
iteration.
7848
=#
79-
# subset_vec = zeros(Int, G.k)
80-
# CodingTheory._subset_unrank!(G.init_rank, UInt(G.n), subset_vec)
81-
82-
# a = @allocated begyyin
8349
subset_vec = zeros(Int, G.k)
8450
if G.init_rank == 1
8551
subset_vec = Int.(collect(1 : G.k))
86-
# first_vec = vcat(ones(Int, r), zeros(Int, k - r))
87-
# for i in 1:G.k
88-
# subset_vec[i] = 1
89-
# end
9052
else
9153
CodingTheory._subset_unrank!(G.init_rank, UInt(G.n), subset_vec)
9254
end
93-
# end; a > 0 && @show a
9455

9556
inds = fill(-1, 3)
9657
(inds, (subset_vec, 1, inds))
@@ -219,37 +180,20 @@ function _subset_unrank!(r::UInt128, n::UInt, T::Vector{Int})
219180
k = length(T)
220181
subset_size_str::String = "subset size k = $k must be smaller than the set size n = $n"
221182
k > n && throw(ArgumentError(subset_size_str))
222-
# count_bins = 0
223-
# bnd = extended_binomial(n, k)
224-
# # count_bins += 1
225-
# rank_size_str::String = "rank must be in [0, choose(n, k) - 1] = $bnd but is $(r)"
226-
# # r > bnd && throw(ArgumentError(rank_size_str))
227-
# if r > bnd
228-
# println(rank_size_str)
229-
# println("bug exit _subset_unrank")
230-
# return
231-
# end
232-
183+
233184
x = 0
234185
i = 0
235186
y = 0
236187
x = n
237188
for i::UInt in k:-1:1
238189
y = extended_binomial(x, i)
239-
# println((Int16.(x),Int16.(i)))
240-
# count_bins += 1
241190
while y > r
242191
x = x - 1
243192
y = extended_binomial(x, i)
244-
# println((x,i))
245-
# count_bins += 1
246193
end
247194
T[i] = x + 1
248195
r = extended_binomial(x + 1, i) - r - 1
249-
# println((x+1,i))
250-
# count_bins += 1
251196
end
252-
# println("num calls to binomial(a,b) in 1 unrank = $(count_bins)")
253197
end
254198

255199
struct GrayCode

src/utils.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ function _min_wt_row(A::Union{CTMatrixTypes, Matrix{S}, LinearAlgebra.Adjoint{S,
164164
return w, i
165165
end
166166

167-
# function _min_wt_col(A::Union{CTMatrixTypes, Matrix{S}, LinearAlgebra.Adjoint{S, Matrix{S}}}) where S <: Integer
168167
function _min_wt_col(A::Union{CTMatrixTypes, Matrix{S}, LinearAlgebra.Adjoint{S, Matrix{S}}, LinearAlgebra.Adjoint{Bool, BitMatrix}}) where S <: Integer
169168
w = size(A, 1) + 1
170169
i = 0
@@ -1993,7 +1992,6 @@ function _rand_invertible_matrix(F::CTFieldTypes, n::Integer)
19931992
return A
19941993
end
19951994

1996-
# @memoize ThreadSafeDict function extended_binomial(x::Union{Int, UInt}, y::Union{Int, UInt})
19971995
function extended_binomial(x::Union{Int, UInt}, y::Union{Int, UInt})
19981996
return y <= x ? UInt128.(binomial(x, y)) : UInt128(0)
19991997
end

0 commit comments

Comments
 (0)