diff --git a/CondaPkg.toml b/CondaPkg.toml index a8db9b1..932dccb 100644 --- a/CondaPkg.toml +++ b/CondaPkg.toml @@ -7,4 +7,5 @@ scipy = "" pymatching = "" ldpc = ">=2.2.8" sinter = ">=1.14" -stim = ">=1.14" \ No newline at end of file +stim = ">=1.14" +fusion-blossom = ">=0.2.13" diff --git a/README.md b/README.md index d64107b..5a134a5 100644 --- a/README.md +++ b/README.md @@ -99,4 +99,36 @@ julia> syndrome = PyArray(H)*error .% 2 julia> decoding = bpd.decode(np.array(syndrome)) Python: array([0, 1, 0]) -``` \ No newline at end of file +``` + +## fusion-blossom + +The python fusion-blossom module is immediately available: + +``` +julia> using PyQDecoders + +julia> PyQDecoders.fb +Python: +``` + +Running the example from `fusion-blossom`'s original [example qec codes demo](https://tutorial.fusionblossom.com/demo/example-qec-codes.html): + +``` +julia> using PyQDecoders: fb; + +julia> code = fb.CodeCapacityPlanarCode(d=11, p=0.05, max_half_weight=500); + +julia> syndrome = code.generate_random_errors(seed=1000); + +julia> initializer = code.get_initializer(); + +julia> solver = fb.SolverSerial(initializer); + +julia> solver.solve(syndrome); + +julia> subgraph = solver.subgraph(); + +julia> println("Minimum Weight Parity Subgraph (MWPS): ", subgraph) +Minimum Weight Parity Subgraph (MWPS): [14, 24, 26, 34, 66, 68, 93, 107, 144, 159, 161, 169] +``` diff --git a/src/PyQDecoders.jl b/src/PyQDecoders.jl index 570fbca..499c637 100644 --- a/src/PyQDecoders.jl +++ b/src/PyQDecoders.jl @@ -7,6 +7,7 @@ const np = PythonCall.pynew() const pm = PythonCall.pynew() const ldpc = PythonCall.pynew() const ldpccodes = PythonCall.pynew() +const fb = PythonCall.pynew() function __init__() PythonCall.pycopy!(sp, PythonCall.pyimport("scipy")) @@ -15,6 +16,7 @@ function __init__() PythonCall.pycopy!(pm, PythonCall.pyimport("pymatching")) PythonCall.pycopy!(ldpc, PythonCall.pyimport("ldpc")) PythonCall.pycopy!(ldpccodes, PythonCall.pyimport("ldpc.codes")) + PythonCall.pycopy!(fb, PythonCall.pyimport("fusion_blossom")) end end # module