diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..188544e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,25 @@ +--- +name: Bug report +about: Report a bug +title: "[Bug]: " +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Environment (please complete the following information):** + - OS: [e.g. Windows10, macOS Monteley] + - Python version: [e.g. 3.8.1] + - Related module versions if applicable: [e.g. numpy=1.23.5] + +**Additional context** +Add any other context about the problem here. diff --git a/docs/source/_static/img/ghz_circuit.svg b/docs/source/_static/img/ghz_circuit.svg index f055d95..b3276f6 100644 --- a/docs/source/_static/img/ghz_circuit.svg +++ b/docs/source/_static/img/ghz_circuit.svg @@ -1,6 +1,6 @@ + width="1150.0" height="781.25" viewBox="-35.0 0 920.0 625.0"> @@ -9,97 +9,231 @@ + + + + + + - + + GHZ + + + +GHZ - - - - - - - - -LOCALCLIFFORDID:6 - - -LOCALCLIFFORDID:6 - - - - - - - - - - - - - - - - + + + + + + + + + + + +FUSE2-5 + + + +FUSE3-4 + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -0 -1 -2 -3 -4 -5 -0 -1 -2 -3 -4 -5 + + +LOCALCLIFFORDID:4 + + +LOCALCLIFFORDID:19 + + +LOCALCLIFFORDID:4 + + +LOCALCLIFFORDID:19 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +ξ=pi/4 +δ=pi/4 + + + +ξ=0.1875*pi +δ=pi/2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 \ No newline at end of file diff --git a/docs/source/_static/img/ghz_pattern.png b/docs/source/_static/img/ghz_pattern.png index 4715a96..c272ad3 100644 Binary files a/docs/source/_static/img/ghz_pattern.png and b/docs/source/_static/img/ghz_pattern.png differ diff --git a/docs/source/_static/img/ghz_pattern_updated.png b/docs/source/_static/img/ghz_pattern_updated.png new file mode 100644 index 0000000..0c1d78c Binary files /dev/null and b/docs/source/_static/img/ghz_pattern_updated.png differ diff --git a/docs/source/tutorial.rst b/docs/source/tutorial.rst index 7755c45..2b79c46 100644 --- a/docs/source/tutorial.rst +++ b/docs/source/tutorial.rst @@ -23,8 +23,8 @@ If you have not installed `graphix` yet, you can install it using `pip` as well: Generating MBQC Pattern ----------------------- -We first generate a MBQC pattern using ``graphix`` library. -First, let us import relevant modules and define function we will use: +We first generate an MBQC pattern using ``graphix`` library. +First, let us import relevant modules and define the function we will use: .. code-block:: python @@ -40,12 +40,13 @@ First, let us import relevant modules and define function we will use: circuit.h(2) circuit.cnot(0, 1) circuit.cnot(0, 2) + circuit.ry(1, np.pi/3) Then we define a circuit: .. code-block:: python - # generate the GHZ state generation pattern + # generate a slightly modified GHZ state generation pattern circuit = Circuit(3) simple_circ(circuit) pattern = circuit.transpile() @@ -62,7 +63,34 @@ Then we define a circuit: .. figure:: ./_static/img/ghz_pattern.png :scale: 85 % - :alt: 2-qubit pattern visualization + :alt: 3-qubit pattern visualization + +This circuit should generate the following state: + +.. math:: + + \frac{\sqrt{6}}{4} |000\rangle+\frac{\sqrt{2}}{4} |010\rangle- \frac{\sqrt{2}}{4} |101\rangle+\frac{\sqrt{6}}{4} |111\rangle + +Next, we update the pattern with Pauli measurements: + +.. code-block:: python + + pattern.standardize() + pattern.shift_signals() + pattern.perform_pauli_measurements() + + # plot the pattern + nodes, edges = pattern.get_graph() + g = nx.Graph() + g.add_nodes_from(nodes) + g.add_edges_from(edges) + np.random.seed(100) + nx.draw(g) + plt.show() + +.. figure:: ./_static/img/ghz_pattern_updated.png + :scale: 85 % + :alt: 3-qubit updated pattern visualization Pattern-to-circuit conversion ----------------------------- @@ -79,12 +107,12 @@ Now let us convert the pattern into a circuit using the `graphix-perceval` libra .. figure:: ./_static/img/ghz_circuit.svg :scale: 85 % - :alt: 2-qubit pattern visualization + :alt: 3-qubit pattern visualization Running pattern on Perceval simulator ------------------------------------- -By running the Perceval's computing backends, We can obtain the probability distribution of the measurement outcomes +By running Perceval's computing backends, we can obtain the probability distribution of the measurement outcomes .. code-block:: python @@ -99,8 +127,10 @@ By running the Perceval's computing backends, We can obtain the probability dist state probability - |000> 0.5 - |111> 0.5 + |000> 0.375 + |011> 0.125 + |100> 0.125 + |111> 0.375
@@ -120,13 +150,16 @@ or sampling distribution with a given number of samples: state counts - |000> 499 - |111> 501 + |000> 354 + |011> 127 + |100> 128 + |111> 391
.. note:: Note that the current implementation only supports ``SLOS`` and ``Naive`` as local Perceval processors. + ``SLOS`` has a better time complexity, while ``Naive`` has a better space complexity. See `Perceval documentation `_ for more details.