QuantumLegos.jl/v0.1.0/index.html

156 lines
35 KiB
HTML
Raw Permalink Normal View History

2024-05-07 11:53:43 +09:00
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Home · QuantumLegos.jl</title><meta name="title" content="Home · QuantumLegos.jl"/><meta property="og:title" content="Home · QuantumLegos.jl"/><meta property="twitter:title" content="Home · 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 class="is-active"><a class="tocitem" href>Home</a><ul class="internal"><li class="toplevel"><a class="tocitem" href="#Example"><span>Example</span></a></li><li><a class="tocitem" href="#CheckMatrix-and-defining-Lego"><span>CheckMatrix and defining Lego</span></a></li><li><a class="tocitem" href="#Defining-and-Updating-State"><span>Defining and Updating State</span></a></li><li><a class="tocitem" href="#2-Lego-1-edge-state"><span>2 Lego 1 edge state</span></a></li><li class="toplevel"><a class="tocitem" href="#Internal(how-it-works)"><span>Internal(how it works)</span></a></li><li><a class="tocitem" href="#Notes-on-Overall-flow"><span>Notes on Overall flow</span></a></li><li class="toplevel"><a class="tocitem" href="#API"><span>API</span></a></li></ul></li><li><a class="tocitem" href="pauliops/">PauliOps</a></li><li><a class="tocitem" href="checkmatrix/">Details on check matrix operations</a></li><li><a class="tocitem" href="distance/">How to calculate code distance from the state.</a></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>Home</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Home</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://githu
julia&gt; stabilizers = pauliop.([&quot;IIXXXX&quot;, &quot;IIZZZZ&quot;, &quot;ZIZZII&quot;, &quot;IZZIZI&quot;, &quot;IXXXII&quot;, &quot;XIXIXI&quot;])
6-element Vector{StaticArraysCore.SVector{6, QuantumLegos.PauliOps.SinglePauliOp}}:
pauliop(&quot;IIXXXX&quot;)
pauliop(&quot;IIZZZZ&quot;)
pauliop(&quot;ZIZZII&quot;)
pauliop(&quot;IZZIZI&quot;)
pauliop(&quot;IXXXII&quot;)
pauliop(&quot;XIXIXI&quot;)
julia&gt; cmat = checkmatrix(stabilizers)
CheckMatrix with 6 generators, 6 legs:
0 0 1 1 1 1 | 0 0 0 0 0 0
0 0 0 0 0 0 | 0 0 1 1 1 1
0 0 0 0 0 0 | 1 0 1 1 0 0
0 0 0 0 0 0 | 0 1 1 0 1 0
0 1 1 1 0 0 | 0 0 0 0 0 0
1 0 1 0 1 0 | 0 0 0 0 0 0
julia&gt; cmat.nlegs
6
julia&gt; cmat.ngens
6
julia&gt; cmat.cmat
6×12 Matrix{Bool}:
0 0 1 1 1 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 1 1 1
0 0 0 0 0 0 1 0 1 1 0 0
0 0 0 0 0 0 0 1 1 0 1 0
0 1 1 1 0 0 0 0 0 0 0 0
1 0 1 0 1 0 0 0 0 0 0 0
julia&gt; # define lego
julia&gt; lego = Lego(stabilizers)
Lego{6}(6, StaticArraysCore.SVector{6, QuantumLegos.PauliOps.SinglePauliOp}[pauliop(&quot;IIXXXX&quot;), pauliop(&quot;IIZZZZ&quot;), pauliop(&quot;ZIZZII&quot;), pauliop(&quot;IZZIZI&quot;), pauliop(&quot;IXXXII&quot;), pauliop(&quot;XIXIXI&quot;)])
julia&gt; lego.stabgens |&gt; checkmatrix
CheckMatrix with 6 generators, 6 legs:
0 0 1 1 1 1 | 0 0 0 0 0 0
0 0 0 0 0 0 | 0 0 1 1 1 1
0 0 0 0 0 0 | 1 0 1 1 0 0
0 0 0 0 0 0 | 0 1 1 0 1 0
0 1 1 1 0 0 | 0 0 0 0 0 0
1 0 1 0 1 0 | 0 0 0 0 0 0
</code></pre><ul><li><a href="pauliops/#QuantumLegos.PauliOps.pauliop-Tuple{AbstractString}"><code>pauliop</code></a></li><li><a href="checkmatrix/#QuantumLegos.checkmatrix"><code>checkmatrix</code></a> and <a href="checkmatrix/#QuantumLegos.CheckMatrix"><code>CheckMatrix</code></a></li><li><a href="#QuantumLegos.Lego"><code>Lego</code></a></li></ul><h2 id="Defining-and-Updating-State"><a class="docs-heading-anchor" href="#Defining-and-Updating-State">Defining and Updating State</a><a id="Defining-and-Updating-State-1"></a><a class="docs-heading-anchor-permalink" href="#Defining-and-Updating-State" title="Permalink"></a></h2><pre><code class="language-julia-repl hljs">julia&gt; using QuantumLegos
julia&gt; stabilizers = pauliop.([&quot;IIXXXX&quot;, &quot;IIZZZZ&quot;, &quot;ZIZZII&quot;, &quot;IZZIZI&quot;, &quot;IXXXII&quot;, &quot;XIXIXI&quot;])
6-element Vector{StaticArraysCore.SVector{6, QuantumLegos.PauliOps.SinglePauliOp}}:
pauliop(&quot;IIXXXX&quot;)
pauliop(&quot;IIZZZZ&quot;)
pauliop(&quot;ZIZZII&quot;)
pauliop(&quot;IZZIZI&quot;)
pauliop(&quot;IXXXII&quot;)
pauliop(&quot;XIXIXI&quot;)
julia&gt; lego = Lego(stabilizers)
Lego{6}(6, StaticArraysCore.SVector{6, QuantumLegos.PauliOps.SinglePauliOp}[pauliop(&quot;IIXXXX&quot;), pauliop(&quot;IIZZZZ&quot;), pauliop(&quot;ZIZZII&quot;), pauliop(&quot;IZZIZI&quot;), pauliop(&quot;IXXXII&quot;), pauliop(&quot;XIXIXI&quot;)])
julia&gt; # state with 1 lego, 0 leg
julia&gt; st = State([lego, ], Tuple{LegoLeg, LegoLeg}[])
State(Lego[Lego{6}(6, StaticArraysCore.SVector{6, QuantumLegos.PauliOps.SinglePauliOp}[pauliop(&quot;IIXXXX&quot;), pauliop(&quot;IIZZZZ&quot;), pauliop(&quot;ZIZZII&quot;), pauliop(&quot;IZZIZI&quot;), pauliop(&quot;IXXXII&quot;), pauliop(&quot;XIXIXI&quot;)])], Tuple{LegoLeg, LegoLeg}[], CheckMatrix(Bool[0 0 … 0 0; 0 0 … 1 1; … ; 0 1 … 0 0; 1 0 … 0 0], 6, 6))
julia&gt; st.cmat.cmat
6×12 Matrix{Bool}:
0 0 1 1 1 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 1 1 1
0 0 0 0 0 0 1 0 1 1 0 0
0 0 0 0 0 0 0 1 1 0 1 0
0 1 1 1 0 0 0 0 0 0 0 0
1 0 1 0 1 0 0 0 0 0 0 0
julia&gt; add_lego!(st, lego)
State(Lego[Lego{6}(6, StaticArraysCore.SVector{6, QuantumLegos.PauliOps.SinglePauliOp}[pauliop(&quot;IIXXXX&quot;), pauliop(&quot;IIZZZZ&quot;), pauliop(&quot;ZIZZII&quot;), pauliop(&quot;IZZIZI&quot;), pauliop(&quot;IXXXII&quot;), pauliop(&quot;XIXIXI&quot;)]), Lego{6}(6, StaticArraysCore.SVector{6, QuantumLegos.PauliOps.SinglePauliOp}[pauliop(&quot;IIXXXX&quot;), pauliop(&quot;IIZZZZ&quot;), pauliop(&quot;ZIZZII&quot;), pauliop(&quot;IZZIZI&quot;), pauliop(&quot;IXXXII&quot;), pauliop(&quot;XIXIXI&quot;)])], Tuple{LegoLeg, LegoLeg}[], CheckMatrix(Bool[0 0 … 0 0; 0 0 … 0 0; … ; 0 0 … 0 0; 0 0 … 0 0], 12, 12))
julia&gt; st.cmat.cmat
12×24 Matrix{Bool}:
0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 0 0
0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0
0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
julia&gt; # state with 2 legos, 0 leg
julia&gt; st2 = State([lego, lego], Tuple{LegoLeg, LegoLeg}[])
State(Lego[Lego{6}(6, StaticArraysCore.SVector{6, QuantumLegos.PauliOps.SinglePauliOp}[pauliop(&quot;IIXXXX&quot;), pauliop(&quot;IIZZZZ&quot;), pauliop(&quot;ZIZZII&quot;), pauliop(&quot;IZZIZI&quot;), pauliop(&quot;IXXXII&quot;), pauliop(&quot;XIXIXI&quot;)]), Lego{6}(6, StaticArraysCore.SVector{6, QuantumLegos.PauliOps.SinglePauliOp}[pauliop(&quot;IIXXXX&quot;), pauliop(&quot;IIZZZZ&quot;), pauliop(&quot;ZIZZII&quot;), pauliop(&quot;IZZIZI&quot;), pauliop(&quot;IXXXII&quot;), pauliop(&quot;XIXIXI&quot;)])], Tuple{LegoLeg, LegoLeg}[], CheckMatrix(Bool[0 0 … 0 0; 0 0 … 0 0; … ; 0 0 … 0 0; 0 0 … 0 0], 12, 12))
julia&gt; st == st2
true</code></pre><h2 id="2-Lego-1-edge-state"><a class="docs-heading-anchor" href="#2-Lego-1-edge-state">2 Lego 1 edge state</a><a id="2-Lego-1-edge-state-1"></a><a class="docs-heading-anchor-permalink" href="#2-Lego-1-edge-state" title="Permalink"></a></h2><pre><code class="language-julia-repl hljs">julia&gt; using QuantumLegos
julia&gt; stabilizers = pauliop.([&quot;IIXXXX&quot;, &quot;IIZZZZ&quot;, &quot;ZIZZII&quot;, &quot;IZZIZI&quot;, &quot;IXXXII&quot;, &quot;XIXIXI&quot;])
6-element Vector{StaticArraysCore.SVector{6, QuantumLegos.PauliOps.SinglePauliOp}}:
pauliop(&quot;IIXXXX&quot;)
pauliop(&quot;IIZZZZ&quot;)
pauliop(&quot;ZIZZII&quot;)
pauliop(&quot;IZZIZI&quot;)
pauliop(&quot;IXXXII&quot;)
pauliop(&quot;XIXIXI&quot;)
julia&gt; lego = Lego(stabilizers)
Lego{6}(6, StaticArraysCore.SVector{6, QuantumLegos.PauliOps.SinglePauliOp}[pauliop(&quot;IIXXXX&quot;), pauliop(&quot;IIZZZZ&quot;), pauliop(&quot;ZIZZII&quot;), pauliop(&quot;IZZIZI&quot;), pauliop(&quot;IXXXII&quot;), pauliop(&quot;XIXIXI&quot;)])
julia&gt; state = State([lego, lego], edge.([((1, 3), (2, 3))]))
State(Lego[Lego{6}(6, StaticArraysCore.SVector{6, QuantumLegos.PauliOps.SinglePauliOp}[pauliop(&quot;IIXXXX&quot;), pauliop(&quot;IIZZZZ&quot;), pauliop(&quot;ZIZZII&quot;), pauliop(&quot;IZZIZI&quot;), pauliop(&quot;IXXXII&quot;), pauliop(&quot;XIXIXI&quot;)]), Lego{6}(6, StaticArraysCore.SVector{6, QuantumLegos.PauliOps.SinglePauliOp}[pauliop(&quot;IIXXXX&quot;), pauliop(&quot;IIZZZZ&quot;), pauliop(&quot;ZIZZII&quot;), pauliop(&quot;IZZIZI&quot;), pauliop(&quot;IXXXII&quot;), pauliop(&quot;XIXIXI&quot;)])], Tuple{LegoLeg, LegoLeg}[(LegoLeg(1, 3), LegoLeg(2, 3))], CheckMatrix(Bool[1 0 … 0 0; 0 1 … 0 0; … ; 0 0 … 1 1; 0 0 … 0 1], 10, 10))
julia&gt; state.cmat
CheckMatrix with 10 generators, 10 legs:
1 0 1 0 1 0 0 0 0 0 | 0 0 0 0 0 0 0 0 0 0
0 1 0 1 1 0 0 0 0 0 | 0 0 0 0 0 0 0 0 0 0
0 0 1 1 1 0 0 1 1 1 | 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 1 0 1 0 1 | 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 1 0 1 1 | 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 | 1 0 0 1 1 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 | 0 1 1 0 1 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 | 0 0 1 1 1 0 0 1 1 1
0 0 0 0 0 0 0 0 0 0 | 0 0 0 0 0 1 0 0 1 1
0 0 0 0 0 0 0 0 0 0 | 0 0 0 0 0 0 1 1 0 1
julia&gt; pg = state.cmat |&gt; generators |&gt; GeneratedPauliGroup
GeneratedPauliGroup{10}(StaticArraysCore.SVector{10, QuantumLegos.PauliOps.SinglePauliOp}[pauliop(&quot;XIXIXIIIII&quot;), pauliop(&quot;IXIXXIIIII&quot;), pauliop(&quot;IIXXXIIXXX&quot;), pauliop(&quot;IIIIIXIXIX&quot;), pauliop(&quot;IIIIIIXIXX&quot;), pauliop(&quot;ZIIZZIIIII&quot;), pauliop(&quot;IZZIZIIIII&quot;), pauliop(&quot;IIZZZIIZZZ&quot;), pauliop(&quot;IIIIIZIIZZ&quot;), pauliop(&quot;IIIIIIZZIZ&quot;)], IterTools.Subsets{Vector{StaticArraysCore.SVector{N, QuantumLegos.PauliOps.SinglePauliOp} where N}}(StaticArraysCore.SVector{N, QuantumLegos.PauliOps.SinglePauliOp} where N[pauliop(&quot;XIXIXIIIII&quot;), pauliop(&quot;IXIXXIIIII&quot;), pauliop(&quot;IIXXXIIXXX&quot;), pauliop(&quot;IIIIIXIXIX&quot;), pauliop(&quot;IIIIIIXIXX&quot;), pauliop(&quot;ZIIZZIIIII&quot;), pauliop(&quot;IZZIZIIIII&quot;), pauliop(&quot;IIZZZIIZZZ&quot;), pauliop(&quot;IIIIIZIIZZ&quot;), pauliop(&quot;IIIIIIZZIZ&quot;)]))
julia&gt; pauliop(&quot;XIIXIXIIXI&quot;) in pg
true
</code></pre><h1 id="Internal(how-it-works)"><a class="docs-heading-anchor" href="#Internal(how-it-works)">Internal(how it works)</a><a id="Internal(how-it-works)-1"></a><a class="docs-heading-anchor-permalink" href="#Internal(how-it-works)" title="Permalink"></a></h1><h2 id="Notes-on-Overall-flow"><a class="docs-heading-anchor" href="#Notes-on-Overall-flow">Notes on Overall flow</a><a id="Notes-on-Overall-flow-1"></a><a class="docs-heading-anchor-permalink" href="#Notes-on-Overall-flow" title="Permalink"></a></h2><p>Details on <sup class="footnote-reference"><a id="citeref-1" href="#footnote-1">[1]</a></sup></p><ul><li>state is translated to a single check matrix<ul><li>the size is ≤ <span>$N \times 2N$</span> where <span>$N$</span> is maximum number of lego logs.</li></ul></li><li>any contraction can be performed on this single check matrix</li><li>if the check matrix can be represented as direct sum of matrices with <span>$k N$</span> columns where <span>$k ∈ $</span>, then they are not contracted</li></ul><h3 id="Construction-of-State"><a class="docs-heading-anchor" href="#Construction-of-State">Construction of State</a><a id="Construction-of-State-1"></a><a class="docs-heading-anchor-permalink" href="#Construction-of-State" title="Permalink"></a></h3><p>Construction of <code>State</code> is completed by calling <code>State</code> constructor recursively.</p><ol><li>Construct <code>State</code> without edge. Just adding legos. Checkmatrix is just a direct sum of each lego&#39;s checkmatrix</li><li>Concatenate each edges. During this operation, self tracing of checkmatrix is evaluated.</li></ol><p>Each constructor calls action function (which is a map from <code>State</code> to <code>State</code>). Therefore, action functions can be used both for direct construction of <code>State</code> and action application to <code>State</code> during the game.</p><h1 id="API"><a class="docs-heading-anchor" href="#API">API</a><a id="API-1"></a><a class="docs-heading-anchor-permalink" href="#API" title="Permalink"></a></h1><ul><li><a href="pauliops/#QuantumLegos.PauliOps"><code>QuantumLegos.PauliOps</code></a></li><li><a href="checkmatrix/#QuantumLegos.CheckMatrix"><code>QuantumLegos.CheckMatrix</code></a></li><li><a href="#QuantumLegos.Lego"><code>QuantumLegos.Lego</code></a></li><li><a href="#QuantumLegos.LegoLeg"><code>QuantumLegos.LegoLeg</code></a></li><li><a href="pauliops/#QuantumLegos.PauliOps.GeneratedPauliGroup"><code>QuantumLegos.PauliOps.GeneratedPauliGroup</code></a></li><li><a href="pauliops/#QuantumLegos.PauliOps.PauliOp"><code>QuantumLegos.PauliOps.PauliOp</code></a></li><li><a href="pauliops/#QuantumLegos.PauliOps.SinglePauliOp"><code>QuantumLegos.PauliOps.SinglePauliOp</code></a></li><li><a href="#QuantumLegos.State"><code>QuantumLegos.State</code></a></li><li><a href="pauliops/#QuantumLegos.PauliOps.pauliop-Tuple{AbstractString}"><code>QuantumLegos.PauliOps.pauliop</code></a></li><li><a href="pauliops/#QuantumLegos.PauliOps.single_pauliop-Tuple{Char}"><code>QuantumLegos.PauliOps.single_pauliop</code></a></li><li><a href="pauliops/#QuantumLegos.PauliOps.weight"><code>QuantumLegos.PauliOps.weight</code></a></li><li><a href="pauliops/#QuantumLegos.PauliOps.xweight"><code>QuantumLegos.PauliOps.xweight</code></a></li><li><a href="pauliops/#QuantumLegos.PauliOps.zweight"><code>QuantumLegos.PauliOps.zweight</code></a></li><li><a href="#QuantumLegos._naive_distance-Tuple{State}"><code>QuantumLegos._naive_distance</code></a></li><li><a href="#QuantumLegos.add_edge!-Tuple{State, LegoLeg, LegoLeg}"><code>QuantumLegos.add_edge!</code></a></li><li><a href="#QuantumLegos.add_lego!-Tuple{State, Lego}"><code>QuantumLegos.add_lego!</code></a></li><li><a href="checkmatrix/#QuantumLegos.align_row!"><code>QuantumLegos.align_row!</code></a></li><li><a href="checkmatrix/#QuantumLegos.checkmatrix"><code>QuantumLegos.checkmatrix</code></a></li><li><a href="#QuantumLegos.cmat_index-Tuple{State, LegoLeg}"><code>QuantumLegos.cmat_index</code></a></li><li><a href="checkmatrix/#QuantumLegos.direct_sum"><code>QuantumLegos.direct_sum</
2-element Vector{StaticArraysCore.SVector{2, QuantumLegos.PauliOps.SinglePauliOp}}:
pauliop(&quot;II&quot;)
pauliop(&quot;XX&quot;)
julia&gt; Lego(stabgens)
Lego{2}(2, StaticArraysCore.SVector{2, QuantumLegos.PauliOps.SinglePauliOp}[pauliop(&quot;II&quot;), pauliop(&quot;XX&quot;)])</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/qwjyh/QuantumLegos.jl/blob/fda016f02dad2c2600c16e88335a3733b9e1c284/src/game.jl#L8-L31">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="QuantumLegos.LegoLeg" href="#QuantumLegos.LegoLeg"><code>QuantumLegos.LegoLeg</code></a><span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">mutable struct State</code></pre><p>To be used in <a href="#QuantumLegos.State"><code>State</code></a>.</p><p><strong>Fields</strong></p><ul><li><code>lego_id::Int64</code>: index in <code>legos</code> in <code>State</code></li><li><code>edge_id::Int64</code>: index in <code>Lego</code> in <code>legos</code> in <code>State</code>. No validation check included in <code>LegoLeg</code>.</li></ul><p><strong>Example</strong></p><pre><code class="language-julia-repl hljs">julia&gt; x = LegoLeg.([(2, 1), (1, 1), (1, 0)])
3-element Vector{LegoLeg}:
LegoLeg(2, 1)
LegoLeg(1, 1)
LegoLeg(1, 0)
julia&gt; sort(x)
3-element Vector{LegoLeg}:
LegoLeg(1, 0)
LegoLeg(1, 1)
LegoLeg(2, 1)</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/qwjyh/QuantumLegos.jl/blob/fda016f02dad2c2600c16e88335a3733b9e1c284/src/game.jl#L50-L73">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="QuantumLegos.State" href="#QuantumLegos.State"><code>QuantumLegos.State</code></a><span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">mutable struct State</code></pre><p>State (in p.4)</p><p><strong>Fields</strong></p><ul><li><code>legos</code>: <code>Vector{Lego}</code></li><li><code>edges</code>: Vector of ((<code>lego_i, leg_n</code>), (<code>lego_j, leg_m</code>)). Each element is sorted (i.e. <code>lego_i &lt; lego_j</code> or <code>lego_i == lego_j &amp;&amp; leg_n &lt; leg_m</code>). This feature is used in <a href="#QuantumLegos.is_connected_to_firstlego-Tuple{State}"><code>is_connected_to_firstlego</code></a>.</li><li><code>cmat::CheckMatrix</code>: CheckMatrix</li></ul><p><strong>Constructor</strong></p><pre><code class="nohighlight hljs">State(legos::Vector{Lego{N}}, edges::Vector{Tuple{LegoLeg, LegoLeg}})</code></pre><p><strong>Methods with</strong></p><ul><li><a href="#QuantumLegos.add_lego!-Tuple{State, Lego}"><code>add_lego!</code></a></li><li><a href="#QuantumLegos.add_edge!-Tuple{State, LegoLeg, LegoLeg}"><code>add_edge!</code></a></li></ul><p><strong>Example</strong></p><p>TODO</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/qwjyh/QuantumLegos.jl/blob/fda016f02dad2c2600c16e88335a3733b9e1c284/src/game.jl#L115-L136">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="QuantumLegos._naive_distance-Tuple{State}" href="#QuantumLegos._naive_distance-Tuple{State}"><code>QuantumLegos._naive_distance</code></a><span class="docstring-category">Method</span></header><section><div><p>Calculate distance. Use minimum distance of all generated normalizers.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/qwjyh/QuantumLegos.jl/blob/fda016f02dad2c2600c16e88335a3733b9e1c284/src/game.jl#L261-L264">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="QuantumLegos.add_edge!-Tuple{State, LegoLeg, LegoLeg}" href="#QuantumLegos.add_edge!-Tuple{State, LegoLeg, LegoLeg}"><code>QuantumLegos.add_edge!</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">add_edge!(state::State, leg_1::LegoLeg, leg_2::LegoLeg)::State</code></pre><p>Add a new edge between <code>leg_1</code> and <code>leg_2</code>, updating <code>state</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/qwjyh/QuantumLegos.jl/blob/fda016f02dad2c2600c16e88335a3733b9e1c284/src/game.jl#L209-L213">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button fa-solid fa-chevron-down" href="javascript:;" title="Collapse docstring"></a><a class="docstring-binding" id="QuantumLegos.add_lego!-Tuple{State, Lego}" href="#QuantumLegos.add_lego!-Tuple{State, Lego}"><code>QuantumLegos.add_lego!</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">add_lego!(state::State, lego::Lego) -&gt; State</code></pre><p>Add a new lego, updating <code>state</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/qwjyh/QuantumLegos.jl/blob/fda016f02dad2c2600c16e88335a3733b9e1c284/src/game.jl#L171-L175">source</a></section></article><article class="docstring"><header><a class="docstring-article-toggle-button f