diff --git a/MQT_Qudits_Tutorial/2dqed.png b/MQT_Qudits_Tutorial/2dqed.png deleted file mode 100644 index d3f2e8e..0000000 Binary files a/MQT_Qudits_Tutorial/2dqed.png and /dev/null differ diff --git a/MQT_Qudits_Tutorial/MQT Qudits Tutorial-checkpoint.ipynb b/MQT_Qudits_Tutorial/MQT Qudits Tutorial-checkpoint.ipynb deleted file mode 100644 index cecb124..0000000 --- a/MQT_Qudits_Tutorial/MQT Qudits Tutorial-checkpoint.ipynb +++ /dev/null @@ -1,827 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "53702878", - "metadata": {}, - "source": [ - "# MQT Qudits 🌌\n", - "*Discover a New Dimension in Quantum Computing*\n", - "\n", - "Embark on a journey with MQT Qudits, a cutting-edge toolkit for Mixed-Dimensional Quantum Computing.\n", - "\n", - "
\n", - "

Delve into the realm of mixed-dimensional quantum computing with NeQSTβ€”a project funded by the European Union and developed at the Chair for Design Automation at the Technical University of Munich, as part of the Munich Quantum Toolkit.

Our team is focused on creating design automation methods and software for quDit-based systems. Explore our Jupyter file to discover the initial tools and contributions we've made to advance Quantum Information Processing for Science and Technology.\n", - "\"Logo \n", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "id": "e3f8addb", - "metadata": {}, - "source": [ - "## Installation steps:\n", - "\n", - "#### mqt.qudits is available via PyPI for all major operating systems and supports Python 3.8 to 3.12.\n", - "\n", - "```\n", - "!pip install mqt.qudits\n", - "```\n" - ] - }, - { - "cell_type": "markdown", - "id": "bfe14179", - "metadata": {}, - "source": [ - "# User Inputs πŸ’»\n", - "\n", - "πŸš€ **New QASM Extension:**\n", - "Dive into a language meticulously designed to express quantum algorithms and circuits. MQT extends the openQASM 2.0 grammar, effortlessly adapting to registers that feature a harmonious mix of qudits and qubits in diverse combinations. \n", - "\n", - "🐍 **Python Interface** \n", - "\n", - "Constructing and manipulating quantum programs becomes a breeze with Python. You have the flexibility to:\n", - "\n", - "1. **Initialize Quantum Circuits:** Start by creating your quantum circuits effortlessly.\n", - "\n", - "2. **Create Quantum Registers:** Build dedicated quantum registers tailored to your needs.\n", - "\n", - "3. **Compose Circuits:** Seamlessly bring together your quantum registers, forming a unified and powerful circuit.\n", - "\n", - "4. **Apply Operations:** Easily apply a variety of qudit operations, without worrying about the right representation. \n", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "id": "08648c55", - "metadata": {}, - "source": [ - "\"2dqed.png\"" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c248f22a", - "metadata": {}, - "outputs": [], - "source": [ - "import numpy as np\n", - "\n", - "from mqt.qudits.quantum_circuit import QuantumCircuit" - ] - }, - { - "cell_type": "markdown", - "id": "2a47bfc3", - "metadata": {}, - "source": [ - "After the import of the quantum circuit object, it is possible starting from a __DITQASM__ program to automatically create a circuit and manipulate it, if not simulate it or compile it to a more suitable gate-set for the machine.\n", - "In the next cell the program is explicitly written, although several methods for importing programs from files are present in the library." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5274efd5", - "metadata": {}, - "outputs": [], - "source": [ - "qasm = \"\"\"\n", - " DITQASM 2.0;\n", - " \n", - " qreg field [7][5,5,5,5,5,5,5];\n", - " qreg matter [2];\n", - " \n", - " creg meas_matter[7];\n", - " creg meas_fields[3];\n", - " \n", - " h matter[0] ctl field[0] field[1] [0,0];\n", - " cx field[2], matter[0];\n", - " cx field[2], matter[1];\n", - " rxy (0, 1, pi, pi/2) field[3];\n", - " \n", - " measure q[0] -> meas[0];\n", - " measure q[1] -> meas[1];\n", - " measure q[2] -> meas[2];\n", - " \"\"\"" - ] - }, - { - "cell_type": "markdown", - "id": "e718e589", - "metadata": {}, - "source": [ - "A new feature is the __control syntax__: _operation_ __ctl__ _quditline_ \\[list of qudit control levels\\]\n", - "
\n", - "We can import the QASM program and construct a quantum circuit.\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "356d82c2", - "metadata": {}, - "outputs": [], - "source": [ - "circuit = QuantumCircuit()\n", - "circuit.from_qasm(qasm)\n", - "\n", - "print(f\"\\n Number of operations: {len(circuit.instructions)}, \\n Number of qudits in the circuit: {circuit.num_qudits}\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4d2b2cf2", - "metadata": {}, - "outputs": [], - "source": [ - "circuit.dimensions" - ] - }, - { - "cell_type": "markdown", - "id": "101de68e", - "metadata": {}, - "source": [ - "##### Let's construct a quantum circuit from scratch, with the python interface.\n", - "
" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "9a283781", - "metadata": {}, - "outputs": [], - "source": [ - "from mqt.qudits.quantum_circuit.components.quantum_register import QuantumRegister\n", - "\n", - "circuit = QuantumCircuit()\n", - "\n", - "field_reg = QuantumRegister(\"fields\", 1, [7])\n", - "matter_reg = QuantumRegister(\"matter\", 1, [2])\n", - "\n", - "circuit.append(field_reg)\n", - "circuit.append(matter_reg)\n", - "\n", - "print(f\"\\n Number of operations: {len(circuit.instructions)}, \\n Number of qudits in the circuit: {circuit.num_qudits}\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "192d09b0", - "metadata": {}, - "outputs": [], - "source": [ - "circuit.gate_set" - ] - }, - { - "cell_type": "markdown", - "id": "a23644c5", - "metadata": {}, - "source": [ - "##### No operations were inserted yet, let's take a look at how operations can be applied!" - ] - }, - { - "cell_type": "markdown", - "id": "2dd17aed", - "metadata": {}, - "source": [ - "The size of every line is detected automatically and the right operations are applied to the right qudits" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "0ed0c548", - "metadata": {}, - "outputs": [], - "source": [ - "h = circuit.h(field_reg[0])" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "22bd7e9b", - "metadata": {}, - "outputs": [], - "source": [ - "csum = circuit.csum([field_reg[0], matter_reg[0]])" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "bc8489ec", - "metadata": {}, - "outputs": [], - "source": [ - "print(f\"\\n Number of operations: {len(circuit.instructions)}, \\n Number of qudits in the circuit: {circuit.num_qudits}\")" - ] - }, - { - "cell_type": "markdown", - "id": "52b43bbf", - "metadata": {}, - "source": [ - "\n", - "##### It is possible to export the code as well and share your program in a QASM file.\n", - "
" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "b79ad7c3", - "metadata": {}, - "outputs": [], - "source": [ - "print(circuit.to_qasm())" - ] - }, - { - "cell_type": "markdown", - "id": "e6c76f81", - "metadata": {}, - "source": [ - "#### Let's save the circuit to file" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "a6e17342", - "metadata": {}, - "outputs": [], - "source": [ - "circuit.save_to_file(\"my_circuit\", \"/home/k3vn/Desktop\")" - ] - }, - { - "cell_type": "markdown", - "id": "9e47c69a", - "metadata": {}, - "source": [ - "#### Load from file" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c6f66e02", - "metadata": {}, - "outputs": [], - "source": [ - "circuit.load_from_file(\"/home/k3vn/Desktop/my_circuit.qasm\")\n", - "\n", - "print(\"Program:\\n\\n\", circuit.to_qasm())\n", - "print(\"Dimensions: \", circuit.dimensions)" - ] - }, - { - "cell_type": "markdown", - "id": "4d59b4c7", - "metadata": {}, - "source": [ - "### Custom gates" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "cf9b9720", - "metadata": {}, - "outputs": [], - "source": [ - "n = 5\n", - "random_matrix = np.random.randn(n, n) + 1j * np.random.randn(n, n)\n", - "\n", - "Q, R = np.linalg.qr(random_matrix)\n", - "\n", - "unitary_matrix = Q\n", - "cu = circuit.cu_one(field_reg[0], unitary_matrix)" - ] - }, - { - "cell_type": "markdown", - "id": "25105c05", - "metadata": {}, - "source": [ - "##### Gates follow the order:\n", - "- target qudit/s : list or single number\n", - "- parameters lis with order lower level, upper level, control level, theta, phi\n", - "- control data" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f9dcf9b4", - "metadata": {}, - "outputs": [], - "source": [ - "r = circuit.r(field_reg[0], [0, 1, np.pi / 5, np.pi / 7])" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "43221ade", - "metadata": {}, - "outputs": [], - "source": [ - "from mqt.qudits.qudit_circuits.components.instructions.gate_extensions.controls import ControlData\n", - "\n", - "r_c1 = circuit.r(field_reg[0], [0, 1, np.pi / 5, np.pi / 7], ControlData([matter_reg[0]], [1]))" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "480417f5", - "metadata": {}, - "outputs": [], - "source": [ - "r_c2 = circuit.r(field_reg[0], [0, 1, np.pi / 5, np.pi / 7]).control([matter_reg[0]], [1])" - ] - }, - { - "cell_type": "markdown", - "id": "b2f8b1f6", - "metadata": {}, - "source": [ - "##### Representation of the matrix is dynamic:\n", - "- 0: no identities\n", - "- 1: identities in between long-range gates are introduced\n", - "- 2: full circuit unitary" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "20f638dc", - "metadata": {}, - "outputs": [], - "source": [ - "print(r._name)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "effbb9a5", - "metadata": {}, - "outputs": [], - "source": [ - "r.to_matrix()" - ] - }, - { - "cell_type": "markdown", - "id": "a030d94b", - "metadata": {}, - "source": [ - "##### you can dagger a gate anytime\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "720bb90b", - "metadata": {}, - "outputs": [], - "source": [ - "rd = r.dag()\n", - "print(rd._name)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f42f7ec4", - "metadata": {}, - "outputs": [], - "source": [ - "rd.to_matrix()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "8695a95e", - "metadata": {}, - "outputs": [], - "source": [ - "r_c1.control_info" - ] - }, - { - "cell_type": "markdown", - "id": "b74cc7f8", - "metadata": {}, - "source": [ - "##### Two and Multi qudits gates follow the rule:\n", - "- two : target_qudits first is control, second is target\n", - "- multi: all are controls, except last one is target" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "bc118b90", - "metadata": {}, - "outputs": [], - "source": [ - "r_c1.reference_lines" - ] - }, - { - "cell_type": "markdown", - "id": "d67f883c", - "metadata": {}, - "source": [ - "# Simulation πŸš€\n", - "\n", - "After crafting your quantum circuit with precision, take it for a spin using two distinct engines, each flaunting its unique set of data structures.\n", - "\n", - "- **External Tensor-Network Simulator:** Delve into the quantum realm with a robust external tensor-network simulator. Can simulate all the gate-set.\n", - "\n", - "- **MiSiM (C++-Powered):** Unleash the power of decision-diagram-based simulation with MiSiM, seamlessly interfaced with Python for a fluid and efficient experience. πŸŒπŸ’‘ Can simulate only the machine set." - ] - }, - { - "cell_type": "markdown", - "id": "13fa1ac7", - "metadata": {}, - "source": [ - "#### Supported by MISIM now:\n", - "csum\n", - "cx\n", - "h\n", - "rxy\n", - "rz\n", - "virtrz\n", - "s\n", - "x\n", - "z\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "39904844", - "metadata": {}, - "outputs": [], - "source": [ - "from mqt.qudits.quantum_circuit.components.quantum_register import QuantumRegister\n", - "\n", - "circuit = QuantumCircuit()\n", - "\n", - "field_reg = QuantumRegister(\"fields\", 1, [3])\n", - "matter_reg = QuantumRegister(\"matter\", 1, [3])\n", - "\n", - "circuit.append(field_reg)\n", - "circuit.append(matter_reg)\n", - "\n", - "h = circuit.h(field_reg[0])\n", - "csum = circuit.csum([field_reg[0], matter_reg[0]])\n", - "\n", - "print(f\"\\n Number of operations: {len(circuit.instructions)}, \\n Number of qudits in the circuit: {circuit.num_qudits}\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "13be385f", - "metadata": {}, - "outputs": [], - "source": [ - "from mqt.qudits.simulation import MQTQuditProvider\n", - "\n", - "provider = MQTQuditProvider()\n", - "provider.backends(\"sim\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "ab6d2c80", - "metadata": {}, - "outputs": [], - "source": [ - "from mqt.qudits.visualisation.plot_information import plot_counts, plot_state\n", - "\n", - "backend = provider.get_backend(\"tnsim\")\n", - "\n", - "job = backend.run(circuit)\n", - "result = job.result()\n", - "\n", - "state_vector = result.get_state_vector()\n", - "\n", - "plot_state(state_vector, circuit)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "e18653e8", - "metadata": {}, - "outputs": [], - "source": [ - "backend = provider.get_backend(\"misim\")\n", - "\n", - "job = backend.run(circuit)\n", - "result = job.result()\n", - "\n", - "state_vector = result.get_state_vector()\n", - "\n", - "plot_state(state_vector, circuit)" - ] - }, - { - "cell_type": "markdown", - "id": "63baa60f", - "metadata": {}, - "source": [ - "### Extending Engines with Noise Model and Properties for FakeBackend\n", - "\n", - "Enhance your quantum simulation experience by extending the engines with a noise model and incorporating various properties. This process allows you to create a FakeBackend, inspired by the best machines in experimental laboratories.\n", - "\n", - "#### Noise Model Integration\n", - "\n", - "Introduce realism into your simulations by incorporating a noise model. Simulate the effects of environmental factors and imperfections, bringing your quantum algorithms closer to real-world scenarios.\n", - "\n", - "\n", - "#### Creating a FakeBackend\n", - "\n", - "By combining a noise model and carefully tuned properties, you can craft a FakeBackend that closely emulates the performance of the best quantum machines in experimental laboratories. This allows for more realistic and insightful quantum simulations.\n", - "\n", - "Experiment, iterate, and simulate quantum circuits with the sophistication of real-world conditions, all within the controlled environment of your simulation. πŸ› οΈπŸ”¬\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "7ddd23dc", - "metadata": {}, - "outputs": [], - "source": [ - "from mqt.qudits.simulation.noise_tools import Noise, NoiseModel\n", - "\n", - "# Depolarizing quantum errors\n", - "local_error = Noise(probability_depolarizing=0.001, probability_dephasing=0.001)\n", - "local_error_rz = Noise(probability_depolarizing=0.03, probability_dephasing=0.03)\n", - "\n", - "entangling_error = Noise(probability_depolarizing=0.1, probability_dephasing=0.001)\n", - "entangling_error_extra = Noise(probability_depolarizing=0.1, probability_dephasing=0.1)\n", - "\n", - "entangling_error_on_target = Noise(probability_depolarizing=0.1, probability_dephasing=0.0)\n", - "entangling_error_on_control = Noise(probability_depolarizing=0.01, probability_dephasing=0.0)\n", - "\n", - "# Add errors to noise_tools model\n", - "\n", - "noise_model = NoiseModel() # We know that the architecture is only two qudits\n", - "# Very noisy gate\n", - "noise_model.add_all_qudit_quantum_error(local_error, [\"csum\"])\n", - "noise_model.add_recurrent_quantum_error_locally(local_error, [\"csum\"], [0])\n", - "# Entangling gates\n", - "noise_model.add_nonlocal_quantum_error(entangling_error, [\"cx\", \"ls\", \"ms\"])\n", - "noise_model.add_nonlocal_quantum_error_on_target(entangling_error_on_target, [\"cx\", \"ls\", \"ms\"])\n", - "noise_model.add_nonlocal_quantum_error_on_control(entangling_error_on_control, [\"csum\", \"cx\", \"ls\", \"ms\"])\n", - "# Super noisy Entangling gates\n", - "noise_model.add_nonlocal_quantum_error(entangling_error_extra, [\"csum\"])\n", - "# Local Gates\n", - "noise_model.add_quantum_error_locally(local_error, [\"h\", \"rxy\", \"s\", \"x\", \"z\"])\n", - "noise_model.add_quantum_error_locally(local_error_rz, [\"rz\", \"virtrz\"])\n", - "\n", - "print(noise_model.quantum_errors)" - ] - }, - { - "cell_type": "markdown", - "id": "7e2effb3", - "metadata": {}, - "source": [ - "##### We can set the noise model for the simulation, but also set several other flags:\n", - "- shots : number of shots for the stochatsic simulation\n", - "- memory : flag for saving shots (True/False)\n", - "- full_state_memory: save the full noisy states \n", - "- file_path: file path of the h5 database storing the data#\n", - "- file_name" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "505715d1", - "metadata": {}, - "outputs": [], - "source": [ - "backend = provider.get_backend(\"tnsim\")\n", - "\n", - "job = backend.run(circuit, noise_model=noise_model)\n", - "\n", - "result = job.result()\n", - "counts = result.get_counts()\n", - "\n", - "plot_counts(counts, circuit)" - ] - }, - { - "cell_type": "markdown", - "id": "2a9ebf27", - "metadata": {}, - "source": [ - "## Fakebackends\n", - "#### You can invoke also a fake banckend a retrieve a few relevant properties, that already embedded in them" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f8a44ca3", - "metadata": {}, - "outputs": [], - "source": [ - "provider = MQTQuditProvider()\n", - "provider.backends(\"fake\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "3f8d02e3", - "metadata": {}, - "outputs": [], - "source": [ - "backend_ion = provider.get_backend(\"faketraps2trits\", shots=1000)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "792435eb", - "metadata": {}, - "outputs": [], - "source": [ - "import matplotlib.pyplot as plt\n", - "import networkx as nx\n", - "\n", - "mapping = backend_ion.energy_level_graphs\n", - "\n", - "pos = nx.circular_layout(mapping[0])\n", - "nx.draw(mapping[0], pos, with_labels=True, node_size=2000, node_color=\"lightblue\", font_size=12, font_weight=\"bold\")\n", - "plt.show()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "0d712293", - "metadata": {}, - "outputs": [], - "source": [ - "job = backend_ion.run(circuit)\n", - "result = job.result()\n", - "counts = result.get_counts()\n", - "\n", - "plot_counts(counts, circuit)" - ] - }, - { - "cell_type": "markdown", - "id": "0a132d35", - "metadata": {}, - "source": [ - "## Compilation βš™οΈ\n", - "\n", - "Tailor your quantum compilation process to achieve optimal performance and emulate the intricacies of experimental setups.\n", - "\n", - "#### Compiler Customization with Modern Passes\n", - "\n", - "1. **Optimization Strategies:** Implement specific optimization strategies based on your quantum algorithm's characteristics. Fine-tune compilation for better resource utilization and reduced gate counts.\n", - "\n", - "2. **Gate Decomposition:** Customize gate decomposition techniques to match the capabilities of experimental quantum hardware. Aligning with the native gate set enhances the efficiency of your compiled circuits.\n", - "\n", - "##### Experimental-Inspired Compilation\n", - "\n", - "Emulate the features of the best experimental laboratories in your compilation process. Leverage modern compiler passes to customize optimization, gate decomposition, and noise-aware strategies, creating compiled circuits that closely resemble the challenges and advantages of cutting-edge quantum hardware.\n", - "\n", - "Customize, compile, and push the boundaries of quantum algorithms with a tailored approach to quantum compilation. πŸ› οΈπŸ”§πŸš€\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "8e187e94", - "metadata": {}, - "outputs": [], - "source": [ - "from mqt.qudits.compiler.dit_manager import QuditCompiler" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "58daadf2", - "metadata": {}, - "outputs": [], - "source": [ - "qudit_compiler = QuditCompiler()\n", - "\n", - "passes = [\"PhyLocQRPass\"]" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "d21fe400", - "metadata": {}, - "outputs": [], - "source": [ - "compiled_circuit_qr = qudit_compiler.compile(backend_ion, circuit, passes)\n", - "\n", - "print(\n", - " f\"\\n Number of operations: {len(compiled_circuit_qr.instructions)}, \\n Number of qudits in the circuit: {compiled_circuit_qr.num_qudits}\"\n", - ")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "85b295ef", - "metadata": {}, - "outputs": [], - "source": [ - "job = backend_ion.run(compiled_circuit_qr)\n", - "\n", - "result = job.result()\n", - "counts = result.get_counts()\n", - "\n", - "plot_counts(counts, compiled_circuit_qr)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "a1b22b44", - "metadata": {}, - "outputs": [], - "source": [ - "passes = [\"PhyLocAdaPass\", \"ZPropagationPass\", \"ZRemovalPass\"]\n", - "\n", - "compiled_circuit_ada = qudit_compiler.compile(backend_ion, circuit, passes)\n", - "\n", - "print(\n", - " f\"\\n Number of operations: {len(compiled_circuit_ada.instructions)}, \\n Number of qudits in the circuit: {compiled_circuit_ada.num_qudits}\"\n", - ")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5a807930", - "metadata": {}, - "outputs": [], - "source": [ - "job = backend_ion.run(compiled_circuit_ada)\n", - "\n", - "result = job.result()\n", - "counts = result.get_counts()\n", - "\n", - "plot_counts(counts, compiled_circuit_ada)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "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" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/MQT_Qudits_Tutorial/MQT Qudits Tutorial.ipynb b/MQT_Qudits_Tutorial/MQT Qudits Tutorial.ipynb deleted file mode 100644 index c114e30..0000000 --- a/MQT_Qudits_Tutorial/MQT Qudits Tutorial.ipynb +++ /dev/null @@ -1,844 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "53702878", - "metadata": {}, - "source": [ - "# MQT Qudits 🌌\n", - "*Discover a New Dimension in Quantum Computing*\n", - "\n", - "Embark on a journey with MQT Qudits, a framework for Mixed-Dimensional Quantum Computing.\n", - "\n", - "
\n", - "Delve into the realm of mixed-dimensional quantum computing with NeQSTβ€”a project funded by the European Union \n", - "and developed at the Chair for Design Automation at \n", - "the Technical University of Munich, \n", - "as part of the Munich Quantum Toolkit.
\n", - "Our team is focused on creating design automation methods and software for quDit-based systems.\n", - "Explore our Jupyter file to discover the initial tools and contributions we've made to advance Quantum Information Processing for Science and Technology.\n", - "\n", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "id": "2fe4da30-157a-4f48-83e4-b5f395a5d443", - "metadata": {}, - "source": [ - "
\n", - " \"Logo\n", - "
\n" - ] - }, - { - "cell_type": "markdown", - "id": "e3f8addb", - "metadata": {}, - "source": [ - "## Installation steps:\n", - "\n", - "#### mqt.qudits is available via PyPI for all major operating systems and supports Python 3.8 to 3.12.\n", - "\n", - "```\n", - "!pip install mqt.qudits\n", - "```\n" - ] - }, - { - "cell_type": "markdown", - "id": "bfe14179", - "metadata": {}, - "source": [ - "# User Inputs πŸ’»\n", - "\n", - "πŸš€ **New QASM Extension:**\n", - "Dive into a language meticulously designed to express quantum algorithms and circuits. MQT extends the openQASM 2.0 grammar, effortlessly adapting to registers that feature a harmonious mix of qudits and qubits in diverse combinations. \n", - "\n", - "🐍 **Python Interface** \n", - "\n", - "Constructing and manipulating quantum programs becomes a breeze with Python. You have the flexibility to:\n", - "\n", - "1. **Initialize Quantum Circuits:** Start by creating your quantum circuits effortlessly.\n", - "\n", - "2. **Create Quantum Registers:** Build dedicated quantum registers tailored to your needs.\n", - "\n", - "3. **Compose Circuits:** Seamlessly bring together your quantum registers, forming a unified and powerful circuit.\n", - "\n", - "4. **Apply Operations:** Easily apply a variety of qudit operations, without worrying about the right representation. \n", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "id": "08648c55", - "metadata": {}, - "source": [ - "
\n", - " \"2dqed.png\"\n", - "
\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c248f22a", - "metadata": {}, - "outputs": [], - "source": [ - "import numpy as np\n", - "\n", - "from mqt.qudits.quantum_circuit import QuantumCircuit" - ] - }, - { - "cell_type": "markdown", - "id": "2a47bfc3", - "metadata": {}, - "source": [ - "After the import of the quantum circuit object, it is possible starting from a __DITQASM__ program to automatically create a circuit and manipulate it, if not simulate it or compile it to a more suitable gate-set for the machine.\n", - "In the next cell the program is explicitly written, although several methods for importing programs from files are present in the library." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5274efd5", - "metadata": {}, - "outputs": [], - "source": [ - "qasm = \"\"\"\n", - " DITQASM 2.0;\n", - " \n", - " qreg field [7][5,5,5,5,5,5,5];\n", - " qreg matter [2];\n", - " \n", - " creg meas_matter[7];\n", - " creg meas_fields[3];\n", - " \n", - " h matter[0] ctl field[0] field[1] [0,0];\n", - " cx field[2], matter[0];\n", - " cx field[2], matter[1];\n", - " rxy (0, 1, pi, pi/2) field[3];\n", - " \n", - " measure q[0] -> meas[0];\n", - " measure q[1] -> meas[1];\n", - " measure q[2] -> meas[2];\n", - " \"\"\"" - ] - }, - { - "cell_type": "markdown", - "id": "e718e589", - "metadata": {}, - "source": [ - "A new feature is the __control syntax__: _operation_ __ctl__ _quditline_ \\[list of qudit control levels\\]\n", - "
\n", - "We can import the QASM program and construct a quantum circuit.\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "356d82c2", - "metadata": {}, - "outputs": [], - "source": [ - "circuit = QuantumCircuit()\n", - "circuit.from_qasm(qasm)\n", - "\n", - "print(f\"\\n Number of operations: {len(circuit.instructions)}, \\n Number of qudits in the circuit: {circuit.num_qudits}\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4d2b2cf2", - "metadata": {}, - "outputs": [], - "source": [ - "circuit.dimensions" - ] - }, - { - "cell_type": "markdown", - "id": "101de68e", - "metadata": {}, - "source": [ - "##### Let's construct a quantum circuit from scratch, with the python interface.\n", - "
" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "9a283781", - "metadata": {}, - "outputs": [], - "source": [ - "from mqt.qudits.quantum_circuit.components.quantum_register import QuantumRegister\n", - "\n", - "circuit = QuantumCircuit()\n", - "\n", - "field_reg = QuantumRegister(\"fields\", 1, [7])\n", - "matter_reg = QuantumRegister(\"matter\", 1, [2])\n", - "\n", - "circuit.append(field_reg)\n", - "circuit.append(matter_reg)\n", - "\n", - "print(f\"\\n Number of operations: {len(circuit.instructions)}, \\n Number of qudits in the circuit: {circuit.num_qudits}\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "192d09b0", - "metadata": {}, - "outputs": [], - "source": [ - "circuit.gate_set" - ] - }, - { - "cell_type": "markdown", - "id": "a23644c5", - "metadata": {}, - "source": [ - "##### No operations were inserted yet, let's take a look at how operations can be applied!" - ] - }, - { - "cell_type": "markdown", - "id": "2dd17aed", - "metadata": {}, - "source": [ - "The size of every line is detected automatically and the right operations are applied to the right qudits" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "0ed0c548", - "metadata": {}, - "outputs": [], - "source": [ - "h = circuit.h(field_reg[0])" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "22bd7e9b", - "metadata": {}, - "outputs": [], - "source": [ - "csum = circuit.csum([field_reg[0], matter_reg[0]])" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "bc8489ec", - "metadata": {}, - "outputs": [], - "source": [ - "print(f\"\\n Number of operations: {len(circuit.instructions)}, \\n Number of qudits in the circuit: {circuit.num_qudits}\")" - ] - }, - { - "cell_type": "markdown", - "id": "52b43bbf", - "metadata": {}, - "source": [ - "\n", - "##### It is possible to export the code as well and share your program in a QASM file.\n", - "
" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "b79ad7c3", - "metadata": {}, - "outputs": [], - "source": [ - "print(circuit.to_qasm())" - ] - }, - { - "cell_type": "markdown", - "id": "e6c76f81", - "metadata": {}, - "source": [ - "#### Let's save the circuit to file" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "a6e17342", - "metadata": {}, - "outputs": [], - "source": [ - "circuit.save_to_file(\"my_circuit\", \"/home/k3vn/Desktop\")" - ] - }, - { - "cell_type": "markdown", - "id": "9e47c69a", - "metadata": {}, - "source": [ - "#### Load from file" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c6f66e02", - "metadata": {}, - "outputs": [], - "source": [ - "circuit.load_from_file(\"/home/k3vn/Desktop/my_circuit.qasm\")\n", - "\n", - "print(\"Program:\\n\\n\", circuit.to_qasm())\n", - "print(\"Dimensions: \", circuit.dimensions)" - ] - }, - { - "cell_type": "markdown", - "id": "4d59b4c7", - "metadata": {}, - "source": [ - "### Custom gates" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "cf9b9720", - "metadata": {}, - "outputs": [], - "source": [ - "n = 5\n", - "random_matrix = np.random.randn(n, n) + 1j * np.random.randn(n, n)\n", - "\n", - "Q, R = np.linalg.qr(random_matrix)\n", - "\n", - "unitary_matrix = Q\n", - "cu = circuit.cu_one(field_reg[0], unitary_matrix)" - ] - }, - { - "cell_type": "markdown", - "id": "25105c05", - "metadata": {}, - "source": [ - "##### Gates follow the order:\n", - "- target qudit/s : list or single number\n", - "- parameters lis with order lower level, upper level, control level, theta, phi\n", - "- control data" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f9dcf9b4", - "metadata": {}, - "outputs": [], - "source": [ - "r = circuit.r(field_reg[0], [0, 1, np.pi / 5, np.pi / 7])" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "43221ade", - "metadata": {}, - "outputs": [], - "source": [ - "from mqt.qudits.qudit_circuits.components.instructions.gate_extensions.controls import ControlData\n", - "\n", - "r_c1 = circuit.r(field_reg[0], [0, 1, np.pi / 5, np.pi / 7], ControlData([matter_reg[0]], [1]))" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "480417f5", - "metadata": {}, - "outputs": [], - "source": [ - "r_c2 = circuit.r(field_reg[0], [0, 1, np.pi / 5, np.pi / 7]).control([matter_reg[0]], [1])" - ] - }, - { - "cell_type": "markdown", - "id": "b2f8b1f6", - "metadata": {}, - "source": [ - "##### Representation of the matrix is dynamic:\n", - "- 0: no identities\n", - "- 1: identities in between long-range gates are introduced\n", - "- 2: full circuit unitary" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "20f638dc", - "metadata": {}, - "outputs": [], - "source": [ - "print(r._name)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "effbb9a5", - "metadata": {}, - "outputs": [], - "source": [ - "r.to_matrix()" - ] - }, - { - "cell_type": "markdown", - "id": "a030d94b", - "metadata": {}, - "source": [ - "##### you can dagger a gate anytime\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "720bb90b", - "metadata": {}, - "outputs": [], - "source": [ - "rd = r.dag()\n", - "print(rd._name)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f42f7ec4", - "metadata": {}, - "outputs": [], - "source": [ - "rd.to_matrix()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "8695a95e", - "metadata": {}, - "outputs": [], - "source": [ - "r_c1.control_info" - ] - }, - { - "cell_type": "markdown", - "id": "b74cc7f8", - "metadata": {}, - "source": [ - "##### Two and Multi qudits gates follow the rule:\n", - "- two : target_qudits first is control, second is target\n", - "- multi: all are controls, except last one is target" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "bc118b90", - "metadata": {}, - "outputs": [], - "source": [ - "r_c1.reference_lines" - ] - }, - { - "cell_type": "markdown", - "id": "d67f883c", - "metadata": {}, - "source": [ - "# Simulation πŸš€\n", - "\n", - "After crafting your quantum circuit with precision, take it for a spin using two distinct engines, each flaunting its unique set of data structures.\n", - "\n", - "- **External Tensor-Network Simulator:** Delve into the quantum realm with a robust external tensor-network simulator. Can simulate all the gate-set.\n", - "\n", - "- **MiSiM (C++-Powered):** Unleash the power of decision-diagram-based simulation with MiSiM, seamlessly interfaced with Python for a fluid and efficient experience. πŸŒπŸ’‘ Can simulate only the machine set." - ] - }, - { - "cell_type": "markdown", - "id": "13fa1ac7", - "metadata": {}, - "source": [ - "#### Supported by MISIM now:\n", - "csum\n", - "cx\n", - "h\n", - "rxy\n", - "rz\n", - "virtrz\n", - "s\n", - "x\n", - "z\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "39904844", - "metadata": {}, - "outputs": [], - "source": [ - "from mqt.qudits.quantum_circuit.components.quantum_register import QuantumRegister\n", - "\n", - "circuit = QuantumCircuit()\n", - "\n", - "field_reg = QuantumRegister(\"fields\", 1, [3])\n", - "matter_reg = QuantumRegister(\"matter\", 1, [3])\n", - "\n", - "circuit.append(field_reg)\n", - "circuit.append(matter_reg)\n", - "\n", - "h = circuit.h(field_reg[0])\n", - "csum = circuit.csum([field_reg[0], matter_reg[0]])\n", - "\n", - "print(f\"\\n Number of operations: {len(circuit.instructions)}, \\n Number of qudits in the circuit: {circuit.num_qudits}\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "13be385f", - "metadata": {}, - "outputs": [], - "source": [ - "from mqt.qudits.simulation import MQTQuditProvider\n", - "\n", - "provider = MQTQuditProvider()\n", - "provider.backends(\"sim\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "ab6d2c80", - "metadata": {}, - "outputs": [], - "source": [ - "from mqt.qudits.visualisation.plot_information import plot_counts, plot_state\n", - "\n", - "backend = provider.get_backend(\"tnsim\")\n", - "\n", - "job = backend.run(circuit)\n", - "result = job.result()\n", - "\n", - "state_vector = result.get_state_vector()\n", - "\n", - "plot_state(state_vector, circuit)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "e18653e8", - "metadata": {}, - "outputs": [], - "source": [ - "backend = provider.get_backend(\"misim\")\n", - "\n", - "job = backend.run(circuit)\n", - "result = job.result()\n", - "\n", - "state_vector = result.get_state_vector()\n", - "\n", - "plot_state(state_vector, circuit)" - ] - }, - { - "cell_type": "markdown", - "id": "63baa60f", - "metadata": {}, - "source": [ - "### Extending Engines with Noise Model and Properties for FakeBackend\n", - "\n", - "Enhance your quantum simulation experience by extending the engines with a noise model and incorporating various properties. This process allows you to create a FakeBackend, inspired by the best machines in experimental laboratories.\n", - "\n", - "#### Noise Model Integration\n", - "\n", - "Introduce realism into your simulations by incorporating a noise model. Simulate the effects of environmental factors and imperfections, bringing your quantum algorithms closer to real-world scenarios.\n", - "\n", - "\n", - "#### Creating a FakeBackend\n", - "\n", - "By combining a noise model and carefully tuned properties, you can craft a FakeBackend that closely emulates the performance of the best quantum machines in experimental laboratories. This allows for more realistic and insightful quantum simulations.\n", - "\n", - "Experiment, iterate, and simulate quantum circuits with the sophistication of real-world conditions, all within the controlled environment of your simulation. πŸ› οΈπŸ”¬\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "7ddd23dc", - "metadata": {}, - "outputs": [], - "source": [ - "from mqt.qudits.simulation.noise_tools import Noise, NoiseModel\n", - "\n", - "# Depolarizing quantum errors\n", - "local_error = Noise(probability_depolarizing=0.001, probability_dephasing=0.001)\n", - "local_error_rz = Noise(probability_depolarizing=0.03, probability_dephasing=0.03)\n", - "\n", - "entangling_error = Noise(probability_depolarizing=0.1, probability_dephasing=0.001)\n", - "entangling_error_extra = Noise(probability_depolarizing=0.1, probability_dephasing=0.1)\n", - "\n", - "entangling_error_on_target = Noise(probability_depolarizing=0.1, probability_dephasing=0.0)\n", - "entangling_error_on_control = Noise(probability_depolarizing=0.01, probability_dephasing=0.0)\n", - "\n", - "# Add errors to noise_tools model\n", - "\n", - "noise_model = NoiseModel() # We know that the architecture is only two qudits\n", - "# Very noisy gate\n", - "noise_model.add_all_qudit_quantum_error(local_error, [\"csum\"])\n", - "noise_model.add_recurrent_quantum_error_locally(local_error, [\"csum\"], [0])\n", - "# Entangling gates\n", - "noise_model.add_nonlocal_quantum_error(entangling_error, [\"cx\", \"ls\", \"ms\"])\n", - "noise_model.add_nonlocal_quantum_error_on_target(entangling_error_on_target, [\"cx\", \"ls\", \"ms\"])\n", - "noise_model.add_nonlocal_quantum_error_on_control(entangling_error_on_control, [\"csum\", \"cx\", \"ls\", \"ms\"])\n", - "# Super noisy Entangling gates\n", - "noise_model.add_nonlocal_quantum_error(entangling_error_extra, [\"csum\"])\n", - "# Local Gates\n", - "noise_model.add_quantum_error_locally(local_error, [\"h\", \"rxy\", \"s\", \"x\", \"z\"])\n", - "noise_model.add_quantum_error_locally(local_error_rz, [\"rz\", \"virtrz\"])\n", - "\n", - "print(noise_model.quantum_errors)" - ] - }, - { - "cell_type": "markdown", - "id": "7e2effb3", - "metadata": {}, - "source": [ - "##### We can set the noise model for the simulation, but also set several other flags:\n", - "- shots : number of shots for the stochatsic simulation\n", - "- memory : flag for saving shots (True/False)\n", - "- full_state_memory: save the full noisy states \n", - "- file_path: file path of the h5 database storing the data#\n", - "- file_name" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "505715d1", - "metadata": {}, - "outputs": [], - "source": [ - "backend = provider.get_backend(\"tnsim\")\n", - "\n", - "job = backend.run(circuit, noise_model=noise_model)\n", - "\n", - "result = job.result()\n", - "counts = result.get_counts()\n", - "\n", - "plot_counts(counts, circuit)" - ] - }, - { - "cell_type": "markdown", - "id": "2a9ebf27", - "metadata": {}, - "source": [ - "## Fakebackends\n", - "#### You can invoke also a fake banckend a retrieve a few relevant properties, that already embedded in them" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f8a44ca3", - "metadata": {}, - "outputs": [], - "source": [ - "provider = MQTQuditProvider()\n", - "provider.backends(\"fake\")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "3f8d02e3", - "metadata": {}, - "outputs": [], - "source": [ - "backend_ion = provider.get_backend(\"faketraps2trits\", shots=1000)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "792435eb", - "metadata": {}, - "outputs": [], - "source": [ - "import matplotlib.pyplot as plt\n", - "import networkx as nx\n", - "\n", - "mapping = backend_ion.energy_level_graphs\n", - "\n", - "pos = nx.circular_layout(mapping[0])\n", - "nx.draw(mapping[0], pos, with_labels=True, node_size=2000, node_color=\"lightblue\", font_size=12, font_weight=\"bold\")\n", - "plt.show()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "0d712293", - "metadata": {}, - "outputs": [], - "source": [ - "job = backend_ion.run(circuit)\n", - "result = job.result()\n", - "counts = result.get_counts()\n", - "\n", - "plot_counts(counts, circuit)" - ] - }, - { - "cell_type": "markdown", - "id": "0a132d35", - "metadata": {}, - "source": [ - "## Compilation βš™οΈ\n", - "\n", - "Tailor your quantum compilation process to achieve optimal performance and emulate the intricacies of experimental setups.\n", - "\n", - "#### Compiler Customization with Modern Passes\n", - "\n", - "1. **Optimization Strategies:** Implement specific optimization strategies based on your quantum algorithm's characteristics. Fine-tune compilation for better resource utilization and reduced gate counts.\n", - "\n", - "2. **Gate Decomposition:** Customize gate decomposition techniques to match the capabilities of experimental quantum hardware. Aligning with the native gate set enhances the efficiency of your compiled circuits.\n", - "\n", - "##### Experimental-Inspired Compilation\n", - "\n", - "Emulate the features of the best experimental laboratories in your compilation process. Leverage modern compiler passes to customize optimization, gate decomposition, and noise-aware strategies, creating compiled circuits that closely resemble the challenges and advantages of cutting-edge quantum hardware.\n", - "\n", - "Customize, compile, and push the boundaries of quantum algorithms with a tailored approach to quantum compilation. πŸ› οΈπŸ”§πŸš€\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "8e187e94", - "metadata": {}, - "outputs": [], - "source": [ - "from mqt.qudits.compiler.dit_manager import QuditCompiler" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "58daadf2", - "metadata": {}, - "outputs": [], - "source": [ - "qudit_compiler = QuditCompiler()\n", - "\n", - "passes = [\"PhyLocQRPass\"]" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "d21fe400", - "metadata": {}, - "outputs": [], - "source": [ - "compiled_circuit_qr = qudit_compiler.compile(backend_ion, circuit, passes)\n", - "\n", - "print(\n", - " f\"\\n Number of operations: {len(compiled_circuit_qr.instructions)}, \\n Number of qudits in the circuit: {compiled_circuit_qr.num_qudits}\"\n", - ")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "85b295ef", - "metadata": {}, - "outputs": [], - "source": [ - "job = backend_ion.run(compiled_circuit_qr)\n", - "\n", - "result = job.result()\n", - "counts = result.get_counts()\n", - "\n", - "plot_counts(counts, compiled_circuit_qr)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "a1b22b44", - "metadata": {}, - "outputs": [], - "source": [ - "passes = [\"PhyLocAdaPass\", \"ZPropagationPass\", \"ZRemovalPass\"]\n", - "\n", - "compiled_circuit_ada = qudit_compiler.compile(backend_ion, circuit, passes)\n", - "\n", - "print(\n", - " f\"\\n Number of operations: {len(compiled_circuit_ada.instructions)}, \\n Number of qudits in the circuit: {compiled_circuit_ada.num_qudits}\"\n", - ")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5a807930", - "metadata": {}, - "outputs": [], - "source": [ - "job = backend_ion.run(compiled_circuit_ada)\n", - "\n", - "result = job.result()\n", - "counts = result.get_counts()\n", - "\n", - "plot_counts(counts, compiled_circuit_ada)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "venv", - "language": "python", - "name": "venv" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/MQT_Qudits_Tutorial/foot.png b/MQT_Qudits_Tutorial/foot.png deleted file mode 100644 index 30d646e..0000000 Binary files a/MQT_Qudits_Tutorial/foot.png and /dev/null differ diff --git a/README.md b/README.md index 42ada6a..5d78eed 100644 --- a/README.md +++ b/README.md @@ -72,27 +72,28 @@ MQT Qudits has been developed based on methods proposed in the following papers: ## Acknowledgements MQT Qudits is the result of the project NeQST funded by the European Union under Horizon Europe Programme - Grant Agreement 101080086. -Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union or European Climate, Infrastructure and Environment Executive Agency (CINEA). Neither the European Union nor the granting authority can be held responsible for them. +Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union +or the European Commission. Neither the European Union nor the granting authority can be held responsible for them. The Munich Quantum Toolkit has been supported by the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation program (grant agreement No. 101001318), the Bavarian State Ministry for Science and Arts through the Distinguished Professorship Program, as well as the Munich Quantum Valley, which is supported by the Bavarian state government with funds from the Hightech Agenda Bayern Plus.

- - + + - + - + - +

diff --git a/docs/_static/eu_funded_dark.svg b/docs/_static/eu_funded_dark.svg new file mode 100644 index 0000000..f2069e9 --- /dev/null +++ b/docs/_static/eu_funded_dark.svg @@ -0,0 +1,477 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/_static/eu_funded_light.svg b/docs/_static/eu_funded_light.svg new file mode 100644 index 0000000..f34e5a2 --- /dev/null +++ b/docs/_static/eu_funded_light.svg @@ -0,0 +1,477 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/_static/foot.png b/docs/_static/foot.png deleted file mode 100644 index 30d646e..0000000 Binary files a/docs/_static/foot.png and /dev/null differ diff --git a/docs/_templates/page.html b/docs/_templates/page.html index 93de1d0..9c94b5a 100644 --- a/docs/_templates/page.html +++ b/docs/_templates/page.html @@ -30,9 +30,8 @@ MQT Qudits is the result of the project NeQST funded by the European Union under Horizon Europe Programme - Grant Agreement 101080086. Views and opinions expressed are however those of the author(s) only and do not necessarily - reflect those of the European Union or European Climate, Infrastructure and - Environment Executive Agency (CINEA). Neither the European Union nor the - granting authority can be held responsible for them.
+ reflect those of the European Union or the European Commission. Neither the + European Union nor the granting authority can be held responsible for them.

The Munich Quantum Toolkit has been supported by the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation program @@ -41,11 +40,16 @@ Quantum Valley, which is supported by the Bavarian state government with funds from the Hightech Agenda Bayern Plus.
-
+
NeQST +
+
+ Funded by the European Union
diff --git a/docs/publications.md b/docs/publications.md index 6abbebe..e315f8b 100644 --- a/docs/publications.md +++ b/docs/publications.md @@ -1,6 +1,6 @@ # Publications -MQT Qudits is academic software. Thus, many of its built-in algorithms have been published as scientific papers {cite:p}`matoAdaptiveCompilationMultilevel2022,matoCompilationEntanglingGates2023,matoCompressionQubitCircuits2023,matoMixeddimensionalQuantumCircuit2023,matoMixeddimensionalQuditState2024`. +MQT Qudits is academic software. Thus, many of its built-in algorithms have been published as scientific papers {cite:p}`matoMixeddimensionalQuditState2024,matoMixeddimensionalQuantumCircuit2023,matoCompressionQubitCircuits2023,matoCompilationEntanglingGates2023,matoAdaptiveCompilationMultilevel2022`. If you use _MQT Qudits_ in your work, we would appreciate if you cited the respective paper(s). diff --git a/docs/refs.bib b/docs/refs.bib index 7f66ece..e2aa82f 100644 --- a/docs/refs.bib +++ b/docs/refs.bib @@ -1,17 +1,16 @@ -@inproceedings{matoAdaptiveCompilationMultilevel2022, - title = {Adaptive compilation of multi-level quantum operations}, - booktitle = {International Conference on Quantum Computing and Engineering (QCE)}, - author = {Mato, Kevin and Ringbauer, Martin and Hillmich, Stefan and Wille, Robert}, - year = {2022}, - doi = {10.1109/QCE53715.2022.00070}, +@inproceedings{matoMixeddimensionalQuditState2024, + title = {Mixed-dimensional qudit state preparation using edge-weighted decision diagrams}, + booktitle = {Design Automation Conference (DAC)}, + author = {Mato, Kevin and Hillmich, Stefan and Wille, Robert}, + year = {2024} } -@inproceedings{matoCompilationEntanglingGates2023, - title = {Compilation of entangling gates for high-dimensional quantum systems}, - booktitle = {Asia and South Pacific Design Automation Conference (ASP-DAC)}, - author = {Mato, Kevin and Ringbauer, Martin and Hillmich, Stefan and Wille, Robert}, +@inproceedings{matoMixeddimensionalQuantumCircuit2023, + title = {Mixed-dimensional quantum circuit simulation with decision diagrams}, + booktitle = {International Conference on Quantum Computing and Engineering (QCE)}, + author = {Mato, Kevin and Hillmich, Stefan and Wille, Robert}, year = {2023}, - doi = {10.1145/3566097.3567930}, + doi = {10.1109/QCE57702.2023.00112}, } @inproceedings{matoCompressionQubitCircuits2023, @@ -22,17 +21,18 @@ @inproceedings{matoCompressionQubitCircuits2023 doi = {10.1109/QSW59989.2023.00027}, } -@inproceedings{matoMixeddimensionalQuantumCircuit2023, - title = {Mixed-dimensional quantum circuit simulation with decision diagrams}, - booktitle = {International Conference on Quantum Computing and Engineering (QCE)}, - author = {Mato, Kevin and Hillmich, Stefan and Wille, Robert}, +@inproceedings{matoCompilationEntanglingGates2023, + title = {Compilation of entangling gates for high-dimensional quantum systems}, + booktitle = {Asia and South Pacific Design Automation Conference (ASP-DAC)}, + author = {Mato, Kevin and Ringbauer, Martin and Hillmich, Stefan and Wille, Robert}, year = {2023}, - doi = {10.1109/QCE57702.2023.00112}, + doi = {10.1145/3566097.3567930}, } -@inproceedings{matoMixeddimensionalQuditState2024, - title = {Mixed-dimensional qudit state preparation using edge-weighted decision diagrams}, - booktitle = {Design Automation Conference (DAC)}, - author = {Mato, Kevin and Hillmich, Stefan and Wille, Robert}, - year = {2024} +@inproceedings{matoAdaptiveCompilationMultilevel2022, + title = {Adaptive compilation of multi-level quantum operations}, + booktitle = {International Conference on Quantum Computing and Engineering (QCE)}, + author = {Mato, Kevin and Ringbauer, Martin and Hillmich, Stefan and Wille, Robert}, + year = {2022}, + doi = {10.1109/QCE53715.2022.00070}, } diff --git a/docs/tutorial.md b/docs/tutorial.md index 4d47e20..08fcf41 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -14,22 +14,15 @@ mystnb: # MQT Qudits Tutorial 🌌 _Discover a New Dimension in Quantum Computing._ -Embark on a journey with MQT Qudits, a cutting-edge framework for Mixed-Dimensional Quantum Computing. +Embark on a journey with MQT Qudits, a framework for Mixed-Dimensional Quantum Computing. Delve into the realm of mixed-dimensional quantum computing with NeQSTβ€”a project funded by the European Union and developed developed as part of the {doc}`Munich Quantum Toolkit (MQT) ` by the [Chair for Design Automation](https://www.cda.cit.tum.de/) at the [Technical University of Munich](https://www.tum.de/). Our team is focused on creating design automation methods and software for quantum computing. The following tutorial will guide you through the initial tools and contributions we have made to advance Quantum Information Processing for Science and Technology. -```{image} /_static/foot.png -:alt: MQT Qudits Project Logos -:width: 80% -:align: center - -``` - +++ -## Installation steps: +## Installation Steps: ```bash (.venv) $ pip install mqt.qudits @@ -247,6 +240,7 @@ After crafting your quantum circuit with precision, take it for a spin using two - h - rxy - rz + - rh - virtrz - s - x @@ -402,7 +396,8 @@ Tailor your quantum compilation process to achieve optimal performance and emula ### Experimental-Inspired Compilation -Emulate the features of the best experimental laboratories in your compilation process. Leverage modern compiler passes to customize optimization, gate decomposition, and noise-aware strategies, creating compiled circuits that closely resemble the challenges and advantages of cutting-edge quantum hardware. +Emulate the features of the best experimental laboratories in your compilation process. +Leverage modern compiler passes to customize optimization, gate decomposition, and noise-aware strategies, creating compiled circuits that closely resemble the challenges and advantages of cutting-edge quantum hardware. Customize, compile, and push the boundaries of quantum algorithms with a tailored approach to quantum compilation. πŸ› οΈπŸ”§πŸš€ diff --git a/MQT_Qudits_Tutorial/MQT Qudits Overview.pdf b/mqt-qudits-overview.pdf similarity index 100% rename from MQT_Qudits_Tutorial/MQT Qudits Overview.pdf rename to mqt-qudits-overview.pdf diff --git a/src/mqt/__init__.py b/src/mqt/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/python/bindings.cpp b/src/python/bindings.cpp index 5147e1d..4eeca8b 100644 --- a/src/python/bindings.cpp +++ b/src/python/bindings.cpp @@ -9,7 +9,6 @@ #include #include #include -#include #include namespace py = pybind11; diff --git a/test/python/compiler/onedit/test_swap_routine.py b/test/python/compiler/onedit/test_swap_routine.py index e2067e6..80f4bf8 100644 --- a/test/python/compiler/onedit/test_swap_routine.py +++ b/test/python/compiler/onedit/test_swap_routine.py @@ -103,7 +103,6 @@ def test_cost_calculator(self): assert total_costing == 0.00425 assert len(pi_pulses_routing) == 2 - assert cost_of_pi_pulses == 0.002 def test_route_states2rotate_basic(self):