-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
83 changed files
with
3,261 additions
and
1,168 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,23 @@ | ||
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://opensource.org/licenses/MIT) | ||
<!--- [![Bindings](https://img.shields.io/github/workflow/status/cda-tum/ddsim/Deploy%20to%20PyPI?style=flat-square&logo=github&label=python)]() | ||
[![Documentation](https://img.shields.io/readthedocs/ddsim?logo=readthedocs&style=flat-square)]() | ||
[![codecov](https://img.shields.io/codecov/c/github/cda-tum/)]() --> | ||
|
||
# MQT Qudit - A Tool For | ||
<p align="center"> | ||
<picture> | ||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/cda-tum/qmap/main/docs/source/_static/mqt_light.png" width="60%"> | ||
<img src="https://raw.githubusercontent.com/cda-tum/qmap/main/docs/source/_static/mqt_dark.png" width="60%"> | ||
</picture> | ||
</p> | ||
|
||
A tool for | ||
# MQT Qudit - A quantum computing software framework tailored for working with mixed-dimensional quantum circuits. | ||
|
||
A tool for research and education for mixed-dimensional quantum computing by | ||
the [Chair for Design Automation](https://www.cda.cit.tum.de/) at | ||
the [Technical University of Munich](https://www.tum.de/). | ||
|
||
If you have any questions, feel free to contact us via [[email protected]](mailto:[email protected]) or by | ||
creating an [issue](https://github.com/cda-tum/mqt-qudit-compression/issues) on GitHub. For more | ||
creating an [issue](https://github.com/cda-tum/mqt-qudit/issues) on GitHub. For more | ||
information [www.cda.cit.tum.de/research/](https://www.cda.cit.tum.de/research/quantum/). | ||
|
||
### System Requirements | ||
|
@@ -26,4 +36,21 @@ The tool demands only for the resolution of dependencies, to solve run in termin | |
|
||
Remember to activate the python environment of the project, with the following lines in the terminal: | ||
|
||
## Documentation | ||
|
||
## System Requirements and Building | ||
|
||
The implementation is compatible with a minimimum version of Python 3.10. | ||
|
||
Building (and running) is continuously tested under Linux, macOS, and Windows using the [latest available system versions for GitHub Actions](https://github.com/actions/virtual-environments). | ||
|
||
## References | ||
- K. Mato, S. Hillmich and R. Wille, "[Mixed-Dimensional Qudit State Preparation Using Edge-Weighted Decision Diagrams]()," 2024 61st Design Automation Conference (DAC), San Francisco, USA, 2024. | ||
|
||
- K. Mato, S. Hillmich and R. Wille, "[Mixed-Dimensional Quantum Circuit Simulation with Decision Diagrams](https://www.cda.cit.tum.de/files/eda/2023_mixed_dimensional_quantum_circuit_simulation_with_decision_diagrams.pdf)," 2023 IEEE International Conference on Quantum Computing and Engineering (QCE), Bellevue, Washington, USA, 2023. | ||
|
||
- K. Mato, S. Hillmich, R. Wille, "Compression of Qubit Circuits: Mapping to Mixed-Dimensional Quantum Systems", IEEE QSW 2023 : IEEE International Conference on Quantum Software | ||
|
||
- K. Mato, M. Ringbauer, S. Hillmich and R. Wille, "[Compilation of Entangling Gates for High-Dimensional Quantum Systems](https://www.cda.cit.tum.de/files/eda/2023_aspdac_qudit_entanglement_compilation.pdf)," 2023 28th Asia and South Pacific Design Automation Conference (ASP-DAC), Tokyo, Japan, 2023, pp. 202-208. | ||
|
||
- K. Mato, M. Ringbauer, S. Hillmich and R. Wille, "[Adaptive Compilation of Multi-Level Quantum Operations](https://www.cda.cit.tum.de/files/eda/2022_qce_adaptive_compilation_of_multi_level_quantum_operations.pdf)," 2022 IEEE International Conference on Quantum Computing and Engineering (QCE), Broomfield, CO, USA, 2022, pp. 484-491, doi: 10.1109/QCE53715.2022.00070. |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
56 changes: 56 additions & 0 deletions
56
src/mqt/qudits/compiler/compilation_minitools/naive_unitary_verifier.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
from functools import reduce | ||
|
||
import numpy as np | ||
from numpy.linalg import inv | ||
|
||
|
||
class UnitaryVerifier: | ||
""" | ||
Verifies unitary matrices. | ||
sequence is a list of numpy arrays | ||
target is a numpy array | ||
dimensions is list of ints, equals to the dimensions of the qudits involved in the target operation | ||
initial_map is a list representing the mapping of the logic states to the physical ones at the beginning of the computation | ||
final_map is a list representing the mapping of the logic states to the physical ones at the end of the computation | ||
""" | ||
|
||
def __init__(self, sequence, target, dimensions, nodes=None, initial_map=None, final_map=None): | ||
self.decomposition = sequence | ||
self.target = target.copy() | ||
self.dimension = reduce(lambda x, y: x * y, dimensions) | ||
|
||
if nodes is not None and initial_map is not None and final_map is not None: | ||
self.permutation_matrix_initial = self.get_perm_matrix(nodes, initial_map) | ||
self.permutation_matrix_final = self.get_perm_matrix(nodes, final_map) | ||
self.target = self.permutation_matrix_initial @ self.target | ||
else: | ||
self.permutation_matrix_initial = None | ||
self.permutation_matrix_final = None | ||
|
||
def get_perm_matrix(self, nodes, mapping): | ||
# sum ( |phy> <log| ) | ||
perm = np.zeros((self.dimension, self.dimension)) | ||
|
||
for i in range(self.dimension): | ||
a = [0 for i in range(self.dimension)] | ||
b = [0 for i in range(self.dimension)] | ||
a[nodes[i]] = 1 | ||
b[mapping[i]] = 1 | ||
narr = np.array(a) | ||
marr = np.array(b) | ||
perm = perm + np.outer(marr, narr) | ||
|
||
return perm | ||
|
||
def verify(self): | ||
target = self.target.copy() | ||
|
||
for rotation in self.decomposition: | ||
target = rotation @ target | ||
|
||
if self.permutation_matrix_final is not None: | ||
target = inv(self.permutation_matrix_final) @ target | ||
|
||
target = target / target[0][0] | ||
|
||
return (abs(target - np.identity(self.dimension, dtype="complex")) < 1e-4).all() |
51 changes: 51 additions & 0 deletions
51
src/mqt/qudits/compiler/compilation_minitools/numerical_ansatz_utils.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import numpy as np | ||
|
||
"""def calculate_q0_q1(lev, dim): | ||
q1 = lev % dim # Calculate the remainder | ||
q0 = (lev - q1) // dim # Calculate the quotient | ||
return q0, q1""" | ||
|
||
|
||
def on1(gate, other_size): | ||
return np.kron(np.identity(other_size, dtype="complex"), gate) | ||
|
||
|
||
def on0(gate, other_size): | ||
return np.kron(gate, np.identity(other_size, dtype="complex")) | ||
|
||
|
||
def gate_expand_to_circuit(gate, circuits_size, target, dims=None): | ||
if dims is None: | ||
dims = [2, 2] | ||
if circuits_size < 1: | ||
msg = "integer circuits_size must be larger or equal to 1" | ||
raise ValueError(msg) | ||
|
||
if target >= circuits_size: | ||
msg = "target must be integer < integer circuits_size" | ||
raise ValueError(msg) | ||
|
||
upper = [np.identity(dims[i], dtype="complex") for i in range(circuits_size - target - 1)] | ||
lower = [np.identity(dims[j], dtype="complex") for j in range(target)] | ||
circ = [*upper, gate, *lower] | ||
res = circ[-1] | ||
|
||
for i in reversed(list(range(1, len(circ)))): | ||
res = np.kron(circ[i - 1], res) | ||
|
||
return res | ||
|
||
|
||
def apply_gate_to_tlines(gate_matrix, circuits_size=2, targets=None, dims=None): | ||
if dims is None: | ||
dims = [2, 2] | ||
if targets is None: | ||
targets = range(circuits_size) | ||
|
||
if isinstance(targets, int): | ||
targets = [targets] | ||
|
||
subset_gate = 0 | ||
for i in targets: | ||
subset_gate += gate_expand_to_circuit(gate_matrix, circuits_size, i, dims) | ||
return subset_gate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,30 @@ | ||
from mqt.qudits.compiler.onedit.local_adaptive_decomp import LocAdaPass | ||
from mqt.qudits.compiler.onedit.local_qr_decomp import LocQRPass | ||
from mqt.qudits.compiler.onedit.propagate_virtrz import ZPropagationPass | ||
from mqt.qudits.compiler.onedit.remove_phase_rotations import ZRemovalPass | ||
from mqt.qudits.compiler.onedit.mapping_aware_transpilation.phy_local_adaptive_decomp import PhyLocAdaPass | ||
from mqt.qudits.compiler.onedit.mapping_aware_transpilation.phy_local_qr_decomp import PhyLocQRPass | ||
from mqt.qudits.compiler.onedit.mapping_un_aware_transpilation.log_local_adaptive_decomp import LogLocAdaPass | ||
from mqt.qudits.compiler.onedit.mapping_un_aware_transpilation.log_local_qr_decomp import LogLocQRPass | ||
from mqt.qudits.compiler.twodit.mapping_un_aware_transpilation.entanglement_qr.cex_decomposition.log_ent_qr_cex_decomp import ( | ||
LogEntQRCEXPass, | ||
) | ||
|
||
|
||
class QuditManager: | ||
class QuditCompiler: | ||
passes_enabled = { | ||
"PhyLocQRPass": PhyLocQRPass, | ||
"PhyLocAdaPass": PhyLocAdaPass, | ||
"LocQRPass": PhyLocQRPass, | ||
"LocAdaPass": PhyLocAdaPass, | ||
"LogLocAdaPass": LogLocAdaPass, | ||
"LogLocQRPass": LogLocQRPass, | ||
"LogEntQRCEXPass": LogEntQRCEXPass, | ||
} | ||
|
||
def __init__(self): | ||
pass | ||
|
||
def compile(self, backend, circuit, passes_names): | ||
# Instantiate and execute created classes | ||
for compiler_pass in passes_names: | ||
compiler_pass = globals()[compiler_pass] | ||
compiler_pass = self.passes_enabled[compiler_pass] | ||
decomposition = compiler_pass(backend) | ||
circuit = decomposition.transpile(circuit) | ||
return circuit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
Oops, something went wrong.