Skip to content

Commit 25e178a

Browse files
committed
Makie bug workaround
1 parent d30cbe4 commit 25e178a

File tree

18 files changed

+731
-297
lines changed

18 files changed

+731
-297
lines changed

Manifest.toml

Lines changed: 146 additions & 114 deletions
Large diffs are not rendered by default.

Project.toml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ AutoHashEquals = "15f4f7f2-30c1-5605-9d31-71845cf9641f"
88
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
99
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
1010
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
11+
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
1112
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
1213
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
13-
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
14+
Hecke = "3e1990a7-5d81-5526-99ce-9ba3ff248f21"
1415
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1516
Oscar = "f1435218-dba5-11e9-1e4d-f1a5fab5fc13"
16-
Hecke = "3e1990a7-5d81-5526-99ce-9ba3ff248f21"
1717
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
1818
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1919
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
@@ -37,24 +37,26 @@ WGLMakie = "276b4fcb-3e11-5398-bf8b-a0c2d153d008"
3737
[extensions]
3838
JLD2Ext = "JLD2"
3939
JuMPExt = ["JuMP", "GLPK"]
40-
MakieExt = ["Makie", "NetworkLayout", "CairoMakie", "GraphMakie", "GLMakie", "WGLMakie", "GraphPlot"]
40+
MakieExt = ["Makie"]
4141

4242
[compat]
43-
AutoHashEquals = "2.1.0"
44-
CairoMakie = "0.10.11"
45-
Colors = "0.12.10"
43+
AutoHashEquals = "2.2.0"
44+
CairoMakie = "0.13.1"
45+
Colors = "0.13.0"
4646
Combinatorics = "1.0.2"
47-
DataStructures = "0.18.15"
48-
FFTW = "1.7.1"
49-
GLMakie = "0.8.11"
50-
GraphMakie = "0.5.6"
51-
GraphPlot = "0.5.2"
52-
Graphs = "1.9.0"
47+
DataStructures = "0.18.20"
48+
DocStringExtensions = "0.9.3"
49+
FFTW = "1.8.0"
50+
GLMakie = "0.11.2"
51+
GraphMakie = "0.5.13"
52+
GraphPlot = "0.6.0"
53+
Graphs = "1.12.0"
5354
Makie = "0.19.11"
54-
NetworkLayout = "0.4.6"
55-
StatsBase = "0.34.2"
55+
NetworkLayout = "0.4.9"
56+
Oscar = "1.2.2"
57+
StatsBase = "0.34.4"
5658
WGLMakie = "0.8.15"
57-
julia = "≥ 1.9"
59+
julia = "≥ 1.10"
5860

5961
[extras]
6062
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

ext/JLD2Ext/JLD2Ext.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
module JLD2Ext
22

33
import CodingTheory
4-
54
import CodingTheory: TriangularColorCode488, TriangularColorCode666, StabilizerCode, set_logicals!, set_minimum_distance! #PlanarSurfaceCode3D, PlanarSurfaceCode3D_X, ToricCode3D,
6-
75
import JLD2
8-
96
import JLD2: @load
10-
117
import Oscar: GF, matrix
128

139
include("Quantum/misc_known_codes.jl")

ext/JuMPExt/JuMPExt.jl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
module JuMPExt
22

33
import CodingTheory
4-
54
import CodingTheory: optimal_lambda, optimal_rho, optimal_lambda_and_rho, LP_decoder_LDPC, AbstractLinearCode, BinarySymmetricChannel
6-
75
import JuMP
8-
96
import JuMP: @variable, @constraint, @objective
10-
117
import GLPK
12-
138
import Oscar
149

1510
include("LDPC/decoders.jl")

