<htmllang="en"><head><metacharset="UTF-8"/><metaname="viewport"content="width=device-width, initial-scale=1.0"/><title>How to calculate code distance from the state. · QuantumLegos.jl</title><metaname="title"content="How to calculate code distance from the state. · QuantumLegos.jl"/><metaproperty="og:title"content="How to calculate code distance from the state. · QuantumLegos.jl"/><metaproperty="twitter:title"content="How to calculate code distance from the state. · QuantumLegos.jl"/><metaname="description"content="Documentation for QuantumLegos.jl."/><metaproperty="og:description"content="Documentation for QuantumLegos.jl."/><metaproperty="twitter:description"content="Documentation for QuantumLegos.jl."/><scriptdata-outdated-warnersrc="../assets/warner.js"></script><linkhref="https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css"rel="stylesheet"type="text/css"/><linkhref="https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.050/juliamono.min.css"rel="stylesheet"type="text/css"/><linkhref="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/fontawesome.min.css"rel="stylesheet"type="text/css"/><linkhref="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/solid.min.css"rel="stylesheet"type="text/css"/><linkhref="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css"rel="stylesheet"type="text/css"/><linkhref="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.16.8/katex.min.css"rel="stylesheet"type="text/css"/><script>documenterBaseURL=".."</script><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js"data-main="../assets/documenter.js"></script><scriptsrc="../search_index.js"></script><scriptsrc="../siteinfo.js"></script><scriptsrc="../../versions.js"></script><linkclass="docs-theme-link"rel="stylesheet"type="text/css"href="../assets/themes/documenter-dark.css"data-theme-name="documenter-dark"data-theme-primary-dark/><linkclass="docs-theme-link"rel="stylesheet"type="text/css"href="../assets/themes/documenter-light.css"data-theme-name="documenter-light"data-theme-primary/><scriptsrc="../assets/themeswap.js"></script></head><body><divid="documenter"><navclass="docs-sidebar"><divclass="docs-package-name"><spanclass="docs-autofit"><ahref="../">QuantumLegos.jl</a></span></div><buttonclass="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><ulclass="docs-menu"><li><aclass="tocitem"href="../">Home</a></li><li><aclass="tocitem"href="../pauliops/">PauliOps</a></li><li><aclass="tocitem"href="../checkmatrix/">Details on check matrix operations</a></li><liclass="is-active"><aclass="tocitem"href>How to calculate code distance from the state.</a><ulclass="internal"><li><aclass="tocitem"href="#Definition-of-code-distance."><span>Definition of code distance.</span></a></li><li><aclass="tocitem"href="#Classification-of-the-stabilizers."><span>Classification of the stabilizers.</span></a></li><li><aclass="tocitem"href="#Calculating-code-distance-from-the-check-matrix."><span>Calculating code distance from the check matrix.</span></a></li><li><aclass="tocitem"href="#Examples"><span>Examples</span></a></li></ul></li></ul><divclass="docs-version-selector field has-addons"><divclass="control"><spanclass="docs-label button is-static is-size-7">Version</span></div><divclass="docs-selector control is-expanded"><divclass="select is-fullwidth is-size-7"><selectid="documenter-version-selector"></select></div></div></div></nav><divclass="docs-main"><headerclass="docs-navbar"><aclass="docs-sidebar-button docs-navbar-link fa-solid fa-bars is-hidden-desktop"id="documenter-sidebar-button"href="#"></a><navclass="breadcrumb"><ulclass="is-hidden-mobile"><liclass="is-active"><ahref>How to calculate code distance from the state.</a></li></ul><ulclass="is-hidden-tablet"><liclass="is-active"><ahref>How to calculate code distance from the state.</a></li></ul></nav><divclass="docs-righ
</code></pre><p>Get stabilizer and normalizers of the <span>$[[5, 1, 3]]$</span> code by assigning the first leg as logical.</p><pre><codeclass="language-julia-repl hljs">julia> stabs = filter(x -> x[1] == PauliOps.I, normalizers)
</code></pre><p>These normalizers are generated from one logical operator and stabilizers.</p><pre><codeclass="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)
</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><sectionclass="footnotes is-size-7"><ul><liclass="footnote"id="footnote-1"><aclass="tag is-link"href="#citeref-1">1</a>Not all state can be formalized like this. TODO</li></ul></section></article><navclass="docs-footer"><aclass="docs-footer-prevpage"href="../checkmatrix/">« Details on check matrix operations</a><divclass="flexbox-break"></div><pclass="footer-message">Powered by <ahref="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <ahref="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><divclass="modal"id="documenter-settings"><divclass="modal-background"></div><divclass="modal-card"><headerclass="modal-card-head"><pclass="modal-card-title">Settings</p><buttonclass="delete"></button></header><sectionclass="modal-card-body"><p><labelclass="label">Theme</label><divclass="select"><selectid="documenter-themepicker"><optionvalue="auto">Automatic (OS)</option><optionvalue="documenter-light">documenter-light</option><optionvalue="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <ahref="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 1.4.1 on <spanclass="colophon-date"title="Tuesday 7 May 2024 07:29">Tuesday 7 May 2024</span>. Using Julia version 1.10.3.</p></section><footerclass="modal-card-foot"></footer></div></div></div></body></html>