mqt-core 3.1.0__cp313-cp313-win_arm64.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.cp313-win_arm64.pyd +0 -0
- mqt/core/dd.pyi +1031 -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 +1019 -0
- mqt/core/ir/registers.pyi +91 -0
- mqt/core/ir/symbolic.pyi +177 -0
- mqt/core/ir.cp313-win_arm64.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.1.0.dist-info/DELVEWHEEL +2 -0
- mqt_core-3.1.0.dist-info/METADATA +168 -0
- mqt_core-3.1.0.dist-info/RECORD +343 -0
- mqt_core-3.1.0.dist-info/WHEEL +5 -0
- mqt_core-3.1.0.dist-info/entry_points.txt +4 -0
- mqt_core-3.1.0.dist-info/licenses/LICENSE.md +22 -0
- mqt_core.libs/msvcp140.dll +0 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023 - 2025 Chair for Design Automation, TUM
|
|
3
|
+
* Copyright (c) 2025 Munich Quantum Software Company GmbH
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
*
|
|
6
|
+
* SPDX-License-Identifier: MIT
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the MIT License
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include "ir/Definitions.hpp"
|
|
14
|
+
#include "ir/Permutation.hpp"
|
|
15
|
+
#include "ir/Register.hpp"
|
|
16
|
+
#include "ir/operations/Control.hpp"
|
|
17
|
+
#include "ir/operations/OpType.hpp"
|
|
18
|
+
#include "ir/operations/Operation.hpp"
|
|
19
|
+
|
|
20
|
+
#include <cstddef>
|
|
21
|
+
#include <functional>
|
|
22
|
+
#include <memory>
|
|
23
|
+
#include <ostream>
|
|
24
|
+
#include <set>
|
|
25
|
+
#include <stdexcept>
|
|
26
|
+
#include <vector>
|
|
27
|
+
|
|
28
|
+
namespace qc {
|
|
29
|
+
|
|
30
|
+
class NonUnitaryOperation final : public Operation {
|
|
31
|
+
public:
|
|
32
|
+
// Measurement constructor
|
|
33
|
+
NonUnitaryOperation(std::vector<Qubit> qubitRegister,
|
|
34
|
+
std::vector<Bit> classicalRegister);
|
|
35
|
+
NonUnitaryOperation(Qubit qubit, Bit cbit);
|
|
36
|
+
|
|
37
|
+
// General constructor
|
|
38
|
+
explicit NonUnitaryOperation(Targets qubits, OpType op = Reset);
|
|
39
|
+
|
|
40
|
+
[[nodiscard]] std::unique_ptr<Operation> clone() const override {
|
|
41
|
+
return std::make_unique<NonUnitaryOperation>(*this);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
[[nodiscard]] bool isUnitary() const override { return false; }
|
|
45
|
+
|
|
46
|
+
[[nodiscard]] bool isNonUnitaryOperation() const override { return true; }
|
|
47
|
+
|
|
48
|
+
[[nodiscard]] const std::vector<Bit>& getClassics() const { return classics; }
|
|
49
|
+
std::vector<Bit>& getClassics() { return classics; }
|
|
50
|
+
[[nodiscard]] std::size_t getNclassics() const { return classics.size(); }
|
|
51
|
+
|
|
52
|
+
void addDepthContribution(std::vector<std::size_t>& depths) const override;
|
|
53
|
+
|
|
54
|
+
void addControl(const Control /*c*/) override {
|
|
55
|
+
throw std::runtime_error("Cannot add control to non-unitary operation.");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
void clearControls() override {
|
|
59
|
+
throw std::runtime_error(
|
|
60
|
+
"Cannot clear controls from non-unitary operation.");
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
void removeControl(const Control /*c*/) override {
|
|
64
|
+
throw std::runtime_error(
|
|
65
|
+
"Cannot remove controls from non-unitary operation.");
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
Controls::iterator removeControl(const Controls::iterator /*it*/) override {
|
|
69
|
+
throw std::runtime_error(
|
|
70
|
+
"Cannot remove controls from non-unitary operation.");
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
[[nodiscard]] bool equals(const Operation& op, const Permutation& perm1,
|
|
74
|
+
const Permutation& perm2) const override;
|
|
75
|
+
[[nodiscard]] bool equals(const Operation& operation) const override {
|
|
76
|
+
return equals(operation, {}, {});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
std::ostream& print(std::ostream& os, const Permutation& permutation,
|
|
80
|
+
std::size_t prefixWidth,
|
|
81
|
+
std::size_t nqubits) const override;
|
|
82
|
+
|
|
83
|
+
void dumpOpenQASM(std::ostream& of, const QubitIndexToRegisterMap& qubitMap,
|
|
84
|
+
const BitIndexToRegisterMap& bitMap, std::size_t indent,
|
|
85
|
+
bool openQASM3) const override;
|
|
86
|
+
|
|
87
|
+
void invert() override {
|
|
88
|
+
throw std::runtime_error(
|
|
89
|
+
"Inverting a non-unitary operation is not supported.");
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
void apply(const Permutation& permutation) override;
|
|
93
|
+
|
|
94
|
+
protected:
|
|
95
|
+
std::vector<Bit> classics; // vector for the classical bits to measure into
|
|
96
|
+
|
|
97
|
+
static void printMeasurement(std::ostream& os, const std::vector<Qubit>& q,
|
|
98
|
+
const std::vector<Bit>& c,
|
|
99
|
+
const Permutation& permutation,
|
|
100
|
+
std::size_t nqubits);
|
|
101
|
+
void printReset(std::ostream& os, const std::vector<Qubit>& q,
|
|
102
|
+
const Permutation& permutation, std::size_t nqubits) const;
|
|
103
|
+
};
|
|
104
|
+
} // namespace qc
|
|
105
|
+
|
|
106
|
+
template <> struct std::hash<qc::NonUnitaryOperation> {
|
|
107
|
+
std::size_t operator()(qc::NonUnitaryOperation const& op) const noexcept {
|
|
108
|
+
std::size_t seed = 0U;
|
|
109
|
+
qc::hashCombine(seed, op.getType());
|
|
110
|
+
for (const auto& q : op.getTargets()) {
|
|
111
|
+
qc::hashCombine(seed, q);
|
|
112
|
+
}
|
|
113
|
+
for (const auto& c : op.getClassics()) {
|
|
114
|
+
qc::hashCombine(seed, c);
|
|
115
|
+
}
|
|
116
|
+
return seed;
|
|
117
|
+
}
|
|
118
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023 - 2025 Chair for Design Automation, TUM
|
|
3
|
+
* Copyright (c) 2025 Munich Quantum Software Company GmbH
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
*
|
|
6
|
+
* SPDX-License-Identifier: MIT
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the MIT License
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include <cstdint>
|
|
14
|
+
#include <istream>
|
|
15
|
+
#include <ostream>
|
|
16
|
+
#include <string>
|
|
17
|
+
|
|
18
|
+
namespace qc {
|
|
19
|
+
|
|
20
|
+
enum OpTypeFlags : uint8_t {
|
|
21
|
+
OpTypeNone = 0b00,
|
|
22
|
+
OpTypeInv = 0b01,
|
|
23
|
+
OpTypeDiag = 0b10,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
constexpr static unsigned NUM_OP_TYPE_FLAG_BITS = 2;
|
|
27
|
+
|
|
28
|
+
// Natively supported operations of the MQT Core library
|
|
29
|
+
enum OpType : std::uint8_t {
|
|
30
|
+
#define HANDLE_OP_TYPE(N, id, flags, repr) \
|
|
31
|
+
id = ((N) << (NUM_OP_TYPE_FLAG_BITS)) | (flags),
|
|
32
|
+
#define LAST_OP_TYPE(N) OpTypeEnd = (N) << (NUM_OP_TYPE_FLAG_BITS),
|
|
33
|
+
#include "OpType.inc"
|
|
34
|
+
|
|
35
|
+
#undef HANDLE_OP_TYPE
|
|
36
|
+
#undef LAST_OP_TYPE
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
std::string toString(OpType opType);
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @brief Gives a short name for the given OpType (at most 3 characters)
|
|
43
|
+
* @param opType OpType to get the short name for
|
|
44
|
+
* @return Short name for the given OpType
|
|
45
|
+
*/
|
|
46
|
+
std::string shortName(OpType opType);
|
|
47
|
+
|
|
48
|
+
[[nodiscard]] constexpr bool isTwoQubitGate(const OpType opType) {
|
|
49
|
+
switch (opType) {
|
|
50
|
+
case SWAP:
|
|
51
|
+
case iSWAP:
|
|
52
|
+
case iSWAPdg:
|
|
53
|
+
case Peres:
|
|
54
|
+
case Peresdg:
|
|
55
|
+
case DCX:
|
|
56
|
+
case ECR:
|
|
57
|
+
case RXX:
|
|
58
|
+
case RYY:
|
|
59
|
+
case RZZ:
|
|
60
|
+
case RZX:
|
|
61
|
+
case XXminusYY:
|
|
62
|
+
case XXplusYY:
|
|
63
|
+
return true;
|
|
64
|
+
default:
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
[[nodiscard]] constexpr bool isSingleQubitGate(const OpType type) {
|
|
70
|
+
switch (type) {
|
|
71
|
+
case I:
|
|
72
|
+
case U:
|
|
73
|
+
case U2:
|
|
74
|
+
case P:
|
|
75
|
+
case X:
|
|
76
|
+
case Y:
|
|
77
|
+
case Z:
|
|
78
|
+
case H:
|
|
79
|
+
case S:
|
|
80
|
+
case Sdg:
|
|
81
|
+
case T:
|
|
82
|
+
case SX:
|
|
83
|
+
case SXdg:
|
|
84
|
+
case Tdg:
|
|
85
|
+
case V:
|
|
86
|
+
case Vdg:
|
|
87
|
+
case RX:
|
|
88
|
+
case RY:
|
|
89
|
+
case RZ:
|
|
90
|
+
return true;
|
|
91
|
+
default:
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
inline std::ostream& operator<<(std::ostream& out, const OpType opType) {
|
|
97
|
+
return out << toString(opType);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
[[nodiscard]] OpType opTypeFromString(const std::string& opType);
|
|
101
|
+
|
|
102
|
+
inline std::istream& operator>>(std::istream& in, OpType& opType) {
|
|
103
|
+
std::string opTypeStr;
|
|
104
|
+
in >> opTypeStr;
|
|
105
|
+
|
|
106
|
+
if (opTypeStr.empty()) {
|
|
107
|
+
in.setstate(std::istream::failbit);
|
|
108
|
+
return in;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
opType = opTypeFromString(opTypeStr);
|
|
112
|
+
return in;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
} // namespace qc
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023 - 2025 Chair for Design Automation, TUM
|
|
3
|
+
* Copyright (c) 2025 Munich Quantum Software Company GmbH
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
*
|
|
6
|
+
* SPDX-License-Identifier: MIT
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the MIT License
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
HANDLE_OP_TYPE(0, None, 0, "none")
|
|
12
|
+
|
|
13
|
+
// Standard Operations
|
|
14
|
+
HANDLE_OP_TYPE(1, GPhase, 0, "gphase")
|
|
15
|
+
HANDLE_OP_TYPE(2, I, OpTypeDiag, "i")
|
|
16
|
+
HANDLE_OP_TYPE(3, Barrier, OpTypeDiag, "barrier")
|
|
17
|
+
HANDLE_OP_TYPE(4, H, OpTypeNone, "h")
|
|
18
|
+
HANDLE_OP_TYPE(5, X, OpTypeNone, "x")
|
|
19
|
+
HANDLE_OP_TYPE(6, Y, OpTypeNone, "y")
|
|
20
|
+
HANDLE_OP_TYPE(7, Z, OpTypeDiag, "z")
|
|
21
|
+
HANDLE_OP_TYPE(8, S, OpTypeDiag, "s")
|
|
22
|
+
HANDLE_OP_TYPE(8, Sdg, OpTypeDiag | OpTypeInv, "sdg")
|
|
23
|
+
HANDLE_OP_TYPE(9, T, OpTypeDiag, "t")
|
|
24
|
+
HANDLE_OP_TYPE(9, Tdg, OpTypeDiag | OpTypeInv, "tdg")
|
|
25
|
+
HANDLE_OP_TYPE(10, V, OpTypeNone, "v")
|
|
26
|
+
HANDLE_OP_TYPE(10, Vdg, OpTypeInv, "vdg")
|
|
27
|
+
HANDLE_OP_TYPE(11, U, OpTypeNone, "u")
|
|
28
|
+
HANDLE_OP_TYPE(12, U2, OpTypeNone, "u2")
|
|
29
|
+
HANDLE_OP_TYPE(13, P, OpTypeDiag, "p")
|
|
30
|
+
HANDLE_OP_TYPE(14, SX, OpTypeNone, "sx")
|
|
31
|
+
HANDLE_OP_TYPE(14, SXdg, OpTypeInv, "sxdg")
|
|
32
|
+
HANDLE_OP_TYPE(15, RX, OpTypeNone, "rx")
|
|
33
|
+
HANDLE_OP_TYPE(16, RY, OpTypeNone, "ry")
|
|
34
|
+
HANDLE_OP_TYPE(17, RZ, OpTypeDiag, "rz")
|
|
35
|
+
HANDLE_OP_TYPE(18, SWAP, OpTypeNone, "swap")
|
|
36
|
+
HANDLE_OP_TYPE(19, iSWAP, OpTypeNone, "iswap")
|
|
37
|
+
HANDLE_OP_TYPE(19, iSWAPdg, OpTypeInv, "iswapdg")
|
|
38
|
+
HANDLE_OP_TYPE(20, Peres, OpTypeNone, "peres")
|
|
39
|
+
HANDLE_OP_TYPE(20, Peresdg, OpTypeInv, "peresdg")
|
|
40
|
+
HANDLE_OP_TYPE(21, DCX, OpTypeNone, "dcx")
|
|
41
|
+
HANDLE_OP_TYPE(22, ECR, OpTypeNone, "ecr")
|
|
42
|
+
HANDLE_OP_TYPE(23, RXX, OpTypeNone, "rxx")
|
|
43
|
+
HANDLE_OP_TYPE(24, RYY, OpTypeNone, "ryy")
|
|
44
|
+
HANDLE_OP_TYPE(25, RZZ, OpTypeDiag, "rzz")
|
|
45
|
+
HANDLE_OP_TYPE(26, RZX, OpTypeNone, "rzx")
|
|
46
|
+
HANDLE_OP_TYPE(27, XXminusYY, OpTypeNone, "xx_minus_yy")
|
|
47
|
+
HANDLE_OP_TYPE(28, XXplusYY, OpTypeNone, "xx_plus_yy")
|
|
48
|
+
|
|
49
|
+
// Compound Operation
|
|
50
|
+
HANDLE_OP_TYPE(29, Compound, OpTypeNone, "compound")
|
|
51
|
+
|
|
52
|
+
// Non Unitary Operations
|
|
53
|
+
HANDLE_OP_TYPE(30, Measure, OpTypeNone, "measure")
|
|
54
|
+
HANDLE_OP_TYPE(31, Reset, OpTypeNone, "reset")
|
|
55
|
+
|
|
56
|
+
// Classically-controlled Operation
|
|
57
|
+
HANDLE_OP_TYPE(32, ClassicControlled, OpTypeNone, "classic_controlled")
|
|
58
|
+
|
|
59
|
+
// Noise operations
|
|
60
|
+
HANDLE_OP_TYPE(33, ATrue, 0, "a_true")
|
|
61
|
+
HANDLE_OP_TYPE(34, AFalse, 0, "a_false")
|
|
62
|
+
HANDLE_OP_TYPE(35, MultiATrue, 0, "multi_a_true")
|
|
63
|
+
HANDLE_OP_TYPE(36, MultiAFalse, 0, "multi_a_false")
|
|
64
|
+
|
|
65
|
+
// Neutral atom shuttling operations
|
|
66
|
+
HANDLE_OP_TYPE(37, Move, 0, "move")
|
|
67
|
+
HANDLE_OP_TYPE(38, AodActivate, 0, "aod_activate")
|
|
68
|
+
HANDLE_OP_TYPE(39, AodDeactivate, 0, "aod_deactivate")
|
|
69
|
+
HANDLE_OP_TYPE(40, AodMove, 0, "aod_move")
|
|
70
|
+
|
|
71
|
+
LAST_OP_TYPE(41)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
#undef OpTypeInv
|
|
75
|
+
#undef OpTypeDiag
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023 - 2025 Chair for Design Automation, TUM
|
|
3
|
+
* Copyright (c) 2025 Munich Quantum Software Company GmbH
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
*
|
|
6
|
+
* SPDX-License-Identifier: MIT
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the MIT License
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include "ir/Definitions.hpp"
|
|
14
|
+
#include "ir/Permutation.hpp"
|
|
15
|
+
#include "ir/Register.hpp"
|
|
16
|
+
#include "ir/operations/Control.hpp"
|
|
17
|
+
#include "ir/operations/OpType.hpp"
|
|
18
|
+
|
|
19
|
+
#include <cstring>
|
|
20
|
+
#include <functional>
|
|
21
|
+
#include <iostream>
|
|
22
|
+
#include <memory>
|
|
23
|
+
#include <set>
|
|
24
|
+
#include <string>
|
|
25
|
+
#include <vector>
|
|
26
|
+
|
|
27
|
+
namespace qc {
|
|
28
|
+
class Operation {
|
|
29
|
+
protected:
|
|
30
|
+
Controls controls;
|
|
31
|
+
Targets targets;
|
|
32
|
+
std::vector<fp> parameter;
|
|
33
|
+
|
|
34
|
+
OpType type = None;
|
|
35
|
+
std::string name;
|
|
36
|
+
|
|
37
|
+
static constexpr size_t OUTPUT_INDENT_SIZE = 2;
|
|
38
|
+
|
|
39
|
+
static bool isWholeQubitRegister(const QubitIndexToRegisterMap& regMap,
|
|
40
|
+
const Qubit start, const Qubit end) {
|
|
41
|
+
const auto& startReg = regMap.at(start).first;
|
|
42
|
+
const auto& endReg = regMap.at(end).first;
|
|
43
|
+
return startReg == endReg && startReg.getStartIndex() == start &&
|
|
44
|
+
endReg.getEndIndex() == end;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public:
|
|
48
|
+
Operation() = default;
|
|
49
|
+
Operation(const Operation& op) = default;
|
|
50
|
+
Operation(Operation&& op) noexcept = default;
|
|
51
|
+
Operation& operator=(const Operation& op) = default;
|
|
52
|
+
Operation& operator=(Operation&& op) noexcept = default;
|
|
53
|
+
|
|
54
|
+
// Virtual Destructor
|
|
55
|
+
virtual ~Operation() = default;
|
|
56
|
+
|
|
57
|
+
[[nodiscard]] virtual std::unique_ptr<Operation> clone() const = 0;
|
|
58
|
+
|
|
59
|
+
// Getters
|
|
60
|
+
[[nodiscard]] virtual const Targets& getTargets() const { return targets; }
|
|
61
|
+
virtual Targets& getTargets() { return targets; }
|
|
62
|
+
[[nodiscard]] virtual std::size_t getNtargets() const {
|
|
63
|
+
return targets.size();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
[[nodiscard]] virtual const Controls& getControls() const { return controls; }
|
|
67
|
+
virtual Controls& getControls() { return controls; }
|
|
68
|
+
[[nodiscard]] virtual std::size_t getNcontrols() const {
|
|
69
|
+
return controls.size();
|
|
70
|
+
}
|
|
71
|
+
[[nodiscard]] virtual std::size_t getNqubits() const {
|
|
72
|
+
return getNcontrols() + getNtargets();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
[[nodiscard]] const std::vector<fp>& getParameter() const {
|
|
76
|
+
return parameter;
|
|
77
|
+
}
|
|
78
|
+
std::vector<fp>& getParameter() { return parameter; }
|
|
79
|
+
|
|
80
|
+
[[nodiscard]] const std::string& getName() const { return name; }
|
|
81
|
+
[[nodiscard]] virtual OpType getType() const { return type; }
|
|
82
|
+
|
|
83
|
+
[[nodiscard]] virtual auto
|
|
84
|
+
getUsedQubitsPermuted(const Permutation& perm) const -> std::set<Qubit>;
|
|
85
|
+
|
|
86
|
+
[[nodiscard]] auto getUsedQubits() const -> std::set<Qubit>;
|
|
87
|
+
|
|
88
|
+
[[nodiscard]] std::unique_ptr<Operation> getInverted() const {
|
|
89
|
+
auto op = clone();
|
|
90
|
+
op->invert();
|
|
91
|
+
return op;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Setter
|
|
95
|
+
virtual void setTargets(const Targets& t) { targets = t; }
|
|
96
|
+
|
|
97
|
+
virtual void setControls(const Controls& c) {
|
|
98
|
+
clearControls();
|
|
99
|
+
addControls(c);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
virtual void addControl(Control c) = 0;
|
|
103
|
+
|
|
104
|
+
void addControls(const Controls& c) {
|
|
105
|
+
for (const auto& control : c) {
|
|
106
|
+
addControl(control);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
virtual void clearControls() = 0;
|
|
111
|
+
|
|
112
|
+
virtual void removeControl(Control c) = 0;
|
|
113
|
+
|
|
114
|
+
virtual Controls::iterator removeControl(Controls::iterator it) = 0;
|
|
115
|
+
|
|
116
|
+
void removeControls(const Controls& c) {
|
|
117
|
+
for (auto it = c.begin(); it != c.end();) {
|
|
118
|
+
it = removeControl(it);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
virtual void setGate(const OpType g) {
|
|
123
|
+
type = g;
|
|
124
|
+
name = toString(g);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
virtual void setParameter(const std::vector<fp>& p) { parameter = p; }
|
|
128
|
+
|
|
129
|
+
virtual void apply(const Permutation& permutation);
|
|
130
|
+
|
|
131
|
+
[[nodiscard]] virtual bool isUnitary() const { return true; }
|
|
132
|
+
|
|
133
|
+
[[nodiscard]] virtual bool isStandardOperation() const { return false; }
|
|
134
|
+
|
|
135
|
+
[[nodiscard]] virtual bool isCompoundOperation() const noexcept {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
[[nodiscard]] virtual bool isNonUnitaryOperation() const { return false; }
|
|
140
|
+
|
|
141
|
+
[[nodiscard]] virtual bool isClassicControlledOperation() const noexcept {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
[[nodiscard]] virtual bool isSymbolicOperation() const { return false; }
|
|
146
|
+
|
|
147
|
+
[[nodiscard]] virtual auto isDiagonalGate() const -> bool {
|
|
148
|
+
// the second bit in the type is a flag that is set for diagonal gates
|
|
149
|
+
return (+type & OpTypeDiag) != 0;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
[[nodiscard]] virtual auto isSingleQubitGate() const -> bool {
|
|
153
|
+
return !isControlled() && qc::isSingleQubitGate(type);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
[[nodiscard]] virtual bool isControlled() const { return !controls.empty(); }
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* @brief Checks whether a gate is global.
|
|
160
|
+
* @details A StandardOperation is global if it acts on all qubits.
|
|
161
|
+
* A CompoundOperation is global if all its sub-operations are
|
|
162
|
+
* StandardOperations of the same type with the same parameters acting on all
|
|
163
|
+
* qubits. The latter is what a QASM line like `ry(π) q;` is translated to in
|
|
164
|
+
* MQT Core. All other operations are not global.
|
|
165
|
+
* @return True if the operation is global, false otherwise.
|
|
166
|
+
*/
|
|
167
|
+
[[nodiscard]] virtual bool isGlobal(size_t /* unused */) const {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
[[nodiscard]] virtual bool actsOn(const Qubit i) const {
|
|
172
|
+
for (const auto& t : targets) {
|
|
173
|
+
if (t == i) {
|
|
174
|
+
return true;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return controls.count(i) > 0;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
virtual void addDepthContribution(std::vector<std::size_t>& depths) const;
|
|
181
|
+
|
|
182
|
+
[[nodiscard]] virtual bool equals(const Operation& op,
|
|
183
|
+
const Permutation& perm1,
|
|
184
|
+
const Permutation& perm2) const;
|
|
185
|
+
[[nodiscard]] virtual bool equals(const Operation& op) const {
|
|
186
|
+
return equals(op, {}, {});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
virtual std::ostream& printParameters(std::ostream& os) const;
|
|
190
|
+
std::ostream& print(std::ostream& os, const std::size_t nqubits) const {
|
|
191
|
+
return print(os, {}, 0, nqubits);
|
|
192
|
+
}
|
|
193
|
+
virtual std::ostream& print(std::ostream& os, const Permutation& permutation,
|
|
194
|
+
std::size_t prefixWidth,
|
|
195
|
+
std::size_t nqubits) const;
|
|
196
|
+
|
|
197
|
+
void dumpOpenQASM2(std::ostream& of, const QubitIndexToRegisterMap& qubitMap,
|
|
198
|
+
const BitIndexToRegisterMap& bitMap) const {
|
|
199
|
+
dumpOpenQASM(of, qubitMap, bitMap, 0, false);
|
|
200
|
+
}
|
|
201
|
+
void dumpOpenQASM3(std::ostream& of, const QubitIndexToRegisterMap& qubitMap,
|
|
202
|
+
const BitIndexToRegisterMap& bitMap) const {
|
|
203
|
+
dumpOpenQASM(of, qubitMap, bitMap, 0, true);
|
|
204
|
+
}
|
|
205
|
+
virtual void dumpOpenQASM(std::ostream& of,
|
|
206
|
+
const QubitIndexToRegisterMap& qubitMap,
|
|
207
|
+
const BitIndexToRegisterMap& bitMap, size_t indent,
|
|
208
|
+
bool openQASM3) const = 0;
|
|
209
|
+
|
|
210
|
+
/// Checks whether operation commutes with other operation on a given qubit.
|
|
211
|
+
[[nodiscard]] virtual auto commutesAtQubit(const Operation& /*other*/,
|
|
212
|
+
const Qubit& /*qubit*/) const
|
|
213
|
+
-> bool {
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
[[nodiscard]] virtual auto isInverseOf(const Operation& /*other*/) const
|
|
218
|
+
-> bool;
|
|
219
|
+
|
|
220
|
+
virtual void invert() = 0;
|
|
221
|
+
|
|
222
|
+
virtual bool operator==(const Operation& rhs) const { return equals(rhs); }
|
|
223
|
+
bool operator!=(const Operation& rhs) const { return !(*this == rhs); }
|
|
224
|
+
};
|
|
225
|
+
} // namespace qc
|
|
226
|
+
|
|
227
|
+
template <> struct std::hash<qc::Operation> {
|
|
228
|
+
std::size_t operator()(const qc::Operation& op) const noexcept {
|
|
229
|
+
std::size_t seed = 0U;
|
|
230
|
+
qc::hashCombine(seed, hash<qc::OpType>{}(op.getType()));
|
|
231
|
+
for (const auto& control : op.getControls()) {
|
|
232
|
+
qc::hashCombine(seed, hash<qc::Qubit>{}(control.qubit));
|
|
233
|
+
if (control.type == qc::Control::Type::Neg) {
|
|
234
|
+
seed ^= 1ULL;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
for (const auto& target : op.getTargets()) {
|
|
238
|
+
qc::hashCombine(seed, hash<qc::Qubit>{}(target));
|
|
239
|
+
}
|
|
240
|
+
for (const auto& param : op.getParameter()) {
|
|
241
|
+
qc::hashCombine(seed, hash<qc::fp>{}(param));
|
|
242
|
+
}
|
|
243
|
+
return seed;
|
|
244
|
+
}
|
|
245
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023 - 2025 Chair for Design Automation, TUM
|
|
3
|
+
* Copyright (c) 2025 Munich Quantum Software Company GmbH
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
*
|
|
6
|
+
* SPDX-License-Identifier: MIT
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the MIT License
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include "ir/Definitions.hpp"
|
|
14
|
+
#include "ir/Permutation.hpp"
|
|
15
|
+
#include "ir/Register.hpp"
|
|
16
|
+
#include "ir/operations/Control.hpp"
|
|
17
|
+
#include "ir/operations/OpType.hpp"
|
|
18
|
+
#include "ir/operations/Operation.hpp"
|
|
19
|
+
|
|
20
|
+
#include <cmath>
|
|
21
|
+
#include <cstddef>
|
|
22
|
+
#include <memory>
|
|
23
|
+
#include <ostream>
|
|
24
|
+
#include <sstream>
|
|
25
|
+
#include <stdexcept>
|
|
26
|
+
#include <string>
|
|
27
|
+
#include <vector>
|
|
28
|
+
|
|
29
|
+
namespace qc {
|
|
30
|
+
class StandardOperation : public Operation {
|
|
31
|
+
protected:
|
|
32
|
+
constexpr static fp PARAMETER_TOLERANCE = 1e-13;
|
|
33
|
+
|
|
34
|
+
static void checkInteger(fp& ld) {
|
|
35
|
+
const fp nearest = std::nearbyint(ld);
|
|
36
|
+
if (std::abs(ld - nearest) < PARAMETER_TOLERANCE) {
|
|
37
|
+
ld = nearest;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
static void checkFractionPi(fp& ld) {
|
|
42
|
+
const fp div = PI / ld;
|
|
43
|
+
const fp nearest = std::nearbyint(div);
|
|
44
|
+
if (std::abs(div - nearest) < PARAMETER_TOLERANCE) {
|
|
45
|
+
ld = PI / nearest;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
OpType parseU3(fp& theta, fp& phi, fp& lambda);
|
|
50
|
+
OpType parseU2(fp& phi, fp& lambda);
|
|
51
|
+
OpType parseU1(fp& lambda);
|
|
52
|
+
|
|
53
|
+
void checkUgate();
|
|
54
|
+
void setup();
|
|
55
|
+
|
|
56
|
+
public:
|
|
57
|
+
StandardOperation() = default;
|
|
58
|
+
|
|
59
|
+
// Standard Constructors
|
|
60
|
+
StandardOperation(Qubit target, OpType g, std::vector<fp> params = {});
|
|
61
|
+
StandardOperation(const Targets& targ, OpType g, std::vector<fp> params = {});
|
|
62
|
+
|
|
63
|
+
StandardOperation(Control control, Qubit target, OpType g,
|
|
64
|
+
const std::vector<fp>& params = {});
|
|
65
|
+
StandardOperation(Control control, const Targets& targ, OpType g,
|
|
66
|
+
const std::vector<fp>& params = {});
|
|
67
|
+
|
|
68
|
+
StandardOperation(const Controls& c, Qubit target, OpType g,
|
|
69
|
+
const std::vector<fp>& params = {});
|
|
70
|
+
StandardOperation(const Controls& c, const Targets& targ, OpType g,
|
|
71
|
+
const std::vector<fp>& params = {});
|
|
72
|
+
|
|
73
|
+
// MCF (cSWAP), Peres, parameterized two target Constructor
|
|
74
|
+
StandardOperation(const Controls& c, Qubit target0, Qubit target1, OpType g,
|
|
75
|
+
const std::vector<fp>& params = {});
|
|
76
|
+
|
|
77
|
+
[[nodiscard]] std::unique_ptr<Operation> clone() const override {
|
|
78
|
+
return std::make_unique<StandardOperation>(*this);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
[[nodiscard]] bool isStandardOperation() const override { return true; }
|
|
82
|
+
|
|
83
|
+
[[nodiscard]] bool isGlobal(size_t nQubits) const override;
|
|
84
|
+
|
|
85
|
+
void addControl(const Control c) override {
|
|
86
|
+
if (actsOn(c.qubit)) {
|
|
87
|
+
throw std::runtime_error("Cannot add control on qubit " +
|
|
88
|
+
std::to_string(c.qubit) +
|
|
89
|
+
" to operation it already acts on the qubit.");
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
controls.emplace(c);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
void clearControls() override { controls.clear(); }
|
|
96
|
+
|
|
97
|
+
void removeControl(const Control c) override {
|
|
98
|
+
if (controls.erase(c) == 0) {
|
|
99
|
+
throw std::runtime_error("Cannot remove control on qubit " +
|
|
100
|
+
std::to_string(c.qubit) +
|
|
101
|
+
" from operation as it is not a control.");
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
Controls::iterator removeControl(const Controls::iterator it) override {
|
|
106
|
+
return controls.erase(it);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
[[nodiscard]] bool equals(const Operation& op, const Permutation& perm1,
|
|
110
|
+
const Permutation& perm2) const override {
|
|
111
|
+
return Operation::equals(op, perm1, perm2);
|
|
112
|
+
}
|
|
113
|
+
[[nodiscard]] bool equals(const Operation& operation) const override {
|
|
114
|
+
return equals(operation, {}, {});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
void dumpOpenQASM(std::ostream& of, const QubitIndexToRegisterMap& qubitMap,
|
|
118
|
+
const BitIndexToRegisterMap& bitMap, size_t indent,
|
|
119
|
+
bool openQASM3) const override;
|
|
120
|
+
|
|
121
|
+
[[nodiscard]] auto commutesAtQubit(const Operation& other,
|
|
122
|
+
const Qubit& qubit) const -> bool override;
|
|
123
|
+
|
|
124
|
+
void invert() override;
|
|
125
|
+
|
|
126
|
+
protected:
|
|
127
|
+
void dumpOpenQASM2(std::ostream& of, std::ostringstream& op,
|
|
128
|
+
const QubitIndexToRegisterMap& qubitMap) const;
|
|
129
|
+
void dumpOpenQASM3(std::ostream& of, std::ostringstream& op,
|
|
130
|
+
const QubitIndexToRegisterMap& qubitMap) const;
|
|
131
|
+
|
|
132
|
+
void dumpGateType(std::ostream& of, std::ostringstream& op,
|
|
133
|
+
const QubitIndexToRegisterMap& qubitMap) const;
|
|
134
|
+
|
|
135
|
+
void dumpControls(std::ostringstream& op) const;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
} // namespace qc
|