mirror of
https://github.com/qwjyh/QuantumLegos.jl.git
synced 2024-11-22 23:11:05 +09:00
44 lines
21 KiB
HTML
44 lines
21 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>Details on check matrix operations · QuantumLegos.jl</title><meta name="title" content="Details on check matrix operations · QuantumLegos.jl"/><meta property="og:title" content="Details on check matrix operations · QuantumLegos.jl"/><meta property="twitter:title" content="Details on check matrix operations · 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 class="is-active"><a class="tocitem" href>Details on check matrix operations</a><ul class="internal"><li><a class="tocitem" href="#Basic-features-of-check-matrix"><span>Basic features of check matrix</span></a></li><li><a class="tocitem" href="#Construction-of-check-matrices-and-retrieving-features"><span>Construction of check matrices and retrieving features</span></a></li><li><a class="tocitem" href="#Direct-sum"><span>Direct sum</span></a></li><li><a class="tocitem" href="#Self-tracing"><span>Self-tracing</span></a></li></ul></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>Details on check matrix operations</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>Details on check matrix operations</a></li></ul></nav><div class="docs-right"><a class="docs-navbar-link" href="https://github.com/qwjyh/QuantumLegos.jl" title="View the repository on GitHub"><span class="docs-icon fa-brands"></span><span class="docs-label is-hidden-touch">GitHub</span></a><a class="docs-navbar-link" href="https://github.com/qwjyh/QuantumLegos.jl/blob/main/docs/src/checkmatrix.md" title="Edit source on GitHub"><span class="docs-icon fa-solid"></span></a><a class="docs-settings-button docs-navbar-link fa-solid fa-gear" id="documenter-settings-button" href="#" title="Settings"></a><a class="docs-article-toggle-button fa-solid fa-chevron-up" id="documenter-article-toggle-button" href="javascript:;" title="Collapse all docstrings"></a></div></header><article class="content" id="documenter-page"><h1 id="Details-on-check-matrix-operations"><a class="docs-heading-anchor" href="#Details-on-check-matrix-operations">Details on check matrix operations</a><a id="Details-on-check-matrix-operations-1"></a><a class="docs-heading-anchor-permalink" href="#Details-on-check-matrix-operations" title="Permalink"></a></h1><h2 id="Basic-features-of-check-matrix"><a class="docs-heading-anchor" href="#Basic-features-of-check-matrix">Basic features of check matrix</a><a id="Basic-features-of-check-matrix-1"></a><a class="docs-heading-anchor-permalink" href="#Basic-features-of-check-matrix" title="Permalink"></a></h2><ul><li>All action on state can be represented as operations on check matrix.</li><li>QuantumLegos which don't connect each other are represented by block diagonal check matrix.</li></ul><p>Thus, one needs only one check matrix to represent state.</p><ul><li>Generated group from generators represented by check matrix is invariant under row-swap and row-multiplying transforms on the check matrix.</li></ul><p>Thus, one can freely perform these row operations on check matrices.</p><h2 id="Construction-of-check-matrices-and-retrieving-features"><a class="docs-heading-anchor" href="#Construction-of-check-matrices-and-retrieving-features">Construction of check matrices and retrieving features</a><a id="Construction-of-check-matrices-and-retrieving-features-1"></a><a class="docs-heading-anchor-permalink" href="#Construction-of-check-matrices-and-retrieving-features" title="Permalink"></a></h2><p>Use <a href="#QuantumLegos.CheckMatrix"><code>CheckMatrix</code></a> from <code>Matrix{Bool}</code> and <a href="#QuantumLegos.checkmatrix"><code>checkmatrix</code></a> from <code>Vector{PauliOp}</code>.</p><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.CheckMatrix" href="#QuantumLegos.CheckMatrix"><code>QuantumLegos.CheckMatrix</code></a> — <span class="docstring-category">Type</span></header><section><div><p>CheckMatrix</p><p><strong>Fields</strong></p><ul><li><code>cmat</code>: matrix itself (matrix of <code>Bool</code> since we consider only pauli ops.)</li><li><code>nlegs</code>: number of columns ÷ 2</li><li><code>ngens</code>: number of rows</li></ul><p><strong>Constructor</strong></p><pre><code class="nohighlight hljs">CheckMatrix(cmat::AbstractMatrix{Bool})</code></pre><p>See also <a href="#QuantumLegos.checkmatrix"><code>checkmatrix</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/qwjyh/QuantumLegos.jl/blob/fda016f02dad2c2600c16e88335a3733b9e1c284/src/checkmatrix.jl#L1-L12">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.checkmatrix" href="#QuantumLegos.checkmatrix"><code>QuantumLegos.checkmatrix</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">checkmatrix(stbgens::AbstractVector{T})::CheckMatrix where {T <: PauliOp}</code></pre><p>Get <a href="#QuantumLegos.CheckMatrix"><code>CheckMatrix</code></a> from stabilizer generator.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/qwjyh/QuantumLegos.jl/blob/fda016f02dad2c2600c16e88335a3733b9e1c284/src/checkmatrix.jl#L78-L82">source</a></section></article><p>Get xpart and zpart of check matrix.</p><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.xpart" href="#QuantumLegos.xpart"><code>QuantumLegos.xpart</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">xpart(cmat::CheckMatrix)</code></pre><p>Get X part (left half) of CheckMatrix.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/qwjyh/QuantumLegos.jl/blob/fda016f02dad2c2600c16e88335a3733b9e1c284/src/checkmatrix.jl#L110-L114">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.zpart" href="#QuantumLegos.zpart"><code>QuantumLegos.zpart</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">zpart(cmat::CheckMatrix)</code></pre><p>Get Z part (right half) of CheckMatrix.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/qwjyh/QuantumLegos.jl/blob/fda016f02dad2c2600c16e88335a3733b9e1c284/src/checkmatrix.jl#L119-L123">source</a></section></article><p>Get generators from check matrix with <a href="#QuantumLegos.generators"><code>generators</code></a>.</p><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.generators" href="#QuantumLegos.generators"><code>QuantumLegos.generators</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">generators(cmat::CheckMatrix)::Vector{PauliOp}</code></pre><p>Get generators from <a href="#QuantumLegos.CheckMatrix"><code>CheckMatrix</code></a>.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/qwjyh/QuantumLegos.jl/blob/fda016f02dad2c2600c16e88335a3733b9e1c284/src/checkmatrix.jl#L132-L136">source</a></section></article><p>See also, <a href="../pauliops/#QuantumLegos.PauliOps.GeneratedPauliGroup"><code>GeneratedPauliGroup</code></a> and <a href="https://docs.julialang.org/en/v1/base/collections/#Base.Set"><code>Base.Set</code></a> to get group generated by generators.</p><h2 id="Direct-sum"><a class="docs-heading-anchor" href="#Direct-sum">Direct sum</a><a id="Direct-sum-1"></a><a class="docs-heading-anchor-permalink" href="#Direct-sum" title="Permalink"></a></h2><p>Used when adding lego without edge.</p><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.direct_sum" href="#QuantumLegos.direct_sum"><code>QuantumLegos.direct_sum</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">direct_sum(cmat_1::T, cmat_2::T)::T where {T <: CheckMatrix}</code></pre><p>Returns block diagonal <code>CheckMatrix</code> consists of <code>cmat_1</code> and <code>cmat_2</code>.</p><p><strong>CheckMatrix transform</strong></p><p>When adding a lego <span>$l$</span> with check matrix <span>$H_l$</span> to a state with check matrix <span>$H_s$</span>, the resulting check matrix of the state will be</p><p class="math-container">\[\begin{pmatrix}
|
|
H_s & O \\
|
|
O & H_l \\
|
|
\end{pmatrix}\]</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/qwjyh/QuantumLegos.jl/blob/fda016f02dad2c2600c16e88335a3733b9e1c284/src/checkmatrix.jl#L151-L165">source</a></section></article><h2 id="Self-tracing"><a class="docs-heading-anchor" href="#Self-tracing">Self-tracing</a><a id="Self-tracing-1"></a><a class="docs-heading-anchor-permalink" href="#Self-tracing" title="Permalink"></a></h2><h3 id="self-tracing"><a class="docs-heading-anchor" href="#self-tracing">self-tracing</a><a id="self-tracing-1"></a><a class="docs-heading-anchor-permalink" href="#self-tracing" title="Permalink"></a></h3><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.self_trace!" href="#QuantumLegos.self_trace!"><code>QuantumLegos.self_trace!</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">self_trace!(cmat::CheckMatrix, col_1::Integer, col_2::Integer)</code></pre><p>Take a self-trace of checkmatrix <code>cmat</code> with column <code>col_1</code> and <code>col_2</code>.</p><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/checkmatrix.jl#L424-L431">source</a></section></article><p>During self-tracing, pre-formatting and post-formatting described below is performed.</p><h3 id="pre-formatting"><a class="docs-heading-anchor" href="#pre-formatting">pre-formatting</a><a id="pre-formatting-1"></a><a class="docs-heading-anchor-permalink" href="#pre-formatting" title="Permalink"></a></h3><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.eliminate_column!" href="#QuantumLegos.eliminate_column!"><code>QuantumLegos.eliminate_column!</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">eliminate_column!(
|
|
cmat::CheckMatrix,
|
|
col::Integer,
|
|
avoid_row::AbstractVector{T},
|
|
)::Union{Nothing, Int64} where {T <: Integer}</code></pre><p>Perform Gauss Elimination on <code>col</code>. Keep only one <code>1</code> on <code>col</code> and remove from other rows by performing multiplication. Choose row not in <code>avoid_row</code>. If all rows with 1 on <code>col</code> are in <code>avoid_row</code>, then the last row of them is chose to keep 1. If all rows on <code>col</code> is 0, return nothing.</p><p><strong>Return</strong></p><p>Row index which have 1 on <code>col</code>. If all row on <code>col</code> is 0, return nothing.</p><p><strong>Example</strong></p><pre><code class="language-julia-repl hljs">julia> ex_cmat = CheckMatrix(Bool[1 0 1 0; 1 1 1 1])
|
|
CheckMatrix with 2 generators, 2 legs:
|
|
1 0 | 1 0
|
|
1 1 | 1 1
|
|
|
|
julia> QuantumLegos.eliminate_column!(ex_cmat, 1, Int64[])
|
|
1
|
|
|
|
julia> ex_cmat
|
|
CheckMatrix with 2 generators, 2 legs:
|
|
1 0 | 1 0
|
|
0 1 | 0 1</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/qwjyh/QuantumLegos.jl/blob/fda016f02dad2c2600c16e88335a3733b9e1c284/src/checkmatrix.jl#L175-L207">source</a></section><section><div><pre><code class="language-julia hljs">eliminate_column!(cmat::CheckMatrix, col::Integer,
|
|
avoid_row::AbstractVector{T}) where {T <: Union{Nothing, Integer}}</code></pre><p><code>avoid_row</code> can include <code>Nothing</code>, which is ignored in actual evaluation.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/qwjyh/QuantumLegos.jl/blob/fda016f02dad2c2600c16e88335a3733b9e1c284/src/checkmatrix.jl#L246-L251">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.align_row!" href="#QuantumLegos.align_row!"><code>QuantumLegos.align_row!</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">align_row!(m::AbstractMatrix, row::Integer, occupied::Vector{Union{Nothing, Integer}}) -> Integer
|
|
align_row!(m::AbstractMatrix, row::Nothing, occupied::Vector{Union{Nothing, Integer}}) -> Nothing</code></pre><p>Swap row at <code>row</code> in <code>m</code> and row at next to the maximum in <code>occupied</code>. <code>occupied</code> is supposed to be a list of returns from <a href="#QuantumLegos.eliminate_column!"><code>eliminate_column!</code></a>. If <code>row</code> is in <code>occupied</code>, do nothing and returns <code>row</code>. If <code>row</code> is <code>nothing</code>, return <code>nothing</code>.</p><p><strong>Arguments</strong></p><ul><li><code>m::AbstractMatrix</code>: mutated</li><li><code>row::Union{Nothing, Integer}</code>: row to be aligned</li><li><code>occupied::Vector{Union{Nothing, Integer}}</code>: indices of already occupied rows. <code>row</code> will be next to these rows.</li></ul><p><strong>Return</strong></p><ul><li>Row index where <code>row</code> is moved.</li></ul></div><a class="docs-sourcelink" target="_blank" href="https://github.com/qwjyh/QuantumLegos.jl/blob/fda016f02dad2c2600c16e88335a3733b9e1c284/src/checkmatrix.jl#L265-L281">source</a></section></article><p><a href="#QuantumLegos.align_row!"><code>QuantumLegos.align_row!</code></a></p><p>By this process, all columns to be traced have <code>1</code>s on only 1st to 4th rows. So during <a href="#QuantumLegos.self_trace!"><code>QuantumLegos.self_trace!</code></a>, all stabilizers generated from top three rows are calculated and perform operator matching.</p><h3 id="post-formatting"><a class="docs-heading-anchor" href="#post-formatting">post-formatting</a><a id="post-formatting-1"></a><a class="docs-heading-anchor-permalink" href="#post-formatting" title="Permalink"></a></h3><p>Remove rows which are linear combinations of other rows.</p><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.ref!" href="#QuantumLegos.ref!"><code>QuantumLegos.ref!</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">ref!(cmat::CheckMatrix) -> Int</code></pre><p>Convert <code>cmat</code> to row echelon form.</p><p>Returns rank of check matrix.</p><p><strong>Examples</strong></p><pre><code class="language-julia-repl hljs">julia> cmat = CheckMatrix(Bool[
|
|
1 0 1 0 1 1 0 1
|
|
0 1 0 0 0 1 0 0
|
|
1 1 1 0 1 0 1 1
|
|
0 1 0 0 0 1 0 0
|
|
])
|
|
CheckMatrix with 4 generators, 4 legs:
|
|
1 0 1 0 | 1 1 0 1
|
|
0 1 0 0 | 0 1 0 0
|
|
1 1 1 0 | 1 0 1 1
|
|
0 1 0 0 | 0 1 0 0
|
|
|
|
|
|
julia> QuantumLegos.ref!(cmat)
|
|
3
|
|
|
|
julia> cmat
|
|
CheckMatrix with 4 generators, 4 legs:
|
|
1 0 1 0 | 1 1 0 1
|
|
0 1 0 0 | 0 1 0 0
|
|
0 0 0 0 | 0 0 1 0
|
|
0 0 0 0 | 0 0 0 0
|
|
</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/qwjyh/QuantumLegos.jl/blob/fda016f02dad2c2600c16e88335a3733b9e1c284/src/checkmatrix.jl#L319-L352">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.eliminate_dependent_row!" href="#QuantumLegos.eliminate_dependent_row!"><code>QuantumLegos.eliminate_dependent_row!</code></a> — <span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">eliminate_dependent_row!(cmat::CheckMatrix) -> CheckMatrix</code></pre><p>Remove dependent rows to keep only independent generators.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/qwjyh/QuantumLegos.jl/blob/fda016f02dad2c2600c16e88335a3733b9e1c284/src/checkmatrix.jl#L407-L411">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../pauliops/">« PauliOps</a><a class="docs-footer-nextpage" href="../distance/">How to calculate code distance from the state. »</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:53">Tuesday 7 May 2024</span>. Using Julia version 1.10.3.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
|