Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

18 mapping #41

Merged
merged 11 commits into from
Oct 16, 2024
20 changes: 10 additions & 10 deletions benchmarks/check_parameterized.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -16,7 +16,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 4,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -46,14 +46,14 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Time taken: 0.008273601531982422\n",
"Time taken: 0.008243083953857422\n",
"OrderedDict({'rz': 1})\n",
"Number of 2-qubit gates: 0\n",
"Number of 1-qubit gates: 1\n",
Expand Down Expand Up @@ -84,7 +84,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 6,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -120,14 +120,14 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Time taken: 0.028227567672729492\n",
"Time taken: 0.003178119659423828\n",
"OrderedDict({'cx': 2, 'rz': 2})\n",
"Number of 2-qubit gates: 2\n",
"Number of 1-qubit gates: 2\n",
Expand Down Expand Up @@ -165,7 +165,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 8,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -196,7 +196,7 @@
},
{
"cell_type": "code",
"execution_count": 35,
"execution_count": 9,
"metadata": {},
"outputs": [
{
Expand All @@ -205,7 +205,7 @@
"OrderedDict([('cx', 2), ('rz', 2)])"
]
},
"execution_count": 35,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
Expand Down
100 changes: 16 additions & 84 deletions benchmarks/custom_compile_qft.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -15,7 +15,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -42,7 +42,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 3,
"metadata": {},
"outputs": [
{
Expand All @@ -59,7 +59,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -74,7 +74,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -90,17 +90,17 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Time taken: 0.24317002296447754\n",
"OrderedDict({'rz': 117, 'cx': 84, 'rx': 53, 'h': 38, 'ry': 27})\n",
"Number of 2-qubit gates: 84\n",
"Number of 1-qubit gates: 235\n"
"Time taken: 0.24729514122009277\n",
"OrderedDict({'rz': 134, 'cx': 86, 'ry': 57, 'rx': 39, 'h': 26})\n",
"Number of 2-qubit gates: 86\n",
"Number of 1-qubit gates: 256\n"
]
}
],
Expand Down Expand Up @@ -131,7 +131,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -151,7 +151,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -166,16 +166,16 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Time taken: 0.5681369304656982\n",
"OrderedDict({'rz': 92, 'ry': 8})\n",
"Number of 2-qubit gates: 0\n",
"Time taken: 0.021783828735351562\n",
"OrderedDict({'rz': 92, 'cx': 56, 'ry': 8})\n",
"Number of 2-qubit gates: 56\n",
"Number of 1-qubit gates: 100\n"
]
}
Expand All @@ -199,74 +199,6 @@
"print(\"Number of 2-qubit gates: \", gate_counts.get(\"cx\", 0))\n",
"print(\"Number of 1-qubit gates: \", gate_counts.get(\"rz\", 0) + gate_counts.get(\"rx\", 0) + gate_counts.get(\"ry\", 0) + gate_counts.get(\"h\", 0))"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"global phase: 4.7185\n",
" ┌──────────┐ ┌────────┐ ┌──────────┐┌─────────┐ ┌──────────┐┌─────────┐ »\n",
"q_0: ─┤ Ry(-π/2) ├──┤ Rz(-π) ├─┤ Rz(-π/4) ├┤ Rz(π/4) ├─┤ Rz(-π/8) ├┤ Rz(π/8) ├─»\n",
" ├─────────┬┘ ┌┴────────┴┐└┬────────┬┘├─────────┴┐├─────────┬┘├─────────┴┐»\n",
"q_1: ─┤ Rz(π/4) ├──┤ Ry(-π/2) ├─┤ Rz(-π) ├─┤ Rz(-π/4) ├┤ Rz(π/4) ├─┤ Rz(-π/8) ├»\n",
" ├─────────┤ ├─────────┬┘┌┴────────┴┐└┬────────┬┘├─────────┴┐├─────────┬┘»\n",
"q_2: ─┤ Rz(π/8) ├──┤ Rz(π/4) ├─┤ Ry(-π/2) ├─┤ Rz(-π) ├─┤ Rz(-π/4) ├┤ Rz(π/4) ├─»\n",
" ├─────────┴┐ ├─────────┤ ├─────────┬┘┌┴────────┴┐└┬────────┬┘├─────────┴┐»\n",
"q_3: ─┤ Rz(π/16) ├─┤ Rz(π/8) ├─┤ Rz(π/4) ├─┤ Ry(-π/2) ├─┤ Rz(-π) ├─┤ Rz(-π/4) ├»\n",
" ├──────────┤ ├─────────┴┐├─────────┤ ├─────────┬┘┌┴────────┴┐└┬────────┬┘»\n",
"q_4: ─┤ Rz(π/32) ├─┤ Rz(π/16) ├┤ Rz(π/8) ├─┤ Rz(π/4) ├─┤ Ry(-π/2) ├─┤ Rz(-π) ├─»\n",
" ├──────────┤ ├──────────┤├─────────┴┐├─────────┤ ├─────────┬┘┌┴────────┴┐»\n",
"q_5: ─┤ Rz(π/64) ├─┤ Rz(π/32) ├┤ Rz(π/16) ├┤ Rz(π/8) ├─┤ Rz(π/4) ├─┤ Ry(-π/2) ├»\n",
" ┌┴──────────┤ ├──────────┤├──────────┤├─────────┴┐├─────────┤ ├─────────┬┘»\n",
"q_6: ┤ Rz(π/128) ├─┤ Rz(π/64) ├┤ Rz(π/32) ├┤ Rz(π/16) ├┤ Rz(π/8) ├─┤ Rz(π/4) ├─»\n",
" ├───────────┤┌┴──────────┤├──────────┤├──────────┤├─────────┴┐├─────────┤ »\n",
"q_7: ┤ Rz(π/256) ├┤ Rz(π/128) ├┤ Rz(π/64) ├┤ Rz(π/32) ├┤ Rz(π/16) ├┤ Rz(π/8) ├─»\n",
" └───────────┘└───────────┘└──────────┘└──────────┘└──────────┘└─────────┘ »\n",
"« ┌───────────┐ ┌──────────┐┌───────────┐ ┌──────────┐┌───────────┐»\n",
"«q_0: ┤ Rz(-π/16) ├─┤ Rz(π/16) ├┤ Rz(-π/32) ├─┤ Rz(π/32) ├┤ Rz(-π/64) ├»\n",
"« └┬─────────┬┘┌┴──────────┤└┬──────────┤┌┴──────────┤└┬──────────┤»\n",
"«q_1: ─┤ Rz(π/8) ├─┤ Rz(-π/16) ├─┤ Rz(π/16) ├┤ Rz(-π/32) ├─┤ Rz(π/32) ├»\n",
"« ├─────────┴┐└┬─────────┬┘┌┴──────────┤└┬──────────┤┌┴──────────┤»\n",
"«q_2: ─┤ Rz(-π/8) ├─┤ Rz(π/8) ├─┤ Rz(-π/16) ├─┤ Rz(π/16) ├┤ Rz(-π/32) ├»\n",
"« ├─────────┬┘ ├─────────┴┐└┬─────────┬┘┌┴──────────┤└┬──────────┤»\n",
"«q_3: ─┤ Rz(π/4) ├──┤ Rz(-π/8) ├─┤ Rz(π/8) ├─┤ Rz(-π/16) ├─┤ Rz(π/16) ├»\n",
"« ├─────────┴┐ ├─────────┬┘ ├─────────┴┐└┬─────────┬┘┌┴──────────┤»\n",
"«q_4: ─┤ Rz(-π/4) ├─┤ Rz(π/4) ├──┤ Rz(-π/8) ├─┤ Rz(π/8) ├─┤ Rz(-π/16) ├»\n",
"« └┬────────┬┘ ├─────────┴┐ ├─────────┬┘ ├─────────┴┐└┬─────────┬┘»\n",
"«q_5: ──┤ Rz(-π) ├──┤ Rz(-π/4) ├─┤ Rz(π/4) ├──┤ Rz(-π/8) ├─┤ Rz(π/8) ├─»\n",
"« ┌┴────────┴┐ └┬────────┬┘ ├─────────┴┐ ├─────────┬┘ └─────────┘ »\n",
"«q_6: ─┤ Ry(-π/2) ├──┤ Rz(-π) ├──┤ Rz(-π/4) ├─┤ Rz(π/4) ├──────────────»\n",
"« ├─────────┬┘ ┌┴────────┴┐ └┬────────┬┘ └─────────┘ »\n",
"«q_7: ─┤ Rz(π/4) ├──┤ Ry(-π/2) ├──┤ Rz(-π) ├───────────────────────────»\n",
"« └─────────┘ └──────────┘ └────────┘ »\n",
"« ┌──────────┐┌────────────┐┌───────────┐ ┌────────────┐┌───────────┐\n",
"«q_0: ─┤ Rz(π/64) ├┤ Rz(-π/128) ├┤ Rz(π/128) ├─┤ Rz(-π/256) ├┤ Rz(π/256) ├\n",
"« ┌┴──────────┤└┬──────────┬┘├───────────┴┐├───────────┬┘└───────────┘\n",
"«q_1: ┤ Rz(-π/64) ├─┤ Rz(π/64) ├─┤ Rz(-π/128) ├┤ Rz(π/128) ├──────────────\n",
"« └┬──────────┤┌┴──────────┤ └┬──────────┬┘└───────────┘ \n",
"«q_2: ─┤ Rz(π/32) ├┤ Rz(-π/64) ├──┤ Rz(π/64) ├────────────────────────────\n",
"« ┌┴──────────┤└┬──────────┤ └──────────┘ \n",
"«q_3: ┤ Rz(-π/32) ├─┤ Rz(π/32) ├──────────────────────────────────────────\n",
"« └┬──────────┤ └──────────┘ \n",
"«q_4: ─┤ Rz(π/16) ├───────────────────────────────────────────────────────\n",
"« └──────────┘ \n",
"«q_5: ────────────────────────────────────────────────────────────────────\n",
"« \n",
"«q_6: ────────────────────────────────────────────────────────────────────\n",
"« \n",
"«q_7: ────────────────────────────────────────────────────────────────────\n",
"« \n"
]
}
],
"source": [
"print(ucc_qc)"
]
}
],
"metadata": {
Expand Down
Loading