</code></pre><ul><li><ahref="pauliops/#QuantumLegos.PauliOps.pauliop-Tuple{AbstractString}"><code>pauliop</code></a></li><li><ahref="checkmatrix/#QuantumLegos.checkmatrix"><code>checkmatrix</code></a> and <ahref="checkmatrix/#QuantumLegos.CheckMatrix"><code>CheckMatrix</code></a></li><li><ahref="#QuantumLegos.Lego"><code>Lego</code></a></li></ul><h2id="Defining-and-Updating-State"><aclass="docs-heading-anchor"href="#Defining-and-Updating-State">Defining and Updating State</a><aid="Defining-and-Updating-State-1"></a><aclass="docs-heading-anchor-permalink"href="#Defining-and-Updating-State"title="Permalink"></a></h2><pre><codeclass="language-julia-repl hljs">julia> using QuantumLegos
</code></pre><h1id="Internal(how-it-works)"><aclass="docs-heading-anchor"href="#Internal(how-it-works)">Internal(how it works)</a><aid="Internal(how-it-works)-1"></a><aclass="docs-heading-anchor-permalink"href="#Internal(how-it-works)"title="Permalink"></a></h1><h2id="Notes-on-Overall-flow"><aclass="docs-heading-anchor"href="#Notes-on-Overall-flow">Notes on Overall flow</a><aid="Notes-on-Overall-flow-1"></a><aclass="docs-heading-anchor-permalink"href="#Notes-on-Overall-flow"title="Permalink"></a></h2><p>Details on <supclass="footnote-reference"><aid="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><h3id="Construction-of-State"><aclass="docs-heading-anchor"href="#Construction-of-State">Construction of State</a><aid="Construction-of-State-1"></a><aclass="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'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><h1id="API"><aclass="docs-heading-anchor"href="#API">API</a><aid="API-1"></a><aclass="docs-heading-anchor-permalink"href="#API"title="Permalink"></a></h1><ul><li><ahref="pauliops/#QuantumLegos.PauliOps"><code>QuantumLegos.PauliOps</code></a></li><li><ahref="checkmatrix/#QuantumLegos.CheckMatrix"><code>QuantumLegos.CheckMatrix</code></a></li><li><ahref="#QuantumLegos.Lego"><code>QuantumLegos.Lego</code></a></li><li><ahref="#QuantumLegos.LegoLeg"><code>QuantumLegos.LegoLeg</code></a></li><li><ahref="pauliops/#QuantumLegos.PauliOps.GeneratedPauliGroup"><code>QuantumLegos.PauliOps.GeneratedPauliGroup</code></a></li><li><ahref="pauliops/#QuantumLegos.PauliOps.PauliOp"><code>QuantumLegos.PauliOps.PauliOp</code></a></li><li><ahref="pauliops/#QuantumLegos.PauliOps.SinglePauliOp"><code>QuantumLegos.PauliOps.SinglePauliOp</code></a></li><li><ahref="#QuantumLegos.State"><code>QuantumLegos.State</code></a></li><li><ahref="pauliops/#QuantumLegos.PauliOps.pauliop-Tuple{AbstractString}"><code>QuantumLegos.PauliOps.pauliop</code></a></li><li><ahref="pauliops/#QuantumLegos.PauliOps.single_pauliop-Tuple{Char}"><code>QuantumLegos.PauliOps.single_pauliop</code></a></li><li><ahref="pauliops/#QuantumLegos.PauliOps.weight"><code>QuantumLegos.PauliOps.weight</code></a></li><li><ahref="pauliops/#QuantumLegos.PauliOps.xweight"><code>QuantumLegos.PauliOps.xweight</code></a></li><li><ahref="pauliops/#QuantumLegos.PauliOps.zweight"><code>QuantumLegos.PauliOps.zweight</code></a></li><li><ahref="#QuantumLegos._naive_distance-Tuple{State}"><code>QuantumLegos._naive_distance</code></a></li><li><ahref="#QuantumLegos.add_edge!-Tuple{State, LegoLeg, LegoLeg}"><code>QuantumLegos.add_edge!</code></a></li><li><ahref="#QuantumLegos.add_lego!-Tuple{State, Lego}"><code>QuantumLegos.add_lego!</code></a></li><li><ahref="checkmatrix/#QuantumLegos.align_row!"><code>QuantumLegos.align_row!</code></a></li><li><ahref="checkmatrix/#QuantumLegos.checkmatrix"><code>QuantumLegos.checkmatrix</code></a></li><li><ahref="#QuantumLegos.cmat_index-Tuple{State, LegoLeg}"><code>QuantumLegos.cmat_index</code></a></li><li><ahref="checkmatrix/#QuantumLegos.direct_sum"><code>QuantumLegos.direct_sum</
Lego{2}(2, StaticArraysCore.SVector{2, QuantumLegos.PauliOps.SinglePauliOp}[pauliop("II"), pauliop("XX")])</code></pre></div><aclass="docs-sourcelink"target="_blank"href="https://github.com/qwjyh/QuantumLegos.jl/blob/c68874a7e7faabcbf7960ac94d25bba3069afdfd/src/game.jl#L8-L31">source</a></section></article><articleclass="docstring"><header><aclass="docstring-article-toggle-button fa-solid fa-chevron-down"href="javascript:;"title="Collapse docstring"></a><aclass="docstring-binding"id="QuantumLegos.LegoLeg"href="#QuantumLegos.LegoLeg"><code>QuantumLegos.LegoLeg</code></a> — <spanclass="docstring-category">Type</span></header><section><div><pre><codeclass="language-julia hljs">mutable struct State</code></pre><p>To be used in <ahref="#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><codeclass="language-julia-repl hljs">julia> x = LegoLeg.([(2, 1), (1, 1), (1, 0)])