QuantumLegos.jl/dev/pauliops/index.html

53 lines
14 KiB
HTML
Raw Permalink Normal View History

2024-05-07 11:47:03 +09:00
<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><title>PauliOps · QuantumLegos.jl</title><meta name="title" content="PauliOps · QuantumLegos.jl"/><meta property="og:title" content="PauliOps · QuantumLegos.jl"/><meta property="twitter:title" content="PauliOps · 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 class="is-active"><a class="tocitem" href>PauliOps</a><ul class="internal"><li><a class="tocitem" href="#Example"><span>Example</span></a></li><li><a class="tocitem" href="#API"><span>API</span></a></li></ul></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>PauliOps</a></li></ul><ul class="is-hidden-tablet"><li class="is-active"><a href>PauliOps</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/pauliops.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-articl
julia&gt; p = PauliOps.single_pauliop(&#39;I&#39;)
I::SinglePauliOp = 0
julia&gt; typeof(p)
Enum QuantumLegos.PauliOps.SinglePauliOp:
I = 0
X = 1
Y = 2
Z = 3
julia&gt; pauliop(&quot;IXYZ&quot;)
4-element PauliOp:
I::SinglePauliOp = 0
X::SinglePauliOp = 1
Y::SinglePauliOp = 2
Z::SinglePauliOp = 3
julia&gt; typeof(ans)
SVector{4, SinglePauliOp} (alias for StaticArraysCore.SArray{Tuple{4}, QuantumLegos.PauliOps.SinglePauliOp, 1, 4})
julia&gt; PauliOps.I * PauliOps.X
X::SinglePauliOp = 1
julia&gt; PauliOps.X * PauliOps.Z
Y::SinglePauliOp = 2
julia&gt; pauliop(&quot;IIX&quot;) .* pauliop(&quot;XIY&quot;)
3-element PauliOp:
X::SinglePauliOp = 1
I::SinglePauliOp = 0
2024-05-07 16:29:24 +09:00
Z::SinglePauliOp = 3</code></pre><h2 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></h2><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.PauliOps" href="#QuantumLegos.PauliOps"><code>QuantumLegos.PauliOps</code></a><span class="docstring-category">Module</span></header><section><div><p>Pauli operator</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/qwjyh/QuantumLegos.jl/blob/f60e0cc4b885816a38722094dca59652e350b613/src/PauliOps/PauliOps.jl#L1-L3">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.PauliOps.GeneratedPauliGroup" href="#QuantumLegos.PauliOps.GeneratedPauliGroup"><code>QuantumLegos.PauliOps.GeneratedPauliGroup</code></a><span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">struct GeneratedPauliGroup</code></pre><p>Iterator for group generated from <code>gens</code>.</p><pre><code class="nohighlight hljs">GeneratedPauliGroup(gens::AbstractVector{T}) where {T &lt;: PauliOp}</code></pre><p><strong>Examples</strong></p><pre><code class="language-julia-repl hljs">julia&gt; gens = pauliop.([&quot;IIXX&quot;, &quot;IZZI&quot;])
2024-05-07 11:47:03 +09:00
2-element Vector{StaticArraysCore.SVector{4, QuantumLegos.PauliOps.SinglePauliOp}}:
pauliop(&quot;IIXX&quot;)
pauliop(&quot;IZZI&quot;)
julia&gt; g = PauliOps.GeneratedPauliGroup(gens)
GeneratedPauliGroup{4}(StaticArraysCore.SVector{4, QuantumLegos.PauliOps.SinglePauliOp}[pauliop(&quot;IIXX&quot;), pauliop(&quot;IZZI&quot;)], IterTools.Subsets{Vector{StaticArraysCore.SVector{4, QuantumLegos.PauliOps.SinglePauliOp}}}(StaticArraysCore.SVector{4, QuantumLegos.PauliOps.SinglePauliOp}[pauliop(&quot;IIXX&quot;), pauliop(&quot;IZZI&quot;)]))
julia&gt; collect(g)
4-element Vector{StaticArraysCore.SVector{4, QuantumLegos.PauliOps.SinglePauliOp}}:
pauliop(&quot;IIII&quot;)
pauliop(&quot;IIXX&quot;)
pauliop(&quot;IZZI&quot;)
2024-05-07 16:29:24 +09:00
pauliop(&quot;IZYX&quot;)</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/qwjyh/QuantumLegos.jl/blob/f60e0cc4b885816a38722094dca59652e350b613/src/PauliOps/PauliOps.jl#L147-L171">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.PauliOps.PauliOp" href="#QuantumLegos.PauliOps.PauliOp"><code>QuantumLegos.PauliOps.PauliOp</code></a><span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">PauliOp{N}</code></pre><p>Pauli operator on multiple qubits.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/qwjyh/QuantumLegos.jl/blob/f60e0cc4b885816a38722094dca59652e350b613/src/PauliOps/PauliOps.jl#L31-L35">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.PauliOps.SinglePauliOp" href="#QuantumLegos.PauliOps.SinglePauliOp"><code>QuantumLegos.PauliOps.SinglePauliOp</code></a><span class="docstring-category">Type</span></header><section><div><pre><code class="language-julia hljs">@enum SinglePauliOp begin
2024-05-07 11:47:03 +09:00
I
X
Y
Z
2024-05-07 16:29:24 +09:00
end</code></pre><p>Pauli Operator on a single qubit.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/qwjyh/QuantumLegos.jl/blob/f60e0cc4b885816a38722094dca59652e350b613/src/PauliOps/PauliOps.jl#L14-L23">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.PauliOps.pauliop-Tuple{AbstractString}" href="#QuantumLegos.PauliOps.pauliop-Tuple{AbstractString}"><code>QuantumLegos.PauliOps.pauliop</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">pauliop(str::AbstractString)::PauliOp</code></pre><p>Convert <code>str</code> to <code>PauliOp</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/qwjyh/QuantumLegos.jl/blob/f60e0cc4b885816a38722094dca59652e350b613/src/PauliOps/PauliOps.jl#L75-L79">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.PauliOps.single_pauliop-Tuple{Char}" href="#QuantumLegos.PauliOps.single_pauliop-Tuple{Char}"><code>QuantumLegos.PauliOps.single_pauliop</code></a><span class="docstring-category">Method</span></header><section><div><pre><code class="language-julia hljs">single_pauliop(char::Char)::SinglePauliOp</code></pre><p>Convert <code>char</code> to <code>SinglePauliOp</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/qwjyh/QuantumLegos.jl/blob/f60e0cc4b885816a38722094dca59652e350b613/src/PauliOps/PauliOps.jl#L38-L42">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.PauliOps.weight" href="#QuantumLegos.PauliOps.weight"><code>QuantumLegos.PauliOps.weight</code></a><span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">weight(p::PauliOp, [init = 1])</code></pre><p>Weight of the operator <code>p</code>, i.e. non <span>$I$</span> operator.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/qwjyh/QuantumLegos.jl/blob/f60e0cc4b885816a38722094dca59652e350b613/src/PauliOps/PauliOps.jl#L96-L100">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.PauliOps.xweight" href="#QuantumLegos.PauliOps.xweight"><code>QuantumLegos.PauliOps.xweight</code></a><span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">xweight(p::PauliOp, [init = 1])</code></pre><p>Number of <span>$X, Y$</span> in <code>p</code>.</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/qwjyh/QuantumLegos.jl/blob/f60e0cc4b885816a38722094dca59652e350b613/src/PauliOps/PauliOps.jl#L113-L117">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.PauliOps.zweight" href="#QuantumLegos.PauliOps.zweight"><code>QuantumLegos.PauliOps.zweight</code></a><span class="docstring-category">Function</span></header><section><div><pre><code class="language-julia hljs">zweight(p::PauliOp, [init = 1])</code></pre><p>Number of <span>$Z, Y$</span> in <code>p</code>. a</p></div><a class="docs-sourcelink" target="_blank" href="https://github.com/qwjyh/QuantumLegos.jl/blob/f60e0cc4b885816a38722094dca59652e350b613/src/PauliOps/PauliOps.jl#L129-L133">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../">« Hom