Skip to content
This repository was archived by the owner on Aug 21, 2023. It is now read-only.

Commit 55b1e23

Browse files
Fixed a code typo in 02_operators_overview.ipynb (#1231)
<!-- ⚠️ If you do not respect this template, your pull request will be closed. ⚠️ Your pull request title should be short detailed and understandable for all. ⚠️ Also, please add it in the CHANGELOG file under Unreleased section. ⚠️ If your pull request fixes an open issue, please link to the issue. ✅ I have added the tests to cover my changes. ✅ I have updated the documentation accordingly. ✅ I have read the CONTRIBUTING document. --> ### Summary Fix a typo, in cell with description "# Compose YX in front of the previous operator". The code compose XZ in front of the previous operator, while it should be YX. ### Details and comments `op.compose(XZ, qargs=[0, 2], front=True)` is changed with `op.compose(YX, qargs=[0, 2], front=True)`, and add the correct output. --------- Co-authored-by: Eric Arellano <[email protected]>
1 parent 5e0b23d commit 55b1e23

File tree

2 files changed

+13
-21
lines changed

2 files changed

+13
-21
lines changed

tutorials/circuits_advanced/01_advanced_circuits.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@
605605
"\n",
606606
"qc.append(sub_circ2.to_instruction(), [qr[2], qr[3]])\n",
607607
"\n",
608-
"print(qc.draw())\n",
608+
"qc.draw()\n",
609609
"\n",
610610
"# The following raises an error: \"QiskitError: 'Name conflict on adding parameter: phi'\"\n",
611611
"# phi2 = Parameter('phi')\n",
@@ -692,9 +692,9 @@
692692
"larger_qc.append(qc.to_instruction({p: theta}), qr[0:3])\n",
693693
"larger_qc.append(qc.to_instruction({p: phi}), qr[3:6])\n",
694694
"larger_qc.append(qc.to_instruction({p: gamma}), qr[6:9])\n",
695-
"print(larger_qc.draw())\n",
695+
"larger_qc.draw()\n",
696696
"\n",
697-
"print(larger_qc.decompose().draw())"
697+
"larger_qc.decompose().draw()"
698698
]
699699
},
700700
{

tutorials/circuits_advanced/02_operators_overview.ipynb

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,7 @@
777777
}
778778
],
779779
"source": [
780-
"# Compose XZ with an 3-qubit identity operator\n",
780+
"# Compose XZ with a 3-qubit identity operator\n",
781781
"op = Operator(np.eye(2 ** 3))\n",
782782
"XZ = Operator(Pauli('XZ'))\n",
783783
"op.compose(XZ, qargs=[0, 2])"
@@ -796,22 +796,14 @@
796796
{
797797
"data": {
798798
"text/plain": [
799-
"Operator([[ 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 1.+0.j, 0.+0.j, 0.+0.j,\n",
800-
" 0.+0.j],\n",
801-
" [ 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, -1.+0.j, 0.+0.j,\n",
802-
" 0.+0.j],\n",
803-
" [ 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 1.+0.j,\n",
804-
" 0.+0.j],\n",
805-
" [ 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j,\n",
806-
" -1.+0.j],\n",
807-
" [ 1.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j,\n",
808-
" 0.+0.j],\n",
809-
" [ 0.+0.j, -1.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j,\n",
810-
" 0.+0.j],\n",
811-
" [ 0.+0.j, 0.+0.j, 1.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j,\n",
812-
" 0.+0.j],\n",
813-
" [ 0.+0.j, 0.+0.j, 0.+0.j, -1.+0.j, 0.+0.j, 0.+0.j, 0.+0.j,\n",
814-
" 0.+0.j]],\n",
799+
"Operator([[0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.-1.j, 0.+0.j, 0.+0.j],\n",
800+
" [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.-1.j, 0.+0.j, 0.+0.j, 0.+0.j],\n",
801+
" [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.-1.j],\n",
802+
" [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.-1.j, 0.+0.j],\n",
803+
" [0.+0.j, 0.+1.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j],\n",
804+
" [0.+1.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j],\n",
805+
" [0.+0.j, 0.+0.j, 0.+0.j, 0.+1.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j],\n",
806+
" [0.+0.j, 0.+0.j, 0.+1.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j]],\n",
815807
" input_dims=(2, 2, 2), output_dims=(2, 2, 2))"
816808
]
817809
},
@@ -824,7 +816,7 @@
824816
"# Compose YX in front of the previous operator\n",
825817
"op = Operator(np.eye(2 ** 3))\n",
826818
"YX = Operator(Pauli('YX'))\n",
827-
"op.compose(XZ, qargs=[0, 2], front=True)"
819+
"op.compose(YX, qargs=[0, 2], front=True)"
828820
]
829821
},
830822
{

0 commit comments

Comments
 (0)