Skip to content

Commit

Permalink
Notebook updates for RE (microsoft#798)
Browse files Browse the repository at this point in the history
* Notebook updates for RE.

* Remove non-needed parameter.
  • Loading branch information
msoeken authored Mar 28, 2023
1 parent 613144d commit feb4d1d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,25 @@
"results[bitwidth_index::len(bitwidths)]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Further, we can plot all items in the result object using the `plot()` function.\n",
"That function takes as optional parameter an array of labels for the plot's\n",
"legend. We are deriving the labels from the names and bitwidths, similar to how\n",
"the items were created."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"results.plot(labels=[f\"{name} ({bitwidth} bit)\" for name in names for bitwidth in bitwidths])"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@
" {\"qubitParams\": {\"name\": \"qubit_gate_ns_e3\"}},\n",
" {\"qubitParams\": {\"name\": \"qubit_gate_ns_e4\"}},\n",
" {\"qecScheme\": {\"name\": \"floquet_code\"}, \"qubitParams\": {\"name\": \"qubit_maj_ns_e4\"}},\n",
" {\"qecScheme\": {\"name\": \"floquet_code\"}, \"qubitParams\": {\"name\": \"qubit_maj_ns_e6\", \"tGateErrorRate\": 0.01}}\n",
" {\"qecScheme\": {\"name\": \"floquet_code\"}, \"qubitParams\": {\"name\": \"qubit_maj_ns_e6\"}}\n",
"]"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
"from azure.quantum.qiskit import AzureQuantumProvider\n",
"from qiskit import QuantumCircuit, transpile\n",
"from qiskit.circuit.library import RGQFTMultiplier\n",
"from qiskit.tools.monitor import job_monitor\n",
"from qiskit_qir import SUPPORTED_INSTRUCTIONS"
"from qiskit.tools.monitor import job_monitor"
]
},
{
Expand All @@ -54,7 +53,7 @@
"metadata": {},
"outputs": [],
"source": [
"def create_algorithm(bitwidth):\n",
"def create_algorithm(bitwidth, backend):\n",
" print(f\"[INFO] Create a QFT-based multiplier with bitwidth {bitwidth}\")\n",
" \n",
" # Print a warning for large bitwidths that will require some time to generate and\n",
Expand All @@ -69,7 +68,9 @@
" # it does not affect the runtime for resource estimation.\n",
" print(f\"[INFO] Decompose circuit into intrinsic quantum operations\")\n",
"\n",
" circ = transpile(circ, basis_gates=SUPPORTED_INSTRUCTIONS, optimization_level=0)\n",
" # retrieve basis gates from backend\n",
" basis_gates = backend.configuration().basis_gates\n",
" circ = transpile(circ, basis_gates=basis_gates, optimization_level=0)\n",
"\n",
" # print some statistics\n",
" print(f\"[INFO] qubit count: {circ.num_qubits}\")\n",
Expand Down Expand Up @@ -130,7 +131,7 @@
"source": [
"bitwidth = 4\n",
"\n",
"circ = create_algorithm(bitwidth)"
"circ = create_algorithm(bitwidth, backend)"
]
},
{
Expand Down

0 comments on commit feb4d1d

Please sign in to comment.