mirror of
https://github.com/qwjyh/QuantumLegos.jl.git
synced 2024-11-23 07:21:05 +09:00
168 lines
16 KiB
HTML
168 lines
16 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>How to calculate code distance from the state. · QuantumLegos.jl</title><meta name="title" content="How to calculate code distance from the state. · QuantumLegos.jl"/><meta property="og:title" content="How to calculate code distance from the state. · QuantumLegos.jl"/><meta property="twitter:title" content="How to calculate code distance from the state. · QuantumLegos.jl"/><meta name="description" content="Documentation for QuantumLegos.jl."/><meta property="og:description" content="Documentation for QuantumLegos.jl."/><meta property="twitter:description" content="Documentation for QuantumLegos.jl."/><script data-outdated-warner src="../assets/warner.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" rel="stylesheet" type="text/css"/><link href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css" rel="stylesheet" type="text/css"/><script>documenterBaseURL=".."</script><script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js" data-main="../assets/documenter.js"></script><script src="../search_index.js"></script><script src="../siteinfo.js"></script><script src="../../versions.js"></script><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-dark.css" data-theme-name="documenter-dark" data-theme-primary-dark/><link class="docs-theme-link" rel="stylesheet" type="text/css" href="../assets/themes/documenter-light.css" data-theme-name="documenter-light" data-theme-primary/><script src="../assets/themeswap.js"></script></head><body><div id="documenter"><nav class="docs-sidebar"><div class="docs-package-name"><span class="docs-autofit"><a href="../">QuantumLegos.jl</a></span></div><button class="docs-search-query input is-rounded is-small is-clickable my-2 mx-auto py-1 px-2" id="documenter-search-query">Search docs (Ctrl + /)</button><ul class="docs-menu"><li><a class="tocitem" href="../">Home</a></li><li><a class="tocitem" href="../pauliops/">PauliOps</a></li><li><a class="tocitem" href="../checkmatrix/">Details on check matrix operations</a></li><li class="is-active"><a class="tocitem" href>How to calculate code distance from the state.</a><ul class="internal"><li><a class="tocitem" href="#Definition-of-code-distance."><span>Definition of code distance.</span></a></li><li><a class="tocitem" href="#Classification-of-the-stabilizers."><span>Classification of the stabilizers.</span></a></li><li><a class="tocitem" href="#Calculating-code-distance-from-the-check-matrix."><span>Calculating code distance from the check matrix.</span></a></li><li><a class="tocitem" href="#Examples"><span>Examples</span></a></li></ul></li></ul><div class="docs-version-selector field has-addons"><div class="control"><span class="docs-label button is-static is-size-7">Version</span></div><div class="docs-selector control is-expanded"><div class="select is-fullwidth is-size-7"><select id="documenter-version-selector"></select></div></div></div></nav><div class="docs-main"><header class="docs-navbar"><a class="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop" id="documenter-sidebar-button" href="#"></a><nav class="breadcrumb"><ul class="is-hidden-mobile"><li class="is-active"><a href>How to calculate code distance from the state.</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>How to calculate code distance from the state.</a></li></ul></nav><div class="docs-righ
|
||
|
|
||
|
julia> stab_513 = pauliop.(["IXZZXI", "IIXZZX", "IXIXZZ", "IZXIXZ", "XXXXXX", "ZZZZZZ"])
|
||
|
6-element Vector{StaticArraysCore.SVector{6, QuantumLegos.PauliOps.SinglePauliOp}}:
|
||
|
pauliop("IXZZXI")
|
||
|
pauliop("IIXZZX")
|
||
|
pauliop("IXIXZZ")
|
||
|
pauliop("IZXIXZ")
|
||
|
pauliop("XXXXXX")
|
||
|
pauliop("ZZZZZZ")
|
||
|
|
||
|
julia> lego_513 = Lego(stab_513)
|
||
|
Lego{6}(6, StaticArraysCore.SVector{6, QuantumLegos.PauliOps.SinglePauliOp}[pauliop("IXZZXI"), pauliop("IIXZZX"), pauliop("IXIXZZ"), pauliop("IZXIXZ"), pauliop("XXXXXX"), pauliop("ZZZZZZ")])
|
||
|
|
||
|
julia> state_513 = State([lego_513], edge.([]))
|
||
|
State(Lego[Lego{6}(6, StaticArraysCore.SVector{6, QuantumLegos.PauliOps.SinglePauliOp}[pauliop("IXZZXI"), pauliop("IIXZZX"), pauliop("IXIXZZ"), pauliop("IZXIXZ"), pauliop("XXXXXX"), pauliop("ZZZZZZ")])], Tuple{LegoLeg, LegoLeg}[], CheckMatrix(Bool[0 1 … 0 0; 0 0 … 1 0; … ; 1 1 … 0 0; 0 0 … 1 1], 6, 6))
|
||
|
</code></pre><p>Then collect generators of the state.</p><pre><code class="language-julia-repl hljs">julia> normalizers = state_513.cmat |> generators |> GeneratedPauliGroup |> collect
|
||
|
64-element Vector{StaticArraysCore.SVector{6, QuantumLegos.PauliOps.SinglePauliOp}}:
|
||
|
pauliop("IIIIII")
|
||
|
pauliop("IXZZXI")
|
||
|
pauliop("IIXZZX")
|
||
|
pauliop("IXYIYX")
|
||
|
pauliop("IXIXZZ")
|
||
|
pauliop("IIZYYZ")
|
||
|
pauliop("IXXYIY")
|
||
|
pauliop("IIYXXY")
|
||
|
pauliop("IZXIXZ")
|
||
|
pauliop("IYYZIZ")
|
||
|
⋮
|
||
|
pauliop("YYIZZI")
|
||
|
pauliop("YXZYZX")
|
||
|
pauliop("YIIXYX")
|
||
|
pauliop("YXYXII")
|
||
|
pauliop("YIXYXI")
|
||
|
pauliop("YIZZIY")
|
||
|
pauliop("YXIIXY")
|
||
|
pauliop("YIYIZZ")
|
||
|
pauliop("YXXZYZ")
|
||
|
</code></pre><p>Get stabilizer and normalizers of the <span>$[[5, 1, 3]]$</span> code by assigning the first leg as logical.</p><pre><code class="language-julia-repl hljs">julia> stabs = filter(x -> x[1] == PauliOps.I, normalizers)
|
||
|
16-element Vector{StaticArraysCore.SVector{6, QuantumLegos.PauliOps.SinglePauliOp}}:
|
||
|
pauliop("IIIIII")
|
||
|
pauliop("IXZZXI")
|
||
|
pauliop("IIXZZX")
|
||
|
pauliop("IXYIYX")
|
||
|
pauliop("IXIXZZ")
|
||
|
pauliop("IIZYYZ")
|
||
|
pauliop("IXXYIY")
|
||
|
pauliop("IIYXXY")
|
||
|
pauliop("IZXIXZ")
|
||
|
pauliop("IYYZIZ")
|
||
|
pauliop("IZIZYY")
|
||
|
pauliop("IYZIZY")
|
||
|
pauliop("IYXXYI")
|
||
|
pauliop("IZYYZI")
|
||
|
pauliop("IYIYXX")
|
||
|
pauliop("IZZXIX")
|
||
|
|
||
|
julia> norm_x = filter(x -> x[1] == PauliOps.X, normalizers)
|
||
|
16-element Vector{StaticArraysCore.SVector{6, QuantumLegos.PauliOps.SinglePauliOp}}:
|
||
|
pauliop("XXXXXX")
|
||
|
pauliop("XIYYIX")
|
||
|
pauliop("XXIYYI")
|
||
|
pauliop("XIZXZI")
|
||
|
pauliop("XIXIYY")
|
||
|
pauliop("XXYZZY")
|
||
|
pauliop("XIIZXZ")
|
||
|
pauliop("XXZIIZ")
|
||
|
pauliop("XYIXIY")
|
||
|
pauliop("XZZYXY")
|
||
|
pauliop("XYXYZZ")
|
||
|
pauliop("XZYXYZ")
|
||
|
pauliop("XZIIZX")
|
||
|
pauliop("XYZZYX")
|
||
|
pauliop("XZXZII")
|
||
|
pauliop("XYYIXI")
|
||
|
|
||
|
julia> norm_y = filter(x -> x[1] == PauliOps.Y, normalizers)
|
||
|
16-element Vector{StaticArraysCore.SVector{6, QuantumLegos.PauliOps.SinglePauliOp}}:
|
||
|
pauliop("YYYYYY")
|
||
|
pauliop("YZXXZY")
|
||
|
pauliop("YYZXXZ")
|
||
|
pauliop("YZIYIZ")
|
||
|
pauliop("YZYZXX")
|
||
|
pauliop("YYXIIX")
|
||
|
pauliop("YZZIYI")
|
||
|
pauliop("YYIZZI")
|
||
|
pauliop("YXZYZX")
|
||
|
pauliop("YIIXYX")
|
||
|
pauliop("YXYXII")
|
||
|
pauliop("YIXYXI")
|
||
|
pauliop("YIZZIY")
|
||
|
pauliop("YXIIXY")
|
||
|
pauliop("YIYIZZ")
|
||
|
pauliop("YXXZYZ")
|
||
|
|
||
|
julia> norm_z = filter(x -> x[1] == PauliOps.Z, normalizers)
|
||
|
16-element Vector{StaticArraysCore.SVector{6, QuantumLegos.PauliOps.SinglePauliOp}}:
|
||
|
pauliop("ZZZZZZ")
|
||
|
pauliop("ZYIIYZ")
|
||
|
pauliop("ZZYIIY")
|
||
|
pauliop("ZYXZXY")
|
||
|
pauliop("ZYZYII")
|
||
|
pauliop("ZZIXXI")
|
||
|
pauliop("ZYYXZX")
|
||
|
pauliop("ZZXYYX")
|
||
|
pauliop("ZIYZYI")
|
||
|
pauliop("ZXXIZI")
|
||
|
pauliop("ZIZIXX")
|
||
|
pauliop("ZXIZIX")
|
||
|
pauliop("ZXYYXZ")
|
||
|
pauliop("ZIXXIZ")
|
||
|
pauliop("ZXZXYY")
|
||
|
pauliop("ZIIYZY")
|
||
|
</code></pre><p>These normalizers are generated from one logical operator and stabilizers.</p><pre><code class="language-julia-repl hljs">julia> map(x -> x .* pauliop("XXXXXX"), stabs) |> Set == Set(norm_x)
|
||
|
true
|
||
|
|
||
|
julia> map(x -> x .* pauliop("ZZZZZZ"), stabs) |> Set == Set(norm_x)
|
||
|
false
|
||
|
|
||
|
julia> map(x -> x .* pauliop("ZZZZZZ"), stabs) |> Set == Set(norm_z)
|
||
|
true
|
||
|
|
||
|
julia> map(x -> x .* pauliop("YYYYYY"), stabs) |> Set == Set(norm_y)
|
||
|
true
|
||
|
|
||
|
julia> using IterTools
|
||
|
|
||
|
julia> groupby(x -> x[1], normalizers) .|> Set == Set.([stabs, norm_x, norm_z, norm_y])
|
||
|
true
|
||
|
</code></pre><p>Define a function to get weight of the operator.</p><pre><code class="language-julia-repl hljs">julia> function weight(x, i = 1)
|
||
|
count(x[i:end] .!= PauliOps.I)
|
||
|
end
|
||
|
weight (generic function with 2 methods)
|
||
|
|
||
|
julia> weight(pauliop("XIXIXI"))
|
||
|
3
|
||
|
|
||
|
julia> weight(pauliop("XIXIXI"), 2)
|
||
|
2
|
||
|
</code></pre><p>Calculate coefficients of enumerator polynomial.</p><pre><code class="language-julia-repl hljs">julia> using DataStructures
|
||
|
|
||
|
julia> stabs .|> weight |> counter
|
||
|
Accumulator{Int64, Int64} with 2 entries:
|
||
|
0 => 1
|
||
|
4 => 15
|
||
|
|
||
|
julia> function weight(i::Integer)
|
||
|
Base.Fix2(weight, i)
|
||
|
end
|
||
|
weight (generic function with 3 methods)
|
||
|
|
||
|
julia> normalizers .|> weight(2) |> counter
|
||
|
Accumulator{Int64, Int64} with 4 entries:
|
||
|
0 => 1
|
||
|
4 => 15
|
||
|
5 => 18
|
||
|
3 => 30
|
||
|
|
||
|
julia> [norm_x..., norm_y..., norm_z...] .|> weight(2) |> counter
|
||
|
Accumulator{Int64, Int64} with 2 entries:
|
||
|
5 => 18
|
||
|
3 => 30
|
||
|
|
||
|
julia> [norm_x..., norm_y..., norm_z...] .|> weight(2) |> counter |> keys |> minimum
|
||
|
3
|
||
|
</code></pre><p>Code distance of the encoding is the minimum degree of the non-zero term in the normalizer's polynomial(<span>$B$</span>) and not in the stabilizer's polynomial(<span>$A$</span>). So the code distance of this encoding is <span>$3$</span>.</p><section class="footnotes is-size-7"><ul><li class="footnote" id="footnote-1"><a class="tag is-link" href="#citeref-1">1</a>Not all state can be formalized like this. TODO</li></ul></section></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../checkmatrix/">« Details on check matrix operations</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="auto">Automatic (OS)</option><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.4.1 on <span class="colophon-date" title="Tuesday 7 May 2024 02:47">Tuesday 7 May 2024</span>. Using Julia version 1.10.3.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
|