diff --git a/examples/Quantinuum_compile_without_api.ipynb b/examples/Quantinuum_compile_without_api.ipynb index f0534381..19ad6751 100644 --- a/examples/Quantinuum_compile_without_api.ipynb +++ b/examples/Quantinuum_compile_without_api.ipynb @@ -1 +1 @@ -{"cells": [{"cell_type": "markdown", "metadata": {}, "source": ["

\n", "
"]}, {"cell_type": "markdown", "metadata": {}, "source": ["# Compiling for Quantinuum Hardware without Querying Quantinuum API"]}, {"cell_type": "markdown", "metadata": {}, "source": ["This notebook contains an example of how to investigate circuits compiled for Quantinuum hardware without logging in or submitting to Quantinuum hardware. This may be useful if it is desired to explore circuit compilation in depth before submitting."]}, {"cell_type": "markdown", "metadata": {}, "source": ["## Circuit Preparation "]}, {"cell_type": "markdown", "metadata": {}, "source": ["Create your circuit."]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["from pytket.circuit import Circuit, OpType\n", "from pytket.circuit.display import render_circuit_jupyter"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["circuit = Circuit(2, name=\"Bell Test\")\n", "circuit.H(0)\n", "circuit.CX(0, 1)\n", "circuit.measure_all()"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["render_circuit_jupyter(circuit)"]}, {"cell_type": "markdown", "metadata": {}, "source": ["## Set up Backend"]}, {"cell_type": "markdown", "metadata": {}, "source": ["Set up a `QuantinuumBackend` object. The difference is the `machine_debug` option uses the default `pytket-quantinuum` options such as pytket's version of the Quantinuum native gate set rather than querying the Quantinuum API for this information."]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["from pytket.extensions.quantinuum import QuantinuumBackend"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["machine = \"H1-1E\"\n", "backend = QuantinuumBackend(device_name=machine, machine_debug=True)"]}, {"cell_type": "markdown", "metadata": {}, "source": ["## Investigate Native Gate Set"]}, {"cell_type": "markdown", "metadata": {}, "source": ["Users can view the hard-coded native gate set for the Quantinuum backend using the following command."]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["import pytket.extensions.quantinuum.backends.quantinuum as qtm"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["print(qtm._GATE_SET)"]}, {"cell_type": "markdown", "metadata": {}, "source": ["### Circuit Compilation "]}, {"cell_type": "markdown", "metadata": {}, "source": ["Circuits can now be compiled with the `get_compiled_circuit` function without querying the Quantinuum API."]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["compiled_circuit = backend.get_compiled_circuit(circuit, optimisation_level=2)"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["render_circuit_jupyter(compiled_circuit)"]}, {"cell_type": "markdown", "metadata": {}, "source": ["
© 2024 by Quantinuum. All Rights Reserved.
"]}], "metadata": {"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.6.4"}}, "nbformat": 4, "nbformat_minor": 2} \ No newline at end of file +{"cells": [{"cell_type": "markdown", "metadata": {}, "source": ["

\n", "
"]}, {"cell_type": "markdown", "metadata": {}, "source": ["# Compiling for Quantinuum Hardware without Querying Quantinuum API"]}, {"cell_type": "markdown", "metadata": {}, "source": ["This notebook contains an example of how to investigate circuits compiled for Quantinuum hardware without logging in or submitting to Quantinuum hardware. This may be useful if it is desired to explore circuit compilation in depth before submitting."]}, {"cell_type": "markdown", "metadata": {}, "source": ["## Circuit Preparation "]}, {"cell_type": "markdown", "metadata": {}, "source": ["Create your circuit."]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["from pytket.circuit import Circuit, OpType\n", "from pytket.circuit.display import render_circuit_jupyter"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["circuit = Circuit(2, name=\"Bell Test\")\n", "circuit.H(0)\n", "circuit.CX(0, 1)\n", "circuit.measure_all()"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["render_circuit_jupyter(circuit)"]}, {"cell_type": "markdown", "metadata": {}, "source": ["## Set up Backend"]}, {"cell_type": "markdown", "metadata": {}, "source": ["Set up a `QuantinuumBackend` object. The difference is the `machine_debug` option uses the default `pytket-quantinuum` options such as pytket's version of the Quantinuum native gate set rather than querying the Quantinuum API for this information."]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["from pytket.extensions.quantinuum import QuantinuumBackend"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["machine = \"H1-1E\"\n", "backend = QuantinuumBackend(device_name=machine, machine_debug=True)"]}, {"cell_type": "markdown", "metadata": {}, "source": ["## Investigate Native Gate Set"]}, {"cell_type": "markdown", "metadata": {}, "source": ["Users can view the hard-coded native gate set for the Quantinuum backend using the following command."]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["import pytket.extensions.quantinuum.backends.quantinuum as qtm"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["print(qtm._ALL_GATES)"]}, {"cell_type": "markdown", "metadata": {}, "source": ["### Circuit Compilation "]}, {"cell_type": "markdown", "metadata": {}, "source": ["Circuits can now be compiled with the `get_compiled_circuit` function without querying the Quantinuum API."]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["compiled_circuit = backend.get_compiled_circuit(circuit, optimisation_level=2)"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["render_circuit_jupyter(compiled_circuit)"]}, {"cell_type": "markdown", "metadata": {}, "source": ["
© 2024 by Quantinuum. All Rights Reserved.
"]}], "metadata": {"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.6.4"}}, "nbformat": 4, "nbformat_minor": 2}