Skip to content

An MCMC decoding example #124

@nzy1997

Description

@nzy1997
using TensorQEC
using Random

# code definition
tanner = CSSTannerGraph(SurfaceCode(3,3))
tanner = CSSTannerGraph(BivariateBicycleCode(6,12, ((3,0),(0,1),(0,2)), ((0,3),(1,0),(2,0))))

# error model and syndrome extraction
p=0.01
em = iid_error(p,p,p,TensorQEC.nq(tanner))
Random.seed!(1234)
error_qubits = random_error_qubits(em)
syd = syndrome_extraction(error_qubits, tanner)

# generate problem
prob,_ = TensorQEC.generate_spin_glass_sa(tanner, em, collect(0:1e-3:1.0), 100,false)
config = TensorQEC._mixed_integer_programming_for_one_solution(tanner, syd)

# get energy
TensorQEC.sa_energy_hard(fill(false, length(prob.ops)), prob, vcat(config[1],config[2]))

# get minimum energy with integer programming
res = decode(IPDecoder(),tanner,syd)
TensorQEC.sa_energy_hard(fill(false, length(prob.ops)), prob, vcat(res.error_qubits.xerror,res.error_qubits.zerror))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions