525 lines
120 KiB
Plaintext
525 lines
120 KiB
Plaintext
{
|
||
"cells": [
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "aea62c4c-1e42-4472-9f1d-e52783e81fc6",
|
||
"metadata": {},
|
||
"source": [
|
||
"# Circuit library"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "14baab34-71a4-4d3c-bdc1-083bb2c32065",
|
||
"metadata": {
|
||
"tags": [
|
||
"version-info"
|
||
]
|
||
},
|
||
"source": [
|
||
"<details>\n",
|
||
"<summary><b>Package versions</b></summary>\n",
|
||
"\n",
|
||
"The code on this page was developed using the following requirements.\n",
|
||
"We recommend using these versions or newer.\n",
|
||
"\n",
|
||
"```\n",
|
||
"qiskit[all]~=1.2.4\n",
|
||
"qiskit-aer~=0.15.1\n",
|
||
"qiskit-ibm-runtime~=0.31.0\n",
|
||
"qiskit-serverless~=0.17.1\n",
|
||
"qiskit-ibm-catalog~=0.1\n",
|
||
"```\n",
|
||
"</details>"
|
||
]
|
||
},
|
||
{
|
||
"attachments": {},
|
||
"cell_type": "markdown",
|
||
"id": "6f257ff9-15c4-48d8-9503-7f0ab16a91b2",
|
||
"metadata": {},
|
||
"source": [
|
||
"The Qiskit SDK includes a library of popular circuits to use as building blocks in your own programs. Using pre-defined circuits saves time researching, writing code, and debugging. The library includes popular circuits in quantum computing, circuits that are difficult to simulate classically, and circuits useful for quantum hardware benchmarking.\n",
|
||
"\n",
|
||
"This page lists the different circuit categories the library provides. For a full list of circuits, see the [circuit library API documentation](/api/qiskit/circuit_library)."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "0b473350",
|
||
"metadata": {},
|
||
"source": [
|
||
"## Standard gates\n",
|
||
"\n",
|
||
"The circuit library also includes standard quantum gates. Some are more fundamental gates (such as the `UGate`), and others are multi-qubit gates that usually need building from single- and two-qubit gates. To add imported gates to your circuit, use the `append` method; the first argument is the gate, and the next argument is a list of qubits to apply the gate to.\n",
|
||
"\n",
|
||
"For example, the following code cell creates a circuit with a Hadamard gate and a multi-controlled-X gate."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 1,
|
||
"id": "a846a845-7ac5-4c92-b124-d2b90a773ba2",
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"image/svg+xml": [
|
||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg width=\"173.79pt\" height=\"218.36pt\" version=\"1.1\" viewBox=\"0 0 173.79 218.36\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"><defs><style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style></defs><path d=\"m0 218.36h173.79v-218.36h-173.79z\" fill=\"#ffffff\"/><path d=\"m64.609 44.283h97.343\" clip-path=\"url(#16ae6c5277f)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m64.609 90.637h97.343\" clip-path=\"url(#16ae6c5277f)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m64.609 136.99h97.343\" clip-path=\"url(#16ae6c5277f)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m64.609 183.35h97.343\" clip-path=\"url(#16ae6c5277f)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m59.974 21.106h-1158.8v231.77h1158.8z\" clip-path=\"url(#16ae6c5277f)\" fill=\"#ffffff\" stroke=\"#ffffff\" stroke-width=\"1.5\"/><path d=\"m135.99 183.35v-139.06\" clip-path=\"url(#16ae6c5277f)\" fill=\"none\" stroke=\"#002d9c\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m74.575 59.348h30.13v-30.13h-30.13z\" clip-path=\"url(#16ae6c5277f)\" fill=\"#fa4d56\" stroke=\"#fa4d56\" stroke-width=\"1.5\"/><path d=\"m135.99 48.803c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958 0-1.1986-0.4762-2.3482-1.3237-3.1958-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237-1.1986 0-2.3482 0.4762-3.1958 1.3237s-1.3237 1.9972-1.3237 3.1958c0 1.1986 0.4762 2.3482 1.3237 3.1958s1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#16ae6c5277f)\" fill=\"#002d9c\" stroke=\"#002d9c\" stroke-width=\"1.5\"/><path d=\"m135.99 95.157c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958s-0.4762-2.3482-1.3237-3.1958c-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237-1.1986 0-2.3482 0.4762-3.1958 1.3237-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958s0.4762 2.3482 1.3237 3.1958c0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#16ae6c5277f)\" fill=\"#002d9c\" stroke=\"#002d9c\" stroke-width=\"1.5\"/><path d=\"m135.99 141.51c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958 0-1.1986-0.4762-2.3482-1.3237-3.1958-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237-1.1986 0-2.3482 0.4762-3.1958 1.3237-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958 0 1.1986 0.4762 2.3482 1.3237 3.1958s1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#16ae6c5277f)\" fill=\"#002d9c\" stroke=\"#002d9c\" stroke-width=\"1.5\"/><path d=\"m135.99 193.89c2.7967 0 5.4792-1.1111 7.4568-3.0887 1.9776-1.9776 3.0887-4.6601 3.0887-7.4568 0-2.7967-1.1111-5.4792-3.0887-7.4568-1.9776-1.9776-4.6601-3.0887-7.4568-3.0887-2.7967 0-5.4792 1.1111-7.4568 3.0887-1.9776 1.9776-3.0887 4.6601-3.0887 7.4568 0 2.7967 1.1111 5.4792 3.0887 7.4568 1.9776 1.9776 4.6601 3.0887 7.4568 3.0887z\" clip-path=\"url(#16ae6c5277f)\" fill=\"#002d9c\" stroke=\"#002d9c\" stroke-width=\"2\"/><path d=\"m135.99 189.37v-12.052\" clip-path=\"url(#16ae6c5277f)\" fill=\"none\" stroke=\"#ffffff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m129.97 183.35h12.052\" clip-path=\"url(#16ae6c5277f)\" fill=\"none\" stroke=\"#ffffff\" stroke-linecap=\"square\" stroke-width=\"2\"/><g clip-path=\"url(#16ae6c5277f)\"><g transform=\"translate(37.301 48.734) scale(.1625 -.1625)\"><defs><path id=\"DejaVuSans-Oblique-71\" transform=\"scale(.015625)\" d=\"m2669 525q-231-303-546-460-314-156-695-156-531 0-833 358-301 358-301 986 0 506 186 978t533 847q225 244 517 375t614 131q387 0 637-153t363-462l100 525h578l-934-4813h-579l360 1844zm-1778 813q0-463 193-705 194-242 560-242 544 0 928 520t384 1264q0 450-199 689-198 239-569 239-272 0-504-127-231-126-403-370-181-256-286-600-104-343-104-668z\"/><path id=\"DejaVuSans-30\" transform=\"scale(.015625)\" d=\"m2034 4250q-487 0-733-480-245-479-245-1442 0-959 245-1439 246-480 733-480 491 0 736 480 246 480 246 1439 0 963-246 1442-245 480-736 480zm0 500q785 0 1199-621 414-620 414-1801 0-1178-414-1799-414-620-1199-620-784 0-1198 620-414 621-414 1799 0 1181 414 1801 414 621 1198 621z\"/></defs><use xlink:href=\"#DejaVuSans-Oblique-71\"/><use transform=\"translate(63.477 -16.406) scale(.7)\" xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#16ae6c5277f)\"><g transform=\"translate(37.301 95.088) scale(.1625 -.1625)\"><defs><path id=\"DejaVuSans-31\" transform=\"scale(.015625)\" d=\"m794 531h1031v3560l-1122-225v575l1116 225h631v-4135h1031v-531h-2687v531z\"/></defs><use xlink:href=\"#DejaVuSans-Oblique-71\"/><use transform=\"translate(63.477 -16.406) scale(.7)\" xlink:href=\"#DejaVuSans-31\"/></g></g><g clip-path=\"url(#16ae6c5277f)\"><g transform=\"translate(37.301 141.44) scale(.1625 -.1625)\"><defs><path id=\"DejaVuSans-32\" transform=\"scale(.015625)\" d=\"m1228 531h2203v-531h-2962v531q359 372 979 998 621 627 780 809 303 340 423 576 121 236 121 464 0 372-261 606-261 235-680 235-297 0-627-103-329-103-704-313v638q381 153 712 231 332 78 607 78 725 0 1156-363 431-362 431-968 0-288-108-546-107-257-392-607-78-91-497-524-418-433-1181-1211z\"/></defs><use xlink:href=\"#DejaVuSans-Oblique-71\"/><use transform=\"translate(63.477 -16.406) scale(.7)\" xlink:href=\"#DejaVuSans-32\"/></g></g><g clip-path=\"url(#16ae6c5277f)\"><g transform=\"translate(37.301 187.8) scale(.1625 -.1625)\"><defs><path id=\"DejaVuSans-33\" transform=\"scale(.015625)\" d=\"m2597 2516q453-97 707-404 255-306 255-756 0-690-475-1069-475-378-1350-378-293 0-604 58t-642 174v609q262-153 574-231 313-78 654-78 593 0 904 234t311 681q0 413-289 645-289 233-804 233h-544v519h569q465 0 712 186t247 536q0 359-255 551-254 193-729 193-260 0-557-57-297-56-653-174v562q360 100 674 150t592 50q719 0 1137-327 419-326 419-882 0-388-222-655t-631-370z\"/></defs><use xlink:href=\"#DejaVuSans-Oblique-71\"/><use transform=\"translate(63.477 -16.406) scale(.7)\" xlink:href=\"#DejaVuSans-33\"/></g></g><g clip-path=\"url(#16ae6c5277f)\"><g transform=\"translate(84.752 47.87) scale(.13 -.13)\"><defs><path id=\"DejaVuSans-48\" transform=\"scale(.015625)\" d=\"m628 4666h631v-1913h2294v1913h631v-4666h-631v2222h-2294v-2222h-631v4666z\"/></defs><use xlink:href=\"#DejaVuSans-48\"/></g></g><defs><clipPath id=\"16ae6c5277f\"><rect x=\"7.2\" y=\"7.2\" width=\"159.39\" height=\"203.96\"/></clipPath></defs></svg>"
|
||
],
|
||
"text/plain": [
|
||
"<Figure size 287.496x367.889 with 1 Axes>"
|
||
]
|
||
},
|
||
"execution_count": 1,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"from qiskit import QuantumCircuit\n",
|
||
"from qiskit.circuit.library import HGate, MCXGate\n",
|
||
"\n",
|
||
"mcx_gate = MCXGate(3)\n",
|
||
"hadamard_gate = HGate()\n",
|
||
"\n",
|
||
"qc = QuantumCircuit(4)\n",
|
||
"qc.append(hadamard_gate, [0])\n",
|
||
"qc.append(mcx_gate, [0, 1, 2, 3])\n",
|
||
"qc.draw(\"mpl\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "e5066595",
|
||
"metadata": {},
|
||
"source": [
|
||
"See [Standard gates](/api/qiskit/circuit_library#standard-gates) in the circuit library API documentation.\n",
|
||
"\n",
|
||
"<CodeAssistantAdmonition\n",
|
||
" tagLine=\"Not sure what your gate's called? Try asking Qiskit Code Assistant.\"\n",
|
||
" prompts={[\n",
|
||
" \"# Import a Hadamard gate from the circuit library\",\n",
|
||
" \"# Import a multi-controlled-X gate\",\n",
|
||
" \"# Add a controlled-phase gate to the circuit 'qc'\"\n",
|
||
" ]}\n",
|
||
"/>"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "f1d7c8c9-1b4d-45e1-9cd5-c5d76c2e25ab",
|
||
"metadata": {},
|
||
"source": [
|
||
"## N-local circuits\n",
|
||
"\n",
|
||
"These circuits alternate layers of single-qubit rotation gates with layers of multi-qubit entangling gates.\n",
|
||
"\n",
|
||
"This family of circuits is popular in variational quantum algorithms because they can produce a wide range of quantum states. Variational algorithms adjust the gate parameters to find states that have certain properties (such as states that represent a good solution to an optimization problem). For this purpose, many circuits in the library are **parameterized**, which means you can define them without fixed values.\n",
|
||
"\n",
|
||
"The following code cell imports a `TwoLocal` circuit, in which the entangling gates are two-qubit gates. This circuit interleaves blocks of parameterized single-qubit gates, followed by entangling blocks of two-qubit gates. The following code creates a three-qubit circuit, with single-qubit RX-gates and two-qubit CZ-gates."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 2,
|
||
"id": "3ccaeb1b-03c6-4dfa-9000-e48db2516303",
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"image/svg+xml": [
|
||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg width=\"683.68pt\" height=\"172pt\" version=\"1.1\" viewBox=\"0 0 683.68 172\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"><defs><style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style></defs><path d=\"m0 172h683.68v-172h-683.68z\" fill=\"#ffffff\"/><path d=\"m64.609 44.283h607.24\" clip-path=\"url(#38530a8beab)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m64.609 90.637h607.24\" clip-path=\"url(#38530a8beab)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m64.609 136.99h607.24\" clip-path=\"url(#38530a8beab)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m59.974 21.106h-1158.8v185.42h1158.8z\" clip-path=\"url(#38530a8beab)\" fill=\"#ffffff\" stroke=\"#ffffff\" stroke-width=\"1.5\"/><path d=\"m135.99 90.637v-46.354\" clip-path=\"url(#38530a8beab)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m182.35 136.99v-92.708\" clip-path=\"url(#38530a8beab)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m228.7 136.99v-46.354\" clip-path=\"url(#38530a8beab)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m321.41 90.637v-46.354\" clip-path=\"url(#38530a8beab)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m367.76 136.99v-92.708\" clip-path=\"url(#38530a8beab)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m414.12 136.99v-46.354\" clip-path=\"url(#38530a8beab)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m506.83 90.637v-46.354\" clip-path=\"url(#38530a8beab)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m553.18 136.99v-92.708\" clip-path=\"url(#38530a8beab)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m599.53 136.99v-46.354\" clip-path=\"url(#38530a8beab)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m135.99 90.637v-46.354\" clip-path=\"url(#38530a8beab)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m182.35 136.99v-92.708\" clip-path=\"url(#38530a8beab)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m228.7 136.99v-46.354\" clip-path=\"url(#38530a8beab)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m321.41 90.637v-46.354\" clip-path=\"url(#38530a8beab)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m367.76 136.99v-92.708\" clip-path=\"url(#38530a8beab)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m414.12 136.99v-46.354\" clip-path=\"url(#38530a8beab)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m506.83 90.637v-46.354\" clip-path=\"url(#38530a8beab)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m553.18 136.99v-92.708\" clip-path=\"url(#38530a8beab)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m599.53 136.99v-46.354\" clip-path=\"url(#38530a8beab)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m74.575 59.348h30.13v-30.13h-30.13z\" clip-path=\"url(#38530a8beab)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m74.575 105.7h30.13v-30.13h-30.13z\" clip-path=\"url(#38530a8beab)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m74.575 152.06h30.13v-30.13h-30.13z\" clip-path=\"url(#38530a8beab)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m135.99 48.803c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958 0-1.1986-0.4762-2.3482-1.3237-3.1958-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237-1.1986 0-2.3482 0.4762-3.1958 1.3237s-1.3237 1.9972-1.3237 3.1958c0 1.1986 0.4762 2.3482 1.3237 3.1958s1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#38530a8beab)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m135.99 95.157c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958s-0.4762-2.3482-1.3237-3.1958c-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237-1.1986 0-2.3482 0.4762-3.1958 1.3237-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958s0.4762 2.3482 1.3237 3.1958c0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#38530a8beab)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m182.35 48.803c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958 0-1.1986-0.4762-2.3482-1.3237-3.1958-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237s-2.3482 0.4762-3.1958 1.3237c-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958 0 1.1986 0.4762 2.3482 1.3237 3.1958 0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#38530a8beab)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m182.35 141.51c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958 0-1.1986-0.4762-2.3482-1.3237-3.1958-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237s-2.3482 0.4762-3.1958 1.3237c-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958 0 1.1986 0.4762 2.3482 1.3237 3.1958 0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#38530a8beab)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m213.64 59.348h30.13v-30.13h-30.13z\" clip-path=\"url(#38530a8beab)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m228.7 95.157c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958s-0.4762-2.3482-1.3237-3.1958c-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237-1.1986 0-2.3482 0.4762-3.1958 1.3237-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958s0.4762 2.3482 1.3237 3.1958c0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#38530a8beab)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m228.7 141.51c1.1986 0 2.3482-0.4762 3.1958-1.3237s1.3237-1.9972 1.3237-3.1958c0-1.1986-0.4762-2.3482-1.3237-3.1958-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237-1.1986 0-2.3482 0.4762-3.1958 1.3237-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958 0 1.1986 0.4762 2.3482 1.3237 3.1958 0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#38530a8beab)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m259.99 105.7h30.13v-30.13h-30.13z\" clip-path=\"url(#38530a8beab)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m259.99 152.06h30.13v-30.13h-30.13z\" clip-path=\"url(#38530a8beab)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m321.41 48.803c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958 0-1.1986-0.4762-2.3482-1.3237-3.1958-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237s-2.3482 0.4762-3.1958 1.3237c-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958 0 1.1986 0.4762 2.3482 1.3237 3.1958 0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#38530a8beab)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m321.41 95.157c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958s-0.4762-2.3482-1.3237-3.1958c-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237s-2.3482 0.4762-3.1958 1.3237c-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958s0.4762 2.3482 1.3237 3.1958c0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#38530a8beab)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m367.76 48.803c1.1986 0 2.3482-0.4762 3.1958-1.3237s1.3237-1.9972 1.3237-3.1958c0-1.1986-0.4762-2.3482-1.3237-3.1958s-1.9972-1.3237-3.1958-1.3237c-1.1986 0-2.3482 0.4762-3.1958 1.3237-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958 0 1.1986 0.4762 2.3482 1.3237 3.1958 0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#38530a8beab)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m367.76 141.51c1.1986 0 2.3482-0.4762 3.1958-1.3237s1.3237-1.9972 1.3237-3.1958c0-1.1986-0.4762-2.3482-1.3237-3.1958-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237-1.1986 0-2.3482 0.4762-3.1958 1.3237-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958 0 1.1986 0.4762 2.3482 1.3237 3.1958 0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#38530a8beab)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m399.05 59.348h30.13v-30.13h-30.13z\" clip-path=\"url(#38530a8beab)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m414.12 95.157c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958s-0.4762-2.3482-1.3237-3.1958c-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237-1.1986 0-2.3482 0.4762-3.1958 1.3237-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958s0.4762 2.3482 1.3237 3.1958c0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#38530a8beab)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m414.12 141.51c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958 0-1.1986-0.4762-2.3482-1.3237-3.1958-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237-1.1986 0-2.3482 0.4762-3.1958 1.3237-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958 0 1.1986 0.4762 2.3482 1.3237 3.1958s1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#38530a8beab)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m445.41 105.7h30.13v-30.13h-30.13z\" clip-path=\"url(#38530a8beab)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m445.41 152.06h30.13v-30.13h-30.13z\" clip-path=\"url(#38530a8beab)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m506.83 48.803c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958 0-1.1986-0.4762-2.3482-1.3237-3.1958-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237-1.1986 0-2.3482 0.4762-3.1958 1.3237s-1.3237 1.9972-1.3237 3.1958c0 1.1986 0.4762 2.3482 1.3237 3.1958s1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#38530a8beab)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m506.83 95.157c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958s-0.4762-2.3482-1.3237-3.1958c-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237-1.1986 0-2.3482 0.4762-3.1958 1.3237-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958s0.4762 2.3482 1.3237 3.1958c0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#38530a8beab)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m553.18 48.803c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958 0-1.1986-0.4762-2.3482-1.3237-3.1958-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237s-2.3482 0.4762-3.1958 1.3237c-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958 0 1.1986 0.4762 2.3482 1.3237 3.1958 0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#38530a8beab)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m553.18 141.51c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958 0-1.1986-0.4762-2.3482-1.3237-3.1958-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237s-2.3482 0.4762-3.1958 1.3237c-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958 0 1.1986 0.4762 2.3482 1.3237 3.1958 0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#38530a8beab)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m584.47 59.348h30.13v-30.13h-30.13z\" clip-path=\"url(#38530a8beab)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m599.53 95.157c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958s-0.4762-2.3482-1.3237-3.1958c-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237-1.1986 0-2.3482 0.4762-3.1958 1.3237-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958s0.4762 2.3482 1.3237 3.1958c0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#38530a8beab)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m599.53 141.51c1.1986 0 2.3482-0.4762 3.1958-1.3237s1.3237-1.9972 1.3237-3.1958c0-1.1986-0.4762-2.3482-1.3237-3.1958-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237-1.1986 0-2.3482 0.4762-3.1958 1.3237-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958 0 1.1986 0.4762 2.3482 1.3237 3.1958 0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#38530a8beab)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m630.82 105.7h30.13v-30.13h-30.13z\" clip-path=\"url(#38530a8beab)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m630.82 152.06h30.13v-30.13h-30.13z\" clip-path=\"url(#38530a8beab)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><g clip-path=\"url(#38530a8beab)\"><g transform=\"translate(37.301 48.734) scale(.1625 -.1625)\"><defs><path id=\"DejaVuSans-Oblique-71\" transform=\"scale(.015625)\" d=\"m2669 525q-231-303-546-460-314-156-695-156-531 0-833 358-301 358-301 986 0 506 186 978t533 847q225 244 517 375t614 131q387 0 637-153t363-462l100 525h578l-934-4813h-579l360 1844zm-1778 813q0-463 193-705 194-242 560-242 544 0 928 520t384 1264q0 450-199 689-198 239-569 239-272 0-504-127-231-126-403-370-181-256-286-600-104-343-104-668z\"/><path id=\"DejaVuSans-30\" transform=\"scale(.015625)\" d=\"m2034 4250q-487 0-733-480-245-479-245-1442 0-959 245-1439 246-480 733-480 491 0 736 480 246 480 246 1439 0 963-246 1442-245 480-736 480zm0 500q785 0 1199-621 414-620 414-1801 0-1178-414-1799-414-620-1199-620-784 0-1198 620-414 621-414 1799 0 1181 414 1801 414 621 1198 621z\"/></defs><use xlink:href=\"#DejaVuSans-Oblique-71\"/><use transform=\"translate(63.477 -16.406) scale(.7)\" xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#38530a8beab)\"><g transform=\"translate(37.301 95.088) scale(.1625 -.1625)\"><defs><path id=\"DejaVuSans-31\" transform=\"scale(.015625)\" d=\"m794 531h1031v3560l-1122-225v575l1116 225h631v-4135h1031v-531h-2687v531z\"/></defs><use xlink:href=\"#DejaVuSans-Oblique-71\"/><use transform=\"translate(63.477 -16.406) scale(.7)\" xlink:href=\"#DejaVuSans-31\"/></g></g><g clip-path=\"url(#38530a8beab)\"><g transform=\"translate(37.301 141.44) scale(.1625 -.1625)\"><defs><path id=\"DejaVuSans-32\" transform=\"scale(.015625)\" d=\"m1228 531h2203v-531h-2962v531q359 372 979 998 621 627 780 809 303 340 423 576 121 236 121 464 0 372-261 606-261 235-680 235-297 0-627-103-329-103-704-313v638q381 153 712 231 332 78 607 78 725 0 1156-363 431-362 431-968 0-288-108-546-107-257-392-607-78-91-497-524-418-433-1181-1211z\"/></defs><use xlink:href=\"#DejaVuSans-Oblique-71\"/><use transform=\"translate(63.477 -16.406) scale(.7)\" xlink:href=\"#DejaVuSans-32\"/></g></g><g clip-path=\"url(#38530a8beab)\"><g transform=\"translate(81.527 55.53) scale(.08 -.08)\" fill=\"#ffffff\"><defs><path id=\"DejaVuSans-3b8\" transform=\"scale(.015625)\" d=\"m2953 2219h-1990q46-935 262-1331 269-488 734-488 469 0 729 491 228 431 265 1328zm-9 531q-88 888-256 1200-269 494-729 494-478 0-731-488-200-393-259-1206h1975zm-985 2163q750 0 1179-663 428-659 428-1828 0-1166-428-1828-429-666-1179-666-753 0-1178 666-428 662-428 1828 0 1169 428 1828 425 663 1178 663z\"/><path id=\"DejaVuSans-5b\" transform=\"scale(.015625)\" d=\"m550 4863h1325v-447h-750v-4813h750v-447h-1325v5707z\"/><path id=\"DejaVuSans-5d\" transform=\"scale(.015625)\" d=\"m1947 4863v-5707h-1325v447h747v4813h-747v447h1325z\"/></defs><use xlink:href=\"#DejaVuSans-3b8\"/><use x=\"61.181641\" xlink:href=\"#DejaVuSans-5b\"/><use x=\"100.195312\" xlink:href=\"#DejaVuSans-30\"/><use x=\"163.818359\" xlink:href=\"#DejaVuSans-5d\"/></g></g><g clip-path=\"url(#38530a8beab)\"><g transform=\"translate(81.71 43.351) scale(.13 -.13)\" fill=\"#ffffff\"><defs><path id=\"DejaVuSans-52\" transform=\"scale(.015625)\" d=\"m2841 2188q203-69 395-294t386-619l641-1275h-679l-596 1197q-232 469-449 622t-592 153h-688v-1972h-631v4666h1425q800 0 1194-335 394-334 394-1009 0-441-205-732-205-290-595-402zm-1582 1959v-1656h794q456 0 689 211t233 620-233 617-689 208h-794z\"/><path id=\"DejaVuSans-58\" transform=\"scale(.015625)\" d=\"m403 4666h678l1160-1735 1165 1735h678l-1500-2241 1600-2425h-678l-1312 1984-1322-1984h-681l1665 2491-1453 2175z\"/></defs><use transform=\"translate(0 .09375)\" xlink:href=\"#DejaVuSans-52\"/><use transform=\"translate(70.439 -16.312) scale(.7)\" xlink:href=\"#DejaVuSans-58\"/></g></g><g clip-path=\"url(#38530a8beab)\"><g transform=\"translate(81.527 101.88) scale(.08 -.08)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-3b8\"/><use x=\"61.181641\" xlink:href=\"#DejaVuSans-5b\"/><use x=\"100.195312\" xlink:href=\"#DejaVuSans-31\"/><use x=\"163.818359\" xlink:href=\"#DejaVuSans-5d\"/></g></g><g clip-path=\"url(#38530a8beab)\"><g transform=\"translate(81.71 89.705) scale(.13 -.13)\" fill=\"#ffffff\"><use transform=\"translate(0 .09375)\" xlink:href=\"#DejaVuSans-52\"/><use transform=\"translate(70.439 -16.312) scale(.7)\" xlink:href=\"#DejaVuSans-58\"/></g></g><g clip-path=\"url(#38530a8beab)\"><g transform=\"translate(81.527 148.24) scale(.08 -.08)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-3b8\"/><use x=\"61.181641\" xlink:href=\"#DejaVuSans-5b\"/><use x=\"100.195312\" xlink:href=\"#DejaVuSans-32\"/><use x=\"163.818359\" xlink:href=\"#DejaVuSans-5d\"/></g></g><g clip-path=\"url(#38530a8beab)\"><g transform=\"translate(81.71 136.06) scale(.13 -.13)\" fill=\"#ffffff\"><use transform=\"translate(0 .09375)\" xlink:href=\"#DejaVuSans-52\"/><use transform=\"translate(70.439 -16.312) scale(.7)\" xlink:href=\"#DejaVuSans-58\"/></g></g><g clip-path=\"url(#38530a8beab)\"><g transform=\"translate(220.59 55.53) scale(.08 -.08)\" fill=\"#ffffff\"><defs><path id=\"DejaVuSans-33\" transform=\"scale(.015625)\" d=\"m2597 2516q453-97 707-404 255-306 255-756 0-690-475-1069-475-378-1350-378-293 0-604 58t-642 174v609q262-153 574-231 313-78 654-78 593 0 904 234t311 681q0 413-289 645-289 233-804 233h-544v519h569q465 0 712 186t247 536q0 359-255 551-254 193-729 193-260 0-557-57-297-56-653-174v562q360 100 674 150t592 50q719 0 1137-327 419-326 419-882 0-388-222-655t-631-370z\"/></defs><use xlink:href=\"#DejaVuSans-3b8\"/><use x=\"61.181641\" xlink:href=\"#DejaVuSans-5b\"/><use x=\"100.195312\" xlink:href=\"#DejaVuSans-33\"/><use x=\"163.818359\" xlink:href=\"#DejaVuSans-5d\"/></g></g><g clip-path=\"url(#38530a8beab)\"><g transform=\"translate(220.77 43.351) scale(.13 -.13)\" fill=\"#ffffff\"><use transform=\"translate(0 .09375)\" xlink:href=\"#DejaVuSans-52\"/><use transform=\"translate(70.439 -16.312) scale(.7)\" xlink:href=\"#DejaVuSans-58\"/></g></g><g clip-path=\"url(#38530a8beab)\"><g transform=\"translate(266.94 101.88) scale(.08 -.08)\" fill=\"#ffffff\"><defs><path id=\"DejaVuSans-34\" transform=\"scale(.015625)\" d=\"m2419 4116-1594-2491h1594v2491zm-166 550h794v-3041h666v-525h-666v-1100h-628v1100h-2106v609l1940 2957z\"/></defs><use xlink:href=\"#DejaVuSans-3b8\"/><use x=\"61.181641\" xlink:href=\"#DejaVuSans-5b\"/><use x=\"100.195312\" xlink:href=\"#DejaVuSans-34\"/><use x=\"163.818359\" xlink:href=\"#DejaVuSans-5d\"/></g></g><g clip-path=\"url(#38530a8beab)\"><g transform=\"translate(267.13 89.705) scale(.13 -.13)\" fill=\"#ffffff\"><use transform=\"translate(0 .09375)\" xlink:href=\"#DejaVuSans-52\"/><use transform=\"translate(70.439 -16.312) scale(.7)\" xlink:href=\"#DejaVuSans-58\"/></g></g><g clip-path=\"url(#38530a8beab)\"><g transform=\"translate(266.94 148.24) scale(.08 -.08)\" fill=\"#ffffff\"><defs><path id=\"DejaVuSans-35\" transform=\"scale(.015625)\" d=\"m691 4666h2478v-532h-1900v-1143q137 47 274 70 138 23 276 23 781 0 1237-428 457-428 457-1159 0-753-469-1171-469-417-1322-417-294 0-599 50-304 50-629 150v635q281-153 581-228t634-75q541 0 856 284 316 284 316 772 0 487-316 771-315 285-856 285-253 0-505-56-251-56-513-175v2344z\"/></defs><use xlink:href=\"#DejaVuSans-3b8\"/><use x=\"61.181641\" xlink:href=\"#DejaVuSans-5b\"/><use x=\"100.195312\" xlink:href=\"#DejaVuSans-35\"/><use x=\"163.818359\" xlink:href=\"#DejaVuSans-5d\"/></g></g><g clip-path=\"url(#38530a8beab)\"><g transform=\"translate(267.13 136.06) scale(.13 -.13)\" fill=\"#ffffff\"><use transform=\"translate(0 .09375)\" xlink:href=\"#DejaVuSans-52\"/><use transform=\"translate(70.439 -16.312) scale(.7)\" xlink:href=\"#DejaVuSans-58\"/></g></g><g clip-path=\"url(#38530a8beab)\"><g transform=\"translate(406 55.53) scale(.08 -.08)\" fill=\"#ffffff\"><defs><path id=\"DejaVuSans-36\" transform=\"scale(.015625)\" d=\"m2113 2584q-425 0-674-291-248-290-248-796 0-503 248-796 249-292 674-292t673 292q248 293 248 796 0 506-248 796-248 291-673 291zm1253 1979v-575q-238 112-480 171-242 60-480 60-625 0-955-422-329-422-376-1275 184 272 462 417 279 145 613 145 703 0 1111-427 408-426 408-1160 0-719-425-1154-425-434-1131-434-810 0-1238 620-428 621-428 1799 0 1106 525 1764t1409 658q238 0 480-47t505-140z\"/></defs><use xlink:href=\"#DejaVuSans-3b8\"/><use x=\"61.181641\" xlink:href=\"#DejaVuSans-5b\"/><use x=\"100.195312\" xlink:href=\"#DejaVuSans-36\"/><use x=\"163.818359\" xlink:href=\"#DejaVuSans-5d\"/></g></g><g clip-path=\"url(#38530a8beab)\"><g transform=\"translate(406.19 43.351) scale(.13 -.13)\" fill=\"#ffffff\"><use transform=\"translate(0 .09375)\" xlink:href=\"#DejaVuSans-52\"/><use transform=\"translate(70.439 -16.312) scale(.7)\" xlink:href=\"#DejaVuSans-58\"/></g></g><g clip-path=\"url(#38530a8beab)\"><g transform=\"translate(452.36 101.88) scale(.08 -.08)\" fill=\"#ffffff\"><defs><path id=\"DejaVuSans-37\" transform=\"scale(.015625)\" d=\"m525 4666h3e3v-269l-1694-4397h-659l1594 4134h-2241v532z\"/></defs><use xlink:href=\"#DejaVuSans-3b8\"/><use x=\"61.181641\" xlink:href=\"#DejaVuSans-5b\"/><use x=\"100.195312\" xlink:href=\"#DejaVuSans-37\"/><use x=\"163.818359\" xlink:href=\"#DejaVuSans-5d\"/></g></g><g clip-path=\"url(#38530a8beab)\"><g transform=\"translate(452.54 89.705) scale(.13 -.13)\" fill=\"#ffffff\"><use transform=\"translate(0 .09375)\" xlink:href=\"#DejaVuSans-52\"/><use transform=\"translate(70.439 -16.312) scale(.7)\" xlink:href=\"#DejaVuSans-58\"/></g></g><g clip-path=\"url(#38530a8beab)\"><g transform=\"translate(452.36 148.24) scale(.08 -.08)\" fill=\"#ffffff\"><defs><path id=\"DejaVuSans-38\" transform=\"scale(.015625)\" d=\"m2034 2216q-450 0-708-241-257-241-257-662 0-422 257-663 258-241 708-241t709 242q260 243 260 662 0 421-258 662-257 241-711 241zm-631 268q-406 100-633 378-226 279-226 679 0 559 398 884 399 325 1092 325 697 0 1094-325t397-884q0-400-227-679-226-278-629-378 456-106 710-416 255-309 255-755 0-679-414-1042-414-362-1186-362-771 0-1186 362-414 363-414 1042 0 446 256 755 257 310 713 416zm-231 997q0-362 226-565 227-203 636-203 407 0 636 203 230 203 230 565 0 363-230 566-229 203-636 203-409 0-636-203-226-203-226-566z\"/></defs><use xlink:href=\"#DejaVuSans-3b8\"/><use x=\"61.181641\" xlink:href=\"#DejaVuSans-5b\"/><use x=\"100.195312\" xlink:href=\"#DejaVuSans-38\"/><use x=\"163.818359\" xlink:href=\"#DejaVuSans-5d\"/></g></g><g clip-path=\"url(#38530a8beab)\"><g transform=\"translate(452.54 136.06) scale(.13 -.13)\" fill=\"#ffffff\"><use transform=\"translate(0 .09375)\" xlink:href=\"#DejaVuSans-52\"/><use transform=\"translate(70.439 -16.312) scale(.7)\" xlink:href=\"#DejaVuSans-58\"/></g></g><g clip-path=\"url(#38530a8beab)\"><g transform=\"translate(591.42 55.53) scale(.08 -.08)\" fill=\"#ffffff\"><defs><path id=\"DejaVuSans-39\" transform=\"scale(.015625)\" d=\"m703 97v575q238-113 481-172 244-59 479-59 625 0 954 420 330 420 377 1277-181-269-460-413-278-144-615-144-700 0-1108 423-408 424-408 1159 0 718 425 1152 425 435 1131 435 810 0 1236-621 427-620 427-1801 0-1103-524-1761-523-658-1407-658-238 0-482 47-243 47-506 141zm1256 1978q425 0 673 290 249 291 249 798 0 503-249 795-248 292-673 292t-673-292-248-795q0-507 248-798 248-290 673-290z\"/></defs><use xlink:href=\"#DejaVuSans-3b8\"/><use x=\"61.181641\" xlink:href=\"#DejaVuSans-5b\"/><use x=\"100.195312\" xlink:href=\"#DejaVuSans-39\"/><use x=\"163.818359\" xlink:href=\"#DejaVuSans-5d\"/></g></g><g clip-path=\"url(#38530a8beab)\"><g transform=\"translate(591.6 43.351) scale(.13 -.13)\" fill=\"#ffffff\"><use transform=\"translate(0 .09375)\" xlink:href=\"#DejaVuSans-52\"/><use transform=\"translate(70.439 -16.312) scale(.7)\" xlink:href=\"#DejaVuSans-58\"/></g></g><g clip-path=\"url(#38530a8beab)\"><g transform=\"translate(635.23 101.88) scale(.08 -.08)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-3b8\"/><use x=\"61.181641\" xlink:href=\"#DejaVuSans-5b\"/><use x=\"100.195312\" xlink:href=\"#DejaVuSans-31\"/><use x=\"163.818359\" xlink:href=\"#DejaVuSans-30\"/><use x=\"227.441406\" xlink:href=\"#DejaVuSans-5d\"/></g></g><g clip-path=\"url(#38530a8beab)\"><g transform=\"translate(637.96 89.705) scale(.13 -.13)\" fill=\"#ffffff\"><use transform=\"translate(0 .09375)\" xlink:href=\"#DejaVuSans-52\"/><use transform=\"translate(70.439 -16.312) scale(.7)\" xlink:href=\"#DejaVuSans-58\"/></g></g><g clip-path=\"url(#38530a8beab)\"><g transform=\"translate(635.23 148.24) scale(.08 -.08)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-3b8\"/><use x=\"61.181641\" xlink:href=\"#DejaVuSans-5b\"/><use x=\"100.195312\" xlink:href=\"#DejaVuSans-31\"/><use x=\"163.818359\" xlink:href=\"#DejaVuSans-31\"/><use x=\"227.441406\" xlink:href=\"#DejaVuSans-5d\"/></g></g><g clip-path=\"url(#38530a8beab)\"><g transform=\"translate(637.96 136.06) scale(.13 -.13)\" fill=\"#ffffff\"><use transform=\"translate(0 .09375)\" xlink:href=\"#DejaVuSans-52\"/><use transform=\"translate(70.439 -16.312) scale(.7)\" xlink:href=\"#DejaVuSans-58\"/></g></g><defs><clipPath id=\"38530a8beab\"><rect x=\"7.2\" y=\"7.2\" width=\"669.28\" height=\"157.6\"/></clipPath></defs></svg>"
|
||
],
|
||
"text/plain": [
|
||
"<Figure size 1207.22x284.278 with 1 Axes>"
|
||
]
|
||
},
|
||
"execution_count": 2,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"from qiskit.circuit.library import TwoLocal\n",
|
||
"\n",
|
||
"two_local = TwoLocal(3, \"rx\", \"cz\")\n",
|
||
"two_local.decompose().draw(\"mpl\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "e32e031b-3218-4c1c-af7c-b40ad6c82100",
|
||
"metadata": {},
|
||
"source": [
|
||
"You can get a list-like object of the circuit's parameters from the `parameters` attribute."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 3,
|
||
"id": "d503e1c8-0ccd-4868-a5dc-4806d00ab54b",
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": [
|
||
"ParameterView([ParameterVectorElement(θ[0]), ParameterVectorElement(θ[1]), ParameterVectorElement(θ[2]), ParameterVectorElement(θ[3]), ParameterVectorElement(θ[4]), ParameterVectorElement(θ[5]), ParameterVectorElement(θ[6]), ParameterVectorElement(θ[7]), ParameterVectorElement(θ[8]), ParameterVectorElement(θ[9]), ParameterVectorElement(θ[10]), ParameterVectorElement(θ[11])])"
|
||
]
|
||
},
|
||
"execution_count": 3,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"two_local.parameters"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "555aca2a-a754-4372-8846-22ee4773ece1",
|
||
"metadata": {},
|
||
"source": [
|
||
"You can also use this to assign these parameters to real values using a dictionary of the form `{ Parameter: number }`. To demonstrate, the following code cell assigns each parameter in the circuit to `0`."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 4,
|
||
"id": "89227b48-12b2-4b1b-9680-55a7fce88a2b",
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"image/svg+xml": [
|
||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg width=\"683.68pt\" height=\"172pt\" version=\"1.1\" viewBox=\"0 0 683.68 172\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"><defs><style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style></defs><path d=\"m0 172h683.68v-172h-683.68z\" fill=\"#ffffff\"/><path d=\"m64.609 44.283h607.24\" clip-path=\"url(#027423ca95d)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m64.609 90.637h607.24\" clip-path=\"url(#027423ca95d)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m64.609 136.99h607.24\" clip-path=\"url(#027423ca95d)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m59.974 21.106h-1158.8v185.42h1158.8z\" clip-path=\"url(#027423ca95d)\" fill=\"#ffffff\" stroke=\"#ffffff\" stroke-width=\"1.5\"/><path d=\"m135.99 90.637v-46.354\" clip-path=\"url(#027423ca95d)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m182.35 136.99v-92.708\" clip-path=\"url(#027423ca95d)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m228.7 136.99v-46.354\" clip-path=\"url(#027423ca95d)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m321.41 90.637v-46.354\" clip-path=\"url(#027423ca95d)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m367.76 136.99v-92.708\" clip-path=\"url(#027423ca95d)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m414.12 136.99v-46.354\" clip-path=\"url(#027423ca95d)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m506.83 90.637v-46.354\" clip-path=\"url(#027423ca95d)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m553.18 136.99v-92.708\" clip-path=\"url(#027423ca95d)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m599.53 136.99v-46.354\" clip-path=\"url(#027423ca95d)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m135.99 90.637v-46.354\" clip-path=\"url(#027423ca95d)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m182.35 136.99v-92.708\" clip-path=\"url(#027423ca95d)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m228.7 136.99v-46.354\" clip-path=\"url(#027423ca95d)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m321.41 90.637v-46.354\" clip-path=\"url(#027423ca95d)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m367.76 136.99v-92.708\" clip-path=\"url(#027423ca95d)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m414.12 136.99v-46.354\" clip-path=\"url(#027423ca95d)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m506.83 90.637v-46.354\" clip-path=\"url(#027423ca95d)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m553.18 136.99v-92.708\" clip-path=\"url(#027423ca95d)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m599.53 136.99v-46.354\" clip-path=\"url(#027423ca95d)\" fill=\"none\" stroke=\"#33b1ff\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m74.575 59.348h30.13v-30.13h-30.13z\" clip-path=\"url(#027423ca95d)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m74.575 105.7h30.13v-30.13h-30.13z\" clip-path=\"url(#027423ca95d)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m74.575 152.06h30.13v-30.13h-30.13z\" clip-path=\"url(#027423ca95d)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m135.99 48.803c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958 0-1.1986-0.4762-2.3482-1.3237-3.1958-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237-1.1986 0-2.3482 0.4762-3.1958 1.3237s-1.3237 1.9972-1.3237 3.1958c0 1.1986 0.4762 2.3482 1.3237 3.1958s1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#027423ca95d)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m135.99 95.157c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958s-0.4762-2.3482-1.3237-3.1958c-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237-1.1986 0-2.3482 0.4762-3.1958 1.3237-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958s0.4762 2.3482 1.3237 3.1958c0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#027423ca95d)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m182.35 48.803c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958 0-1.1986-0.4762-2.3482-1.3237-3.1958-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237s-2.3482 0.4762-3.1958 1.3237c-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958 0 1.1986 0.4762 2.3482 1.3237 3.1958 0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#027423ca95d)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m182.35 141.51c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958 0-1.1986-0.4762-2.3482-1.3237-3.1958-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237s-2.3482 0.4762-3.1958 1.3237c-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958 0 1.1986 0.4762 2.3482 1.3237 3.1958 0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#027423ca95d)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m213.64 59.348h30.13v-30.13h-30.13z\" clip-path=\"url(#027423ca95d)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m228.7 95.157c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958s-0.4762-2.3482-1.3237-3.1958c-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237-1.1986 0-2.3482 0.4762-3.1958 1.3237-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958s0.4762 2.3482 1.3237 3.1958c0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#027423ca95d)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m228.7 141.51c1.1986 0 2.3482-0.4762 3.1958-1.3237s1.3237-1.9972 1.3237-3.1958c0-1.1986-0.4762-2.3482-1.3237-3.1958-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237-1.1986 0-2.3482 0.4762-3.1958 1.3237-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958 0 1.1986 0.4762 2.3482 1.3237 3.1958 0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#027423ca95d)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m259.99 105.7h30.13v-30.13h-30.13z\" clip-path=\"url(#027423ca95d)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m259.99 152.06h30.13v-30.13h-30.13z\" clip-path=\"url(#027423ca95d)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m321.41 48.803c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958 0-1.1986-0.4762-2.3482-1.3237-3.1958-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237s-2.3482 0.4762-3.1958 1.3237c-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958 0 1.1986 0.4762 2.3482 1.3237 3.1958 0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#027423ca95d)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m321.41 95.157c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958s-0.4762-2.3482-1.3237-3.1958c-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237s-2.3482 0.4762-3.1958 1.3237c-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958s0.4762 2.3482 1.3237 3.1958c0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#027423ca95d)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m367.76 48.803c1.1986 0 2.3482-0.4762 3.1958-1.3237s1.3237-1.9972 1.3237-3.1958c0-1.1986-0.4762-2.3482-1.3237-3.1958s-1.9972-1.3237-3.1958-1.3237c-1.1986 0-2.3482 0.4762-3.1958 1.3237-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958 0 1.1986 0.4762 2.3482 1.3237 3.1958 0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#027423ca95d)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m367.76 141.51c1.1986 0 2.3482-0.4762 3.1958-1.3237s1.3237-1.9972 1.3237-3.1958c0-1.1986-0.4762-2.3482-1.3237-3.1958-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237-1.1986 0-2.3482 0.4762-3.1958 1.3237-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958 0 1.1986 0.4762 2.3482 1.3237 3.1958 0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#027423ca95d)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m399.05 59.348h30.13v-30.13h-30.13z\" clip-path=\"url(#027423ca95d)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m414.12 95.157c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958s-0.4762-2.3482-1.3237-3.1958c-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237-1.1986 0-2.3482 0.4762-3.1958 1.3237-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958s0.4762 2.3482 1.3237 3.1958c0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#027423ca95d)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m414.12 141.51c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958 0-1.1986-0.4762-2.3482-1.3237-3.1958-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237-1.1986 0-2.3482 0.4762-3.1958 1.3237-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958 0 1.1986 0.4762 2.3482 1.3237 3.1958s1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#027423ca95d)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m445.41 105.7h30.13v-30.13h-30.13z\" clip-path=\"url(#027423ca95d)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m445.41 152.06h30.13v-30.13h-30.13z\" clip-path=\"url(#027423ca95d)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m506.83 48.803c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958 0-1.1986-0.4762-2.3482-1.3237-3.1958-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237-1.1986 0-2.3482 0.4762-3.1958 1.3237s-1.3237 1.9972-1.3237 3.1958c0 1.1986 0.4762 2.3482 1.3237 3.1958s1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#027423ca95d)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m506.83 95.157c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958s-0.4762-2.3482-1.3237-3.1958c-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237-1.1986 0-2.3482 0.4762-3.1958 1.3237-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958s0.4762 2.3482 1.3237 3.1958c0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#027423ca95d)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m553.18 48.803c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958 0-1.1986-0.4762-2.3482-1.3237-3.1958-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237s-2.3482 0.4762-3.1958 1.3237c-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958 0 1.1986 0.4762 2.3482 1.3237 3.1958 0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#027423ca95d)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m553.18 141.51c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958 0-1.1986-0.4762-2.3482-1.3237-3.1958-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237s-2.3482 0.4762-3.1958 1.3237c-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958 0 1.1986 0.4762 2.3482 1.3237 3.1958 0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#027423ca95d)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m584.47 59.348h30.13v-30.13h-30.13z\" clip-path=\"url(#027423ca95d)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m599.53 95.157c1.1986 0 2.3482-0.4762 3.1958-1.3237 0.84753-0.84753 1.3237-1.9972 1.3237-3.1958s-0.4762-2.3482-1.3237-3.1958c-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237-1.1986 0-2.3482 0.4762-3.1958 1.3237-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958s0.4762 2.3482 1.3237 3.1958c0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#027423ca95d)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m599.53 141.51c1.1986 0 2.3482-0.4762 3.1958-1.3237s1.3237-1.9972 1.3237-3.1958c0-1.1986-0.4762-2.3482-1.3237-3.1958-0.84753-0.84753-1.9972-1.3237-3.1958-1.3237-1.1986 0-2.3482 0.4762-3.1958 1.3237-0.84753 0.84753-1.3237 1.9972-1.3237 3.1958 0 1.1986 0.4762 2.3482 1.3237 3.1958 0.84753 0.84753 1.9972 1.3237 3.1958 1.3237z\" clip-path=\"url(#027423ca95d)\" fill=\"#33b1ff\" stroke=\"#33b1ff\" stroke-width=\"1.5\"/><path d=\"m630.82 105.7h30.13v-30.13h-30.13z\" clip-path=\"url(#027423ca95d)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m630.82 152.06h30.13v-30.13h-30.13z\" clip-path=\"url(#027423ca95d)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><g clip-path=\"url(#027423ca95d)\"><g transform=\"translate(37.301 48.734) scale(.1625 -.1625)\"><defs><path id=\"DejaVuSans-Oblique-71\" transform=\"scale(.015625)\" d=\"m2669 525q-231-303-546-460-314-156-695-156-531 0-833 358-301 358-301 986 0 506 186 978t533 847q225 244 517 375t614 131q387 0 637-153t363-462l100 525h578l-934-4813h-579l360 1844zm-1778 813q0-463 193-705 194-242 560-242 544 0 928 520t384 1264q0 450-199 689-198 239-569 239-272 0-504-127-231-126-403-370-181-256-286-600-104-343-104-668z\"/><path id=\"DejaVuSans-30\" transform=\"scale(.015625)\" d=\"m2034 4250q-487 0-733-480-245-479-245-1442 0-959 245-1439 246-480 733-480 491 0 736 480 246 480 246 1439 0 963-246 1442-245 480-736 480zm0 500q785 0 1199-621 414-620 414-1801 0-1178-414-1799-414-620-1199-620-784 0-1198 620-414 621-414 1799 0 1181 414 1801 414 621 1198 621z\"/></defs><use xlink:href=\"#DejaVuSans-Oblique-71\"/><use transform=\"translate(63.477 -16.406) scale(.7)\" xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#027423ca95d)\"><g transform=\"translate(37.301 95.088) scale(.1625 -.1625)\"><defs><path id=\"DejaVuSans-31\" transform=\"scale(.015625)\" d=\"m794 531h1031v3560l-1122-225v575l1116 225h631v-4135h1031v-531h-2687v531z\"/></defs><use xlink:href=\"#DejaVuSans-Oblique-71\"/><use transform=\"translate(63.477 -16.406) scale(.7)\" xlink:href=\"#DejaVuSans-31\"/></g></g><g clip-path=\"url(#027423ca95d)\"><g transform=\"translate(37.301 141.44) scale(.1625 -.1625)\"><defs><path id=\"DejaVuSans-32\" transform=\"scale(.015625)\" d=\"m1228 531h2203v-531h-2962v531q359 372 979 998 621 627 780 809 303 340 423 576 121 236 121 464 0 372-261 606-261 235-680 235-297 0-627-103-329-103-704-313v638q381 153 712 231 332 78 607 78 725 0 1156-363 431-362 431-968 0-288-108-546-107-257-392-607-78-91-497-524-418-433-1181-1211z\"/></defs><use xlink:href=\"#DejaVuSans-Oblique-71\"/><use transform=\"translate(63.477 -16.406) scale(.7)\" xlink:href=\"#DejaVuSans-32\"/></g></g><g clip-path=\"url(#027423ca95d)\"><g transform=\"translate(87.095 55.53) scale(.08 -.08)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#027423ca95d)\"><g transform=\"translate(81.71 43.351) scale(.13 -.13)\" fill=\"#ffffff\"><defs><path id=\"DejaVuSans-52\" transform=\"scale(.015625)\" d=\"m2841 2188q203-69 395-294t386-619l641-1275h-679l-596 1197q-232 469-449 622t-592 153h-688v-1972h-631v4666h1425q800 0 1194-335 394-334 394-1009 0-441-205-732-205-290-595-402zm-1582 1959v-1656h794q456 0 689 211t233 620-233 617-689 208h-794z\"/><path id=\"DejaVuSans-58\" transform=\"scale(.015625)\" d=\"m403 4666h678l1160-1735 1165 1735h678l-1500-2241 1600-2425h-678l-1312 1984-1322-1984h-681l1665 2491-1453 2175z\"/></defs><use transform=\"translate(0 .09375)\" xlink:href=\"#DejaVuSans-52\"/><use transform=\"translate(70.439 -16.312) scale(.7)\" xlink:href=\"#DejaVuSans-58\"/></g></g><g clip-path=\"url(#027423ca95d)\"><g transform=\"translate(87.095 101.88) scale(.08 -.08)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#027423ca95d)\"><g transform=\"translate(81.71 89.705) scale(.13 -.13)\" fill=\"#ffffff\"><use transform=\"translate(0 .09375)\" xlink:href=\"#DejaVuSans-52\"/><use transform=\"translate(70.439 -16.312) scale(.7)\" xlink:href=\"#DejaVuSans-58\"/></g></g><g clip-path=\"url(#027423ca95d)\"><g transform=\"translate(87.095 148.24) scale(.08 -.08)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#027423ca95d)\"><g transform=\"translate(81.71 136.06) scale(.13 -.13)\" fill=\"#ffffff\"><use transform=\"translate(0 .09375)\" xlink:href=\"#DejaVuSans-52\"/><use transform=\"translate(70.439 -16.312) scale(.7)\" xlink:href=\"#DejaVuSans-58\"/></g></g><g clip-path=\"url(#027423ca95d)\"><g transform=\"translate(226.16 55.53) scale(.08 -.08)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#027423ca95d)\"><g transform=\"translate(220.77 43.351) scale(.13 -.13)\" fill=\"#ffffff\"><use transform=\"translate(0 .09375)\" xlink:href=\"#DejaVuSans-52\"/><use transform=\"translate(70.439 -16.312) scale(.7)\" xlink:href=\"#DejaVuSans-58\"/></g></g><g clip-path=\"url(#027423ca95d)\"><g transform=\"translate(272.51 101.88) scale(.08 -.08)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#027423ca95d)\"><g transform=\"translate(267.13 89.705) scale(.13 -.13)\" fill=\"#ffffff\"><use transform=\"translate(0 .09375)\" xlink:href=\"#DejaVuSans-52\"/><use transform=\"translate(70.439 -16.312) scale(.7)\" xlink:href=\"#DejaVuSans-58\"/></g></g><g clip-path=\"url(#027423ca95d)\"><g transform=\"translate(272.51 148.24) scale(.08 -.08)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#027423ca95d)\"><g transform=\"translate(267.13 136.06) scale(.13 -.13)\" fill=\"#ffffff\"><use transform=\"translate(0 .09375)\" xlink:href=\"#DejaVuSans-52\"/><use transform=\"translate(70.439 -16.312) scale(.7)\" xlink:href=\"#DejaVuSans-58\"/></g></g><g clip-path=\"url(#027423ca95d)\"><g transform=\"translate(411.57 55.53) scale(.08 -.08)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#027423ca95d)\"><g transform=\"translate(406.19 43.351) scale(.13 -.13)\" fill=\"#ffffff\"><use transform=\"translate(0 .09375)\" xlink:href=\"#DejaVuSans-52\"/><use transform=\"translate(70.439 -16.312) scale(.7)\" xlink:href=\"#DejaVuSans-58\"/></g></g><g clip-path=\"url(#027423ca95d)\"><g transform=\"translate(457.93 101.88) scale(.08 -.08)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#027423ca95d)\"><g transform=\"translate(452.54 89.705) scale(.13 -.13)\" fill=\"#ffffff\"><use transform=\"translate(0 .09375)\" xlink:href=\"#DejaVuSans-52\"/><use transform=\"translate(70.439 -16.312) scale(.7)\" xlink:href=\"#DejaVuSans-58\"/></g></g><g clip-path=\"url(#027423ca95d)\"><g transform=\"translate(457.93 148.24) scale(.08 -.08)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#027423ca95d)\"><g transform=\"translate(452.54 136.06) scale(.13 -.13)\" fill=\"#ffffff\"><use transform=\"translate(0 .09375)\" xlink:href=\"#DejaVuSans-52\"/><use transform=\"translate(70.439 -16.312) scale(.7)\" xlink:href=\"#DejaVuSans-58\"/></g></g><g clip-path=\"url(#027423ca95d)\"><g transform=\"translate(596.99 55.53) scale(.08 -.08)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#027423ca95d)\"><g transform=\"translate(591.6 43.351) scale(.13 -.13)\" fill=\"#ffffff\"><use transform=\"translate(0 .09375)\" xlink:href=\"#DejaVuSans-52\"/><use transform=\"translate(70.439 -16.312) scale(.7)\" xlink:href=\"#DejaVuSans-58\"/></g></g><g clip-path=\"url(#027423ca95d)\"><g transform=\"translate(643.34 101.88) scale(.08 -.08)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#027423ca95d)\"><g transform=\"translate(637.96 89.705) scale(.13 -.13)\" fill=\"#ffffff\"><use transform=\"translate(0 .09375)\" xlink:href=\"#DejaVuSans-52\"/><use transform=\"translate(70.439 -16.312) scale(.7)\" xlink:href=\"#DejaVuSans-58\"/></g></g><g clip-path=\"url(#027423ca95d)\"><g transform=\"translate(643.34 148.24) scale(.08 -.08)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#027423ca95d)\"><g transform=\"translate(637.96 136.06) scale(.13 -.13)\" fill=\"#ffffff\"><use transform=\"translate(0 .09375)\" xlink:href=\"#DejaVuSans-52\"/><use transform=\"translate(70.439 -16.312) scale(.7)\" xlink:href=\"#DejaVuSans-58\"/></g></g><defs><clipPath id=\"027423ca95d\"><rect x=\"7.2\" y=\"7.2\" width=\"669.28\" height=\"157.6\"/></clipPath></defs></svg>"
|
||
],
|
||
"text/plain": [
|
||
"<Figure size 1207.22x284.278 with 1 Axes>"
|
||
]
|
||
},
|
||
"execution_count": 4,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"bound_circuit = two_local.assign_parameters(\n",
|
||
" {p: 0 for p in two_local.parameters}\n",
|
||
")\n",
|
||
"bound_circuit.decompose().draw(\"mpl\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "78772993-d0da-4651-9211-706e86a59432",
|
||
"metadata": {},
|
||
"source": [
|
||
"For more information, see [N-local gates](/api/qiskit/circuit_library#n-local-circuits) in the circuit library API documentation or take our [Variational algorithm design course](https://learning.quantum.ibm.com/course/variational-algorithm-design)."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "3e463081-bce9-4ee2-9046-97659e9ac847",
|
||
"metadata": {},
|
||
"source": [
|
||
"## Data-encoding circuits\n",
|
||
"\n",
|
||
"These parameterized circuits encode data onto quantum states for processing by quantum machine learning algorithms. Some circuits supported by Qiskit are:\n",
|
||
" - Amplitude encoding, which encodes each number into the amplitude of a basis state. This can store $2^n$ numbers in a single state, but can be costly to implement.\n",
|
||
" - Basis encoding, which encodes an integer $k$ by preparing the corresponding basis state $|k\\rangle$.\n",
|
||
" - Angle encoding, which sets each number in the data as a rotation angle in a parameterized circuit.\n",
|
||
"\n",
|
||
"The best approach depends upon the specifics of your application. On current quantum computers, however, we often use angle-encoding circuits such as the `ZZFeatureMap`."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 5,
|
||
"id": "cf8b1efc-57b3-4681-8e6a-d5b8406d092d",
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"image/svg+xml": [
|
||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg width=\"220.14pt\" height=\"172pt\" version=\"1.1\" viewBox=\"0 0 220.14 172\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"><defs><style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style></defs><path d=\"m0 172h220.14v-172h-220.14z\" fill=\"#ffffff\"/><path d=\"m64.609 44.283h143.7\" clip-path=\"url(#91b4d634d8a)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m64.609 90.637h143.7\" clip-path=\"url(#91b4d634d8a)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m64.609 136.99h143.7\" clip-path=\"url(#91b4d634d8a)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m59.974 21.106h-1158.8v185.42h1158.8z\" clip-path=\"url(#91b4d634d8a)\" fill=\"#ffffff\" stroke=\"#ffffff\" stroke-width=\"1.5\"/><path d=\"m80.089 152.06h111.81v-122.84h-111.81z\" clip-path=\"url(#91b4d634d8a)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><g clip-path=\"url(#91b4d634d8a)\"><g transform=\"translate(37.301 48.734) scale(.1625 -.1625)\"><defs><path id=\"DejaVuSans-Oblique-71\" transform=\"scale(.015625)\" d=\"m2669 525q-231-303-546-460-314-156-695-156-531 0-833 358-301 358-301 986 0 506 186 978t533 847q225 244 517 375t614 131q387 0 637-153t363-462l100 525h578l-934-4813h-579l360 1844zm-1778 813q0-463 193-705 194-242 560-242 544 0 928 520t384 1264q0 450-199 689-198 239-569 239-272 0-504-127-231-126-403-370-181-256-286-600-104-343-104-668z\"/><path id=\"DejaVuSans-30\" transform=\"scale(.015625)\" d=\"m2034 4250q-487 0-733-480-245-479-245-1442 0-959 245-1439 246-480 733-480 491 0 736 480 246 480 246 1439 0 963-246 1442-245 480-736 480zm0 500q785 0 1199-621 414-620 414-1801 0-1178-414-1799-414-620-1199-620-784 0-1198 620-414 621-414 1799 0 1181 414 1801 414 621 1198 621z\"/></defs><use xlink:href=\"#DejaVuSans-Oblique-71\"/><use transform=\"translate(63.477 -16.406) scale(.7)\" xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#91b4d634d8a)\"><g transform=\"translate(37.301 95.088) scale(.1625 -.1625)\"><defs><path id=\"DejaVuSans-31\" transform=\"scale(.015625)\" d=\"m794 531h1031v3560l-1122-225v575l1116 225h631v-4135h1031v-531h-2687v531z\"/></defs><use xlink:href=\"#DejaVuSans-Oblique-71\"/><use transform=\"translate(63.477 -16.406) scale(.7)\" xlink:href=\"#DejaVuSans-31\"/></g></g><g clip-path=\"url(#91b4d634d8a)\"><g transform=\"translate(37.301 141.44) scale(.1625 -.1625)\"><defs><path id=\"DejaVuSans-32\" transform=\"scale(.015625)\" d=\"m1228 531h2203v-531h-2962v531q359 372 979 998 621 627 780 809 303 340 423 576 121 236 121 464 0 372-261 606-261 235-680 235-297 0-627-103-329-103-704-313v638q381 153 712 231 332 78 607 78 725 0 1156-363 431-362 431-968 0-288-108-546-107-257-392-607-78-91-497-524-418-433-1181-1211z\"/></defs><use xlink:href=\"#DejaVuSans-Oblique-71\"/><use transform=\"translate(63.477 -16.406) scale(.7)\" xlink:href=\"#DejaVuSans-32\"/></g></g><g clip-path=\"url(#91b4d634d8a)\"><g transform=\"translate(83.334 47.87) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#91b4d634d8a)\"><g transform=\"translate(83.334 94.224) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-31\"/></g></g><g clip-path=\"url(#91b4d634d8a)\"><g transform=\"translate(83.334 140.58) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-32\"/></g></g><g clip-path=\"url(#91b4d634d8a)\"><g transform=\"translate(116.92 114.63) scale(.08 -.08)\" fill=\"#ffffff\"><defs><path id=\"DejaVuSans-2e\" transform=\"scale(.015625)\" d=\"m684 794h660v-794h-660v794z\"/><path id=\"DejaVuSans-2c\" transform=\"scale(.015625)\" d=\"m750 794h659v-538l-512-1e3h-403l256 1e3v538z\"/><path id=\"DejaVuSans-34\" transform=\"scale(.015625)\" d=\"m2419 4116-1594-2491h1594v2491zm-166 550h794v-3041h666v-525h-666v-1100h-628v1100h-2106v609l1940 2957z\"/><path id=\"DejaVuSans-38\" transform=\"scale(.015625)\" d=\"m2034 2216q-450 0-708-241-257-241-257-662 0-422 257-663 258-241 708-241t709 242q260 243 260 662 0 421-258 662-257 241-711 241zm-631 268q-406 100-633 378-226 279-226 679 0 559 398 884 399 325 1092 325 697 0 1094-325t397-884q0-400-227-679-226-278-629-378 456-106 710-416 255-309 255-755 0-679-414-1042-414-362-1186-362-771 0-1186 362-414 363-414 1042 0 446 256 755 257 310 713 416zm-231 997q0-362 226-565 227-203 636-203 407 0 636 203 230 203 230 565 0 363-230 566-229 203-636 203-409 0-636-203-226-203-226-566z\"/></defs><use xlink:href=\"#DejaVuSans-30\"/><use x=\"63.623047\" xlink:href=\"#DejaVuSans-2e\"/><use x=\"95.410156\" xlink:href=\"#DejaVuSans-32\"/><use x=\"159.033203\" xlink:href=\"#DejaVuSans-2c\"/><use x=\"190.820312\" xlink:href=\"#DejaVuSans-20\"/><use x=\"222.607422\" xlink:href=\"#DejaVuSans-30\"/><use x=\"286.230469\" xlink:href=\"#DejaVuSans-2e\"/><use x=\"318.017578\" xlink:href=\"#DejaVuSans-34\"/><use x=\"381.640625\" xlink:href=\"#DejaVuSans-2c\"/><use x=\"413.427734\" xlink:href=\"#DejaVuSans-20\"/><use x=\"445.214844\" xlink:href=\"#DejaVuSans-30\"/><use x=\"508.837891\" xlink:href=\"#DejaVuSans-2e\"/><use x=\"540.625\" xlink:href=\"#DejaVuSans-38\"/></g></g><g clip-path=\"url(#91b4d634d8a)\"><g transform=\"translate(93.913 91.443) scale(.13 -.13)\" fill=\"#ffffff\"><defs><path id=\"DejaVuSans-5a\" transform=\"scale(.015625)\" d=\"m359 4666h3666v-482l-2950-3653h3022v-531h-3809v481l2950 3653h-2879v532z\"/><path id=\"DejaVuSans-46\" transform=\"scale(.015625)\" d=\"m628 4666h2681v-532h-2050v-1375h1850v-531h-1850v-2228h-631v4666z\"/><path id=\"DejaVuSans-65\" transform=\"scale(.015625)\" d=\"m3597 1894v-281h-2644q38-594 358-905t892-311q331 0 642 81t618 244v-544q-310-131-635-200t-659-69q-838 0-1327 487-489 488-489 1320 0 859 464 1363 464 505 1252 505 706 0 1117-455 411-454 411-1235zm-575 169q-6 471-264 752-258 282-683 282-481 0-770-272t-333-766l2050 4z\"/><path id=\"DejaVuSans-61\" transform=\"scale(.015625)\" d=\"m2194 1759q-697 0-966-159t-269-544q0-306 202-486 202-179 548-179 479 0 768 339t289 901v128h-572zm1147 238v-1997h-575v531q-197-318-491-470t-719-152q-537 0-855 302-317 302-317 808 0 590 395 890 396 300 1180 300h807v57q0 397-261 614t-733 217q-300 0-585-72-284-72-546-216v532q315 122 612 182 297 61 578 61 760 0 1135-394 375-393 375-1193z\"/><path id=\"DejaVuSans-74\" transform=\"scale(.015625)\" d=\"m1172 4494v-994h1184v-447h-1184v-1900q0-428 117-550t477-122h590v-481h-590q-666 0-919 248-253 249-253 905v1900h-422v447h422v994h578z\"/><path id=\"DejaVuSans-75\" transform=\"scale(.015625)\" d=\"m544 1381v2119h575v-2097q0-497 193-746 194-248 582-248 465 0 735 297 271 297 271 810v1984h575v-3500h-575v538q-209-319-486-474-276-155-642-155-603 0-916 375-312 375-312 1097zm1447 2203z\"/><path id=\"DejaVuSans-72\" transform=\"scale(.015625)\" d=\"m2631 2963q-97 56-211 82-114 27-251 27-488 0-749-317t-261-911v-1844h-578v3500h578v-544q182 319 472 473 291 155 707 155 59 0 131-8 72-7 159-23l3-590z\"/><path id=\"DejaVuSans-4d\" transform=\"scale(.015625)\" d=\"m628 4666h941l1190-3175 1197 3175h941v-4666h-616v4097l-1203-3200h-634l-1203 3200v-4097h-613v4666z\"/><path id=\"DejaVuSans-70\" transform=\"scale(.015625)\" d=\"m1159 525v-1856h-578v4831h578v-531q182 312 458 463 277 152 661 152 638 0 1036-506 399-506 399-1331t-399-1332q-398-506-1036-506-384 0-661 152-276 152-458 464zm1957 1222q0 634-261 995t-717 361q-457 0-718-361t-261-995 261-995 718-361q456 0 717 361t261 995z\"/></defs><use xlink:href=\"#DejaVuSans-5a\"/><use x=\"68.505859\" xlink:href=\"#DejaVuSans-5a\"/><use x=\"137.011719\" xlink:href=\"#DejaVuSans-46\"/><use x=\"189.03125\" xlink:href=\"#DejaVuSans-65\"/><use x=\"250.554688\" xlink:href=\"#DejaVuSans-61\"/><use x=\"311.833984\" xlink:href=\"#DejaVuSans-74\"/><use x=\"351.042969\" xlink:href=\"#DejaVuSans-75\"/><use x=\"414.421875\" xlink:href=\"#DejaVuSans-72\"/><use x=\"453.285156\" xlink:href=\"#DejaVuSans-65\"/><use x=\"514.808594\" xlink:href=\"#DejaVuSans-4d\"/><use x=\"601.087891\" xlink:href=\"#DejaVuSans-61\"/><use x=\"662.367188\" xlink:href=\"#DejaVuSans-70\"/></g></g><defs><clipPath id=\"91b4d634d8a\"><rect x=\"7.2\" y=\"7.2\" width=\"205.74\" height=\"157.6\"/></clipPath></defs></svg>"
|
||
],
|
||
"text/plain": [
|
||
"<Figure size 371.107x284.278 with 1 Axes>"
|
||
]
|
||
},
|
||
"execution_count": 5,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"from qiskit.circuit.library import ZZFeatureMap\n",
|
||
"\n",
|
||
"features = [0.2, 0.4, 0.8]\n",
|
||
"feature_map = ZZFeatureMap(feature_dimension=len(features))\n",
|
||
"\n",
|
||
"encoded = feature_map.assign_parameters(features)\n",
|
||
"encoded.draw(\"mpl\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "031bf004-ca80-4cc0-b153-2cd5cd778386",
|
||
"metadata": {},
|
||
"source": [
|
||
"See [Data encoding circuits](/api/qiskit/circuit_library#data-encoding-circuits) in the circuit library API documentation."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "5c5d2735-ef6a-48db-8382-9dc03c9af20a",
|
||
"metadata": {},
|
||
"source": [
|
||
"## Time-evolution circuits\n",
|
||
"\n",
|
||
"These circuits simulate a quantum state evolving in time. Use time-evolution circuits to investigate physical effects such as heat transfer or phase transitions in a system. Time-evolution circuits are also a fundamental building block of chemistry wave functions (such as unitary coupled-cluster trial states) and of the QAOA algorithm we use for optimization problems."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 6,
|
||
"id": "834794df-86e9-4bea-8efa-5380499e359b",
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"image/svg+xml": [
|
||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg width=\"312.85pt\" height=\"172pt\" version=\"1.1\" viewBox=\"0 0 312.85 172\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"><defs><style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style></defs><path d=\"m0 172h312.85v-172h-312.85z\" fill=\"#ffffff\"/><path d=\"m64.609 44.283h236.41\" clip-path=\"url(#57db765eb94)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m64.609 90.637h236.41\" clip-path=\"url(#57db765eb94)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m64.609 136.99h236.41\" clip-path=\"url(#57db765eb94)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m59.974 21.106h-1158.8v185.42h1158.8z\" clip-path=\"url(#57db765eb94)\" fill=\"#ffffff\" stroke=\"#ffffff\" stroke-width=\"1.5\"/><path d=\"m74.575 105.7h30.13v-30.13h-30.13z\" clip-path=\"url(#57db765eb94)\" fill=\"#fa4d56\" stroke=\"#fa4d56\" stroke-width=\"1.5\"/><path d=\"m134.36 152.06h142.33v-122.84h-142.33z\" clip-path=\"url(#57db765eb94)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><g clip-path=\"url(#57db765eb94)\"><g transform=\"translate(37.301 48.734) scale(.1625 -.1625)\"><defs><path id=\"DejaVuSans-Oblique-71\" transform=\"scale(.015625)\" d=\"m2669 525q-231-303-546-460-314-156-695-156-531 0-833 358-301 358-301 986 0 506 186 978t533 847q225 244 517 375t614 131q387 0 637-153t363-462l100 525h578l-934-4813h-579l360 1844zm-1778 813q0-463 193-705 194-242 560-242 544 0 928 520t384 1264q0 450-199 689-198 239-569 239-272 0-504-127-231-126-403-370-181-256-286-600-104-343-104-668z\"/><path id=\"DejaVuSans-30\" transform=\"scale(.015625)\" d=\"m2034 4250q-487 0-733-480-245-479-245-1442 0-959 245-1439 246-480 733-480 491 0 736 480 246 480 246 1439 0 963-246 1442-245 480-736 480zm0 500q785 0 1199-621 414-620 414-1801 0-1178-414-1799-414-620-1199-620-784 0-1198 620-414 621-414 1799 0 1181 414 1801 414 621 1198 621z\"/></defs><use xlink:href=\"#DejaVuSans-Oblique-71\"/><use transform=\"translate(63.477 -16.406) scale(.7)\" xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#57db765eb94)\"><g transform=\"translate(37.301 95.088) scale(.1625 -.1625)\"><defs><path id=\"DejaVuSans-31\" transform=\"scale(.015625)\" d=\"m794 531h1031v3560l-1122-225v575l1116 225h631v-4135h1031v-531h-2687v531z\"/></defs><use xlink:href=\"#DejaVuSans-Oblique-71\"/><use transform=\"translate(63.477 -16.406) scale(.7)\" xlink:href=\"#DejaVuSans-31\"/></g></g><g clip-path=\"url(#57db765eb94)\"><g transform=\"translate(37.301 141.44) scale(.1625 -.1625)\"><defs><path id=\"DejaVuSans-32\" transform=\"scale(.015625)\" d=\"m1228 531h2203v-531h-2962v531q359 372 979 998 621 627 780 809 303 340 423 576 121 236 121 464 0 372-261 606-261 235-680 235-297 0-627-103-329-103-704-313v638q381 153 712 231 332 78 607 78 725 0 1156-363 431-362 431-968 0-288-108-546-107-257-392-607-78-91-497-524-418-433-1181-1211z\"/></defs><use xlink:href=\"#DejaVuSans-Oblique-71\"/><use transform=\"translate(63.477 -16.406) scale(.7)\" xlink:href=\"#DejaVuSans-32\"/></g></g><g clip-path=\"url(#57db765eb94)\"><g transform=\"translate(84.752 94.224) scale(.13 -.13)\"><defs><path id=\"DejaVuSans-48\" transform=\"scale(.015625)\" d=\"m628 4666h631v-1913h2294v1913h631v-4666h-631v2222h-2294v-2222h-631v4666z\"/></defs><use xlink:href=\"#DejaVuSans-48\"/></g></g><g clip-path=\"url(#57db765eb94)\"><g transform=\"translate(137.6 47.87) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#57db765eb94)\"><g transform=\"translate(137.6 94.224) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-31\"/></g></g><g clip-path=\"url(#57db765eb94)\"><g transform=\"translate(137.6 140.58) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-32\"/></g></g><g clip-path=\"url(#57db765eb94)\"><g transform=\"translate(208.08 114.63) scale(.08 -.08)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-31\"/></g></g><g clip-path=\"url(#57db765eb94)\"><g transform=\"translate(148.63 91.443) scale(.13 -.13)\" fill=\"#ffffff\"><defs><path id=\"DejaVuSans-65\" transform=\"scale(.015625)\" d=\"m3597 1894v-281h-2644q38-594 358-905t892-311q331 0 642 81t618 244v-544q-310-131-635-200t-659-69q-838 0-1327 487-489 488-489 1320 0 859 464 1363 464 505 1252 505 706 0 1117-455 411-454 411-1235zm-575 169q-6 471-264 752-258 282-683 282-481 0-770-272t-333-766l2050 4z\"/><path id=\"DejaVuSans-78\" transform=\"scale(.015625)\" d=\"m3513 3500-1266-1703 1331-1797h-678l-1019 1375-1018-1375h-679l1360 1831-1244 1669h678l928-1247 928 1247h679z\"/><path id=\"DejaVuSans-70\" transform=\"scale(.015625)\" d=\"m1159 525v-1856h-578v4831h578v-531q182 312 458 463 277 152 661 152 638 0 1036-506 399-506 399-1331t-399-1332q-398-506-1036-506-384 0-661 152-276 152-458 464zm1957 1222q0 634-261 995t-717 361q-457 0-718-361t-261-995 261-995 718-361q456 0 717 361t261 995z\"/><path id=\"DejaVuSans-28\" transform=\"scale(.015625)\" d=\"m1984 4856q-418-718-622-1422-203-703-203-1425 0-721 205-1429t620-1424h-500q-468 735-701 1444t-233 1409q0 697 231 1403 232 707 703 1444h500z\"/><path id=\"DejaVuSans-2d\" transform=\"scale(.015625)\" d=\"m313 2009h1684v-512h-1684v512z\"/><path id=\"DejaVuSans-69\" transform=\"scale(.015625)\" d=\"m603 3500h575v-3500h-575v3500zm0 1363h575v-729h-575v729z\"/><path id=\"DejaVuSans-74\" transform=\"scale(.015625)\" d=\"m1172 4494v-994h1184v-447h-1184v-1900q0-428 117-550t477-122h590v-481h-590q-666 0-919 248-253 249-253 905v1900h-422v447h422v994h578z\"/><path id=\"DejaVuSans-5a\" transform=\"scale(.015625)\" d=\"m359 4666h3666v-482l-2950-3653h3022v-531h-3809v481l2950 3653h-2879v532z\"/><path id=\"DejaVuSans-49\" transform=\"scale(.015625)\" d=\"m628 4666h631v-4666h-631v4666z\"/><path id=\"DejaVuSans-2b\" transform=\"scale(.015625)\" d=\"m2944 4013v-1741h1740v-531h-1740v-1741h-525v1741h-1741v531h1741v1741h525z\"/><path id=\"DejaVuSans-29\" transform=\"scale(.015625)\" d=\"m513 4856h500q468-737 701-1444 233-706 233-1403 0-700-233-1409t-701-1444h-500q415 716 620 1424t205 1429q0 722-205 1425-205 704-620 1422z\"/></defs><use xlink:href=\"#DejaVuSans-65\"/><use x=\"59.773438\" xlink:href=\"#DejaVuSans-78\"/><use x=\"118.953125\" xlink:href=\"#DejaVuSans-70\"/><use x=\"182.429688\" xlink:href=\"#DejaVuSans-28\"/><use x=\"221.443359\" xlink:href=\"#DejaVuSans-2d\"/><use x=\"257.527344\" xlink:href=\"#DejaVuSans-69\"/><use x=\"285.310547\" xlink:href=\"#DejaVuSans-74\"/><use x=\"324.519531\" xlink:href=\"#DejaVuSans-20\"/><use x=\"356.306641\" xlink:href=\"#DejaVuSans-28\"/><use x=\"395.320312\" xlink:href=\"#DejaVuSans-5a\"/><use x=\"463.826172\" xlink:href=\"#DejaVuSans-5a\"/><use x=\"532.332031\" xlink:href=\"#DejaVuSans-49\"/><use x=\"561.824219\" xlink:href=\"#DejaVuSans-20\"/><use x=\"593.611328\" xlink:href=\"#DejaVuSans-2b\"/><use x=\"677.400391\" xlink:href=\"#DejaVuSans-20\"/><use x=\"709.1875\" xlink:href=\"#DejaVuSans-49\"/><use x=\"738.679688\" xlink:href=\"#DejaVuSans-5a\"/><use x=\"807.185547\" xlink:href=\"#DejaVuSans-5a\"/><use x=\"875.691406\" xlink:href=\"#DejaVuSans-29\"/><use x=\"914.705078\" xlink:href=\"#DejaVuSans-29\"/></g></g><defs><clipPath id=\"57db765eb94\"><rect x=\"7.2\" y=\"7.2\" width=\"298.45\" height=\"157.6\"/></clipPath></defs></svg>"
|
||
],
|
||
"text/plain": [
|
||
"<Figure size 538.33x284.278 with 1 Axes>"
|
||
]
|
||
},
|
||
"execution_count": 6,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"from qiskit.circuit.library import PauliEvolutionGate\n",
|
||
"from qiskit.circuit import QuantumCircuit\n",
|
||
"from qiskit.quantum_info import SparsePauliOp\n",
|
||
"\n",
|
||
"\n",
|
||
"# Prepare an initial state with a Hadamard on the middle qubit\n",
|
||
"state = QuantumCircuit(3)\n",
|
||
"state.h(1)\n",
|
||
"\n",
|
||
"hamiltonian = SparsePauliOp([\"ZZI\", \"IZZ\"])\n",
|
||
"evolution = PauliEvolutionGate(hamiltonian, time=1)\n",
|
||
"\n",
|
||
"# Evolve state by appending the evolution gate\n",
|
||
"state.compose(evolution, inplace=True)\n",
|
||
"\n",
|
||
"state.draw(\"mpl\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "e2dad12f-535a-4f42-8ac4-dbfcfb5533cc",
|
||
"metadata": {},
|
||
"source": [
|
||
"Read the [`PauliEvolutionGate` API documentation](/api/qiskit/qiskit.circuit.library.PauliEvolutionGate)."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "0cf7122d-c3fe-41a6-936c-b3770b33f0f1",
|
||
"metadata": {},
|
||
"source": [
|
||
"## Benchmarking and complexity-theory circuits\n",
|
||
"\n",
|
||
"Benchmarking circuits give us a sense of how well our hardware is actually working, and complexity-theory circuits help us understand how difficult the problems we want to solve are.\n",
|
||
"\n",
|
||
"For example, the \"quantum volume\" benchmark measures how accurately a quantum computer executes a type of random quantum circuit. The score of the quantum computer increases with the size of the circuit it can reliably run. This takes into account all aspects of the computer, including qubit count, instruction fidelity, qubit connectivity, and the software stack transpiling and post-processing results. Read more about quantum volume in the original [quantum volume paper](https://arxiv.org/abs/1811.12926).\n",
|
||
"\n",
|
||
"The following code shows an example of a quantum volume circuit built in Qiskit that runs on four qubits (the `su4_` blocks are randomized two-qubit gates)."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 7,
|
||
"id": "9629a507-8191-409e-b895-fd0833c8fcd7",
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"image/svg+xml": [
|
||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg width=\"730.04pt\" height=\"218.36pt\" version=\"1.1\" viewBox=\"0 0 730.04 218.36\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"><defs><style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style></defs><path d=\"m0 218.36h730.04v-218.36h-730.04z\" fill=\"#ffffff\"/><path d=\"m64.609 44.283h653.59\" clip-path=\"url(#8fb275c92b1)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m64.609 90.637h653.59\" clip-path=\"url(#8fb275c92b1)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m64.609 136.99h653.59\" clip-path=\"url(#8fb275c92b1)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m64.609 183.35h653.59\" clip-path=\"url(#8fb275c92b1)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m59.974 21.106h-1158.8v231.77h1158.8z\" clip-path=\"url(#8fb275c92b1)\" fill=\"#ffffff\" stroke=\"#ffffff\" stroke-width=\"1.5\"/><path d=\"m82.455 152.06h60.724v-122.84h-60.724z\" clip-path=\"url(#8fb275c92b1)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m175.16 198.41h60.724v-122.84h-60.724z\" clip-path=\"url(#8fb275c92b1)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m267.87 198.41h60.724v-169.19h-60.724z\" clip-path=\"url(#8fb275c92b1)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m360.58 152.06h60.724v-76.484h-60.724z\" clip-path=\"url(#8fb275c92b1)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m453.29 105.7h60.724v-76.484h-60.724z\" clip-path=\"url(#8fb275c92b1)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m453.29 198.41h60.724v-76.484h-60.724z\" clip-path=\"url(#8fb275c92b1)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m546 152.06h60.724v-122.84h-60.724z\" clip-path=\"url(#8fb275c92b1)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m638.7 198.41h60.724v-122.84h-60.724z\" clip-path=\"url(#8fb275c92b1)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><g clip-path=\"url(#8fb275c92b1)\"><g transform=\"translate(37.301 48.734) scale(.1625 -.1625)\"><defs><path id=\"DejaVuSans-Oblique-71\" transform=\"scale(.015625)\" d=\"m2669 525q-231-303-546-460-314-156-695-156-531 0-833 358-301 358-301 986 0 506 186 978t533 847q225 244 517 375t614 131q387 0 637-153t363-462l100 525h578l-934-4813h-579l360 1844zm-1778 813q0-463 193-705 194-242 560-242 544 0 928 520t384 1264q0 450-199 689-198 239-569 239-272 0-504-127-231-126-403-370-181-256-286-600-104-343-104-668z\"/><path id=\"DejaVuSans-30\" transform=\"scale(.015625)\" d=\"m2034 4250q-487 0-733-480-245-479-245-1442 0-959 245-1439 246-480 733-480 491 0 736 480 246 480 246 1439 0 963-246 1442-245 480-736 480zm0 500q785 0 1199-621 414-620 414-1801 0-1178-414-1799-414-620-1199-620-784 0-1198 620-414 621-414 1799 0 1181 414 1801 414 621 1198 621z\"/></defs><use xlink:href=\"#DejaVuSans-Oblique-71\"/><use transform=\"translate(63.477 -16.406) scale(.7)\" xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#8fb275c92b1)\"><g transform=\"translate(37.301 95.088) scale(.1625 -.1625)\"><defs><path id=\"DejaVuSans-31\" transform=\"scale(.015625)\" d=\"m794 531h1031v3560l-1122-225v575l1116 225h631v-4135h1031v-531h-2687v531z\"/></defs><use xlink:href=\"#DejaVuSans-Oblique-71\"/><use transform=\"translate(63.477 -16.406) scale(.7)\" xlink:href=\"#DejaVuSans-31\"/></g></g><g clip-path=\"url(#8fb275c92b1)\"><g transform=\"translate(37.301 141.44) scale(.1625 -.1625)\"><defs><path id=\"DejaVuSans-32\" transform=\"scale(.015625)\" d=\"m1228 531h2203v-531h-2962v531q359 372 979 998 621 627 780 809 303 340 423 576 121 236 121 464 0 372-261 606-261 235-680 235-297 0-627-103-329-103-704-313v638q381 153 712 231 332 78 607 78 725 0 1156-363 431-362 431-968 0-288-108-546-107-257-392-607-78-91-497-524-418-433-1181-1211z\"/></defs><use xlink:href=\"#DejaVuSans-Oblique-71\"/><use transform=\"translate(63.477 -16.406) scale(.7)\" xlink:href=\"#DejaVuSans-32\"/></g></g><g clip-path=\"url(#8fb275c92b1)\"><g transform=\"translate(37.301 187.8) scale(.1625 -.1625)\"><defs><path id=\"DejaVuSans-33\" transform=\"scale(.015625)\" d=\"m2597 2516q453-97 707-404 255-306 255-756 0-690-475-1069-475-378-1350-378-293 0-604 58t-642 174v609q262-153 574-231 313-78 654-78 593 0 904 234t311 681q0 413-289 645-289 233-804 233h-544v519h569q465 0 712 186t247 536q0 359-255 551-254 193-729 193-260 0-557-57-297-56-653-174v562q360 100 674 150t592 50q719 0 1137-327 419-326 419-882 0-388-222-655t-631-370z\"/></defs><use xlink:href=\"#DejaVuSans-Oblique-71\"/><use transform=\"translate(63.477 -16.406) scale(.7)\" xlink:href=\"#DejaVuSans-33\"/></g></g><g clip-path=\"url(#8fb275c92b1)\"><g transform=\"translate(85.7 47.87) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#8fb275c92b1)\"><g transform=\"translate(85.7 140.58) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-31\"/></g></g><g clip-path=\"url(#8fb275c92b1)\"><g transform=\"translate(94.183 94.224) scale(.13 -.13)\" fill=\"#ffffff\"><defs><path id=\"DejaVuSans-55\" transform=\"scale(.015625)\" d=\"m556 4666h635v-2835q0-750 271-1080 272-329 882-329 606 0 878 329 272 330 272 1080v2835h634v-2913q0-912-452-1378-451-466-1332-466-885 0-1337 466-451 466-451 1378v2913z\"/><path id=\"DejaVuSans-6e\" transform=\"scale(.015625)\" d=\"m3513 2113v-2113h-575v2094q0 497-194 743-194 247-581 247-466 0-735-297-269-296-269-809v-1978h-578v3500h578v-544q207 316 486 472 280 156 646 156 603 0 912-373 310-373 310-1098z\"/><path id=\"DejaVuSans-69\" transform=\"scale(.015625)\" d=\"m603 3500h575v-3500h-575v3500zm0 1363h575v-729h-575v729z\"/><path id=\"DejaVuSans-74\" transform=\"scale(.015625)\" d=\"m1172 4494v-994h1184v-447h-1184v-1900q0-428 117-550t477-122h590v-481h-590q-666 0-919 248-253 249-253 905v1900h-422v447h422v994h578z\"/><path id=\"DejaVuSans-61\" transform=\"scale(.015625)\" d=\"m2194 1759q-697 0-966-159t-269-544q0-306 202-486 202-179 548-179 479 0 768 339t289 901v128h-572zm1147 238v-1997h-575v531q-197-318-491-470t-719-152q-537 0-855 302-317 302-317 808 0 590 395 890 396 300 1180 300h807v57q0 397-261 614t-733 217q-300 0-585-72-284-72-546-216v532q315 122 612 182 297 61 578 61 760 0 1135-394 375-393 375-1193z\"/><path id=\"DejaVuSans-72\" transform=\"scale(.015625)\" d=\"m2631 2963q-97 56-211 82-114 27-251 27-488 0-749-317t-261-911v-1844h-578v3500h578v-544q182 319 472 473 291 155 707 155 59 0 131-8 72-7 159-23l3-590z\"/><path id=\"DejaVuSans-79\" transform=\"scale(.015625)\" d=\"m2059-325q-243-625-475-815-231-191-618-191h-460v481h338q237 0 368 113 132 112 291 531l103 262-1415 3444h609l1094-2737 1094 2737h609l-1538-3825z\"/></defs><use xlink:href=\"#DejaVuSans-55\"/><use x=\"73.193359\" xlink:href=\"#DejaVuSans-6e\"/><use x=\"136.572266\" xlink:href=\"#DejaVuSans-69\"/><use x=\"164.355469\" xlink:href=\"#DejaVuSans-74\"/><use x=\"203.564453\" xlink:href=\"#DejaVuSans-61\"/><use x=\"264.84375\" xlink:href=\"#DejaVuSans-72\"/><use x=\"305.957031\" xlink:href=\"#DejaVuSans-79\"/></g></g><g clip-path=\"url(#8fb275c92b1)\"><g transform=\"translate(178.41 186.93) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#8fb275c92b1)\"><g transform=\"translate(178.41 94.224) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-31\"/></g></g><g clip-path=\"url(#8fb275c92b1)\"><g transform=\"translate(186.89 140.58) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-55\"/><use x=\"73.193359\" xlink:href=\"#DejaVuSans-6e\"/><use x=\"136.572266\" xlink:href=\"#DejaVuSans-69\"/><use x=\"164.355469\" xlink:href=\"#DejaVuSans-74\"/><use x=\"203.564453\" xlink:href=\"#DejaVuSans-61\"/><use x=\"264.84375\" xlink:href=\"#DejaVuSans-72\"/><use x=\"305.957031\" xlink:href=\"#DejaVuSans-79\"/></g></g><g clip-path=\"url(#8fb275c92b1)\"><g transform=\"translate(271.12 47.87) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#8fb275c92b1)\"><g transform=\"translate(271.12 186.93) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-31\"/></g></g><g clip-path=\"url(#8fb275c92b1)\"><g transform=\"translate(279.6 117.4) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-55\"/><use x=\"73.193359\" xlink:href=\"#DejaVuSans-6e\"/><use x=\"136.572266\" xlink:href=\"#DejaVuSans-69\"/><use x=\"164.355469\" xlink:href=\"#DejaVuSans-74\"/><use x=\"203.564453\" xlink:href=\"#DejaVuSans-61\"/><use x=\"264.84375\" xlink:href=\"#DejaVuSans-72\"/><use x=\"305.957031\" xlink:href=\"#DejaVuSans-79\"/></g></g><g clip-path=\"url(#8fb275c92b1)\"><g transform=\"translate(363.82 94.224) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#8fb275c92b1)\"><g transform=\"translate(363.82 140.58) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-31\"/></g></g><g clip-path=\"url(#8fb275c92b1)\"><g transform=\"translate(372.31 117.4) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-55\"/><use x=\"73.193359\" xlink:href=\"#DejaVuSans-6e\"/><use x=\"136.572266\" xlink:href=\"#DejaVuSans-69\"/><use x=\"164.355469\" xlink:href=\"#DejaVuSans-74\"/><use x=\"203.564453\" xlink:href=\"#DejaVuSans-61\"/><use x=\"264.84375\" xlink:href=\"#DejaVuSans-72\"/><use x=\"305.957031\" xlink:href=\"#DejaVuSans-79\"/></g></g><g clip-path=\"url(#8fb275c92b1)\"><g transform=\"translate(456.53 47.87) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#8fb275c92b1)\"><g transform=\"translate(456.53 94.224) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-31\"/></g></g><g clip-path=\"url(#8fb275c92b1)\"><g transform=\"translate(465.02 71.047) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-55\"/><use x=\"73.193359\" xlink:href=\"#DejaVuSans-6e\"/><use x=\"136.572266\" xlink:href=\"#DejaVuSans-69\"/><use x=\"164.355469\" xlink:href=\"#DejaVuSans-74\"/><use x=\"203.564453\" xlink:href=\"#DejaVuSans-61\"/><use x=\"264.84375\" xlink:href=\"#DejaVuSans-72\"/><use x=\"305.957031\" xlink:href=\"#DejaVuSans-79\"/></g></g><g clip-path=\"url(#8fb275c92b1)\"><g transform=\"translate(456.53 140.58) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#8fb275c92b1)\"><g transform=\"translate(456.53 186.93) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-31\"/></g></g><g clip-path=\"url(#8fb275c92b1)\"><g transform=\"translate(465.02 163.76) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-55\"/><use x=\"73.193359\" xlink:href=\"#DejaVuSans-6e\"/><use x=\"136.572266\" xlink:href=\"#DejaVuSans-69\"/><use x=\"164.355469\" xlink:href=\"#DejaVuSans-74\"/><use x=\"203.564453\" xlink:href=\"#DejaVuSans-61\"/><use x=\"264.84375\" xlink:href=\"#DejaVuSans-72\"/><use x=\"305.957031\" xlink:href=\"#DejaVuSans-79\"/></g></g><g clip-path=\"url(#8fb275c92b1)\"><g transform=\"translate(549.24 47.87) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#8fb275c92b1)\"><g transform=\"translate(549.24 140.58) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-31\"/></g></g><g clip-path=\"url(#8fb275c92b1)\"><g transform=\"translate(557.72 94.224) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-55\"/><use x=\"73.193359\" xlink:href=\"#DejaVuSans-6e\"/><use x=\"136.572266\" xlink:href=\"#DejaVuSans-69\"/><use x=\"164.355469\" xlink:href=\"#DejaVuSans-74\"/><use x=\"203.564453\" xlink:href=\"#DejaVuSans-61\"/><use x=\"264.84375\" xlink:href=\"#DejaVuSans-72\"/><use x=\"305.957031\" xlink:href=\"#DejaVuSans-79\"/></g></g><g clip-path=\"url(#8fb275c92b1)\"><g transform=\"translate(641.95 94.224) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#8fb275c92b1)\"><g transform=\"translate(641.95 186.93) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-31\"/></g></g><g clip-path=\"url(#8fb275c92b1)\"><g transform=\"translate(650.43 140.58) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-55\"/><use x=\"73.193359\" xlink:href=\"#DejaVuSans-6e\"/><use x=\"136.572266\" xlink:href=\"#DejaVuSans-69\"/><use x=\"164.355469\" xlink:href=\"#DejaVuSans-74\"/><use x=\"203.564453\" xlink:href=\"#DejaVuSans-61\"/><use x=\"264.84375\" xlink:href=\"#DejaVuSans-72\"/><use x=\"305.957031\" xlink:href=\"#DejaVuSans-79\"/></g></g><defs><clipPath id=\"8fb275c92b1\"><rect x=\"7.2\" y=\"7.2\" width=\"715.64\" height=\"203.96\"/></clipPath></defs></svg>"
|
||
],
|
||
"text/plain": [
|
||
"<Figure size 1290.83x367.889 with 1 Axes>"
|
||
]
|
||
},
|
||
"execution_count": 7,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"from qiskit.circuit.library import QuantumVolume\n",
|
||
"\n",
|
||
"QuantumVolume(4).decompose().draw(\"mpl\")"
|
||
]
|
||
},
|
||
{
|
||
"attachments": {},
|
||
"cell_type": "markdown",
|
||
"id": "908e4b4a-5edf-4390-82a0-e755050c2a37",
|
||
"metadata": {},
|
||
"source": [
|
||
"The circuit library also includes circuits believed to be hard to simulate classically, such as instantaneous quantum polynomial (IQP) circuits. These circuits sandwich certain diagonal gates (in the computational basis) between blocks of Hadamard gates.\n",
|
||
"\n",
|
||
"Other circuits include `GroverOperator` for use in Grover's algorithm, and the `FourierChecking` circuit for the Fourier checking problem. See these circuits in [Particular quantum circuits](/api/qiskit/circuit_library#particular-quantum-circuits) in the circuit library API documentation."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "58b1a7b8-c173-4de8-957a-ca5d58332073",
|
||
"metadata": {},
|
||
"source": [
|
||
"## Arithmetic circuits\n",
|
||
"\n",
|
||
"Arithmetic operations are classical functions, such as adding integers and bit-wise operations. These may be useful with algorithms such as amplitude estimation for finance applications, and in algorithms like the HHL algorithm, which solves linear systems of equations.\n",
|
||
"\n",
|
||
"As an example, let’s try adding two three-bit numbers using a \"ripple-carry\" circuit to perform in-place addition (`CDKMRippleCarryAdder`). This adder adds two numbers (we'll call them \"A\" and \"B\") and writes the result to the register that held B. In the following example, A=2 and B=3."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 8,
|
||
"id": "77555a5a-a81c-47b8-a9ae-3015d84adcf5",
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"image/svg+xml": [
|
||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg width=\"466.46pt\" height=\"450.13pt\" version=\"1.1\" viewBox=\"0 0 466.46 450.13\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"><defs><style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style></defs><path d=\"m0 450.13h466.46v-450.13h-466.46z\" fill=\"#ffffff\"/><path d=\"m79.157 44.283h375.47\" clip-path=\"url(#d7f8b105feb)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m79.157 90.637h375.47\" clip-path=\"url(#d7f8b105feb)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m79.157 136.99h375.47\" clip-path=\"url(#d7f8b105feb)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m79.157 183.35h375.47\" clip-path=\"url(#d7f8b105feb)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m79.157 229.7h375.47\" clip-path=\"url(#d7f8b105feb)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m79.157 276.05h375.47\" clip-path=\"url(#d7f8b105feb)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m79.157 322.41h375.47\" clip-path=\"url(#d7f8b105feb)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m79.157 368.76h375.47\" clip-path=\"url(#d7f8b105feb)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m88.428 419.75 4.6354-9.2708\" clip-path=\"url(#d7f8b105feb)\" fill=\"none\" stroke=\"#778899\" stroke-linecap=\"square\"/><path d=\"m79.157 413.61h375.47\" clip-path=\"url(#d7f8b105feb)\" fill=\"none\" stroke=\"#778899\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m79.157 416.62h375.47\" clip-path=\"url(#d7f8b105feb)\" fill=\"none\" stroke=\"#778899\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m329.93 404.57h12.052l-6.026 8.6914z\" clip-path=\"url(#d7f8b105feb)\" fill=\"#778899\"/><path d=\"m376.29 404.57h12.052l-6.026 8.6914z\" clip-path=\"url(#d7f8b105feb)\" fill=\"#778899\"/><path d=\"m422.64 404.57h12.052l-6.026 8.6914z\" clip-path=\"url(#d7f8b105feb)\" fill=\"#778899\"/><path d=\"m74.521 21.106h-1158.8v463.54h1158.8z\" clip-path=\"url(#d7f8b105feb)\" fill=\"#ffffff\" stroke=\"#ffffff\" stroke-width=\"1.5\"/><path d=\"m337.46 229.7v174.87\" clip-path=\"url(#d7f8b105feb)\" fill=\"none\" stroke=\"#778899\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m334.45 229.7v174.87\" clip-path=\"url(#d7f8b105feb)\" fill=\"none\" stroke=\"#778899\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m383.82 276.05v128.52\" clip-path=\"url(#d7f8b105feb)\" fill=\"none\" stroke=\"#778899\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m380.81 276.05v128.52\" clip-path=\"url(#d7f8b105feb)\" fill=\"none\" stroke=\"#778899\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m430.17 322.41v82.162\" clip-path=\"url(#d7f8b105feb)\" fill=\"none\" stroke=\"#778899\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m427.16 322.41v82.162\" clip-path=\"url(#d7f8b105feb)\" fill=\"none\" stroke=\"#778899\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m89.123 198.41h30.13v-122.84h-30.13z\" clip-path=\"url(#d7f8b105feb)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m89.123 337.47h30.13v-122.84h-30.13z\" clip-path=\"url(#d7f8b105feb)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m132.74 383.83h174.67v-354.61h-174.67z\" clip-path=\"url(#d7f8b105feb)\" fill=\"#9f1853\" stroke=\"#9f1853\" stroke-width=\"1.5\"/><path d=\"m320.89 244.76h30.13v-30.13h-30.13z\" clip-path=\"url(#d7f8b105feb)\" fill=\"#a8a8a8\" stroke=\"#a8a8a8\" stroke-width=\"1.5\"/><path d=\"m346.5 234.22c0-2.7958-1.1118-5.4799-3.0887-7.4568s-4.661-3.0887-7.4568-3.0887c-2.7958 0-5.4799 1.1118-7.4568 3.0887s-3.0887 4.661-3.0887 7.4568\" clip-path=\"url(#d7f8b105feb)\" fill=\"none\" stroke=\"#000000\" stroke-width=\"2\"/><path d=\"m335.96 234.22 10.546-10.546\" clip-path=\"url(#d7f8b105feb)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m367.25 291.12h30.13v-30.13h-30.13z\" clip-path=\"url(#d7f8b105feb)\" fill=\"#a8a8a8\" stroke=\"#a8a8a8\" stroke-width=\"1.5\"/><path d=\"m392.86 280.57c0-2.7958-1.1118-5.4799-3.0887-7.4568s-4.661-3.0887-7.4568-3.0887-5.4799 1.1118-7.4568 3.0887-3.0887 4.661-3.0887 7.4568\" clip-path=\"url(#d7f8b105feb)\" fill=\"none\" stroke=\"#000000\" stroke-width=\"2\"/><path d=\"m382.31 280.57 10.546-10.546\" clip-path=\"url(#d7f8b105feb)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><path d=\"m413.6 337.47h30.13v-30.13h-30.13z\" clip-path=\"url(#d7f8b105feb)\" fill=\"#a8a8a8\" stroke=\"#a8a8a8\" stroke-width=\"1.5\"/><path d=\"m439.21 326.93c0-2.7958-1.1118-5.4799-3.0887-7.4568-1.9769-1.9769-4.661-3.0887-7.4568-3.0887s-5.4799 1.1118-7.4568 3.0887c-1.9769 1.9769-3.0887 4.661-3.0887 7.4568\" clip-path=\"url(#d7f8b105feb)\" fill=\"none\" stroke=\"#000000\" stroke-width=\"2\"/><path d=\"m428.67 326.93 10.546-10.546\" clip-path=\"url(#d7f8b105feb)\" fill=\"none\" stroke=\"#000000\" stroke-linecap=\"square\" stroke-width=\"2\"/><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(45.998 48.767) scale(.1625 -.1625)\"><defs><path id=\"DejaVuSans-Oblique-63\" transform=\"scale(.015625)\" d=\"m3431 3366-115-569q-207 150-440 225-232 75-482 75-275 0-524-97-248-97-417-275-269-272-416-638-146-365-146-756 0-472 236-703t717-231q237 0 504 72 268 72 558 215l-109-568q-250-103-514-155t-542-52q-697 0-1072 348-375 349-375 996 0 544 195 1002t580 823q262 250 615 378 354 128 772 128 244 0 484-55 241-54 491-163z\"/><path id=\"DejaVuSans-Oblique-69\" transform=\"scale(.015625)\" d=\"m1172 4863h575l-141-729h-575l141 729zm-263-1363h575l-684-3500h-575l684 3500z\"/><path id=\"DejaVuSans-Oblique-6e\" transform=\"scale(.015625)\" d=\"m3566 2113-410-2113h-578l410 2091q28 147 43 259 16 113 16 178 0 263-166 409-165 147-462 147-463 0-797-308-334-307-438-835l-384-1941h-575l678 3500h575l-115-550q240 303 577 468 338 166 710 166 463 0 717-250 255-250 255-703 0-112-14-240t-42-278z\"/></defs><use transform=\"translate(0 .015625)\" xlink:href=\"#DejaVuSans-Oblique-63\"/><use transform=\"translate(54.98 .015625)\" xlink:href=\"#DejaVuSans-Oblique-69\"/><use transform=\"translate(82.764 .015625)\" xlink:href=\"#DejaVuSans-Oblique-6e\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(52.173 95.121) scale(.1625 -.1625)\"><defs><path id=\"DejaVuSans-Oblique-61\" transform=\"scale(.015625)\" d=\"m3438 1997-391-1997h-575l106 531q-253-312-577-467-323-155-720-155-447 0-733 273-285 274-285 702 0 613 489 969t1348 356h800l31 154q7 25 10 54 3 30 3 92 0 279-227 433-226 155-636 155-281 0-577-72-295-72-607-216l100 532q325 122 636 182 311 61 601 61 619 0 942-269 324-268 324-781 0-103-16-242-15-139-46-295zm-622-238h-575q-707 0-1046-189t-339-586q0-275 173-431 174-156 480-156 469 0 819 336t463 898l25 128z\"/><path id=\"DejaVuSans-30\" transform=\"scale(.015625)\" d=\"m2034 4250q-487 0-733-480-245-479-245-1442 0-959 245-1439 246-480 733-480 491 0 736 480 246 480 246 1439 0 963-246 1442-245 480-736 480zm0 500q785 0 1199-621 414-620 414-1801 0-1178-414-1799-414-620-1199-620-784 0-1198 620-414 621-414 1799 0 1181 414 1801 414 621 1198 621z\"/></defs><use xlink:href=\"#DejaVuSans-Oblique-61\"/><use transform=\"translate(61.279 -16.406) scale(.7)\" xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(52.173 141.48) scale(.1625 -.1625)\"><defs><path id=\"DejaVuSans-31\" transform=\"scale(.015625)\" d=\"m794 531h1031v3560l-1122-225v575l1116 225h631v-4135h1031v-531h-2687v531z\"/></defs><use xlink:href=\"#DejaVuSans-Oblique-61\"/><use transform=\"translate(61.279 -16.406) scale(.7)\" xlink:href=\"#DejaVuSans-31\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(52.173 187.83) scale(.1625 -.1625)\"><defs><path id=\"DejaVuSans-32\" transform=\"scale(.015625)\" d=\"m1228 531h2203v-531h-2962v531q359 372 979 998 621 627 780 809 303 340 423 576 121 236 121 464 0 372-261 606-261 235-680 235-297 0-627-103-329-103-704-313v638q381 153 712 231 332 78 607 78 725 0 1156-363 431-362 431-968 0-288-108-546-107-257-392-607-78-91-497-524-418-433-1181-1211z\"/></defs><use xlink:href=\"#DejaVuSans-Oblique-61\"/><use transform=\"translate(61.279 -16.406) scale(.7)\" xlink:href=\"#DejaVuSans-32\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(51.848 234.18) scale(.1625 -.1625)\"><defs><path id=\"DejaVuSans-Oblique-62\" transform=\"scale(.015625)\" d=\"m3169 2138q0 453-208 709t-573 256q-266 0-499-130-233-129-405-376-181-259-286-602-104-342-104-682 0-432 204-677 205-245 565-245 271 0 502 126 232 127 407 374 178 256 287 596 110 341 110 651zm-1788 831q213 287 533 451t670 164q538 0 855-363 317-362 317-980 0-507-186-982t-529-843q-225-244-519-376-294-131-616-131-340 0-590 156-250 157-407 466l-103-531h-575l947 4863h575l-372-1894z\"/></defs><use transform=\"translate(0 .015625)\" xlink:href=\"#DejaVuSans-Oblique-62\"/><use transform=\"translate(63.477 -16.391) scale(.7)\" xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(51.848 280.54) scale(.1625 -.1625)\"><use transform=\"translate(0 .015625)\" xlink:href=\"#DejaVuSans-Oblique-62\"/><use transform=\"translate(63.477 -16.391) scale(.7)\" xlink:href=\"#DejaVuSans-31\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(51.848 326.89) scale(.1625 -.1625)\"><use transform=\"translate(0 .015625)\" xlink:href=\"#DejaVuSans-Oblique-62\"/><use transform=\"translate(63.477 -16.391) scale(.7)\" xlink:href=\"#DejaVuSans-32\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(34.298 373.25) scale(.1625 -.1625)\"><defs><path id=\"DejaVuSans-Oblique-6f\" transform=\"scale(.015625)\" d=\"m1625-91q-616 0-974 380-357 380-357 1036 0 381 123 776 124 396 321 665 309 418 690 618t863 200q597 0 964-372 367-371 367-971 0-416-122-829-122-412-319-684-306-419-687-619t-869-200zm-734 1435q0-475 198-711 199-236 602-236 578 0 957 504 380 505 380 1280 0 453-203 684-203 232-597 232-325 0-578-152-253-151-453-461-147-231-227-528-79-297-79-612z\"/><path id=\"DejaVuSans-Oblique-75\" transform=\"scale(.015625)\" d=\"m428 1388 410 2112h578l-410-2091q-31-153-45-262t-14-181q0-266 162-412 163-145 460-145 462 0 799 312 338 313 441 842l385 1937h575l-678-3500h-575l115 550q-243-306-579-474-336-167-714-167-460 0-716 252t-256 702q0 93 15 234 16 141 47 291z\"/><path id=\"DejaVuSans-Oblique-74\" transform=\"scale(.015625)\" d=\"m2706 3500-87-447h-1147l-372-1900q-19-106-28-178t-9-112q0-200 120-291t386-91h581l-97-481h-550q-512 0-764 200-251 200-251 606 0 72 9 158t28 189l372 1900h-488l91 447h478l194 994h575l-191-994h1150z\"/></defs><use transform=\"translate(0 .78125)\" xlink:href=\"#DejaVuSans-Oblique-63\"/><use transform=\"translate(54.98 .78125)\" xlink:href=\"#DejaVuSans-Oblique-6f\"/><use transform=\"translate(116.16 .78125)\" xlink:href=\"#DejaVuSans-Oblique-75\"/><use transform=\"translate(179.54 .78125)\" xlink:href=\"#DejaVuSans-Oblique-74\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(83.792 408.32) scale(.104 -.104)\"><defs><path id=\"DejaVuSans-33\" transform=\"scale(.015625)\" d=\"m2597 2516q453-97 707-404 255-306 255-756 0-690-475-1069-475-378-1350-378-293 0-604 58t-642 174v609q262-153 574-231 313-78 654-78 593 0 904 234t311 681q0 413-289 645-289 233-804 233h-544v519h569q465 0 712 186t247 536q0 359-255 551-254 193-729 193-260 0-557-57-297-56-653-174v562q360 100 674 150t592 50q719 0 1137-327 419-326 419-882 0-388-222-655t-631-370z\"/></defs><use xlink:href=\"#DejaVuSans-33\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(50.612 419.6) scale(.1625 -.1625)\"><defs><path id=\"DejaVuSans-63\" transform=\"scale(.015625)\" d=\"m3122 3366v-538q-244 135-489 202t-495 67q-560 0-870-355-309-354-309-995t309-996q310-354 870-354 250 0 495 67t489 202v-532q-241-112-499-168-257-57-548-57-791 0-1257 497-465 497-465 1341 0 856 470 1346 471 491 1290 491 265 0 518-55 253-54 491-163z\"/></defs><use xlink:href=\"#DejaVuSans-63\"/><use x=\"54.980469\" xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(92.368 94.224) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(92.368 140.58) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-31\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(92.368 186.93) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-32\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(103.61 160.99) scale(.08 -.08)\" fill=\"#ffffff\"><defs><path id=\"DejaVuSans-5b\" transform=\"scale(.015625)\" d=\"m550 4863h1325v-447h-750v-4813h750v-447h-1325v5707z\"/><path id=\"DejaVuSans-5d\" transform=\"scale(.015625)\" d=\"m1947 4863v-5707h-1325v447h747v4813h-747v447h1325z\"/></defs><use transform=\"translate(0 .015625)\" xlink:href=\"#DejaVuSans-5b\"/><use transform=\"translate(39.014 .015625)\" xlink:href=\"#DejaVuSans-32\"/><use transform=\"translate(102.64 .015625)\" xlink:href=\"#DejaVuSans-5d\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(100.25 137.65) scale(.13 -.13)\" fill=\"#ffffff\"><defs><path id=\"DejaVuSans-7c\" transform=\"scale(.015625)\" d=\"m1344 4891v-6400h-531v6400h531z\"/><path id=\"DejaVuSans-Oblique-3c8\" transform=\"scale(.015625)\" d=\"m1591-78q-700 116-975 419-338 372-191 1131l394 2028h581l-391-2006q-109-572 110-810 194-206 572-250l593 3066h572l-593-3062q418 43 665 250 319 262 425 809l388 2003h581l-394-2025q-153-787-628-1131-428-310-1137-419l-244-1256h-572l244 1253z\"/><path id=\"DejaVuSans-27e9\" transform=\"scale(.015625)\" d=\"m1925 2006-881-2850h-531l881 2850-881 2850h531l881-2850z\"/></defs><use transform=\"translate(0 .57812)\" xlink:href=\"#DejaVuSans-7c\"/><use transform=\"translate(33.691 .57812)\" xlink:href=\"#DejaVuSans-Oblique-3c8\"/><use transform=\"translate(99.658 .57812)\" xlink:href=\"#DejaVuSans-27e9\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(92.368 233.29) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(92.368 279.64) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-31\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(92.368 325.99) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-32\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(103.61 300.05) scale(.08 -.08)\" fill=\"#ffffff\"><use transform=\"translate(0 .015625)\" xlink:href=\"#DejaVuSans-5b\"/><use transform=\"translate(39.014 .015625)\" xlink:href=\"#DejaVuSans-33\"/><use transform=\"translate(102.64 .015625)\" xlink:href=\"#DejaVuSans-5d\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(100.25 276.72) scale(.13 -.13)\" fill=\"#ffffff\"><use transform=\"translate(0 .57812)\" xlink:href=\"#DejaVuSans-7c\"/><use transform=\"translate(33.691 .57812)\" xlink:href=\"#DejaVuSans-Oblique-3c8\"/><use transform=\"translate(99.658 .57812)\" xlink:href=\"#DejaVuSans-27e9\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(135.98 47.87) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(135.98 94.224) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-31\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(135.98 140.58) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-32\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(135.98 186.93) scale(.13 -.13)\" fill=\"#ffffff\"><use xlink:href=\"#DejaVuSans-33\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(135.98 233.29) scale(.13 -.13)\" fill=\"#ffffff\"><defs><path id=\"DejaVuSans-34\" transform=\"scale(.015625)\" d=\"m2419 4116-1594-2491h1594v2491zm-166 550h794v-3041h666v-525h-666v-1100h-628v1100h-2106v609l1940 2957z\"/></defs><use xlink:href=\"#DejaVuSans-34\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(135.98 279.64) scale(.13 -.13)\" fill=\"#ffffff\"><defs><path id=\"DejaVuSans-35\" transform=\"scale(.015625)\" d=\"m691 4666h2478v-532h-1900v-1143q137 47 274 70 138 23 276 23 781 0 1237-428 457-428 457-1159 0-753-469-1171-469-417-1322-417-294 0-599 50-304 50-629 150v635q281-153 581-228t634-75q541 0 856 284 316 284 316 772 0 487-316 771-315 285-856 285-253 0-505-56-251-56-513-175v2344z\"/></defs><use xlink:href=\"#DejaVuSans-35\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(135.98 325.99) scale(.13 -.13)\" fill=\"#ffffff\"><defs><path id=\"DejaVuSans-36\" transform=\"scale(.015625)\" d=\"m2113 2584q-425 0-674-291-248-290-248-796 0-503 248-796 249-292 674-292t673 292q248 293 248 796 0 506-248 796-248 291-673 291zm1253 1979v-575q-238 112-480 171-242 60-480 60-625 0-955-422-329-422-376-1275 184 272 462 417 279 145 613 145 703 0 1111-427 408-426 408-1160 0-719-425-1154-425-434-1131-434-810 0-1238 620-428 621-428 1799 0 1106 525 1764t1409 658q238 0 480-47t505-140z\"/></defs><use xlink:href=\"#DejaVuSans-36\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(135.98 372.35) scale(.13 -.13)\" fill=\"#ffffff\"><defs><path id=\"DejaVuSans-37\" transform=\"scale(.015625)\" d=\"m525 4666h3e3v-269l-1694-4397h-659l1594 4134h-2241v532z\"/></defs><use xlink:href=\"#DejaVuSans-37\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(148.52 210.11) scale(.13 -.13)\" fill=\"#ffffff\"><defs><path id=\"DejaVuSans-43\" transform=\"scale(.015625)\" d=\"m4122 4306v-665q-319 297-680 443-361 147-767 147-800 0-1225-489t-425-1414q0-922 425-1411t1225-489q406 0 767 147t680 444v-660q-331-225-702-338-370-112-782-112-1060 0-1670 648-609 649-609 1771 0 1125 609 1773 610 649 1670 649 418 0 788-111 371-111 696-333z\"/><path id=\"DejaVuSans-44\" transform=\"scale(.015625)\" d=\"m1259 4147v-3628h763q966 0 1414 437 448 438 448 1382 0 937-448 1373t-1414 436h-763zm-631 519h1297q1356 0 1990-564 635-564 635-1764 0-1207-638-1773-637-565-1987-565h-1297v4666z\"/><path id=\"DejaVuSans-4b\" transform=\"scale(.015625)\" d=\"m628 4666h631v-1972l2094 1972h813l-2316-2175 2481-2491h-831l-2241 2247v-2247h-631v4666z\"/><path id=\"DejaVuSans-4d\" transform=\"scale(.015625)\" d=\"m628 4666h941l1190-3175 1197 3175h941v-4666h-616v4097l-1203-3200h-634l-1203 3200v-4097h-613v4666z\"/><path id=\"DejaVuSans-52\" transform=\"scale(.015625)\" d=\"m2841 2188q203-69 395-294t386-619l641-1275h-679l-596 1197q-232 469-449 622t-592 153h-688v-1972h-631v4666h1425q800 0 1194-335 394-334 394-1009 0-441-205-732-205-290-595-402zm-1582 1959v-1656h794q456 0 689 211t233 620-233 617-689 208h-794z\"/><path id=\"DejaVuSans-69\" transform=\"scale(.015625)\" d=\"m603 3500h575v-3500h-575v3500zm0 1363h575v-729h-575v729z\"/><path id=\"DejaVuSans-70\" transform=\"scale(.015625)\" d=\"m1159 525v-1856h-578v4831h578v-531q182 312 458 463 277 152 661 152 638 0 1036-506 399-506 399-1331t-399-1332q-398-506-1036-506-384 0-661 152-276 152-458 464zm1957 1222q0 634-261 995t-717 361q-457 0-718-361t-261-995 261-995 718-361q456 0 717 361t261 995z\"/><path id=\"DejaVuSans-6c\" transform=\"scale(.015625)\" d=\"m603 4863h575v-4863h-575v4863z\"/><path id=\"DejaVuSans-65\" transform=\"scale(.015625)\" d=\"m3597 1894v-281h-2644q38-594 358-905t892-311q331 0 642 81t618 244v-544q-310-131-635-200t-659-69q-838 0-1327 487-489 488-489 1320 0 859 464 1363 464 505 1252 505 706 0 1117-455 411-454 411-1235zm-575 169q-6 471-264 752-258 282-683 282-481 0-770-272t-333-766l2050 4z\"/><path id=\"DejaVuSans-61\" transform=\"scale(.015625)\" d=\"m2194 1759q-697 0-966-159t-269-544q0-306 202-486 202-179 548-179 479 0 768 339t289 901v128h-572zm1147 238v-1997h-575v531q-197-318-491-470t-719-152q-537 0-855 302-317 302-317 808 0 590 395 890 396 300 1180 300h807v57q0 397-261 614t-733 217q-300 0-585-72-284-72-546-216v532q315 122 612 182 297 61 578 61 760 0 1135-394 375-393 375-1193z\"/><path id=\"DejaVuSans-72\" transform=\"scale(.015625)\" d=\"m2631 2963q-97 56-211 82-114 27-251 27-488 0-749-317t-261-911v-1844h-578v3500h578v-544q182 319 472 473 291 155 707 155 59 0 131-8 72-7 159-23l3-590z\"/><path id=\"DejaVuSans-79\" transform=\"scale(.015625)\" d=\"m2059-325q-243-625-475-815-231-191-618-191h-460v481h338q237 0 368 113 132 112 291 531l103 262-1415 3444h609l1094-2737 1094 2737h609l-1538-3825z\"/><path id=\"DejaVuSans-41\" transform=\"scale(.015625)\" d=\"m2188 4044-857-2322h1716l-859 2322zm-357 622h716l1778-4666h-656l-425 1197h-2103l-425-1197h-666l1781 4666z\"/><path id=\"DejaVuSans-64\" transform=\"scale(.015625)\" d=\"m2906 2969v1894h575v-4863h-575v525q-181-312-458-464-276-152-664-152-634 0-1033 506-398 507-398 1332t398 1331q399 506 1033 506 388 0 664-152 277-151 458-463zm-1959-1222q0-634 261-995t717-361 718 361q263 361 263 995t-263 995q-262 361-718 361t-717-361-261-995z\"/></defs><use xlink:href=\"#DejaVuSans-43\"/><use x=\"69.824219\" xlink:href=\"#DejaVuSans-44\"/><use x=\"146.826172\" xlink:href=\"#DejaVuSans-4b\"/><use x=\"212.402344\" xlink:href=\"#DejaVuSans-4d\"/><use x=\"298.681641\" xlink:href=\"#DejaVuSans-52\"/><use x=\"368.164062\" xlink:href=\"#DejaVuSans-69\"/><use x=\"395.947266\" xlink:href=\"#DejaVuSans-70\"/><use x=\"459.423828\" xlink:href=\"#DejaVuSans-70\"/><use x=\"522.900391\" xlink:href=\"#DejaVuSans-6c\"/><use x=\"550.683594\" xlink:href=\"#DejaVuSans-65\"/><use x=\"612.207031\" xlink:href=\"#DejaVuSans-43\"/><use x=\"682.03125\" xlink:href=\"#DejaVuSans-61\"/><use x=\"743.310547\" xlink:href=\"#DejaVuSans-72\"/><use x=\"782.673828\" xlink:href=\"#DejaVuSans-72\"/><use x=\"823.787109\" xlink:href=\"#DejaVuSans-79\"/><use x=\"882.966797\" xlink:href=\"#DejaVuSans-41\"/><use x=\"949.625\" xlink:href=\"#DejaVuSans-64\"/><use x=\"1013.101562\" xlink:href=\"#DejaVuSans-64\"/><use x=\"1076.578125\" xlink:href=\"#DejaVuSans-65\"/><use x=\"1138.101562\" xlink:href=\"#DejaVuSans-72\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(347.55 408.32) scale(.104 -.104)\"><use xlink:href=\"#DejaVuSans-30\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(393.9 408.32) scale(.104 -.104)\"><use xlink:href=\"#DejaVuSans-31\"/></g></g><g clip-path=\"url(#d7f8b105feb)\"><g transform=\"translate(440.25 408.32) scale(.104 -.104)\"><use xlink:href=\"#DejaVuSans-32\"/></g></g><defs><clipPath id=\"d7f8b105feb\"><rect x=\"7.2\" y=\"7.2\" width=\"452.06\" height=\"435.73\"/></clipPath></defs></svg>"
|
||
],
|
||
"text/plain": [
|
||
"<Figure size 815.403x785.944 with 1 Axes>"
|
||
]
|
||
},
|
||
"execution_count": 8,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"from qiskit.circuit.library import CDKMRippleCarryAdder\n",
|
||
"from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister\n",
|
||
"\n",
|
||
"adder = CDKMRippleCarryAdder(3) # Adder of 3-bit numbers\n",
|
||
"\n",
|
||
"# Create the number A=2\n",
|
||
"reg_a = QuantumRegister(3, \"a\")\n",
|
||
"number_a = QuantumCircuit(reg_a)\n",
|
||
"number_a.initialize(2) # Number 2; |010>\n",
|
||
"\n",
|
||
"# Create the number B=3\n",
|
||
"reg_b = QuantumRegister(3, \"b\")\n",
|
||
"number_b = QuantumCircuit(reg_b)\n",
|
||
"number_b.initialize(3) # Number 3; |011>\n",
|
||
"\n",
|
||
"# Create a circuit to hold everything, including a classical register for\n",
|
||
"# the result\n",
|
||
"reg_result = ClassicalRegister(3)\n",
|
||
"circuit = QuantumCircuit(*adder.qregs, reg_result)\n",
|
||
"\n",
|
||
"# Compose number initializers with the adder. Adder stores the result to\n",
|
||
"# register B, so we'll measure those qubits.\n",
|
||
"circuit = (\n",
|
||
" circuit.compose(number_a, qubits=reg_a)\n",
|
||
" .compose(number_b, qubits=reg_b)\n",
|
||
" .compose(adder)\n",
|
||
")\n",
|
||
"circuit.measure(reg_b, reg_result)\n",
|
||
"circuit.draw(\"mpl\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "e8a8deee-ad46-42cd-844e-51d5541c3f65",
|
||
"metadata": {},
|
||
"source": [
|
||
"Simulating the circuit shows that it outputs `5` for all `1024` shots (i.e. is measured with probability `1.0`)."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 9,
|
||
"id": "ede21ca4-0358-4c83-9af5-63a1c67ae3cb",
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"name": "stdout",
|
||
"output_type": "stream",
|
||
"text": [
|
||
"Count data:\n",
|
||
" {5: 1024}\n"
|
||
]
|
||
}
|
||
],
|
||
"source": [
|
||
"from qiskit.primitives import StatevectorSampler\n",
|
||
"\n",
|
||
"result = StatevectorSampler().run([circuit]).result()\n",
|
||
"\n",
|
||
"print(f\"Count data:\\n {result[0].data.c0.get_int_counts()}\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "cbd99d49-eb5c-4cd5-bac2-528497b8405e",
|
||
"metadata": {},
|
||
"source": [
|
||
"See [Arithmetic circuits](/api/qiskit/circuit_library#arithmetic-circuits) in the circuit library API documentation."
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"id": "9a900a84-c52f-4a03-b3e9-87c71fa93e88",
|
||
"metadata": {},
|
||
"source": [
|
||
"## Next steps\n",
|
||
"\n",
|
||
"<Admonition type=\"tip\" title=\"Recommendations\">\n",
|
||
" - Learn advanced methods for creating circuits in the [Construct circuits](./construct-circuits) topic.\n",
|
||
" - See an example of circuits being used in the [Grover's Algorithm](https://learning.quantum.ibm.com/tutorial/grovers-algorithm) tutorial.\n",
|
||
" - Review the [circuit library API](/api/qiskit/circuit_library) reference.\n",
|
||
"</Admonition>"
|
||
]
|
||
}
|
||
],
|
||
"metadata": {
|
||
"description": "Read more about out-of-the-box circuits provided by the Qiskit circuit library, including N-local, time-evolution and data-encoding circuits",
|
||
"kernelspec": {
|
||
"display_name": "Python 3",
|
||
"language": "python",
|
||
"name": "python3"
|
||
},
|
||
"language_info": {
|
||
"codemirror_mode": {
|
||
"name": "ipython",
|
||
"version": 3
|
||
},
|
||
"file_extension": ".py",
|
||
"mimetype": "text/x-python",
|
||
"name": "python",
|
||
"nbconvert_exporter": "python",
|
||
"pygments_lexer": "ipython3",
|
||
"version": "3"
|
||
},
|
||
"title": "Circuit library"
|
||
},
|
||
"nbformat": 4,
|
||
"nbformat_minor": 5
|
||
}
|