ext/MakieExt/Classical/Tanner.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,34 +20,34 @@ function CodingTheory.Tanner_graph_plot(H::Union{CodingTheory.CTMatrixTypes, Mat
2020
# put in top right corner in order to get parents, children working
2121
A[1:nc, nc + 1:end] = transpose(M)
2222

23-
fig = Figure();
24-
ax = Axis(fig[1, 1], yreversed = true, xautolimitmargin = (0.15, 0.20),
23+
fig = CairoMakie.Figure();
24+
ax = CairoMakie.Axis(fig[1, 1], yreversed = true, xautolimitmargin = (0.15, 0.20),
2525
yautolimitmargin = (0.15, 0.20))
26-
hidespines!(ax)
27-
hidedecorations!(ax)
26+
CairoMakie.hidespines!(ax)
27+
CairoMakie.hidedecorations!(ax)
2828

2929
left_x, left_y = zeros(nc), 1.:nc
3030
right_x, right_y = ones(nr) * nr, range(1, nc, nr)
3131
x = vcat(left_x, right_x)
3232
y = vcat(left_y, right_y)
33-
points = CairoMakie.Point.(zip(x, y))
33+
points = CairoMakie.Point2f.(zip(x, y))
3434
cols = (:aqua, :red, :orange, :green, :blue, :purple)
3535

36-
G = SimpleDiGraph(A)
36+
G = Grphs.SimpleDiGraph(A)
3737
parents = [Grphs.inneighbors(G, i) for i in Grphs.vertices(G)]
3838
children = findall(x -> length(x) > 0, parents)
3939

4040
for (i, v) in enumerate(children)
4141
for node in parents[v]
42-
lines!(CairoMakie.Point(x[[node, v]]...), CairoMakie.Point(y[[node, v]]...),
43-
color = cols[i % 6 + 1], linewidth = 5)
42+
CairoMakie.lines!([CairoMakie.Point2f(x[[node, v]])...], [CairoMakie.Point2f(y[[node,
43+
v]])...], color = cols[i % 6 + 1], linewidth = 5)
4444
end
45-
text!(points[v], text = L"c_{%$i}", offset = (20, -15))
45+
CairoMakie.text!(points[v], text = L"c_{%$i}", offset = (20, -15))
4646
end
4747

4848
for (i, point) in enumerate(points[1:nc])
4949
CairoMakie.scatter!(point, color = :black, marker = :circle, markersize = 25)
50-
text!(point, text = L"v_{%$i}", offset = (-30, -10))
50+
CairoMakie.text!(point, text = L"v_{%$i}", offset = (-30, -10))
5151
end
5252

5353
for (i, point) in enumerate(points[nc + 1:end])

ext/MakieExt/LDPC/codes.jl

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

46-
"""
47-
$TYPEDSIGNATURES
46+
# """
47+
# $TYPEDSIGNATURES
4848

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.
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.
5252

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
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
6262

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
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
7272

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
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
8383

84-
"""
85-
$TYPEDSIGNATURES
84+
# """
85+
# $TYPEDSIGNATURES
8686

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.
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.
9090

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
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
100100

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
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
110110

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
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
121121

122122
"""
123123
$TYPEDSIGNATURES

ext/MakieExt/MakieExt.jl

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,13 @@
11
module MakieExt
22

3-
import CodingTheory
4-
5-
import CodingTheory: Tanner_graph_plot, weight_plot, EXIT_chart_plot, degree_distributions_plot, count_short_cycles_plot, count_elementary_cycles_plot, ACE_spectrum_plot, computation_graph, weight_plot_CSS_X, weight_plot_CSS_Z, weight_plot_CSS
6-
7-
import Makie
8-
9-
import NetworkLayout
10-
11-
import CairoMakie
12-
13-
import GraphMakie
14-
15-
import GLMakie
16-
17-
import WGLMakie
18-
19-
import GraphPlot
20-
21-
import Oscar
22-
3+
import CodingTheory, Oscar
4+
import CodingTheory: Tanner_graph_plot, weight_plot, EXIT_chart_plot, degree_distributions_plot, count_short_cycles_plot, count_elementary_cycles_plot, ACE_spectrum_plot, computation_graph, weight_plot_CSS_X, weight_plot_CSS_Z, weight_plot_CSS, AbstractLinearCode, AbstractLDPCCode,
5+
LDPCEnsemble, AbstractClassicalNoiseChannel, AbstractStabilizerCode, AbstractStabilizerCodeCSS
6+
# import Makie
7+
using Makie, NetworkLayout, CairoMakie, GraphMakie, GLMakie, WGLMakie#, GraphPlot
8+
import CairoMakie: @L_str #, Figure, Axis, hidespines!, hidedecorations!, lines!, text!
239
import Graphs as Grphs
10+
using DocStringExtensions
2411
# import CairoMakie: save
2512

2613
include("Classical/Tanner.jl")

ext/MakieExt/Quantum/weight_dist.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@
88
# Weight Enumerators
99
#############################
1010

11-
"""
12-
$TYPEDSIGNATURES
11+
# """
12+
# $TYPEDSIGNATURES
1313

14-
Return a bar graph of the weight distribution related to `S`.
14+
# Return a bar graph of the weight distribution related to `S`.
1515

16-
If `type` is `:stabilizer`, the weight distribution of the stabilizers are computed.
17-
If `type` is `:normalizer`, the weight distrbution of the normalizer of the stabilizers
18-
are computed. If `type` is `:quotient`, the weight distrbution of the normalizer mod the
19-
stabilizers is computed.
16+
# If `type` is `:stabilizer`, the weight distribution of the stabilizers are computed.
17+
# If `type` is `:normalizer`, the weight distrbution of the normalizer of the stabilizers
18+
# are computed. If `type` is `:quotient`, the weight distrbution of the normalizer mod the
19+
# stabilizers is computed.
2020

21-
# Note
22-
- Run `using Makie` to activate this extension.
23-
"""
21+
# # Note
22+
# - Run `using Makie` to activate this extension.
23+
# """
2424
function CodingTheory.weight_plot(S::AbstractStabilizerCode; alg::Symbol = :auto,
2525
type::Symbol = :stabilizer)
2626

src/Classical/TwistedReedSolomon.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function TwistedReedSolomonCode(k::Int, α::Vector{T}, t::Vector{Int}, h::Vector
4040
G[i + 1, c] = g_i(α[c])
4141
end
4242
end
43-
display(G)
43+
# display(G)
4444

4545
t_dual = k .- h
4646
h_dual = (n - k) .- t
@@ -55,11 +55,11 @@ function TwistedReedSolomonCode(k::Int, α::Vector{T}, t::Vector{Int}, h::Vector
5555
H[i + 1, c] = g_i(α[c])
5656
end
5757
end
58-
println(" ")
59-
display(H)
58+
# println(" ")
59+
# display(H)
6060

61-
println(" ")
62-
display(G * transpose(H))
61+
# println(" ")
62+
# display(G * transpose(H))
6363

6464
C = LinearCode(G, H, false)
6565
return TwistedReedSolomonCode(C.F, C.n, C.k, C.d, C.l_bound, C.u_bound, C.G, C.H, C.G_stand, C.H_stand, C.P_stand, C.weight_enum, α, t, h, η, l)

0 commit comments

Comments
 (0)