mqt-core 3.2.0__cp314-cp314-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mqt-core might be problematic. Click here for more details.
- mqt/core/__init__.py +89 -0
- mqt/core/__main__.py +55 -0
- mqt/core/_commands.py +52 -0
- mqt/core/_compat/__init__.py +11 -0
- mqt/core/_compat/typing.py +29 -0
- mqt/core/_version.py +21 -0
- mqt/core/_version.pyi +12 -0
- mqt/core/bin/mqt-core-algorithms.dll +0 -0
- mqt/core/bin/mqt-core-circuit-optimizer.dll +0 -0
- mqt/core/bin/mqt-core-dd.dll +0 -0
- mqt/core/bin/mqt-core-ds.dll +0 -0
- mqt/core/bin/mqt-core-ir.dll +0 -0
- mqt/core/bin/mqt-core-na.dll +0 -0
- mqt/core/bin/mqt-core-qasm.dll +0 -0
- mqt/core/bin/mqt-core-zx.dll +0 -0
- mqt/core/dd.cp314-win_amd64.pyd +0 -0
- mqt/core/dd.pyi +1018 -0
- mqt/core/dd_evaluation.py +368 -0
- mqt/core/include/mqt-core/algorithms/BernsteinVazirani.hpp +39 -0
- mqt/core/include/mqt-core/algorithms/GHZState.hpp +18 -0
- mqt/core/include/mqt-core/algorithms/Grover.hpp +33 -0
- mqt/core/include/mqt-core/algorithms/QFT.hpp +21 -0
- mqt/core/include/mqt-core/algorithms/QPE.hpp +30 -0
- mqt/core/include/mqt-core/algorithms/RandomCliffordCircuit.hpp +22 -0
- mqt/core/include/mqt-core/algorithms/StatePreparation.hpp +43 -0
- mqt/core/include/mqt-core/algorithms/WState.hpp +18 -0
- mqt/core/include/mqt-core/algorithms/mqt_core_algorithms_export.h +43 -0
- mqt/core/include/mqt-core/boost/config/abi/borland_prefix.hpp +27 -0
- mqt/core/include/mqt-core/boost/config/abi/borland_suffix.hpp +12 -0
- mqt/core/include/mqt-core/boost/config/abi/msvc_prefix.hpp +22 -0
- mqt/core/include/mqt-core/boost/config/abi/msvc_suffix.hpp +8 -0
- mqt/core/include/mqt-core/boost/config/abi_prefix.hpp +25 -0
- mqt/core/include/mqt-core/boost/config/abi_suffix.hpp +25 -0
- mqt/core/include/mqt-core/boost/config/assert_cxx03.hpp +211 -0
- mqt/core/include/mqt-core/boost/config/assert_cxx11.hpp +212 -0
- mqt/core/include/mqt-core/boost/config/assert_cxx14.hpp +47 -0
- mqt/core/include/mqt-core/boost/config/assert_cxx17.hpp +65 -0
- mqt/core/include/mqt-core/boost/config/assert_cxx20.hpp +59 -0
- mqt/core/include/mqt-core/boost/config/assert_cxx23.hpp +41 -0
- mqt/core/include/mqt-core/boost/config/assert_cxx98.hpp +23 -0
- mqt/core/include/mqt-core/boost/config/auto_link.hpp +525 -0
- mqt/core/include/mqt-core/boost/config/compiler/borland.hpp +342 -0
- mqt/core/include/mqt-core/boost/config/compiler/clang.hpp +370 -0
- mqt/core/include/mqt-core/boost/config/compiler/clang_version.hpp +89 -0
- mqt/core/include/mqt-core/boost/config/compiler/codegear.hpp +389 -0
- mqt/core/include/mqt-core/boost/config/compiler/comeau.hpp +59 -0
- mqt/core/include/mqt-core/boost/config/compiler/common_edg.hpp +185 -0
- mqt/core/include/mqt-core/boost/config/compiler/compaq_cxx.hpp +19 -0
- mqt/core/include/mqt-core/boost/config/compiler/cray.hpp +446 -0
- mqt/core/include/mqt-core/boost/config/compiler/diab.hpp +26 -0
- mqt/core/include/mqt-core/boost/config/compiler/digitalmars.hpp +146 -0
- mqt/core/include/mqt-core/boost/config/compiler/gcc.hpp +386 -0
- mqt/core/include/mqt-core/boost/config/compiler/gcc_xml.hpp +115 -0
- mqt/core/include/mqt-core/boost/config/compiler/greenhills.hpp +28 -0
- mqt/core/include/mqt-core/boost/config/compiler/hp_acc.hpp +153 -0
- mqt/core/include/mqt-core/boost/config/compiler/intel.hpp +577 -0
- mqt/core/include/mqt-core/boost/config/compiler/kai.hpp +33 -0
- mqt/core/include/mqt-core/boost/config/compiler/metrowerks.hpp +201 -0
- mqt/core/include/mqt-core/boost/config/compiler/mpw.hpp +143 -0
- mqt/core/include/mqt-core/boost/config/compiler/nvcc.hpp +64 -0
- mqt/core/include/mqt-core/boost/config/compiler/pathscale.hpp +141 -0
- mqt/core/include/mqt-core/boost/config/compiler/pgi.hpp +23 -0
- mqt/core/include/mqt-core/boost/config/compiler/sgi_mipspro.hpp +29 -0
- mqt/core/include/mqt-core/boost/config/compiler/sunpro_cc.hpp +225 -0
- mqt/core/include/mqt-core/boost/config/compiler/vacpp.hpp +189 -0
- mqt/core/include/mqt-core/boost/config/compiler/visualc.hpp +398 -0
- mqt/core/include/mqt-core/boost/config/compiler/xlcpp.hpp +303 -0
- mqt/core/include/mqt-core/boost/config/compiler/xlcpp_zos.hpp +174 -0
- mqt/core/include/mqt-core/boost/config/detail/cxx_composite.hpp +218 -0
- mqt/core/include/mqt-core/boost/config/detail/posix_features.hpp +95 -0
- mqt/core/include/mqt-core/boost/config/detail/select_compiler_config.hpp +157 -0
- mqt/core/include/mqt-core/boost/config/detail/select_platform_config.hpp +147 -0
- mqt/core/include/mqt-core/boost/config/detail/select_stdlib_config.hpp +121 -0
- mqt/core/include/mqt-core/boost/config/detail/suffix.hpp +1334 -0
- mqt/core/include/mqt-core/boost/config/header_deprecated.hpp +26 -0
- mqt/core/include/mqt-core/boost/config/helper_macros.hpp +37 -0
- mqt/core/include/mqt-core/boost/config/no_tr1/cmath.hpp +28 -0
- mqt/core/include/mqt-core/boost/config/no_tr1/complex.hpp +28 -0
- mqt/core/include/mqt-core/boost/config/no_tr1/functional.hpp +28 -0
- mqt/core/include/mqt-core/boost/config/no_tr1/memory.hpp +28 -0
- mqt/core/include/mqt-core/boost/config/no_tr1/utility.hpp +28 -0
- mqt/core/include/mqt-core/boost/config/platform/aix.hpp +33 -0
- mqt/core/include/mqt-core/boost/config/platform/amigaos.hpp +15 -0
- mqt/core/include/mqt-core/boost/config/platform/beos.hpp +26 -0
- mqt/core/include/mqt-core/boost/config/platform/bsd.hpp +83 -0
- mqt/core/include/mqt-core/boost/config/platform/cloudabi.hpp +18 -0
- mqt/core/include/mqt-core/boost/config/platform/cray.hpp +18 -0
- mqt/core/include/mqt-core/boost/config/platform/cygwin.hpp +71 -0
- mqt/core/include/mqt-core/boost/config/platform/haiku.hpp +31 -0
- mqt/core/include/mqt-core/boost/config/platform/hpux.hpp +87 -0
- mqt/core/include/mqt-core/boost/config/platform/irix.hpp +31 -0
- mqt/core/include/mqt-core/boost/config/platform/linux.hpp +106 -0
- mqt/core/include/mqt-core/boost/config/platform/macos.hpp +87 -0
- mqt/core/include/mqt-core/boost/config/platform/qnxnto.hpp +31 -0
- mqt/core/include/mqt-core/boost/config/platform/solaris.hpp +31 -0
- mqt/core/include/mqt-core/boost/config/platform/symbian.hpp +97 -0
- mqt/core/include/mqt-core/boost/config/platform/vms.hpp +25 -0
- mqt/core/include/mqt-core/boost/config/platform/vxworks.hpp +422 -0
- mqt/core/include/mqt-core/boost/config/platform/wasm.hpp +23 -0
- mqt/core/include/mqt-core/boost/config/platform/win32.hpp +90 -0
- mqt/core/include/mqt-core/boost/config/platform/zos.hpp +32 -0
- mqt/core/include/mqt-core/boost/config/pragma_message.hpp +31 -0
- mqt/core/include/mqt-core/boost/config/requires_threads.hpp +92 -0
- mqt/core/include/mqt-core/boost/config/stdlib/dinkumware.hpp +324 -0
- mqt/core/include/mqt-core/boost/config/stdlib/libcomo.hpp +93 -0
- mqt/core/include/mqt-core/boost/config/stdlib/libcpp.hpp +180 -0
- mqt/core/include/mqt-core/boost/config/stdlib/libstdcpp3.hpp +482 -0
- mqt/core/include/mqt-core/boost/config/stdlib/modena.hpp +79 -0
- mqt/core/include/mqt-core/boost/config/stdlib/msl.hpp +98 -0
- mqt/core/include/mqt-core/boost/config/stdlib/roguewave.hpp +208 -0
- mqt/core/include/mqt-core/boost/config/stdlib/sgi.hpp +168 -0
- mqt/core/include/mqt-core/boost/config/stdlib/stlport.hpp +258 -0
- mqt/core/include/mqt-core/boost/config/stdlib/vacpp.hpp +74 -0
- mqt/core/include/mqt-core/boost/config/stdlib/xlcpp_zos.hpp +61 -0
- mqt/core/include/mqt-core/boost/config/user.hpp +133 -0
- mqt/core/include/mqt-core/boost/config/warning_disable.hpp +47 -0
- mqt/core/include/mqt-core/boost/config/workaround.hpp +305 -0
- mqt/core/include/mqt-core/boost/config.hpp +67 -0
- mqt/core/include/mqt-core/boost/cstdint.hpp +556 -0
- mqt/core/include/mqt-core/boost/cxx11_char_types.hpp +70 -0
- mqt/core/include/mqt-core/boost/detail/workaround.hpp +10 -0
- mqt/core/include/mqt-core/boost/limits.hpp +146 -0
- mqt/core/include/mqt-core/boost/multiprecision/complex128.hpp +24 -0
- mqt/core/include/mqt-core/boost/multiprecision/complex_adaptor.hpp +1046 -0
- mqt/core/include/mqt-core/boost/multiprecision/concepts/mp_number_archetypes.hpp +257 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_bin_float/io.hpp +698 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_bin_float/transcendental.hpp +157 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_bin_float.hpp +2297 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_complex.hpp +12 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_dec_float.hpp +3690 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int/add.hpp +368 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int/add_unsigned.hpp +387 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int/bitwise.hpp +889 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int/checked.hpp +178 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int/comparison.hpp +374 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int/cpp_int_config.hpp +161 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int/divide.hpp +703 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int/import_export.hpp +248 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int/intel_intrinsics.hpp +138 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int/limits.hpp +282 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int/literals.hpp +295 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int/misc.hpp +1457 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int/multiply.hpp +848 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int/serialize.hpp +211 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int/value_pack.hpp +42 -0
- mqt/core/include/mqt-core/boost/multiprecision/cpp_int.hpp +2360 -0
- mqt/core/include/mqt-core/boost/multiprecision/debug_adaptor.hpp +760 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/assert.hpp +29 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/atomic.hpp +62 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/bitscan.hpp +317 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/check_cpp11_config.hpp +64 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/constexpr.hpp +88 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/default_ops.hpp +4052 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/digits.hpp +49 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/dynamic_array.hpp +44 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/empty_value.hpp +87 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/endian.hpp +35 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/et_ops.hpp +1831 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/float128_functions.hpp +95 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/float_string_cvt.hpp +333 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/fpclassify.hpp +101 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/functions/constants.hpp +288 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/functions/pow.hpp +905 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/functions/trig.hpp +1058 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/functions/trunc.hpp +82 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/generic_interconvert.hpp +687 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/hash.hpp +56 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/integer_ops.hpp +474 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/itos.hpp +39 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/min_max.hpp +106 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/no_et_ops.hpp +661 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/no_exceptions_support.hpp +55 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/number_base.hpp +1656 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/number_compare.hpp +848 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/precision.hpp +313 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/rebind.hpp +19 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/standalone_config.hpp +148 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/static_array.hpp +42 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/string_helpers.hpp +48 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/tables.hpp +80 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/ublas_interop.hpp +75 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/uniform_int_distribution.hpp +212 -0
- mqt/core/include/mqt-core/boost/multiprecision/detail/utype_helper.hpp +374 -0
- mqt/core/include/mqt-core/boost/multiprecision/eigen.hpp +248 -0
- mqt/core/include/mqt-core/boost/multiprecision/float128.hpp +920 -0
- mqt/core/include/mqt-core/boost/multiprecision/fwd.hpp +268 -0
- mqt/core/include/mqt-core/boost/multiprecision/gmp.hpp +4060 -0
- mqt/core/include/mqt-core/boost/multiprecision/integer.hpp +363 -0
- mqt/core/include/mqt-core/boost/multiprecision/logged_adaptor.hpp +834 -0
- mqt/core/include/mqt-core/boost/multiprecision/miller_rabin.hpp +221 -0
- mqt/core/include/mqt-core/boost/multiprecision/mpc.hpp +1721 -0
- mqt/core/include/mqt-core/boost/multiprecision/mpfi.hpp +2559 -0
- mqt/core/include/mqt-core/boost/multiprecision/mpfr.hpp +3644 -0
- mqt/core/include/mqt-core/boost/multiprecision/number.hpp +2500 -0
- mqt/core/include/mqt-core/boost/multiprecision/random.hpp +23 -0
- mqt/core/include/mqt-core/boost/multiprecision/rational_adaptor.hpp +1289 -0
- mqt/core/include/mqt-core/boost/multiprecision/tommath.hpp +1034 -0
- mqt/core/include/mqt-core/boost/multiprecision/traits/explicit_conversion.hpp +67 -0
- mqt/core/include/mqt-core/boost/multiprecision/traits/extract_exponent_type.hpp +28 -0
- mqt/core/include/mqt-core/boost/multiprecision/traits/is_backend.hpp +91 -0
- mqt/core/include/mqt-core/boost/multiprecision/traits/is_byte_container.hpp +51 -0
- mqt/core/include/mqt-core/boost/multiprecision/traits/is_complex.hpp +22 -0
- mqt/core/include/mqt-core/boost/multiprecision/traits/is_convertible_arithmetic.hpp +51 -0
- mqt/core/include/mqt-core/boost/multiprecision/traits/is_restricted_conversion.hpp +47 -0
- mqt/core/include/mqt-core/boost/multiprecision/traits/is_variable_precision.hpp +25 -0
- mqt/core/include/mqt-core/boost/multiprecision/traits/max_digits10.hpp +79 -0
- mqt/core/include/mqt-core/boost/multiprecision/traits/std_integer_traits.hpp +90 -0
- mqt/core/include/mqt-core/boost/multiprecision/traits/transcendental_reduction_type.hpp +21 -0
- mqt/core/include/mqt-core/boost/version.hpp +32 -0
- mqt/core/include/mqt-core/circuit_optimizer/CircuitOptimizer.hpp +106 -0
- mqt/core/include/mqt-core/circuit_optimizer/mqt_core_circuit_optimizer_export.h +43 -0
- mqt/core/include/mqt-core/datastructures/DirectedAcyclicGraph.hpp +117 -0
- mqt/core/include/mqt-core/datastructures/DirectedGraph.hpp +158 -0
- mqt/core/include/mqt-core/datastructures/DisjointSet.hpp +50 -0
- mqt/core/include/mqt-core/datastructures/Layer.hpp +172 -0
- mqt/core/include/mqt-core/datastructures/SymmetricMatrix.hpp +57 -0
- mqt/core/include/mqt-core/datastructures/UndirectedGraph.hpp +227 -0
- mqt/core/include/mqt-core/datastructures/mqt_core_ds_export.h +43 -0
- mqt/core/include/mqt-core/dd/Approximation.hpp +45 -0
- mqt/core/include/mqt-core/dd/CachedEdge.hpp +167 -0
- mqt/core/include/mqt-core/dd/Complex.hpp +165 -0
- mqt/core/include/mqt-core/dd/ComplexNumbers.hpp +150 -0
- mqt/core/include/mqt-core/dd/ComplexValue.hpp +184 -0
- mqt/core/include/mqt-core/dd/ComputeTable.hpp +183 -0
- mqt/core/include/mqt-core/dd/DDDefinitions.hpp +139 -0
- mqt/core/include/mqt-core/dd/DDpackageConfig.hpp +104 -0
- mqt/core/include/mqt-core/dd/DensityNoiseTable.hpp +114 -0
- mqt/core/include/mqt-core/dd/Edge.hpp +416 -0
- mqt/core/include/mqt-core/dd/Export.hpp +438 -0
- mqt/core/include/mqt-core/dd/FunctionalityConstruction.hpp +75 -0
- mqt/core/include/mqt-core/dd/GateMatrixDefinitions.hpp +43 -0
- mqt/core/include/mqt-core/dd/LinkedListBase.hpp +45 -0
- mqt/core/include/mqt-core/dd/MemoryManager.hpp +193 -0
- mqt/core/include/mqt-core/dd/Node.hpp +223 -0
- mqt/core/include/mqt-core/dd/NoiseFunctionality.hpp +144 -0
- mqt/core/include/mqt-core/dd/Operations.hpp +308 -0
- mqt/core/include/mqt-core/dd/Package.hpp +2036 -0
- mqt/core/include/mqt-core/dd/Package_fwd.hpp +22 -0
- mqt/core/include/mqt-core/dd/RealNumber.hpp +255 -0
- mqt/core/include/mqt-core/dd/RealNumberUniqueTable.hpp +217 -0
- mqt/core/include/mqt-core/dd/Simulation.hpp +98 -0
- mqt/core/include/mqt-core/dd/StateGeneration.hpp +143 -0
- mqt/core/include/mqt-core/dd/StochasticNoiseOperationTable.hpp +88 -0
- mqt/core/include/mqt-core/dd/UnaryComputeTable.hpp +121 -0
- mqt/core/include/mqt-core/dd/UniqueTable.hpp +243 -0
- mqt/core/include/mqt-core/dd/mqt_core_dd_export.h +43 -0
- mqt/core/include/mqt-core/dd/statistics/MemoryManagerStatistics.hpp +84 -0
- mqt/core/include/mqt-core/dd/statistics/PackageStatistics.hpp +55 -0
- mqt/core/include/mqt-core/dd/statistics/Statistics.hpp +48 -0
- mqt/core/include/mqt-core/dd/statistics/TableStatistics.hpp +79 -0
- mqt/core/include/mqt-core/dd/statistics/UniqueTableStatistics.hpp +31 -0
- mqt/core/include/mqt-core/ir/Definitions.hpp +108 -0
- mqt/core/include/mqt-core/ir/Permutation.hpp +213 -0
- mqt/core/include/mqt-core/ir/QuantumComputation.hpp +594 -0
- mqt/core/include/mqt-core/ir/Register.hpp +125 -0
- mqt/core/include/mqt-core/ir/mqt_core_ir_export.h +43 -0
- mqt/core/include/mqt-core/ir/operations/AodOperation.hpp +92 -0
- mqt/core/include/mqt-core/ir/operations/ClassicControlledOperation.hpp +156 -0
- mqt/core/include/mqt-core/ir/operations/CompoundOperation.hpp +210 -0
- mqt/core/include/mqt-core/ir/operations/Control.hpp +142 -0
- mqt/core/include/mqt-core/ir/operations/Expression.hpp +847 -0
- mqt/core/include/mqt-core/ir/operations/NonUnitaryOperation.hpp +118 -0
- mqt/core/include/mqt-core/ir/operations/OpType.hpp +115 -0
- mqt/core/include/mqt-core/ir/operations/OpType.inc +75 -0
- mqt/core/include/mqt-core/ir/operations/Operation.hpp +245 -0
- mqt/core/include/mqt-core/ir/operations/StandardOperation.hpp +138 -0
- mqt/core/include/mqt-core/ir/operations/SymbolicOperation.hpp +144 -0
- mqt/core/include/mqt-core/na/NAComputation.hpp +185 -0
- mqt/core/include/mqt-core/na/entities/Atom.hpp +62 -0
- mqt/core/include/mqt-core/na/entities/Location.hpp +154 -0
- mqt/core/include/mqt-core/na/entities/Zone.hpp +95 -0
- mqt/core/include/mqt-core/na/mqt_core_na_export.h +43 -0
- mqt/core/include/mqt-core/na/operations/GlobalCZOp.hpp +38 -0
- mqt/core/include/mqt-core/na/operations/GlobalOp.hpp +58 -0
- mqt/core/include/mqt-core/na/operations/GlobalRYOp.hpp +42 -0
- mqt/core/include/mqt-core/na/operations/LoadOp.hpp +89 -0
- mqt/core/include/mqt-core/na/operations/LocalOp.hpp +56 -0
- mqt/core/include/mqt-core/na/operations/LocalRZOp.hpp +42 -0
- mqt/core/include/mqt-core/na/operations/LocalUOp.hpp +49 -0
- mqt/core/include/mqt-core/na/operations/MoveOp.hpp +66 -0
- mqt/core/include/mqt-core/na/operations/Op.hpp +62 -0
- mqt/core/include/mqt-core/na/operations/ShuttlingOp.hpp +51 -0
- mqt/core/include/mqt-core/na/operations/StoreOp.hpp +87 -0
- mqt/core/include/mqt-core/qasm3/Exception.hpp +85 -0
- mqt/core/include/mqt-core/qasm3/Gate.hpp +65 -0
- mqt/core/include/mqt-core/qasm3/Importer.hpp +192 -0
- mqt/core/include/mqt-core/qasm3/InstVisitor.hpp +145 -0
- mqt/core/include/mqt-core/qasm3/NestedEnvironment.hpp +41 -0
- mqt/core/include/mqt-core/qasm3/Parser.hpp +170 -0
- mqt/core/include/mqt-core/qasm3/Scanner.hpp +73 -0
- mqt/core/include/mqt-core/qasm3/Statement.hpp +486 -0
- mqt/core/include/mqt-core/qasm3/Statement_fwd.hpp +39 -0
- mqt/core/include/mqt-core/qasm3/StdGates.hpp +123 -0
- mqt/core/include/mqt-core/qasm3/Token.hpp +198 -0
- mqt/core/include/mqt-core/qasm3/Types.hpp +238 -0
- mqt/core/include/mqt-core/qasm3/Types_fwd.hpp +22 -0
- mqt/core/include/mqt-core/qasm3/mqt_core_qasm_export.h +43 -0
- mqt/core/include/mqt-core/qasm3/passes/CompilerPass.hpp +22 -0
- mqt/core/include/mqt-core/qasm3/passes/ConstEvalPass.hpp +102 -0
- mqt/core/include/mqt-core/qasm3/passes/TypeCheckPass.hpp +124 -0
- mqt/core/include/mqt-core/zx/FunctionalityConstruction.hpp +125 -0
- mqt/core/include/mqt-core/zx/Rational.hpp +318 -0
- mqt/core/include/mqt-core/zx/Rules.hpp +132 -0
- mqt/core/include/mqt-core/zx/Simplify.hpp +182 -0
- mqt/core/include/mqt-core/zx/Utils.hpp +212 -0
- mqt/core/include/mqt-core/zx/ZXDefinitions.hpp +93 -0
- mqt/core/include/mqt-core/zx/ZXDiagram.hpp +480 -0
- mqt/core/include/mqt-core/zx/mqt_core_zx_export.h +43 -0
- mqt/core/ir/__init__.pyi +1998 -0
- mqt/core/ir/operations.pyi +991 -0
- mqt/core/ir/registers.pyi +91 -0
- mqt/core/ir/symbolic.pyi +177 -0
- mqt/core/ir.cp314-win_amd64.pyd +0 -0
- mqt/core/lib/mqt-core-algorithms.lib +0 -0
- mqt/core/lib/mqt-core-circuit-optimizer.lib +0 -0
- mqt/core/lib/mqt-core-dd.lib +0 -0
- mqt/core/lib/mqt-core-ds.lib +0 -0
- mqt/core/lib/mqt-core-ir.lib +0 -0
- mqt/core/lib/mqt-core-na.lib +0 -0
- mqt/core/lib/mqt-core-qasm.lib +0 -0
- mqt/core/lib/mqt-core-zx.lib +0 -0
- mqt/core/plugins/__init__.py +9 -0
- mqt/core/plugins/qiskit/__init__.py +19 -0
- mqt/core/plugins/qiskit/mqt_to_qiskit.py +354 -0
- mqt/core/plugins/qiskit/qiskit_to_mqt.py +455 -0
- mqt/core/py.typed +2 -0
- mqt/core/share/cmake/mqt-core/AddMQTPythonBinding.cmake +52 -0
- mqt/core/share/cmake/mqt-core/Cache.cmake +32 -0
- mqt/core/share/cmake/mqt-core/FindGMP.cmake +103 -0
- mqt/core/share/cmake/mqt-core/PackageAddTest.cmake +40 -0
- mqt/core/share/cmake/mqt-core/PreventInSourceBuilds.cmake +25 -0
- mqt/core/share/cmake/mqt-core/StandardProjectSettings.cmake +87 -0
- mqt/core/share/cmake/mqt-core/mqt-core-config-version.cmake +85 -0
- mqt/core/share/cmake/mqt-core/mqt-core-config.cmake +49 -0
- mqt/core/share/cmake/mqt-core/mqt-core-targets-release.cmake +90 -0
- mqt/core/share/cmake/mqt-core/mqt-core-targets.cmake +324 -0
- mqt_core-3.2.0.dist-info/DELVEWHEEL +2 -0
- mqt_core-3.2.0.dist-info/METADATA +169 -0
- mqt_core-3.2.0.dist-info/RECORD +343 -0
- mqt_core-3.2.0.dist-info/WHEEL +5 -0
- mqt_core-3.2.0.dist-info/entry_points.txt +4 -0
- mqt_core-3.2.0.dist-info/licenses/LICENSE.md +22 -0
- mqt_core.libs/msvcp140.dll +0 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Copyright (c) 2023 - 2025 Chair for Design Automation, TUM
|
|
2
|
+
# Copyright (c) 2025 Munich Quantum Software Company GmbH
|
|
3
|
+
# All rights reserved.
|
|
4
|
+
#
|
|
5
|
+
# SPDX-License-Identifier: MIT
|
|
6
|
+
#
|
|
7
|
+
# Licensed under the MIT License
|
|
8
|
+
|
|
9
|
+
__all__ = ["ClassicalRegister", "QuantumRegister"]
|
|
10
|
+
|
|
11
|
+
class QuantumRegister:
|
|
12
|
+
"""A class to represent a collection of qubits.
|
|
13
|
+
|
|
14
|
+
Args:
|
|
15
|
+
start: The starting index of the quantum register.
|
|
16
|
+
size: The number of qubits in the quantum register.
|
|
17
|
+
name: The name of the quantum register. A name will be generated if not provided.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
def __init__(self, start: int, size: int, name: str = "") -> None: ...
|
|
21
|
+
@property
|
|
22
|
+
def start(self) -> int:
|
|
23
|
+
"""The index of the first qubit in the quantum register."""
|
|
24
|
+
|
|
25
|
+
@property
|
|
26
|
+
def end(self) -> int:
|
|
27
|
+
"""Index of the last qubit in the quantum register."""
|
|
28
|
+
|
|
29
|
+
@property
|
|
30
|
+
def size(self) -> int:
|
|
31
|
+
"""The number of qubits in the quantum register."""
|
|
32
|
+
|
|
33
|
+
@property
|
|
34
|
+
def name(self) -> str:
|
|
35
|
+
"""The name of the quantum register."""
|
|
36
|
+
|
|
37
|
+
def __eq__(self, other: object) -> bool:
|
|
38
|
+
"""Check if the quantum register is equal to another quantum register."""
|
|
39
|
+
|
|
40
|
+
def __ne__(self, other: object) -> bool:
|
|
41
|
+
"""Check if the quantum register is not equal to another quantum register."""
|
|
42
|
+
|
|
43
|
+
def __hash__(self) -> int:
|
|
44
|
+
"""Return the hash of the quantum register."""
|
|
45
|
+
|
|
46
|
+
def __getitem__(self, key: int) -> int:
|
|
47
|
+
"""Get the qubit at the specified index."""
|
|
48
|
+
|
|
49
|
+
def __contains__(self, qubit: int) -> bool:
|
|
50
|
+
"""Check if the quantum register contains a qubit."""
|
|
51
|
+
|
|
52
|
+
class ClassicalRegister:
|
|
53
|
+
"""A class to represent a collection of classical bits.
|
|
54
|
+
|
|
55
|
+
Args:
|
|
56
|
+
start: The starting index of the classical register.
|
|
57
|
+
size: The number of bits in the classical register.
|
|
58
|
+
name: The name of the classical register. A name will be generated if not provided.
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
def __init__(self, start: int, size: int, name: str = "") -> None: ...
|
|
62
|
+
@property
|
|
63
|
+
def start(self) -> int:
|
|
64
|
+
"""The index of the first bit in the classical register."""
|
|
65
|
+
|
|
66
|
+
@property
|
|
67
|
+
def end(self) -> int:
|
|
68
|
+
"""Index of the last bit in the classical register."""
|
|
69
|
+
|
|
70
|
+
@property
|
|
71
|
+
def size(self) -> int:
|
|
72
|
+
"""The number of bits in the classical register."""
|
|
73
|
+
|
|
74
|
+
@property
|
|
75
|
+
def name(self) -> str:
|
|
76
|
+
"""The name of the classical register."""
|
|
77
|
+
|
|
78
|
+
def __eq__(self, other: object) -> bool:
|
|
79
|
+
"""Check if the classical register is equal to another classical register."""
|
|
80
|
+
|
|
81
|
+
def __ne__(self, other: object) -> bool:
|
|
82
|
+
"""Check if the classical register is not equal to another classical register."""
|
|
83
|
+
|
|
84
|
+
def __hash__(self) -> int:
|
|
85
|
+
"""Return the hash of the classical register."""
|
|
86
|
+
|
|
87
|
+
def __getitem__(self, key: int) -> int:
|
|
88
|
+
"""Get the bit at the specified index."""
|
|
89
|
+
|
|
90
|
+
def __contains__(self, bit: int) -> bool:
|
|
91
|
+
"""Check if the classical register contains a bit."""
|
mqt/core/ir/symbolic.pyi
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# Copyright (c) 2023 - 2025 Chair for Design Automation, TUM
|
|
2
|
+
# Copyright (c) 2025 Munich Quantum Software Company GmbH
|
|
3
|
+
# All rights reserved.
|
|
4
|
+
#
|
|
5
|
+
# SPDX-License-Identifier: MIT
|
|
6
|
+
#
|
|
7
|
+
# Licensed under the MIT License
|
|
8
|
+
|
|
9
|
+
from collections.abc import Iterator, Mapping, Sequence
|
|
10
|
+
from typing import overload
|
|
11
|
+
|
|
12
|
+
__all__ = ["Expression", "Term", "Variable"]
|
|
13
|
+
|
|
14
|
+
class Variable:
|
|
15
|
+
"""A symbolic variable.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
name: The name of the variable.
|
|
19
|
+
|
|
20
|
+
Note:
|
|
21
|
+
Variables are uniquely identified by their name, so if a variable with the same name already exists,
|
|
22
|
+
the existing variable will be returned.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
def __eq__(self, arg0: object) -> bool: ...
|
|
26
|
+
def __gt__(self, arg0: Variable) -> bool: ...
|
|
27
|
+
def __hash__(self) -> int: ...
|
|
28
|
+
def __init__(self, name: str = "") -> None: ...
|
|
29
|
+
def __lt__(self, arg0: Variable) -> bool: ...
|
|
30
|
+
def __ne__(self, arg0: object) -> bool: ...
|
|
31
|
+
@property
|
|
32
|
+
def name(self) -> str:
|
|
33
|
+
"""The name of the variable."""
|
|
34
|
+
|
|
35
|
+
class Term:
|
|
36
|
+
"""A symbolic term which consists of a variable with a given coefficient.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
variable: The variable of the term.
|
|
40
|
+
coefficient: The coefficient of the term.
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
def __eq__(self, arg0: object) -> bool: ...
|
|
44
|
+
def __hash__(self) -> int: ...
|
|
45
|
+
def __init__(self, variable: Variable, coefficient: float = 1.0) -> None: ...
|
|
46
|
+
def __mul__(self, arg0: float) -> Term: ...
|
|
47
|
+
def __ne__(self, arg0: object) -> bool: ...
|
|
48
|
+
def __rmul__(self, arg0: float) -> Term: ...
|
|
49
|
+
def __rtruediv__(self, arg0: float) -> Term: ...
|
|
50
|
+
def __truediv__(self, arg0: float) -> Term: ...
|
|
51
|
+
def add_coefficient(self, coeff: float) -> None:
|
|
52
|
+
"""Add a coefficient to the coefficient of this term.
|
|
53
|
+
|
|
54
|
+
Args:
|
|
55
|
+
coeff: The coefficient to add.
|
|
56
|
+
"""
|
|
57
|
+
|
|
58
|
+
def evaluate(self, assignment: Mapping[Variable, float]) -> float:
|
|
59
|
+
"""Evaluate the term with a given variable assignment.
|
|
60
|
+
|
|
61
|
+
Args:
|
|
62
|
+
assignment: The variable assignment.
|
|
63
|
+
|
|
64
|
+
Returns:
|
|
65
|
+
The evaluated value of the term.
|
|
66
|
+
"""
|
|
67
|
+
|
|
68
|
+
def has_zero_coefficient(self) -> bool:
|
|
69
|
+
"""Check if the coefficient of the term is zero."""
|
|
70
|
+
|
|
71
|
+
@property
|
|
72
|
+
def coefficient(self) -> float:
|
|
73
|
+
"""The coefficient of the term."""
|
|
74
|
+
|
|
75
|
+
@property
|
|
76
|
+
def variable(self) -> Variable:
|
|
77
|
+
"""The variable of the term."""
|
|
78
|
+
|
|
79
|
+
class Expression:
|
|
80
|
+
r"""A symbolic expression which consists of a sum of terms and a constant.
|
|
81
|
+
|
|
82
|
+
The expression is of the form :math:`constant + term_1 + term_2 + \dots + term_n`.
|
|
83
|
+
|
|
84
|
+
Args:
|
|
85
|
+
terms: The list of terms.
|
|
86
|
+
constant: The constant.
|
|
87
|
+
|
|
88
|
+
Alternatively, an expression can be created with a single term and a constant or just a constant.
|
|
89
|
+
"""
|
|
90
|
+
|
|
91
|
+
constant: float
|
|
92
|
+
"""
|
|
93
|
+
The constant of the expression.
|
|
94
|
+
"""
|
|
95
|
+
|
|
96
|
+
@overload
|
|
97
|
+
def __add__(self, arg0: Expression) -> Expression: ...
|
|
98
|
+
@overload
|
|
99
|
+
def __add__(self, arg0: Term) -> Expression: ...
|
|
100
|
+
@overload
|
|
101
|
+
def __add__(self, arg0: float) -> Expression: ...
|
|
102
|
+
def __eq__(self, arg0: object) -> bool: ...
|
|
103
|
+
def __getitem__(self, idx: int) -> Term: ...
|
|
104
|
+
def __hash__(self) -> int: ...
|
|
105
|
+
@overload
|
|
106
|
+
def __init__(self, terms: Sequence[Term], constant: float = 0.0) -> None:
|
|
107
|
+
"""Create an expression with a given list of terms and a constant.
|
|
108
|
+
|
|
109
|
+
Args:
|
|
110
|
+
terms: The list of terms.
|
|
111
|
+
constant: The constant.
|
|
112
|
+
"""
|
|
113
|
+
|
|
114
|
+
@overload
|
|
115
|
+
def __init__(self, term: Term, constant: float = 0.0) -> None:
|
|
116
|
+
"""Create an expression with a given term and a constant.
|
|
117
|
+
|
|
118
|
+
Args:
|
|
119
|
+
term: The term.
|
|
120
|
+
constant: The constant.
|
|
121
|
+
"""
|
|
122
|
+
|
|
123
|
+
@overload
|
|
124
|
+
def __init__(self, constant: float = 0.0) -> None:
|
|
125
|
+
"""Create an expression with a given constant.
|
|
126
|
+
|
|
127
|
+
Args:
|
|
128
|
+
constant: The constant.
|
|
129
|
+
"""
|
|
130
|
+
|
|
131
|
+
def __iter__(self) -> Iterator[Term]: ...
|
|
132
|
+
def __len__(self) -> int: ...
|
|
133
|
+
def __mul__(self, arg0: float) -> Expression: ...
|
|
134
|
+
def __ne__(self, arg0: object) -> bool: ...
|
|
135
|
+
@overload
|
|
136
|
+
def __radd__(self, arg0: Term) -> Expression: ...
|
|
137
|
+
@overload
|
|
138
|
+
def __radd__(self, arg0: float) -> Expression: ...
|
|
139
|
+
def __rmul__(self, arg0: float) -> Expression: ...
|
|
140
|
+
@overload
|
|
141
|
+
def __rsub__(self, arg0: Term) -> Expression: ...
|
|
142
|
+
@overload
|
|
143
|
+
def __rsub__(self, arg0: float) -> Expression: ...
|
|
144
|
+
def __rtruediv__(self, arg0: float) -> Expression: ...
|
|
145
|
+
@overload
|
|
146
|
+
def __sub__(self, arg0: Expression) -> Expression: ...
|
|
147
|
+
@overload
|
|
148
|
+
def __sub__(self, arg0: Term) -> Expression: ...
|
|
149
|
+
@overload
|
|
150
|
+
def __sub__(self, arg0: float) -> Expression: ...
|
|
151
|
+
def __truediv__(self, arg0: float) -> Expression: ...
|
|
152
|
+
def evaluate(self, assignment: Mapping[Variable, float]) -> float:
|
|
153
|
+
"""Evaluate the expression with a given variable assignment.
|
|
154
|
+
|
|
155
|
+
Args:
|
|
156
|
+
assignment: The variable assignment.
|
|
157
|
+
|
|
158
|
+
Returns:
|
|
159
|
+
The evaluated value of the expression.
|
|
160
|
+
"""
|
|
161
|
+
|
|
162
|
+
def is_constant(self) -> bool:
|
|
163
|
+
"""Check if the expression is a constant."""
|
|
164
|
+
|
|
165
|
+
def is_zero(self) -> bool:
|
|
166
|
+
"""Check if the expression is zero."""
|
|
167
|
+
|
|
168
|
+
def num_terms(self) -> int:
|
|
169
|
+
"""The number of terms in the expression."""
|
|
170
|
+
|
|
171
|
+
@property
|
|
172
|
+
def terms(self) -> list[Term]:
|
|
173
|
+
"""The terms of the expression."""
|
|
174
|
+
|
|
175
|
+
@property
|
|
176
|
+
def variables(self) -> set[Variable]:
|
|
177
|
+
"""The variables in the expression."""
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Copyright (c) 2023 - 2025 Chair for Design Automation, TUM
|
|
2
|
+
# Copyright (c) 2025 Munich Quantum Software Company GmbH
|
|
3
|
+
# All rights reserved.
|
|
4
|
+
#
|
|
5
|
+
# SPDX-License-Identifier: MIT
|
|
6
|
+
#
|
|
7
|
+
# Licensed under the MIT License
|
|
8
|
+
|
|
9
|
+
"""MQT Qiskit Plugin."""
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
from .mqt_to_qiskit import mqt_to_qiskit
|
|
14
|
+
from .qiskit_to_mqt import qiskit_to_mqt
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"mqt_to_qiskit",
|
|
18
|
+
"qiskit_to_mqt",
|
|
19
|
+
]
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
# Copyright (c) 2023 - 2025 Chair for Design Automation, TUM
|
|
2
|
+
# Copyright (c) 2025 Munich Quantum Software Company GmbH
|
|
3
|
+
# All rights reserved.
|
|
4
|
+
#
|
|
5
|
+
# SPDX-License-Identifier: MIT
|
|
6
|
+
#
|
|
7
|
+
# Licensed under the MIT License
|
|
8
|
+
|
|
9
|
+
"""Functionality for translating from the MQT to Qiskit."""
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
from typing import TYPE_CHECKING
|
|
14
|
+
|
|
15
|
+
from qiskit.circuit import AncillaRegister, ClassicalRegister, Clbit, QuantumCircuit, QuantumRegister, Qubit
|
|
16
|
+
from qiskit.circuit.library import (
|
|
17
|
+
DCXGate,
|
|
18
|
+
ECRGate,
|
|
19
|
+
HGate,
|
|
20
|
+
IGate,
|
|
21
|
+
PhaseGate,
|
|
22
|
+
RXGate,
|
|
23
|
+
RXXGate,
|
|
24
|
+
RYGate,
|
|
25
|
+
RYYGate,
|
|
26
|
+
RZGate,
|
|
27
|
+
RZXGate,
|
|
28
|
+
RZZGate,
|
|
29
|
+
SdgGate,
|
|
30
|
+
SGate,
|
|
31
|
+
SwapGate,
|
|
32
|
+
SXdgGate,
|
|
33
|
+
SXGate,
|
|
34
|
+
TdgGate,
|
|
35
|
+
TGate,
|
|
36
|
+
U2Gate,
|
|
37
|
+
U3Gate,
|
|
38
|
+
XGate,
|
|
39
|
+
XXMinusYYGate,
|
|
40
|
+
XXPlusYYGate,
|
|
41
|
+
YGate,
|
|
42
|
+
ZGate,
|
|
43
|
+
iSwapGate,
|
|
44
|
+
)
|
|
45
|
+
from qiskit.transpiler.layout import Layout, TranspileLayout
|
|
46
|
+
|
|
47
|
+
from ...ir import Permutation
|
|
48
|
+
from ...ir.operations import (
|
|
49
|
+
ClassicControlledOperation,
|
|
50
|
+
CompoundOperation,
|
|
51
|
+
Control,
|
|
52
|
+
NonUnitaryOperation,
|
|
53
|
+
Operation,
|
|
54
|
+
OpType,
|
|
55
|
+
StandardOperation,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
if TYPE_CHECKING:
|
|
59
|
+
from collections.abc import Mapping, Sequence
|
|
60
|
+
|
|
61
|
+
from qiskit.circuit.singleton import SingletonGate
|
|
62
|
+
|
|
63
|
+
from ...ir import QuantumComputation
|
|
64
|
+
|
|
65
|
+
__all__ = ["mqt_to_qiskit"]
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def __dir__() -> list[str]:
|
|
69
|
+
return __all__
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def _translate_controls(controls: set[Control], qubit_map: Mapping[int, Qubit]) -> tuple[list[Qubit], str]:
|
|
73
|
+
"""Translate a set of :class:`~mqt.core.ir.operations.Control` to Qiskit.
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
controls: The controls to translate.
|
|
77
|
+
qubit_map: A mapping from qubit indices to Qiskit :class:`~qiskit.circuit.Qubit`.
|
|
78
|
+
|
|
79
|
+
Returns:
|
|
80
|
+
A tuple containing the translated qubits and control states.
|
|
81
|
+
"""
|
|
82
|
+
qubits: list[Qubit] = []
|
|
83
|
+
ctrl_state: str = ""
|
|
84
|
+
for control in controls:
|
|
85
|
+
qubit = qubit_map[control.qubit]
|
|
86
|
+
qubits.append(qubit)
|
|
87
|
+
# MSB to the left
|
|
88
|
+
ctrl_state = "1" + ctrl_state if control.type_ == Control.Type.Pos else "0" + ctrl_state
|
|
89
|
+
return qubits, ctrl_state
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def _translate_targets(targets: Sequence[int], qubit_map: Mapping[int, Qubit]) -> list[Qubit]:
|
|
93
|
+
"""Translate a sequence of target qubit indices to a list of Qiskit :class:`~qiskit.circuit.Qubit`.
|
|
94
|
+
|
|
95
|
+
Args:
|
|
96
|
+
targets: The target qubit indices to translate.
|
|
97
|
+
qubit_map: A mapping from qubit indices to Qiskit :class:`~qiskit.circuit.Qubit`.
|
|
98
|
+
|
|
99
|
+
Returns:
|
|
100
|
+
The translated qubits.
|
|
101
|
+
"""
|
|
102
|
+
return [qubit_map[target] for target in targets]
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def _add_standard_operation(circ: QuantumCircuit, op: StandardOperation, qubit_map: Mapping[int, Qubit]) -> None:
|
|
106
|
+
"""Add a :class:`~mqt.core.ir.operations.StandardOperation`.
|
|
107
|
+
|
|
108
|
+
Args:
|
|
109
|
+
circ: The Qiskit circuit to add the operation to.
|
|
110
|
+
op: The MQT operation to add.
|
|
111
|
+
qubit_map: A mapping from qubit indices to Qiskit :class:`~qiskit.circuit.Qubit`.
|
|
112
|
+
|
|
113
|
+
Raises:
|
|
114
|
+
TypeError: If the operation type is not supported.
|
|
115
|
+
"""
|
|
116
|
+
targets = _translate_targets(op.targets, qubit_map)
|
|
117
|
+
|
|
118
|
+
if op.type_ == OpType.barrier:
|
|
119
|
+
circ.barrier(targets)
|
|
120
|
+
return
|
|
121
|
+
|
|
122
|
+
controls, ctrl_state = _translate_controls(op.controls, qubit_map)
|
|
123
|
+
|
|
124
|
+
gate_map_singleton: dict[OpType, SingletonGate] = {
|
|
125
|
+
OpType.i: IGate(),
|
|
126
|
+
OpType.x: XGate(),
|
|
127
|
+
OpType.y: YGate(),
|
|
128
|
+
OpType.z: ZGate(),
|
|
129
|
+
OpType.h: HGate(),
|
|
130
|
+
OpType.s: SGate(),
|
|
131
|
+
OpType.sdg: SdgGate(),
|
|
132
|
+
OpType.t: TGate(),
|
|
133
|
+
OpType.tdg: TdgGate(),
|
|
134
|
+
OpType.sx: SXGate(),
|
|
135
|
+
OpType.sxdg: SXdgGate(),
|
|
136
|
+
OpType.dcx: DCXGate(),
|
|
137
|
+
OpType.ecr: ECRGate(),
|
|
138
|
+
OpType.swap: SwapGate(),
|
|
139
|
+
OpType.iswap: iSwapGate(),
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if op.type_ in gate_map_singleton:
|
|
143
|
+
gate = gate_map_singleton[op.type_]
|
|
144
|
+
if len(controls) == 0:
|
|
145
|
+
circ.append(gate, targets)
|
|
146
|
+
else:
|
|
147
|
+
circ.append(gate.control(len(controls), ctrl_state=ctrl_state), [*controls, *targets])
|
|
148
|
+
return
|
|
149
|
+
|
|
150
|
+
gate_map_single_param: dict[OpType, type] = {
|
|
151
|
+
OpType.rx: RXGate,
|
|
152
|
+
OpType.ry: RYGate,
|
|
153
|
+
OpType.rz: RZGate,
|
|
154
|
+
OpType.p: PhaseGate,
|
|
155
|
+
OpType.rxx: RXXGate,
|
|
156
|
+
OpType.ryy: RYYGate,
|
|
157
|
+
OpType.rzz: RZZGate,
|
|
158
|
+
OpType.rzx: RZXGate,
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if op.type_ in gate_map_single_param:
|
|
162
|
+
gate = gate_map_single_param[op.type_]
|
|
163
|
+
parameter = op.parameter[0]
|
|
164
|
+
if len(controls) == 0:
|
|
165
|
+
circ.append(gate(parameter), targets)
|
|
166
|
+
else:
|
|
167
|
+
circ.append(gate(parameter).control(len(controls), ctrl_state=ctrl_state), [*controls, *targets])
|
|
168
|
+
return
|
|
169
|
+
|
|
170
|
+
gate_map_two_param: dict[OpType, type] = {
|
|
171
|
+
OpType.u2: U2Gate,
|
|
172
|
+
OpType.xx_plus_yy: XXPlusYYGate,
|
|
173
|
+
OpType.xx_minus_yy: XXMinusYYGate,
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if op.type_ in gate_map_two_param:
|
|
177
|
+
gate = gate_map_two_param[op.type_]
|
|
178
|
+
parameter1, parameter2 = op.parameter
|
|
179
|
+
if len(controls) == 0:
|
|
180
|
+
circ.append(gate(parameter1, parameter2), targets)
|
|
181
|
+
else:
|
|
182
|
+
circ.append(
|
|
183
|
+
gate(parameter1, parameter2).control(len(controls), ctrl_state=ctrl_state), [*controls, *targets]
|
|
184
|
+
)
|
|
185
|
+
return
|
|
186
|
+
|
|
187
|
+
gate_map_three_param: dict[OpType, type] = {
|
|
188
|
+
OpType.u: U3Gate,
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if op.type_ in gate_map_three_param:
|
|
192
|
+
gate = gate_map_three_param[op.type_]
|
|
193
|
+
parameter1, parameter2, parameter3 = op.parameter
|
|
194
|
+
if len(controls) == 0:
|
|
195
|
+
circ.append(gate(parameter1, parameter2, parameter3), targets)
|
|
196
|
+
else:
|
|
197
|
+
circ.append(
|
|
198
|
+
gate(parameter1, parameter2, parameter3).control(len(controls), ctrl_state=ctrl_state),
|
|
199
|
+
[*controls, *targets],
|
|
200
|
+
)
|
|
201
|
+
return
|
|
202
|
+
|
|
203
|
+
msg = f"Unsupported operation type: {op.type_}"
|
|
204
|
+
raise TypeError(msg)
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
def _add_non_unitary_operation(
|
|
208
|
+
circ: QuantumCircuit, op: NonUnitaryOperation, qubit_map: Mapping[int, Qubit], clbit_map: Mapping[int, Clbit]
|
|
209
|
+
) -> None:
|
|
210
|
+
"""Add a :class:`~mqt.core.ir.operations.NonUnitaryOperation`.
|
|
211
|
+
|
|
212
|
+
Args:
|
|
213
|
+
circ: The Qiskit circuit to add the operation to.
|
|
214
|
+
op: The MQT operation to add.
|
|
215
|
+
qubit_map: A mapping from qubit indices to Qiskit :class:`~qiskit.circuit.Qubit`.
|
|
216
|
+
clbit_map: A mapping from classical bit indices to Qiskit :class:`~qiskit.circuit.Clbit`.
|
|
217
|
+
"""
|
|
218
|
+
if op.type_ == OpType.measure:
|
|
219
|
+
for qubit, clbit in zip(op.targets, op.classics):
|
|
220
|
+
circ.measure(qubit_map[qubit], clbit_map[clbit])
|
|
221
|
+
return
|
|
222
|
+
|
|
223
|
+
if op.type_ == OpType.reset:
|
|
224
|
+
for qubit in op.targets:
|
|
225
|
+
circ.reset(qubit_map[qubit])
|
|
226
|
+
return
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
def _add_compound_operation(
|
|
230
|
+
circ: QuantumCircuit, op: CompoundOperation, qubit_map: Mapping[int, Qubit], clbit_map: Mapping[int, Clbit]
|
|
231
|
+
) -> None:
|
|
232
|
+
"""Add a :class:`~mqt.core.ir.operations.CompoundOperation`.
|
|
233
|
+
|
|
234
|
+
Args:
|
|
235
|
+
circ: The Qiskit circuit to add the operation to.
|
|
236
|
+
op: The MQT operation to add.
|
|
237
|
+
qubit_map: A mapping from qubit indices to Qiskit :class:`~qiskit.circuit.Qubit`.
|
|
238
|
+
clbit_map: A mapping from classical bit indices to Qiskit :class:`~qiskit.circuit.Clbit`.
|
|
239
|
+
"""
|
|
240
|
+
inner_circ = QuantumCircuit(*circ.qregs, *circ.cregs)
|
|
241
|
+
for inner_op in op:
|
|
242
|
+
_add_operation(inner_circ, inner_op, qubit_map, clbit_map)
|
|
243
|
+
circ.append(inner_circ.to_instruction(), circ.qubits, circ.clbits)
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
def _add_operation(
|
|
247
|
+
circ: QuantumCircuit, op: Operation, qubit_map: Mapping[int, Qubit], clbit_map: Mapping[int, Clbit]
|
|
248
|
+
) -> None:
|
|
249
|
+
"""Add an operation to a Qiskit circuit.
|
|
250
|
+
|
|
251
|
+
Args:
|
|
252
|
+
circ: The Qiskit circuit to add the operation to.
|
|
253
|
+
op: The MQT operation to add.
|
|
254
|
+
qubit_map: A mapping from qubit indices to Qiskit :class:`~qiskit.circuit.Qubit`.
|
|
255
|
+
clbit_map: A mapping from classical bit indices to Qiskit :class:`~qiskit.circuit.Clbit`.
|
|
256
|
+
|
|
257
|
+
Raises:
|
|
258
|
+
TypeError: If the operation type is not supported.
|
|
259
|
+
NotImplementedError: If the operation type is not yet supported.
|
|
260
|
+
"""
|
|
261
|
+
if isinstance(op, StandardOperation):
|
|
262
|
+
_add_standard_operation(circ, op, qubit_map)
|
|
263
|
+
elif isinstance(op, NonUnitaryOperation):
|
|
264
|
+
_add_non_unitary_operation(circ, op, qubit_map, clbit_map)
|
|
265
|
+
elif isinstance(op, CompoundOperation):
|
|
266
|
+
_add_compound_operation(circ, op, qubit_map, clbit_map)
|
|
267
|
+
elif isinstance(op, ClassicControlledOperation):
|
|
268
|
+
msg = "Conversion of classic-controlled operations to Qiskit is not yet supported."
|
|
269
|
+
raise NotImplementedError(msg)
|
|
270
|
+
else:
|
|
271
|
+
msg = f"Unsupported operation type: {type(op)}"
|
|
272
|
+
raise TypeError(msg)
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
def mqt_to_qiskit(qc: QuantumComputation, *, set_layout: bool = False) -> QuantumCircuit:
|
|
276
|
+
"""Convert a :class:`~mqt.core.ir.QuantumComputation` to a Qiskit :class:`~qiskit.circuit.QuantumCircuit`.
|
|
277
|
+
|
|
278
|
+
Args:
|
|
279
|
+
qc: The MQT circuit to convert.
|
|
280
|
+
set_layout: If true, the :attr:`~qiskit.circuit.QuantumCircuit.layout` property is populated with the
|
|
281
|
+
initial layout and output permutation of the MQT circuit.
|
|
282
|
+
|
|
283
|
+
Returns:
|
|
284
|
+
The converted circuit.
|
|
285
|
+
|
|
286
|
+
Raises:
|
|
287
|
+
NotImplementedError: If the MQT circuit contains variables.
|
|
288
|
+
"""
|
|
289
|
+
if not qc.is_variable_free():
|
|
290
|
+
msg = "Converting symbolic circuits with variables to Qiskit is not yet supported."
|
|
291
|
+
raise NotImplementedError(msg)
|
|
292
|
+
|
|
293
|
+
circ = QuantumCircuit()
|
|
294
|
+
|
|
295
|
+
if qc.name is not None:
|
|
296
|
+
circ.name = qc.name
|
|
297
|
+
|
|
298
|
+
qregs = sorted((qc.qregs | qc.ancregs).values(), key=lambda reg: reg.start)
|
|
299
|
+
qubit_map: dict[int, Qubit] = {}
|
|
300
|
+
for qreg in qregs:
|
|
301
|
+
qiskit_reg = (
|
|
302
|
+
QuantumRegister(size=qreg.size, name=qreg.name)
|
|
303
|
+
if qreg.name in qc.qregs
|
|
304
|
+
else AncillaRegister(size=qreg.size, name=qreg.name)
|
|
305
|
+
)
|
|
306
|
+
circ.add_register(qiskit_reg)
|
|
307
|
+
for i, qubit in enumerate(qiskit_reg):
|
|
308
|
+
qubit_map[qreg.start + i] = qubit
|
|
309
|
+
|
|
310
|
+
cregs = sorted(qc.cregs.values(), key=lambda reg: reg.start)
|
|
311
|
+
clbit_map: dict[int, Clbit] = {}
|
|
312
|
+
for creg in cregs:
|
|
313
|
+
qiskit_creg = ClassicalRegister(size=creg.size, name=creg.name)
|
|
314
|
+
circ.add_register(qiskit_creg)
|
|
315
|
+
for i, clbit in enumerate(qiskit_creg):
|
|
316
|
+
clbit_map[creg.start + i] = clbit
|
|
317
|
+
|
|
318
|
+
for op in qc:
|
|
319
|
+
_add_operation(circ, op, qubit_map, clbit_map)
|
|
320
|
+
|
|
321
|
+
if not set_layout:
|
|
322
|
+
return circ
|
|
323
|
+
|
|
324
|
+
# create a list of physical qubits initialized to none, but with the correct length
|
|
325
|
+
p2v: list[Qubit | None] = [None] * len(circ.qubits)
|
|
326
|
+
# fill the list with the correct virtual qubits
|
|
327
|
+
for virtual, physical in qc.initial_layout.items():
|
|
328
|
+
p2v[virtual] = qubit_map[physical]
|
|
329
|
+
initial_layout = Layout().from_qubit_list(p2v, *circ.qregs)
|
|
330
|
+
|
|
331
|
+
# reconstruct the final layout, which is the permutation between the initial layout and the output permutation
|
|
332
|
+
permutation = Permutation()
|
|
333
|
+
for physical, virtual in qc.output_permutation.items():
|
|
334
|
+
# find the virtual qubit in the initial layout and store the corresponding physical qubit
|
|
335
|
+
for p, v in qc.initial_layout.items():
|
|
336
|
+
if v == virtual:
|
|
337
|
+
permutation[p] = physical
|
|
338
|
+
continue
|
|
339
|
+
|
|
340
|
+
p2v = [None] * len(circ.qubits)
|
|
341
|
+
# fill the list with the correct virtual qubits
|
|
342
|
+
for physical, virtual in permutation.items():
|
|
343
|
+
p2v[virtual] = qubit_map[physical]
|
|
344
|
+
final_layout = Layout().from_qubit_list(p2v, *circ.qregs)
|
|
345
|
+
|
|
346
|
+
circ._layout = TranspileLayout( # noqa: SLF001
|
|
347
|
+
initial_layout=initial_layout,
|
|
348
|
+
input_qubit_mapping={qubit: idx for idx, qubit in qubit_map.items()},
|
|
349
|
+
final_layout=final_layout,
|
|
350
|
+
_input_qubit_count=qc.num_qubits,
|
|
351
|
+
_output_qubit_list=list(final_layout.get_virtual_bits()),
|
|
352
|
+
)
|
|
353
|
+
|
|
354
|
+
return circ
|