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 @@ \ 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