mirror of
https://github.com/qwjyh/QuantumLegos.jl.git
synced 2024-11-23 15:31:05 +09:00
52 lines
14 KiB
HTML
52 lines
14 KiB
HTML
<!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-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="PauliOps"><a class="docs-heading-anchor" href="#PauliOps">PauliOps</a><a id="PauliOps-1"></a><a class="docs-heading-anchor-permalink" href="#PauliOps" title="Permalink"></a></h1><p>submodule</p><h2 id="Example"><a class="docs-heading-anchor" href="#Example">Example</a><a id="Example-1"></a><a class="docs-heading-anchor-permalink" href="#Example" title="Permalink"></a></h2><pre><code class="language-julia-repl hljs">julia> using QuantumLegos
|
|
|
|
julia> p = PauliOps.single_pauliop('I')
|
|
I::SinglePauliOp = 0
|
|
|
|
julia> typeof(p)
|
|
Enum QuantumLegos.PauliOps.SinglePauliOp:
|
|
I = 0
|
|
X = 1
|
|
Y = 2
|
|
Z = 3
|
|
|
|
julia> pauliop("IXYZ")
|
|
4-element PauliOp:
|
|
I::SinglePauliOp = 0
|
|
X::SinglePauliOp = 1
|
|
Y::SinglePauliOp = 2
|
|
Z::SinglePauliOp = 3
|
|
|
|
julia> typeof(ans)
|
|
SVector{4, SinglePauliOp} (alias for StaticArraysCore.SArray{Tuple{4}, QuantumLegos.PauliOps.SinglePauliOp, 1, 4})
|
|
|
|
julia> PauliOps.I * PauliOps.X
|
|
X::SinglePauliOp = 1
|
|
|
|
julia> PauliOps.X * PauliOps.Z
|
|
Y::SinglePauliOp = 2
|
|
|
|
julia> pauliop("IIX") .* pauliop("XIY")
|
|
3-element PauliOp:
|
|
X::SinglePauliOp = 1
|
|
I::SinglePauliOp = 0
|
|
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/fda016f02dad2c2600c16e88335a3733b9e1c284/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 <: PauliOp}</code></pre><p><strong>Examples</strong></p><pre><code class="language-julia-repl hljs">julia> gens = pauliop.(["IIXX", "IZZI"])
|
|
2-element Vector{StaticArraysCore.SVector{4, QuantumLegos.PauliOps.SinglePauliOp}}:
|
|
pauliop("IIXX")
|
|
pauliop("IZZI")
|
|
|
|
julia> g = PauliOps.GeneratedPauliGroup(gens)
|
|
GeneratedPauliGroup{4}(StaticArraysCore.SVector{4, QuantumLegos.PauliOps.SinglePauliOp}[pauliop("IIXX"), pauliop("IZZI")], IterTools.Subsets{Vector{StaticArraysCore.SVector{4, QuantumLegos.PauliOps.SinglePauliOp}}}(StaticArraysCore.SVector{4, QuantumLegos.PauliOps.SinglePauliOp}[pauliop("IIXX"), pauliop("IZZI")]))
|
|
|
|
julia> collect(g)
|
|
4-element Vector{StaticArraysCore.SVector{4, QuantumLegos.PauliOps.SinglePauliOp}}:
|
|
pauliop("IIII")
|
|
pauliop("IIXX")
|
|
pauliop("IZZI")
|
|
pauliop("IZYX")</code></pre></div><a class="docs-sourcelink" target="_blank" href="https://github.com/qwjyh/QuantumLegos.jl/blob/fda016f02dad2c2600c16e88335a3733b9e1c284/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/fda016f02dad2c2600c16e88335a3733b9e1c284/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
|
|
I
|
|
X
|
|
Y
|
|
Z
|
|
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/fda016f02dad2c2600c16e88335a3733b9e1c284/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/fda016f02dad2c2600c16e88335a3733b9e1c284/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/fda016f02dad2c2600c16e88335a3733b9e1c284/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/fda016f02dad2c2600c16e88335a3733b9e1c284/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/fda016f02dad2c2600c16e88335a3733b9e1c284/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/fda016f02dad2c2600c16e88335a3733b9e1c284/src/PauliOps/PauliOps.jl#L129-L133">source</a></section></article></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../">« Home</a><a class="docs-footer-nextpage" href="../checkmatrix/">Details on check matrix operations »</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>
|