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.

Files changed (343) hide show
  1. mqt/core/__init__.py +89 -0
  2. mqt/core/__main__.py +55 -0
  3. mqt/core/_commands.py +52 -0
  4. mqt/core/_compat/__init__.py +11 -0
  5. mqt/core/_compat/typing.py +29 -0
  6. mqt/core/_version.py +21 -0
  7. mqt/core/_version.pyi +12 -0
  8. mqt/core/bin/mqt-core-algorithms.dll +0 -0
  9. mqt/core/bin/mqt-core-circuit-optimizer.dll +0 -0
  10. mqt/core/bin/mqt-core-dd.dll +0 -0
  11. mqt/core/bin/mqt-core-ds.dll +0 -0
  12. mqt/core/bin/mqt-core-ir.dll +0 -0
  13. mqt/core/bin/mqt-core-na.dll +0 -0
  14. mqt/core/bin/mqt-core-qasm.dll +0 -0
  15. mqt/core/bin/mqt-core-zx.dll +0 -0
  16. mqt/core/dd.cp314-win_amd64.pyd +0 -0
  17. mqt/core/dd.pyi +1018 -0
  18. mqt/core/dd_evaluation.py +368 -0
  19. mqt/core/include/mqt-core/algorithms/BernsteinVazirani.hpp +39 -0
  20. mqt/core/include/mqt-core/algorithms/GHZState.hpp +18 -0
  21. mqt/core/include/mqt-core/algorithms/Grover.hpp +33 -0
  22. mqt/core/include/mqt-core/algorithms/QFT.hpp +21 -0
  23. mqt/core/include/mqt-core/algorithms/QPE.hpp +30 -0
  24. mqt/core/include/mqt-core/algorithms/RandomCliffordCircuit.hpp +22 -0
  25. mqt/core/include/mqt-core/algorithms/StatePreparation.hpp +43 -0
  26. mqt/core/include/mqt-core/algorithms/WState.hpp +18 -0
  27. mqt/core/include/mqt-core/algorithms/mqt_core_algorithms_export.h +43 -0
  28. mqt/core/include/mqt-core/boost/config/abi/borland_prefix.hpp +27 -0
  29. mqt/core/include/mqt-core/boost/config/abi/borland_suffix.hpp +12 -0
  30. mqt/core/include/mqt-core/boost/config/abi/msvc_prefix.hpp +22 -0
  31. mqt/core/include/mqt-core/boost/config/abi/msvc_suffix.hpp +8 -0
  32. mqt/core/include/mqt-core/boost/config/abi_prefix.hpp +25 -0
  33. mqt/core/include/mqt-core/boost/config/abi_suffix.hpp +25 -0
  34. mqt/core/include/mqt-core/boost/config/assert_cxx03.hpp +211 -0
  35. mqt/core/include/mqt-core/boost/config/assert_cxx11.hpp +212 -0
  36. mqt/core/include/mqt-core/boost/config/assert_cxx14.hpp +47 -0
  37. mqt/core/include/mqt-core/boost/config/assert_cxx17.hpp +65 -0
  38. mqt/core/include/mqt-core/boost/config/assert_cxx20.hpp +59 -0
  39. mqt/core/include/mqt-core/boost/config/assert_cxx23.hpp +41 -0
  40. mqt/core/include/mqt-core/boost/config/assert_cxx98.hpp +23 -0
  41. mqt/core/include/mqt-core/boost/config/auto_link.hpp +525 -0
  42. mqt/core/include/mqt-core/boost/config/compiler/borland.hpp +342 -0
  43. mqt/core/include/mqt-core/boost/config/compiler/clang.hpp +370 -0
  44. mqt/core/include/mqt-core/boost/config/compiler/clang_version.hpp +89 -0
  45. mqt/core/include/mqt-core/boost/config/compiler/codegear.hpp +389 -0
  46. mqt/core/include/mqt-core/boost/config/compiler/comeau.hpp +59 -0
  47. mqt/core/include/mqt-core/boost/config/compiler/common_edg.hpp +185 -0
  48. mqt/core/include/mqt-core/boost/config/compiler/compaq_cxx.hpp +19 -0
  49. mqt/core/include/mqt-core/boost/config/compiler/cray.hpp +446 -0
  50. mqt/core/include/mqt-core/boost/config/compiler/diab.hpp +26 -0
  51. mqt/core/include/mqt-core/boost/config/compiler/digitalmars.hpp +146 -0
  52. mqt/core/include/mqt-core/boost/config/compiler/gcc.hpp +386 -0
  53. mqt/core/include/mqt-core/boost/config/compiler/gcc_xml.hpp +115 -0
  54. mqt/core/include/mqt-core/boost/config/compiler/greenhills.hpp +28 -0
  55. mqt/core/include/mqt-core/boost/config/compiler/hp_acc.hpp +153 -0
  56. mqt/core/include/mqt-core/boost/config/compiler/intel.hpp +577 -0
  57. mqt/core/include/mqt-core/boost/config/compiler/kai.hpp +33 -0
  58. mqt/core/include/mqt-core/boost/config/compiler/metrowerks.hpp +201 -0
  59. mqt/core/include/mqt-core/boost/config/compiler/mpw.hpp +143 -0
  60. mqt/core/include/mqt-core/boost/config/compiler/nvcc.hpp +64 -0
  61. mqt/core/include/mqt-core/boost/config/compiler/pathscale.hpp +141 -0
  62. mqt/core/include/mqt-core/boost/config/compiler/pgi.hpp +23 -0
  63. mqt/core/include/mqt-core/boost/config/compiler/sgi_mipspro.hpp +29 -0
  64. mqt/core/include/mqt-core/boost/config/compiler/sunpro_cc.hpp +225 -0
  65. mqt/core/include/mqt-core/boost/config/compiler/vacpp.hpp +189 -0
  66. mqt/core/include/mqt-core/boost/config/compiler/visualc.hpp +398 -0
  67. mqt/core/include/mqt-core/boost/config/compiler/xlcpp.hpp +303 -0
  68. mqt/core/include/mqt-core/boost/config/compiler/xlcpp_zos.hpp +174 -0
  69. mqt/core/include/mqt-core/boost/config/detail/cxx_composite.hpp +218 -0
  70. mqt/core/include/mqt-core/boost/config/detail/posix_features.hpp +95 -0
  71. mqt/core/include/mqt-core/boost/config/detail/select_compiler_config.hpp +157 -0
  72. mqt/core/include/mqt-core/boost/config/detail/select_platform_config.hpp +147 -0
  73. mqt/core/include/mqt-core/boost/config/detail/select_stdlib_config.hpp +121 -0
  74. mqt/core/include/mqt-core/boost/config/detail/suffix.hpp +1334 -0
  75. mqt/core/include/mqt-core/boost/config/header_deprecated.hpp +26 -0
  76. mqt/core/include/mqt-core/boost/config/helper_macros.hpp +37 -0
  77. mqt/core/include/mqt-core/boost/config/no_tr1/cmath.hpp +28 -0
  78. mqt/core/include/mqt-core/boost/config/no_tr1/complex.hpp +28 -0
  79. mqt/core/include/mqt-core/boost/config/no_tr1/functional.hpp +28 -0
  80. mqt/core/include/mqt-core/boost/config/no_tr1/memory.hpp +28 -0
  81. mqt/core/include/mqt-core/boost/config/no_tr1/utility.hpp +28 -0
  82. mqt/core/include/mqt-core/boost/config/platform/aix.hpp +33 -0
  83. mqt/core/include/mqt-core/boost/config/platform/amigaos.hpp +15 -0
  84. mqt/core/include/mqt-core/boost/config/platform/beos.hpp +26 -0
  85. mqt/core/include/mqt-core/boost/config/platform/bsd.hpp +83 -0
  86. mqt/core/include/mqt-core/boost/config/platform/cloudabi.hpp +18 -0
  87. mqt/core/include/mqt-core/boost/config/platform/cray.hpp +18 -0
  88. mqt/core/include/mqt-core/boost/config/platform/cygwin.hpp +71 -0
  89. mqt/core/include/mqt-core/boost/config/platform/haiku.hpp +31 -0
  90. mqt/core/include/mqt-core/boost/config/platform/hpux.hpp +87 -0
  91. mqt/core/include/mqt-core/boost/config/platform/irix.hpp +31 -0
  92. mqt/core/include/mqt-core/boost/config/platform/linux.hpp +106 -0
  93. mqt/core/include/mqt-core/boost/config/platform/macos.hpp +87 -0
  94. mqt/core/include/mqt-core/boost/config/platform/qnxnto.hpp +31 -0
  95. mqt/core/include/mqt-core/boost/config/platform/solaris.hpp +31 -0
  96. mqt/core/include/mqt-core/boost/config/platform/symbian.hpp +97 -0
  97. mqt/core/include/mqt-core/boost/config/platform/vms.hpp +25 -0
  98. mqt/core/include/mqt-core/boost/config/platform/vxworks.hpp +422 -0
  99. mqt/core/include/mqt-core/boost/config/platform/wasm.hpp +23 -0
  100. mqt/core/include/mqt-core/boost/config/platform/win32.hpp +90 -0
  101. mqt/core/include/mqt-core/boost/config/platform/zos.hpp +32 -0
  102. mqt/core/include/mqt-core/boost/config/pragma_message.hpp +31 -0
  103. mqt/core/include/mqt-core/boost/config/requires_threads.hpp +92 -0
  104. mqt/core/include/mqt-core/boost/config/stdlib/dinkumware.hpp +324 -0
  105. mqt/core/include/mqt-core/boost/config/stdlib/libcomo.hpp +93 -0
  106. mqt/core/include/mqt-core/boost/config/stdlib/libcpp.hpp +180 -0
  107. mqt/core/include/mqt-core/boost/config/stdlib/libstdcpp3.hpp +482 -0
  108. mqt/core/include/mqt-core/boost/config/stdlib/modena.hpp +79 -0
  109. mqt/core/include/mqt-core/boost/config/stdlib/msl.hpp +98 -0
  110. mqt/core/include/mqt-core/boost/config/stdlib/roguewave.hpp +208 -0
  111. mqt/core/include/mqt-core/boost/config/stdlib/sgi.hpp +168 -0
  112. mqt/core/include/mqt-core/boost/config/stdlib/stlport.hpp +258 -0
  113. mqt/core/include/mqt-core/boost/config/stdlib/vacpp.hpp +74 -0
  114. mqt/core/include/mqt-core/boost/config/stdlib/xlcpp_zos.hpp +61 -0
  115. mqt/core/include/mqt-core/boost/config/user.hpp +133 -0
  116. mqt/core/include/mqt-core/boost/config/warning_disable.hpp +47 -0
  117. mqt/core/include/mqt-core/boost/config/workaround.hpp +305 -0
  118. mqt/core/include/mqt-core/boost/config.hpp +67 -0
  119. mqt/core/include/mqt-core/boost/cstdint.hpp +556 -0
  120. mqt/core/include/mqt-core/boost/cxx11_char_types.hpp +70 -0
  121. mqt/core/include/mqt-core/boost/detail/workaround.hpp +10 -0
  122. mqt/core/include/mqt-core/boost/limits.hpp +146 -0
  123. mqt/core/include/mqt-core/boost/multiprecision/complex128.hpp +24 -0
  124. mqt/core/include/mqt-core/boost/multiprecision/complex_adaptor.hpp +1046 -0
  125. mqt/core/include/mqt-core/boost/multiprecision/concepts/mp_number_archetypes.hpp +257 -0
  126. mqt/core/include/mqt-core/boost/multiprecision/cpp_bin_float/io.hpp +698 -0
  127. mqt/core/include/mqt-core/boost/multiprecision/cpp_bin_float/transcendental.hpp +157 -0
  128. mqt/core/include/mqt-core/boost/multiprecision/cpp_bin_float.hpp +2297 -0
  129. mqt/core/include/mqt-core/boost/multiprecision/cpp_complex.hpp +12 -0
  130. mqt/core/include/mqt-core/boost/multiprecision/cpp_dec_float.hpp +3690 -0
  131. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/add.hpp +368 -0
  132. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/add_unsigned.hpp +387 -0
  133. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/bitwise.hpp +889 -0
  134. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/checked.hpp +178 -0
  135. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/comparison.hpp +374 -0
  136. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/cpp_int_config.hpp +161 -0
  137. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/divide.hpp +703 -0
  138. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/import_export.hpp +248 -0
  139. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/intel_intrinsics.hpp +138 -0
  140. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/limits.hpp +282 -0
  141. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/literals.hpp +295 -0
  142. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/misc.hpp +1457 -0
  143. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/multiply.hpp +848 -0
  144. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/serialize.hpp +211 -0
  145. mqt/core/include/mqt-core/boost/multiprecision/cpp_int/value_pack.hpp +42 -0
  146. mqt/core/include/mqt-core/boost/multiprecision/cpp_int.hpp +2360 -0
  147. mqt/core/include/mqt-core/boost/multiprecision/debug_adaptor.hpp +760 -0
  148. mqt/core/include/mqt-core/boost/multiprecision/detail/assert.hpp +29 -0
  149. mqt/core/include/mqt-core/boost/multiprecision/detail/atomic.hpp +62 -0
  150. mqt/core/include/mqt-core/boost/multiprecision/detail/bitscan.hpp +317 -0
  151. mqt/core/include/mqt-core/boost/multiprecision/detail/check_cpp11_config.hpp +64 -0
  152. mqt/core/include/mqt-core/boost/multiprecision/detail/constexpr.hpp +88 -0
  153. mqt/core/include/mqt-core/boost/multiprecision/detail/default_ops.hpp +4052 -0
  154. mqt/core/include/mqt-core/boost/multiprecision/detail/digits.hpp +49 -0
  155. mqt/core/include/mqt-core/boost/multiprecision/detail/dynamic_array.hpp +44 -0
  156. mqt/core/include/mqt-core/boost/multiprecision/detail/empty_value.hpp +87 -0
  157. mqt/core/include/mqt-core/boost/multiprecision/detail/endian.hpp +35 -0
  158. mqt/core/include/mqt-core/boost/multiprecision/detail/et_ops.hpp +1831 -0
  159. mqt/core/include/mqt-core/boost/multiprecision/detail/float128_functions.hpp +95 -0
  160. mqt/core/include/mqt-core/boost/multiprecision/detail/float_string_cvt.hpp +333 -0
  161. mqt/core/include/mqt-core/boost/multiprecision/detail/fpclassify.hpp +101 -0
  162. mqt/core/include/mqt-core/boost/multiprecision/detail/functions/constants.hpp +288 -0
  163. mqt/core/include/mqt-core/boost/multiprecision/detail/functions/pow.hpp +905 -0
  164. mqt/core/include/mqt-core/boost/multiprecision/detail/functions/trig.hpp +1058 -0
  165. mqt/core/include/mqt-core/boost/multiprecision/detail/functions/trunc.hpp +82 -0
  166. mqt/core/include/mqt-core/boost/multiprecision/detail/generic_interconvert.hpp +687 -0
  167. mqt/core/include/mqt-core/boost/multiprecision/detail/hash.hpp +56 -0
  168. mqt/core/include/mqt-core/boost/multiprecision/detail/integer_ops.hpp +474 -0
  169. mqt/core/include/mqt-core/boost/multiprecision/detail/itos.hpp +39 -0
  170. mqt/core/include/mqt-core/boost/multiprecision/detail/min_max.hpp +106 -0
  171. mqt/core/include/mqt-core/boost/multiprecision/detail/no_et_ops.hpp +661 -0
  172. mqt/core/include/mqt-core/boost/multiprecision/detail/no_exceptions_support.hpp +55 -0
  173. mqt/core/include/mqt-core/boost/multiprecision/detail/number_base.hpp +1656 -0
  174. mqt/core/include/mqt-core/boost/multiprecision/detail/number_compare.hpp +848 -0
  175. mqt/core/include/mqt-core/boost/multiprecision/detail/precision.hpp +313 -0
  176. mqt/core/include/mqt-core/boost/multiprecision/detail/rebind.hpp +19 -0
  177. mqt/core/include/mqt-core/boost/multiprecision/detail/standalone_config.hpp +148 -0
  178. mqt/core/include/mqt-core/boost/multiprecision/detail/static_array.hpp +42 -0
  179. mqt/core/include/mqt-core/boost/multiprecision/detail/string_helpers.hpp +48 -0
  180. mqt/core/include/mqt-core/boost/multiprecision/detail/tables.hpp +80 -0
  181. mqt/core/include/mqt-core/boost/multiprecision/detail/ublas_interop.hpp +75 -0
  182. mqt/core/include/mqt-core/boost/multiprecision/detail/uniform_int_distribution.hpp +212 -0
  183. mqt/core/include/mqt-core/boost/multiprecision/detail/utype_helper.hpp +374 -0
  184. mqt/core/include/mqt-core/boost/multiprecision/eigen.hpp +248 -0
  185. mqt/core/include/mqt-core/boost/multiprecision/float128.hpp +920 -0
  186. mqt/core/include/mqt-core/boost/multiprecision/fwd.hpp +268 -0
  187. mqt/core/include/mqt-core/boost/multiprecision/gmp.hpp +4060 -0
  188. mqt/core/include/mqt-core/boost/multiprecision/integer.hpp +363 -0
  189. mqt/core/include/mqt-core/boost/multiprecision/logged_adaptor.hpp +834 -0
  190. mqt/core/include/mqt-core/boost/multiprecision/miller_rabin.hpp +221 -0
  191. mqt/core/include/mqt-core/boost/multiprecision/mpc.hpp +1721 -0
  192. mqt/core/include/mqt-core/boost/multiprecision/mpfi.hpp +2559 -0
  193. mqt/core/include/mqt-core/boost/multiprecision/mpfr.hpp +3644 -0
  194. mqt/core/include/mqt-core/boost/multiprecision/number.hpp +2500 -0
  195. mqt/core/include/mqt-core/boost/multiprecision/random.hpp +23 -0
  196. mqt/core/include/mqt-core/boost/multiprecision/rational_adaptor.hpp +1289 -0
  197. mqt/core/include/mqt-core/boost/multiprecision/tommath.hpp +1034 -0
  198. mqt/core/include/mqt-core/boost/multiprecision/traits/explicit_conversion.hpp +67 -0
  199. mqt/core/include/mqt-core/boost/multiprecision/traits/extract_exponent_type.hpp +28 -0
  200. mqt/core/include/mqt-core/boost/multiprecision/traits/is_backend.hpp +91 -0
  201. mqt/core/include/mqt-core/boost/multiprecision/traits/is_byte_container.hpp +51 -0
  202. mqt/core/include/mqt-core/boost/multiprecision/traits/is_complex.hpp +22 -0
  203. mqt/core/include/mqt-core/boost/multiprecision/traits/is_convertible_arithmetic.hpp +51 -0
  204. mqt/core/include/mqt-core/boost/multiprecision/traits/is_restricted_conversion.hpp +47 -0
  205. mqt/core/include/mqt-core/boost/multiprecision/traits/is_variable_precision.hpp +25 -0
  206. mqt/core/include/mqt-core/boost/multiprecision/traits/max_digits10.hpp +79 -0
  207. mqt/core/include/mqt-core/boost/multiprecision/traits/std_integer_traits.hpp +90 -0
  208. mqt/core/include/mqt-core/boost/multiprecision/traits/transcendental_reduction_type.hpp +21 -0
  209. mqt/core/include/mqt-core/boost/version.hpp +32 -0
  210. mqt/core/include/mqt-core/circuit_optimizer/CircuitOptimizer.hpp +106 -0
  211. mqt/core/include/mqt-core/circuit_optimizer/mqt_core_circuit_optimizer_export.h +43 -0
  212. mqt/core/include/mqt-core/datastructures/DirectedAcyclicGraph.hpp +117 -0
  213. mqt/core/include/mqt-core/datastructures/DirectedGraph.hpp +158 -0
  214. mqt/core/include/mqt-core/datastructures/DisjointSet.hpp +50 -0
  215. mqt/core/include/mqt-core/datastructures/Layer.hpp +172 -0
  216. mqt/core/include/mqt-core/datastructures/SymmetricMatrix.hpp +57 -0
  217. mqt/core/include/mqt-core/datastructures/UndirectedGraph.hpp +227 -0
  218. mqt/core/include/mqt-core/datastructures/mqt_core_ds_export.h +43 -0
  219. mqt/core/include/mqt-core/dd/Approximation.hpp +45 -0
  220. mqt/core/include/mqt-core/dd/CachedEdge.hpp +167 -0
  221. mqt/core/include/mqt-core/dd/Complex.hpp +165 -0
  222. mqt/core/include/mqt-core/dd/ComplexNumbers.hpp +150 -0
  223. mqt/core/include/mqt-core/dd/ComplexValue.hpp +184 -0
  224. mqt/core/include/mqt-core/dd/ComputeTable.hpp +183 -0
  225. mqt/core/include/mqt-core/dd/DDDefinitions.hpp +139 -0
  226. mqt/core/include/mqt-core/dd/DDpackageConfig.hpp +104 -0
  227. mqt/core/include/mqt-core/dd/DensityNoiseTable.hpp +114 -0
  228. mqt/core/include/mqt-core/dd/Edge.hpp +416 -0
  229. mqt/core/include/mqt-core/dd/Export.hpp +438 -0
  230. mqt/core/include/mqt-core/dd/FunctionalityConstruction.hpp +75 -0
  231. mqt/core/include/mqt-core/dd/GateMatrixDefinitions.hpp +43 -0
  232. mqt/core/include/mqt-core/dd/LinkedListBase.hpp +45 -0
  233. mqt/core/include/mqt-core/dd/MemoryManager.hpp +193 -0
  234. mqt/core/include/mqt-core/dd/Node.hpp +223 -0
  235. mqt/core/include/mqt-core/dd/NoiseFunctionality.hpp +144 -0
  236. mqt/core/include/mqt-core/dd/Operations.hpp +308 -0
  237. mqt/core/include/mqt-core/dd/Package.hpp +2036 -0
  238. mqt/core/include/mqt-core/dd/Package_fwd.hpp +22 -0
  239. mqt/core/include/mqt-core/dd/RealNumber.hpp +255 -0
  240. mqt/core/include/mqt-core/dd/RealNumberUniqueTable.hpp +217 -0
  241. mqt/core/include/mqt-core/dd/Simulation.hpp +98 -0
  242. mqt/core/include/mqt-core/dd/StateGeneration.hpp +143 -0
  243. mqt/core/include/mqt-core/dd/StochasticNoiseOperationTable.hpp +88 -0
  244. mqt/core/include/mqt-core/dd/UnaryComputeTable.hpp +121 -0
  245. mqt/core/include/mqt-core/dd/UniqueTable.hpp +243 -0
  246. mqt/core/include/mqt-core/dd/mqt_core_dd_export.h +43 -0
  247. mqt/core/include/mqt-core/dd/statistics/MemoryManagerStatistics.hpp +84 -0
  248. mqt/core/include/mqt-core/dd/statistics/PackageStatistics.hpp +55 -0
  249. mqt/core/include/mqt-core/dd/statistics/Statistics.hpp +48 -0
  250. mqt/core/include/mqt-core/dd/statistics/TableStatistics.hpp +79 -0
  251. mqt/core/include/mqt-core/dd/statistics/UniqueTableStatistics.hpp +31 -0
  252. mqt/core/include/mqt-core/ir/Definitions.hpp +108 -0
  253. mqt/core/include/mqt-core/ir/Permutation.hpp +213 -0
  254. mqt/core/include/mqt-core/ir/QuantumComputation.hpp +594 -0
  255. mqt/core/include/mqt-core/ir/Register.hpp +125 -0
  256. mqt/core/include/mqt-core/ir/mqt_core_ir_export.h +43 -0
  257. mqt/core/include/mqt-core/ir/operations/AodOperation.hpp +92 -0
  258. mqt/core/include/mqt-core/ir/operations/ClassicControlledOperation.hpp +156 -0
  259. mqt/core/include/mqt-core/ir/operations/CompoundOperation.hpp +210 -0
  260. mqt/core/include/mqt-core/ir/operations/Control.hpp +142 -0
  261. mqt/core/include/mqt-core/ir/operations/Expression.hpp +847 -0
  262. mqt/core/include/mqt-core/ir/operations/NonUnitaryOperation.hpp +118 -0
  263. mqt/core/include/mqt-core/ir/operations/OpType.hpp +115 -0
  264. mqt/core/include/mqt-core/ir/operations/OpType.inc +75 -0
  265. mqt/core/include/mqt-core/ir/operations/Operation.hpp +245 -0
  266. mqt/core/include/mqt-core/ir/operations/StandardOperation.hpp +138 -0
  267. mqt/core/include/mqt-core/ir/operations/SymbolicOperation.hpp +144 -0
  268. mqt/core/include/mqt-core/na/NAComputation.hpp +185 -0
  269. mqt/core/include/mqt-core/na/entities/Atom.hpp +62 -0
  270. mqt/core/include/mqt-core/na/entities/Location.hpp +154 -0
  271. mqt/core/include/mqt-core/na/entities/Zone.hpp +95 -0
  272. mqt/core/include/mqt-core/na/mqt_core_na_export.h +43 -0
  273. mqt/core/include/mqt-core/na/operations/GlobalCZOp.hpp +38 -0
  274. mqt/core/include/mqt-core/na/operations/GlobalOp.hpp +58 -0
  275. mqt/core/include/mqt-core/na/operations/GlobalRYOp.hpp +42 -0
  276. mqt/core/include/mqt-core/na/operations/LoadOp.hpp +89 -0
  277. mqt/core/include/mqt-core/na/operations/LocalOp.hpp +56 -0
  278. mqt/core/include/mqt-core/na/operations/LocalRZOp.hpp +42 -0
  279. mqt/core/include/mqt-core/na/operations/LocalUOp.hpp +49 -0
  280. mqt/core/include/mqt-core/na/operations/MoveOp.hpp +66 -0
  281. mqt/core/include/mqt-core/na/operations/Op.hpp +62 -0
  282. mqt/core/include/mqt-core/na/operations/ShuttlingOp.hpp +51 -0
  283. mqt/core/include/mqt-core/na/operations/StoreOp.hpp +87 -0
  284. mqt/core/include/mqt-core/qasm3/Exception.hpp +85 -0
  285. mqt/core/include/mqt-core/qasm3/Gate.hpp +65 -0
  286. mqt/core/include/mqt-core/qasm3/Importer.hpp +192 -0
  287. mqt/core/include/mqt-core/qasm3/InstVisitor.hpp +145 -0
  288. mqt/core/include/mqt-core/qasm3/NestedEnvironment.hpp +41 -0
  289. mqt/core/include/mqt-core/qasm3/Parser.hpp +170 -0
  290. mqt/core/include/mqt-core/qasm3/Scanner.hpp +73 -0
  291. mqt/core/include/mqt-core/qasm3/Statement.hpp +486 -0
  292. mqt/core/include/mqt-core/qasm3/Statement_fwd.hpp +39 -0
  293. mqt/core/include/mqt-core/qasm3/StdGates.hpp +123 -0
  294. mqt/core/include/mqt-core/qasm3/Token.hpp +198 -0
  295. mqt/core/include/mqt-core/qasm3/Types.hpp +238 -0
  296. mqt/core/include/mqt-core/qasm3/Types_fwd.hpp +22 -0
  297. mqt/core/include/mqt-core/qasm3/mqt_core_qasm_export.h +43 -0
  298. mqt/core/include/mqt-core/qasm3/passes/CompilerPass.hpp +22 -0
  299. mqt/core/include/mqt-core/qasm3/passes/ConstEvalPass.hpp +102 -0
  300. mqt/core/include/mqt-core/qasm3/passes/TypeCheckPass.hpp +124 -0
  301. mqt/core/include/mqt-core/zx/FunctionalityConstruction.hpp +125 -0
  302. mqt/core/include/mqt-core/zx/Rational.hpp +318 -0
  303. mqt/core/include/mqt-core/zx/Rules.hpp +132 -0
  304. mqt/core/include/mqt-core/zx/Simplify.hpp +182 -0
  305. mqt/core/include/mqt-core/zx/Utils.hpp +212 -0
  306. mqt/core/include/mqt-core/zx/ZXDefinitions.hpp +93 -0
  307. mqt/core/include/mqt-core/zx/ZXDiagram.hpp +480 -0
  308. mqt/core/include/mqt-core/zx/mqt_core_zx_export.h +43 -0
  309. mqt/core/ir/__init__.pyi +1998 -0
  310. mqt/core/ir/operations.pyi +991 -0
  311. mqt/core/ir/registers.pyi +91 -0
  312. mqt/core/ir/symbolic.pyi +177 -0
  313. mqt/core/ir.cp314-win_amd64.pyd +0 -0
  314. mqt/core/lib/mqt-core-algorithms.lib +0 -0
  315. mqt/core/lib/mqt-core-circuit-optimizer.lib +0 -0
  316. mqt/core/lib/mqt-core-dd.lib +0 -0
  317. mqt/core/lib/mqt-core-ds.lib +0 -0
  318. mqt/core/lib/mqt-core-ir.lib +0 -0
  319. mqt/core/lib/mqt-core-na.lib +0 -0
  320. mqt/core/lib/mqt-core-qasm.lib +0 -0
  321. mqt/core/lib/mqt-core-zx.lib +0 -0
  322. mqt/core/plugins/__init__.py +9 -0
  323. mqt/core/plugins/qiskit/__init__.py +19 -0
  324. mqt/core/plugins/qiskit/mqt_to_qiskit.py +354 -0
  325. mqt/core/plugins/qiskit/qiskit_to_mqt.py +455 -0
  326. mqt/core/py.typed +2 -0
  327. mqt/core/share/cmake/mqt-core/AddMQTPythonBinding.cmake +52 -0
  328. mqt/core/share/cmake/mqt-core/Cache.cmake +32 -0
  329. mqt/core/share/cmake/mqt-core/FindGMP.cmake +103 -0
  330. mqt/core/share/cmake/mqt-core/PackageAddTest.cmake +40 -0
  331. mqt/core/share/cmake/mqt-core/PreventInSourceBuilds.cmake +25 -0
  332. mqt/core/share/cmake/mqt-core/StandardProjectSettings.cmake +87 -0
  333. mqt/core/share/cmake/mqt-core/mqt-core-config-version.cmake +85 -0
  334. mqt/core/share/cmake/mqt-core/mqt-core-config.cmake +49 -0
  335. mqt/core/share/cmake/mqt-core/mqt-core-targets-release.cmake +90 -0
  336. mqt/core/share/cmake/mqt-core/mqt-core-targets.cmake +324 -0
  337. mqt_core-3.2.0.dist-info/DELVEWHEEL +2 -0
  338. mqt_core-3.2.0.dist-info/METADATA +169 -0
  339. mqt_core-3.2.0.dist-info/RECORD +343 -0
  340. mqt_core-3.2.0.dist-info/WHEEL +5 -0
  341. mqt_core-3.2.0.dist-info/entry_points.txt +4 -0
  342. mqt_core-3.2.0.dist-info/licenses/LICENSE.md +22 -0
  343. mqt_core.libs/msvcp140.dll +0 -0
@@ -0,0 +1,1998 @@
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 Core IR - The MQT Core Intermediate Representation (IR) module."""
10
+
11
+ from collections.abc import ItemsView, Iterable, Iterator, Mapping, MutableMapping, MutableSequence, Sequence
12
+ from os import PathLike
13
+ from typing import overload
14
+
15
+ from .operations import ComparisonKind, Control, Operation, OpType
16
+ from .registers import ClassicalRegister, QuantumRegister
17
+ from .symbolic import Expression, Variable
18
+
19
+ __all__ = [
20
+ "Permutation",
21
+ "QuantumComputation",
22
+ ]
23
+
24
+ class Permutation(MutableMapping[int, int]):
25
+ """A class to represent a permutation of the qubits in a quantum circuit.
26
+
27
+ Args:
28
+ permutation: The permutation to initialize the object with.
29
+
30
+ """
31
+
32
+ def __init__(self, permutation: dict[int, int] | None = None) -> None:
33
+ """Initialize the permutation."""
34
+
35
+ def __getitem__(self, idx: int) -> int:
36
+ """Get the value of the permutation at the given index.
37
+
38
+ Args:
39
+ idx: The index to get the value of the permutation at.
40
+
41
+ Returns:
42
+ The value of the permutation at the given index.
43
+ """
44
+
45
+ def __setitem__(self, idx: int, val: int) -> None:
46
+ """Set the value of the permutation at the given index.
47
+
48
+ Args:
49
+ idx: The index to set the value of the permutation at.
50
+ val: The value to set the permutation at the given index to.
51
+ """
52
+
53
+ def __delitem__(self, key: int) -> None:
54
+ """Delete the value of the permutation at the given index.
55
+
56
+ Args:
57
+ key: The index to delete the value of the permutation at.
58
+ """
59
+
60
+ def __iter__(self) -> Iterator[int]:
61
+ """Return an iterator over the indices of the permutation."""
62
+
63
+ def items(self) -> ItemsView[int, int]:
64
+ """Return an iterable over the items of the permutation."""
65
+
66
+ def __len__(self) -> int:
67
+ """Return the number of indices in the permutation."""
68
+
69
+ def __eq__(self, other: object) -> bool:
70
+ """Check if the permutation is equal to another permutation."""
71
+
72
+ def __ne__(self, other: object) -> bool:
73
+ """Check if the permutation is not equal to another permutation."""
74
+
75
+ def __hash__(self) -> int:
76
+ """Return the hash of the permutation."""
77
+
78
+ def clear(self) -> None:
79
+ """Clear the permutation of all indices and values."""
80
+
81
+ @overload
82
+ def apply(self, controls: set[Control]) -> set[Control]:
83
+ """Apply the permutation to a set of controls.
84
+
85
+ Args:
86
+ controls: The set of controls to apply the permutation to.
87
+
88
+ Returns:
89
+ The set of controls with the permutation applied.
90
+ """
91
+
92
+ @overload
93
+ def apply(self, targets: list[int]) -> list[int]:
94
+ """Apply the permutation to a list of targets.
95
+
96
+ Args:
97
+ targets: The list of targets to apply the permutation to.
98
+
99
+ Returns:
100
+ The list of targets with the permutation applied.
101
+ """
102
+
103
+ class QuantumComputation(MutableSequence[Operation]):
104
+ """The main class for representing quantum computations within the MQT.
105
+
106
+ Acts as mutable sequence of :class:`~mqt.core.ir.operations.Operation` objects,
107
+ which represent the individual operations in the quantum computation.
108
+
109
+ Args:
110
+ nq: The number of qubits in the quantum computation.
111
+ nc: The number of classical bits in the quantum computation.
112
+ seed: The seed to use for the internal random number generator.
113
+ """
114
+
115
+ # --------------------------------------------------------------------------
116
+ # Constructors
117
+ # --------------------------------------------------------------------------
118
+ def __init__(self, nq: int = 0, nc: int = 0, seed: int = 0) -> None: ...
119
+ @staticmethod
120
+ def from_qasm_str(qasm: str) -> QuantumComputation:
121
+ """Create a QuantumComputation object from an OpenQASM string.
122
+
123
+ Args:
124
+ qasm: The OpenQASM string to create the QuantumComputation object from.
125
+
126
+ Returns:
127
+ The QuantumComputation object created from the OpenQASM string.
128
+ """
129
+ @staticmethod
130
+ def from_qasm(filename: str) -> QuantumComputation:
131
+ """Create a QuantumComputation object from an OpenQASM file.
132
+
133
+ Args:
134
+ filename: The filename of the OpenQASM file to create the QuantumComputation object from.
135
+
136
+ Returns:
137
+ The QuantumComputation object created from the OpenQASM file.
138
+ """
139
+
140
+ # --------------------------------------------------------------------------
141
+ # General Properties
142
+ # --------------------------------------------------------------------------
143
+
144
+ name: str
145
+ """
146
+ The name of the quantum computation.
147
+ """
148
+ global_phase: float
149
+ """
150
+ The global phase of the quantum computation.
151
+ """
152
+
153
+ @property
154
+ def num_qubits(self) -> int:
155
+ """The total number of qubits in the quantum computation."""
156
+
157
+ @property
158
+ def num_ancilla_qubits(self) -> int:
159
+ r"""The number of ancilla qubits in the quantum computation.
160
+
161
+ Note:
162
+ Ancilla qubits are qubits that always start in a fixed state (usually :math:`|0\\rangle`).
163
+ """
164
+
165
+ @property
166
+ def num_garbage_qubits(self) -> int:
167
+ """The number of garbage qubits in the quantum computation.
168
+
169
+ Note:
170
+ Garbage qubits are qubits whose final state is not relevant for the computation.
171
+ """
172
+
173
+ @property
174
+ def num_measured_qubits(self) -> int:
175
+ """The number of qubits that are measured in the quantum computation.
176
+
177
+ Computed as :math:`|qubits| - |garbage|`.
178
+ """
179
+
180
+ @property
181
+ def num_data_qubits(self) -> int:
182
+ """The number of data qubits in the quantum computation.
183
+
184
+ Computed as :math:`|qubits| - |ancilla|`.
185
+ """
186
+
187
+ @property
188
+ def num_classical_bits(self) -> int:
189
+ """The number of classical bits in the quantum computation."""
190
+
191
+ @property
192
+ def num_ops(self) -> int:
193
+ """The number of operations in the quantum computation."""
194
+
195
+ def num_single_qubit_ops(self) -> int:
196
+ """Return the number of single-qubit operations in the quantum computation."""
197
+
198
+ def num_total_ops(self) -> int:
199
+ """Return the total number of operations in the quantum computation.
200
+
201
+ Recursively counts sub-operations (e.g., from :class:`~mqt.core.ir.operations.CompoundOperation` objects).
202
+ """
203
+
204
+ def depth(self) -> int:
205
+ """Return the depth of the quantum computation."""
206
+
207
+ def invert(self) -> None:
208
+ """Invert the quantum computation in-place by inverting each operation and reversing the order of operations."""
209
+
210
+ def to_operation(self) -> Operation:
211
+ """Convert the quantum computation to a single operation.
212
+
213
+ This gives ownership of the operations to the resulting operation,
214
+ so the quantum computation will be empty after this operation.
215
+
216
+ When the quantum computation contains more than one operation,
217
+ the resulting operation is a :class:`~mqt.core.ir.operations.CompoundOperation`.
218
+
219
+ Returns:
220
+ The operation representing the quantum computation.
221
+ """
222
+
223
+ # --------------------------------------------------------------------------
224
+ # Mutable Sequence Interface
225
+ # --------------------------------------------------------------------------
226
+
227
+ def __len__(self) -> int:
228
+ """Return the number of operations in the quantum computation."""
229
+
230
+ @overload
231
+ def __getitem__(self, idx: int) -> Operation:
232
+ """Get the operation at the given index.
233
+
234
+ Note:
235
+ This gives write access to the operation at the given index.
236
+
237
+ Args:
238
+ idx: The index of the operation to get.
239
+
240
+ Returns:
241
+ The operation at the given index.
242
+ """
243
+
244
+ @overload
245
+ def __getitem__(self, idx: slice) -> list[Operation]:
246
+ """Get a slice of operations from the quantum computation.
247
+
248
+ Note:
249
+ This gives write access to the operations in the given slice.
250
+
251
+ Args:
252
+ idx: The slice of operations to get.
253
+
254
+ Returns:
255
+ The operations in the given slice.
256
+ """
257
+
258
+ @overload
259
+ def __setitem__(self, idx: int, op: Operation) -> None:
260
+ """Set the operation at the given index.
261
+
262
+ Args:
263
+ idx: The index of the operation to set.
264
+ op: The operation to set at the given index.
265
+ """
266
+
267
+ @overload
268
+ def __setitem__(self, idx: slice, ops: Iterable[Operation]) -> None:
269
+ """Set the operations in the given slice.
270
+
271
+ Args:
272
+ idx: The slice of operations to set.
273
+ ops: The operations to set in the given slice.
274
+ """
275
+
276
+ @overload
277
+ def __delitem__(self, idx: int) -> None:
278
+ """Delete the operation at the given index.
279
+
280
+ Args:
281
+ idx: The index of the operation to delete.
282
+ """
283
+
284
+ @overload
285
+ def __delitem__(self, idx: slice) -> None:
286
+ """Delete the operations in the given slice.
287
+
288
+ Args:
289
+ idx: The slice of operations to delete.
290
+ """
291
+
292
+ def insert(self, idx: int, op: Operation) -> None:
293
+ """Insert an operation at the given index.
294
+
295
+ Args:
296
+ idx: The index to insert the operation at.
297
+ op: The operation to insert.
298
+ """
299
+
300
+ def append(self, op: Operation) -> None:
301
+ """Append an operation to the end of the quantum computation.
302
+
303
+ Args:
304
+ op: The operation to append.
305
+ """
306
+
307
+ def reverse(self) -> None:
308
+ """Reverse the order of the operations in the quantum computation (in-place)."""
309
+
310
+ def clear(self) -> None:
311
+ """Clear the quantum computation of all operations."""
312
+
313
+ # --------------------------------------------------------------------------
314
+ # (Qu)Bit Registers
315
+ # --------------------------------------------------------------------------
316
+
317
+ def add_ancillary_register(self, n: int, name: str = "anc") -> QuantumRegister:
318
+ """Add an ancillary register to the quantum computation.
319
+
320
+ Args:
321
+ n: The number of qubits in the ancillary register.
322
+ name: The name of the ancillary register.
323
+
324
+ Returns:
325
+ The ancillary register added to the quantum computation.
326
+ """
327
+
328
+ def add_classical_register(self, n: int, name: str = "c") -> ClassicalRegister:
329
+ """Add a classical register to the quantum computation.
330
+
331
+ Args:
332
+ n: The number of bits in the classical register.
333
+ name: The name of the classical register.
334
+
335
+ Returns:
336
+ The classical register added to the quantum computation.
337
+ """
338
+
339
+ def add_qubit_register(self, n: int, name: str = "q") -> QuantumRegister:
340
+ """Add a qubit register to the quantum computation.
341
+
342
+ Args:
343
+ n: The number of qubits in the qubit register.
344
+ name: The name of the qubit register.
345
+
346
+ Returns:
347
+ The qubit register added to the quantum computation.
348
+ """
349
+
350
+ def unify_quantum_registers(self, name: str = "q") -> QuantumRegister:
351
+ """Unify all quantum registers in the quantum computation.
352
+
353
+ Args:
354
+ name: The name of the unified quantum register.
355
+
356
+ Returns:
357
+ The unified quantum register.
358
+ """
359
+
360
+ @property
361
+ def qregs(self) -> dict[str, QuantumRegister]:
362
+ """The quantum registers in the quantum computation."""
363
+
364
+ @property
365
+ def cregs(self) -> dict[str, ClassicalRegister]:
366
+ """The classical registers in the quantum computation."""
367
+
368
+ @property
369
+ def ancregs(self) -> dict[str, QuantumRegister]:
370
+ """The ancillary registers in the quantum computation."""
371
+
372
+ # --------------------------------------------------------------------------
373
+ # Initial Layout and Output Permutation
374
+ # --------------------------------------------------------------------------
375
+
376
+ initial_layout: Permutation
377
+ """
378
+ The initial layout of the qubits in the quantum computation.
379
+
380
+ This is a permutation of the qubits in the quantum computation. It is mainly
381
+ used to track the mapping of circuit qubits to device qubits during quantum
382
+ circuit compilation. The keys are the device qubits (in which a compiled circuit
383
+ is expressed in), and the values are the circuit qubits (in which the original
384
+ quantum circuit is expressed in).
385
+
386
+ Any operations in the quantum circuit are expected to be expressed in terms
387
+ of the keys of the initial layout.
388
+
389
+ Examples:
390
+ - If no initial layout is explicitly specified (which is the default),
391
+ the initial layout is assumed to be the identity permutation.
392
+ - Assume a three-qubit circuit has been compiled to a four qubit device
393
+ and circuit qubit 0 is mapped to device qubit 1, circuit qubit 1 is
394
+ mapped to device qubit 2, and circuit qubit 2 is mapped to device qubit 3.
395
+ Then the initial layout is {1: 0, 2: 1, 3: 2}.
396
+
397
+ """
398
+ output_permutation: Permutation
399
+ """
400
+ The output permutation of the qubits in the quantum computation.
401
+
402
+ This is a permutation of the qubits in the quantum computation. It is mainly
403
+ used to track where individual qubits end up at the end of the quantum computation,
404
+ for example after a circuit has been compiled to a specific device and SWAP
405
+ gates have been inserted, which permute the qubits. The keys are the qubits
406
+ in the circuit and the values are the actual qubits being measured.
407
+
408
+ Similar to the initial layout, the keys in the output permutation are the
409
+ qubits actually present in the circuit and the values are the qubits in the
410
+ "original" circuit.
411
+
412
+ Examples:
413
+ - If no output permutation is explicitly specified and the circuit does
414
+ not contain measurements at the end, the output permutation is assumed
415
+ to be the identity permutation.
416
+ - If the circuit contains measurements at the end, these measurements
417
+ are used to infer the output permutation. Assume a three-qubit circuit
418
+ has been compiled to a four qubit device and, at the end of the circuit,
419
+ circuit qubit 0 is measured into classical bit 2, circuit qubit 1 is
420
+ measured into classical bit 1, and circuit qubit 3 is measured into
421
+ classical bit 0. Then the output permutation is {0: 2, 1: 1, 3: 0}.
422
+ """
423
+
424
+ def initialize_io_mapping(self) -> None:
425
+ """Initialize the I/O mapping of the quantum computation.
426
+
427
+ If no initial layout is explicitly specified, the initial layout is assumed
428
+ to be the identity permutation. If the circuit contains measurements at the
429
+ end, these measurements are used to infer the output permutation.
430
+ """
431
+
432
+ # --------------------------------------------------------------------------
433
+ # Ancilla and Garbage Handling
434
+ # --------------------------------------------------------------------------
435
+
436
+ @property
437
+ def ancillary(self) -> list[bool]:
438
+ """A list of booleans indicating whether each qubit is ancillary."""
439
+
440
+ def set_circuit_qubit_ancillary(self, q: int) -> None:
441
+ """Set a circuit (i.e., logical) qubit to be ancillary.
442
+
443
+ Args:
444
+ q: The index of the circuit qubit to set as ancillary.
445
+ """
446
+
447
+ def set_circuit_qubits_ancillary(self, q_min: int, q_max: int) -> None:
448
+ """Set a range of circuit (i.e., logical) qubits to be ancillary.
449
+
450
+ Args:
451
+ q_min: The minimum index of the circuit qubits to set as ancillary.
452
+ q_max: The maximum index of the circuit qubits to set as ancillary.
453
+ """
454
+
455
+ def is_circuit_qubit_ancillary(self, q: int) -> bool:
456
+ """Check if a circuit (i.e., logical) qubit is ancillary.
457
+
458
+ Args:
459
+ q: The index of the circuit qubit to check.
460
+
461
+ Returns:
462
+ True if the circuit qubit is ancillary, False otherwise.
463
+ """
464
+
465
+ @property
466
+ def garbage(self) -> list[bool]:
467
+ """A list of booleans indicating whether each qubit is garbage."""
468
+
469
+ def set_circuit_qubit_garbage(self, q: int) -> None:
470
+ """Set a circuit (i.e., logical) qubit to be garbage.
471
+
472
+ Args:
473
+ q: The index of the circuit qubit to set as garbage.
474
+ """
475
+
476
+ def set_circuit_qubits_garbage(self, q_min: int, q_max: int) -> None:
477
+ """Set a range of circuit (i.e., logical) qubits to be garbage.
478
+
479
+ Args:
480
+ q_min: The minimum index of the circuit qubits to set as garbage.
481
+ q_max: The maximum index of the circuit qubits to set as garbage.
482
+ """
483
+
484
+ def is_circuit_qubit_garbage(self, q: int) -> bool:
485
+ """Check if a circuit (i.e., logical) qubit is garbage.
486
+
487
+ Args:
488
+ q: The index of the circuit qubit to check.
489
+
490
+ Returns:
491
+ True if the circuit qubit is garbage, False otherwise.
492
+ """
493
+
494
+ # --------------------------------------------------------------------------
495
+ # Symbolic Circuit Handling
496
+ # --------------------------------------------------------------------------
497
+
498
+ @property
499
+ def variables(self) -> set[Variable]:
500
+ """The set of variables in the quantum computation."""
501
+
502
+ def add_variable(self, var: Expression | float) -> None:
503
+ """Add a variable to the quantum computation.
504
+
505
+ Args:
506
+ var: The variable to add.
507
+ """
508
+
509
+ def add_variables(self, vars_: Sequence[Expression | float]) -> None:
510
+ """Add multiple variables to the quantum computation.
511
+
512
+ Args:
513
+ vars_: The variables to add.
514
+ """
515
+
516
+ def is_variable_free(self) -> bool:
517
+ """Check if the quantum computation is free of variables.
518
+
519
+ Returns:
520
+ True if the quantum computation is free of variables, False otherwise.
521
+ """
522
+
523
+ def instantiate(self, assignment: Mapping[Variable, float]) -> QuantumComputation:
524
+ """Instantiate the quantum computation with the given variable assignment.
525
+
526
+ Args:
527
+ assignment: The variable assignment to instantiate the quantum computation with.
528
+
529
+ Returns:
530
+ The instantiated quantum computation.
531
+ """
532
+
533
+ def instantiate_inplace(self, assignment: Mapping[Variable, float]) -> None:
534
+ """Instantiate the quantum computation with the given variable assignment in-place.
535
+
536
+ Args:
537
+ assignment: The variable assignment to instantiate the quantum computation with.
538
+ """
539
+
540
+ # --------------------------------------------------------------------------
541
+ # Output Handling
542
+ # --------------------------------------------------------------------------
543
+
544
+ def qasm2_str(self) -> str:
545
+ """Return the OpenQASM2 representation of the quantum computation as a string.
546
+
547
+ Note:
548
+ This uses some custom extensions to OpenQASM 2.0 that allow for easier
549
+ definition of multi-controlled gates. These extensions might not be
550
+ supported by all OpenQASM 2.0 parsers. Consider using the :meth:`qasm3_str`
551
+ method instead, which uses OpenQASM 3.0 that natively supports
552
+ multi-controlled gates. The export also assumes the bigger, non-standard
553
+ `qelib1.inc` from Qiskit is available.
554
+
555
+ Returns:
556
+ The OpenQASM2 representation of the quantum computation as a string.
557
+ """
558
+
559
+ def qasm2(self, filename: PathLike[str] | str) -> None:
560
+ """Write the OpenQASM2 representation of the quantum computation to a file.
561
+
562
+ See Also:
563
+ :meth:`qasm2_str`
564
+
565
+ Args:
566
+ filename: The filename of the file to write the OpenQASM2 representation to.
567
+ """
568
+
569
+ def qasm3_str(self) -> str:
570
+ """Return the OpenQASM3 representation of the quantum computation as a string.
571
+
572
+ Returns:
573
+ The OpenQASM3 representation of the quantum computation as a string.
574
+ """
575
+
576
+ def qasm3(self, filename: PathLike[str] | str) -> None:
577
+ """Write the OpenQASM3 representation of the quantum computation to a file.
578
+
579
+ See Also:
580
+ :meth:`qasm3_str`
581
+
582
+ Args:
583
+ filename: The filename of the file to write the OpenQASM3 representation to.
584
+ """
585
+
586
+ # --------------------------------------------------------------------------
587
+ # Operations
588
+ # --------------------------------------------------------------------------
589
+
590
+ def i(self, q: int) -> None:
591
+ r"""Apply an identity operation.
592
+
593
+ .. math::
594
+ I = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}
595
+
596
+ Args:
597
+ q: The target qubit
598
+ """
599
+
600
+ def ci(self, control: Control | int, target: int) -> None:
601
+ """Apply a controlled identity operation.
602
+
603
+ Args:
604
+ control: The control qubit
605
+ target: The target qubit
606
+
607
+ See Also:
608
+ :meth:`i`
609
+ """
610
+
611
+ def mci(self, controls: set[Control | int], target: int) -> None:
612
+ """Apply a multi-controlled identity operation.
613
+
614
+ Args:
615
+ controls: The control qubits
616
+ target: The target qubit
617
+
618
+ See Also:
619
+ :meth:`i`
620
+ """
621
+
622
+ def x(self, q: int) -> None:
623
+ r"""Apply a Pauli-X gate.
624
+
625
+ .. math::
626
+ X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}
627
+
628
+ Args:
629
+ q: The target qubit
630
+ """
631
+
632
+ def cx(self, control: Control | int, target: int) -> None:
633
+ """Apply a controlled Pauli-X (CNOT / CX) gate.
634
+
635
+ Args:
636
+ control: The control qubit
637
+ target: The target qubit
638
+
639
+ See Also:
640
+ :meth:`x`
641
+ """
642
+
643
+ def mcx(self, controls: set[Control | int], target: int) -> None:
644
+ """Apply a multi-controlled Pauli-X (Toffoli / MCX) gate.
645
+
646
+ Args:
647
+ controls: The control qubits
648
+ target: The target qubit
649
+
650
+ See Also:
651
+ :meth:`x`
652
+ """
653
+
654
+ def y(self, q: int) -> None:
655
+ r"""Apply a Pauli-Y gate.
656
+
657
+ .. math::
658
+ Y = \begin{pmatrix} 0 & -i \\ i & 0 \end{pmatrix}
659
+
660
+ Args:
661
+ q: The target qubit
662
+ """
663
+
664
+ def cy(self, control: Control | int, target: int) -> None:
665
+ """Apply a controlled Pauli-Y gate.
666
+
667
+ Args:
668
+ control: The control qubit
669
+ target: The target qubit
670
+
671
+ See Also:
672
+ :meth:`y`
673
+ """
674
+
675
+ def mcy(self, controls: set[Control | int], target: int) -> None:
676
+ """Apply a multi-controlled Pauli-Y gate.
677
+
678
+ Args:
679
+ controls: The control qubits
680
+ target: The target qubit
681
+
682
+ See Also:
683
+ :meth:`y`
684
+ """
685
+
686
+ def z(self, q: int) -> None:
687
+ r"""Apply a Pauli-Z gate.
688
+
689
+ .. math::
690
+ Z = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}
691
+
692
+ Args:
693
+ q: The target qubit
694
+ """
695
+
696
+ def cz(self, control: Control | int, target: int) -> None:
697
+ """Apply a controlled Pauli-Z (CZ) gate.
698
+
699
+ Args:
700
+ control: The control qubit
701
+ target: The target qubit
702
+
703
+ See Also:
704
+ :meth:`z`
705
+ """
706
+
707
+ def mcz(self, controls: set[Control | int], target: int) -> None:
708
+ """Apply a multi-controlled Pauli-Z (MCZ) gate.
709
+
710
+ Args:
711
+ controls: The control qubits
712
+ target: The target qubit
713
+
714
+ See Also:
715
+ :meth:`z`
716
+ """
717
+
718
+ def h(self, q: int) -> None:
719
+ r"""Apply a Hadamard gate.
720
+
721
+ .. math::
722
+ H = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}
723
+
724
+ Args:
725
+ q: The target qubit
726
+ """
727
+
728
+ def ch(self, control: Control | int, target: int) -> None:
729
+ """Apply a controlled Hadamard gate.
730
+
731
+ Args:
732
+ control: The control qubit
733
+ target: The target qubit
734
+
735
+ See Also:
736
+ :meth:`h`
737
+ """
738
+
739
+ def mch(self, controls: set[Control | int], target: int) -> None:
740
+ """Apply a multi-controlled Hadamard gate.
741
+
742
+ Args:
743
+ controls: The control qubits
744
+ target: The target qubit
745
+
746
+ See Also:
747
+ :meth:`h`
748
+ """
749
+
750
+ def s(self, q: int) -> None:
751
+ r"""Apply an S gate (phase gate).
752
+
753
+ .. math::
754
+ S = \begin{pmatrix} 1 & 0 \\ 0 & i \end{pmatrix}
755
+
756
+ Args:
757
+ q: The target qubit
758
+ """
759
+
760
+ def cs(self, control: Control | int, target: int) -> None:
761
+ """Apply a controlled S gate (CS gate).
762
+
763
+ Args:
764
+ control: The control qubit
765
+ target: The target qubit
766
+
767
+ See Also:
768
+ :meth:`s`
769
+ """
770
+
771
+ def mcs(self, controls: set[Control | int], target: int) -> None:
772
+ """Apply a multi-controlled S gate.
773
+
774
+ Args:
775
+ controls: The control qubits
776
+ target: The target qubit
777
+
778
+ See Also:
779
+ :meth:`s`
780
+ """
781
+
782
+ def sdg(self, q: int) -> None:
783
+ r"""Apply an :math:`S^{\dagger}` gate.
784
+
785
+ .. math::
786
+ S^{\dagger} = \begin{pmatrix} 1 & 0 \\ 0 & -i \end{pmatrix}
787
+
788
+ Args:
789
+ q: The target qubit
790
+ """
791
+
792
+ def csdg(self, control: Control | int, target: int) -> None:
793
+ r"""Apply a controlled :math:`S^{\dagger}` gate.
794
+
795
+ Args:
796
+ control: The control qubit
797
+ target: The target qubit
798
+
799
+ See Also:
800
+ :meth:`sdg`
801
+ """
802
+
803
+ def mcsdg(self, controls: set[Control | int], target: int) -> None:
804
+ r"""Apply a multi-controlled :math:`S^{\dagger}` gate.
805
+
806
+ Args:
807
+ controls: The control qubits
808
+ target: The target qubit
809
+
810
+ See Also:
811
+ :meth:`sdg`
812
+ """
813
+
814
+ def t(self, q: int) -> None:
815
+ r"""Apply a T gate.
816
+
817
+ .. math::
818
+ T = \begin{pmatrix} 1 & 0 \\ 0 & e^{i\pi/4} \end{pmatrix}
819
+
820
+ Args:
821
+ q: The target qubit
822
+ """
823
+
824
+ def ct(self, control: Control | int, target: int) -> None:
825
+ """Apply a controlled T gate.
826
+
827
+ Args:
828
+ control: The control qubit
829
+ target: The target qubit
830
+
831
+ See Also:
832
+ :meth:`t`
833
+ """
834
+
835
+ def mct(self, controls: set[Control | int], target: int) -> None:
836
+ """Apply a multi-controlled T gate.
837
+
838
+ Args:
839
+ controls: The control qubits
840
+ target: The target qubit
841
+
842
+ See Also:
843
+ :meth:`t`
844
+ """
845
+
846
+ def tdg(self, q: int) -> None:
847
+ r"""Apply a :math:`T^{\dagger}` gate.
848
+
849
+ .. math::
850
+ T^{\dagger} = \begin{pmatrix} 1 & 0 \\ 0 & e^{-i\pi/4} \end{pmatrix}
851
+
852
+ Args:
853
+ q: The target qubit
854
+ """
855
+
856
+ def ctdg(self, control: Control | int, target: int) -> None:
857
+ r"""Apply a controlled :math:`T^{\dagger}` gate.
858
+
859
+ Args:
860
+ control: The control qubit
861
+ target: The target qubit
862
+
863
+ See Also:
864
+ :meth:`tdg`
865
+ """
866
+
867
+ def mctdg(self, controls: set[Control | int], target: int) -> None:
868
+ r"""Apply a multi-controlled :math:`T^{\dagger}` gate.
869
+
870
+ Args:
871
+ controls: The control qubits
872
+ target: The target qubit
873
+
874
+ See Also:
875
+ :meth:`tdg`
876
+ """
877
+
878
+ def v(self, q: int) -> None:
879
+ r"""Apply a V gate.
880
+
881
+ .. math::
882
+ V = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & -i \\ -i & 1 \end{pmatrix}
883
+
884
+ Args:
885
+ q: The target qubit
886
+ """
887
+
888
+ def cv(self, control: Control | int, target: int) -> None:
889
+ """Apply a controlled V gate.
890
+
891
+ Args:
892
+ control: The control qubit
893
+ target: The target qubit
894
+
895
+ See Also:
896
+ :meth:`v`
897
+ """
898
+
899
+ def mcv(self, controls: set[Control | int], target: int) -> None:
900
+ """Apply a multi-controlled V gate.
901
+
902
+ Args:
903
+ controls: The control qubits
904
+ target: The target qubit
905
+
906
+ See Also:
907
+ :meth:`v`
908
+ """
909
+
910
+ def vdg(self, q: int) -> None:
911
+ r"""Apply a :math:`V^{\dagger}` gate.
912
+
913
+ .. math::
914
+ V^{\dagger} = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & i \\ i & 1 \end{pmatrix}
915
+
916
+ Args:
917
+ q: The target qubit
918
+ """
919
+
920
+ def cvdg(self, control: Control | int, target: int) -> None:
921
+ r"""Apply a controlled :math:`V^{\dagger}` gate.
922
+
923
+ Args:
924
+ control: The control qubit
925
+ target: The target qubit
926
+
927
+ See Also:
928
+ :meth:`vdg`
929
+ """
930
+
931
+ def mcvdg(self, controls: set[Control | int], target: int) -> None:
932
+ r"""Apply a multi-controlled :math:`V^{\dagger}` gate.
933
+
934
+ Args:
935
+ controls: The control qubits
936
+ target: The target qubit
937
+
938
+ See Also:
939
+ :meth:`vdg`
940
+ """
941
+
942
+ def sx(self, q: int) -> None:
943
+ r"""Apply a :math:`\sqrt{X}` gate.
944
+
945
+ .. math::
946
+ \sqrt{X} = \frac{1}{2} \begin{pmatrix} 1 + i & 1 - i \\ 1 - i & 1 + i \end{pmatrix}
947
+
948
+ Args:
949
+ q: The target qubit
950
+ """
951
+
952
+ def csx(self, control: Control | int, target: int) -> None:
953
+ r"""Apply a controlled :math:`\sqrt{X}` gate.
954
+
955
+ Args:
956
+ control: The control qubit
957
+ target: The target qubit
958
+
959
+ See Also:
960
+ :meth:`sx`
961
+ """
962
+
963
+ def mcsx(self, controls: set[Control | int], target: int) -> None:
964
+ r"""Apply a multi-controlled :math:`\sqrt{X}` gate.
965
+
966
+ Args:
967
+ controls: The control qubits
968
+ target: The target qubit
969
+
970
+ See Also:
971
+ :meth:`sx`
972
+ """
973
+
974
+ def sxdg(self, q: int) -> None:
975
+ r"""Apply a :math:`\sqrt{X}^{\dagger}` gate.
976
+
977
+ .. math::
978
+ \sqrt{X}^{\dagger} = \frac{1}{2} \begin{pmatrix} 1 - i & 1 + i \\ 1 + i & 1 - i \end{pmatrix}
979
+
980
+ Args:
981
+ q: The target qubit
982
+ """
983
+
984
+ def csxdg(self, control: Control | int, target: int) -> None:
985
+ r"""Apply a controlled :math:`\sqrt{X}^{\dagger}` gate.
986
+
987
+ Args:
988
+ control: The control qubit
989
+ target: The target qubit
990
+
991
+ See Also:
992
+ :meth:`sxdg`
993
+ """
994
+
995
+ def mcsxdg(self, controls: set[Control | int], target: int) -> None:
996
+ r"""Apply a multi-controlled :math:`\sqrt{X}^{\dagger}` gate.
997
+
998
+ Args:
999
+ controls: The control qubits
1000
+ target: The target qubit
1001
+
1002
+ See Also:
1003
+ :meth:`sxdg`
1004
+ """
1005
+
1006
+ def rx(self, theta: float | Expression, q: int) -> None:
1007
+ r"""Apply an :math:`R_x(\theta)` gate.
1008
+
1009
+ .. math::
1010
+ R_x(\theta) = e^{-i\theta X/2} = \cos(\theta/2) I - i \sin(\theta/2) X
1011
+ = \begin{pmatrix} \cos(\theta/2) & -i \sin(\theta/2) \\ -i \sin(\theta/2) & \cos(\theta/2) \end{pmatrix}
1012
+
1013
+ Args:
1014
+ theta: The rotation angle
1015
+ q: The target qubit
1016
+ """
1017
+
1018
+ def crx(self, theta: float | Expression, control: Control | int, target: int) -> None:
1019
+ r"""Apply a controlled :math:`R_x(\theta)` gate.
1020
+
1021
+ Args:
1022
+ theta: The rotation angle
1023
+ control: The control qubit
1024
+ target: The target qubit
1025
+
1026
+ See Also:
1027
+ :meth:`rx`
1028
+ """
1029
+
1030
+ def mcrx(self, theta: float | Expression, controls: set[Control | int], target: int) -> None:
1031
+ r"""Apply a multi-controlled :math:`R_x(\theta)` gate.
1032
+
1033
+ Args:
1034
+ theta: The rotation angle
1035
+ controls: The control qubits
1036
+ target: The target qubit
1037
+
1038
+ See Also:
1039
+ :meth:`rx`
1040
+ """
1041
+
1042
+ def ry(self, theta: float | Expression, q: int) -> None:
1043
+ r"""Apply an :math:`R_y(\theta)` gate.
1044
+
1045
+ .. math::
1046
+ R_y(\theta) = e^{-i\theta Y/2} = \cos(\theta/2) I - i \sin(\theta/2) Y
1047
+ = \begin{pmatrix} \cos(\theta/2) & -\sin(\theta/2) \\ \sin(\theta/2) & \cos(\theta/2) \end{pmatrix}
1048
+
1049
+ Args:
1050
+ theta: The rotation angle
1051
+ q: The target qubit
1052
+ """
1053
+
1054
+ def cry(self, theta: float | Expression, control: Control | int, target: int) -> None:
1055
+ r"""Apply a controlled :math:`R_y(\theta)` gate.
1056
+
1057
+ Args:
1058
+ theta: The rotation angle
1059
+ control: The control qubit
1060
+ target: The target qubit
1061
+
1062
+ See Also:
1063
+ :meth:`ry`
1064
+ """
1065
+
1066
+ def mcry(self, theta: float | Expression, controls: set[Control | int], target: int) -> None:
1067
+ r"""Apply a multi-controlled :math:`R_y(\theta)` gate.
1068
+
1069
+ Args:
1070
+ theta: The rotation angle
1071
+ controls: The control qubits
1072
+ target: The target qubit
1073
+
1074
+ See Also:
1075
+ :meth:`ry`
1076
+ """
1077
+
1078
+ def rz(self, theta: float | Expression, q: int) -> None:
1079
+ r"""Apply an :math:`R_z(\theta)` gate.
1080
+
1081
+ .. math::
1082
+ R_z(\theta) = e^{-i\theta Z/2} = \begin{pmatrix} e^{-i\theta/2} & 0 \\ 0 & e^{i\theta/2} \end{pmatrix}
1083
+
1084
+ Args:
1085
+ theta: The rotation angle
1086
+ q: The target qubit
1087
+ """
1088
+
1089
+ def crz(self, theta: float | Expression, control: Control | int, target: int) -> None:
1090
+ r"""Apply a controlled :math:`R_z(\theta)` gate.
1091
+
1092
+ Args:
1093
+ theta: The rotation angle
1094
+ control: The control qubit
1095
+ target: The target qubit
1096
+
1097
+ See Also:
1098
+ :meth:`rz`
1099
+ """
1100
+
1101
+ def mcrz(self, theta: float | Expression, controls: set[Control | int], target: int) -> None:
1102
+ r"""Apply a multi-controlled :math:`R_z(\theta)` gate.
1103
+
1104
+ Args:
1105
+ theta: The rotation angle
1106
+ controls: The control qubits
1107
+ target: The target qubit
1108
+
1109
+ See Also:
1110
+ :meth:`rz`
1111
+ """
1112
+
1113
+ def p(self, theta: float | Expression, q: int) -> None:
1114
+ r"""Apply a phase gate.
1115
+
1116
+ .. math::
1117
+ P(\theta) = \begin{pmatrix} 1 & 0 \\ 0 & e^{i\theta} \end{pmatrix}
1118
+
1119
+ Args:
1120
+ theta: The rotation angle
1121
+ q: The target qubit
1122
+ """
1123
+
1124
+ def cp(self, theta: float | Expression, control: Control | int, target: int) -> None:
1125
+ """Apply a controlled phase gate.
1126
+
1127
+ Args:
1128
+ theta: The rotation angle
1129
+ control: The control qubit
1130
+ target: The target qubit
1131
+
1132
+ See Also:
1133
+ :meth:`p`
1134
+ """
1135
+
1136
+ def mcp(self, theta: float | Expression, controls: set[Control | int], target: int) -> None:
1137
+ """Apply a multi-controlled phase gate.
1138
+
1139
+ Args:
1140
+ theta: The rotation angle
1141
+ controls: The control qubits
1142
+ target: The target qubit
1143
+
1144
+ See Also:
1145
+ :meth:`p`
1146
+ """
1147
+
1148
+ def u2(self, phi: float | Expression, lambda_: float | Expression, q: int) -> None:
1149
+ r"""Apply a :math:`U_2(\phi, \lambda)` gate.
1150
+
1151
+ .. math::
1152
+ U_2(\phi, \lambda) =
1153
+ \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & -e^{i\lambda} \\ e^{i\phi} & e^{i(\phi + \lambda)} \end{pmatrix}
1154
+
1155
+ Args:
1156
+ phi: The rotation angle
1157
+ lambda_: The rotation angle
1158
+ q: The target qubit
1159
+ """
1160
+
1161
+ def cu2(self, phi: float | Expression, lambda_: float | Expression, control: Control | int, target: int) -> None:
1162
+ r"""Apply a controlled :math:`U_2(\phi, \lambda)` gate.
1163
+
1164
+ Args:
1165
+ phi: The rotation angle
1166
+ lambda_: The rotation angle
1167
+ control: The control qubit
1168
+ target: The target qubit
1169
+
1170
+ See Also:
1171
+ :meth:`u2`
1172
+ """
1173
+
1174
+ def mcu2(
1175
+ self,
1176
+ phi: float | Expression,
1177
+ lambda_: float | Expression,
1178
+ controls: set[Control | int],
1179
+ target: int,
1180
+ ) -> None:
1181
+ r"""Apply a multi-controlled :math:`U_2(\phi, \lambda)` gate.
1182
+
1183
+ Args:
1184
+ phi: The rotation angle
1185
+ lambda_: The rotation angle
1186
+ controls: The control qubits
1187
+ target: The target qubit
1188
+
1189
+ See Also:
1190
+ :meth:`u2`
1191
+ """
1192
+
1193
+ def u(self, theta: float | Expression, phi: float | Expression, lambda_: float | Expression, q: int) -> None:
1194
+ r"""Apply a :math:`U(\theta, \phi, \lambda)` gate.
1195
+
1196
+ .. math::
1197
+ U(\theta, \phi, \lambda) =
1198
+ \begin{pmatrix} \cos(\theta/2) & -e^{i\lambda}\sin(\theta/2) \\
1199
+ e^{i\phi}\sin(\theta/2) & e^{i(\phi + \lambda)}\cos(\theta/2) \end{pmatrix}
1200
+
1201
+ Args:
1202
+ theta: The rotation angle
1203
+ phi: The rotation angle
1204
+ lambda_: The rotation angle
1205
+ q: The target qubit
1206
+ """
1207
+
1208
+ def cu(
1209
+ self,
1210
+ theta: float | Expression,
1211
+ phi: float | Expression,
1212
+ lambda_: float | Expression,
1213
+ control: Control | int,
1214
+ target: int,
1215
+ ) -> None:
1216
+ r"""Apply a controlled :math:`U(\theta, \phi, \lambda)` gate.
1217
+
1218
+ Args:
1219
+ theta: The rotation angle
1220
+ phi: The rotation angle
1221
+ lambda_: The rotation angle
1222
+ control: The control qubit
1223
+ target: The target qubit
1224
+
1225
+ See Also:
1226
+ :meth:`u`
1227
+ """
1228
+
1229
+ def mcu(
1230
+ self,
1231
+ theta: float | Expression,
1232
+ phi: float | Expression,
1233
+ lambda_: float | Expression,
1234
+ controls: set[Control | int],
1235
+ target: int,
1236
+ ) -> None:
1237
+ r"""Apply a multi-controlled :math:`U(\theta, \phi, \lambda)` gate.
1238
+
1239
+ Args:
1240
+ theta: The rotation angle
1241
+ phi: The rotation angle
1242
+ lambda_: The rotation angle
1243
+ controls: The control qubits
1244
+ target: The target qubit
1245
+
1246
+ See Also:
1247
+ :meth:`u`
1248
+ """
1249
+
1250
+ def swap(self, target1: int, target2: int) -> None:
1251
+ r"""Apply a SWAP gate.
1252
+
1253
+ .. math::
1254
+ SWAP = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix}
1255
+
1256
+ Args:
1257
+ target1: The first target qubit
1258
+ target2: The second target qubit
1259
+ """
1260
+
1261
+ def cswap(self, control: Control | int, target1: int, target2: int) -> None:
1262
+ """Apply a controlled SWAP gate.
1263
+
1264
+ Args:
1265
+ control: The control qubit
1266
+ target1: The first target qubit
1267
+ target2: The second target qubit
1268
+
1269
+ See Also:
1270
+ :meth:`swap`
1271
+ """
1272
+
1273
+ def mcswap(self, controls: set[Control | int], target1: int, target2: int) -> None:
1274
+ """Apply a multi-controlled SWAP gate.
1275
+
1276
+ Args:
1277
+ controls: The control qubits
1278
+ target1: The first target qubit
1279
+ target2: The second target qubit
1280
+
1281
+ See Also:
1282
+ :meth:`swap`
1283
+ """
1284
+
1285
+ def dcx(self, target1: int, target2: int) -> None:
1286
+ r"""Apply a DCX (double CNOT) gate.
1287
+
1288
+ .. math::
1289
+ DCX = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \end{pmatrix}
1290
+
1291
+ Args:
1292
+ target1: The first target qubit
1293
+ target2: The second target qubit
1294
+ """
1295
+
1296
+ def cdcx(self, control: Control | int, target1: int, target2: int) -> None:
1297
+ """Apply a controlled DCX (double CNOT) gate.
1298
+
1299
+ Args:
1300
+ control: The control qubit
1301
+ target1: The first target qubit
1302
+ target2: The second target qubit
1303
+
1304
+ See Also:
1305
+ :meth:`dcx`
1306
+ """
1307
+
1308
+ def mcdcx(self, controls: set[Control | int], target1: int, target2: int) -> None:
1309
+ """Apply a multi-controlled DCX (double CNOT) gate.
1310
+
1311
+ Args:
1312
+ controls: The control qubits
1313
+ target1: The first target qubit
1314
+ target2: The second target qubit
1315
+
1316
+ See Also:
1317
+ :meth:`dcx`
1318
+ """
1319
+
1320
+ def ecr(self, target1: int, target2: int) -> None:
1321
+ r"""Apply an ECR (echoed cross-resonance) gate.
1322
+
1323
+ .. math::
1324
+ ECR = \frac{1}{\sqrt{2}}
1325
+ \begin{pmatrix} 0 & 0 & 1 & i \\ 0 & 0 & i & 1 \\ 1 & -i & 0 & 0 \\ -i & 1 & 0 & 0 \end{pmatrix}
1326
+
1327
+ Args:
1328
+ target1: The first target qubit
1329
+ target2: The second target qubit
1330
+ """
1331
+
1332
+ def cecr(self, control: Control | int, target1: int, target2: int) -> None:
1333
+ """Apply a controlled ECR (echoed cross-resonance) gate.
1334
+
1335
+ Args:
1336
+ control: The control qubit
1337
+ target1: The first target qubit
1338
+ target2: The second target qubit
1339
+
1340
+ See Also:
1341
+ :meth:`ecr`
1342
+ """
1343
+
1344
+ def mcecr(self, controls: set[Control | int], target1: int, target2: int) -> None:
1345
+ """Apply a multi-controlled ECR (echoed cross-resonance) gate.
1346
+
1347
+ Args:
1348
+ controls: The control qubits
1349
+ target1: The first target qubit
1350
+ target2: The second target qubit
1351
+
1352
+ See Also:
1353
+ :meth:`ecr`
1354
+ """
1355
+
1356
+ def iswap(self, target1: int, target2: int) -> None:
1357
+ r"""Apply an iSWAP gate.
1358
+
1359
+ .. math::
1360
+ iSWAP = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & i & 0 \\ 0 & i & 0 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix}
1361
+
1362
+ Args:
1363
+ target1: The first target qubit
1364
+ target2: The second target qubit
1365
+ """
1366
+
1367
+ def ciswap(self, control: Control | int, target1: int, target2: int) -> None:
1368
+ """Apply a controlled iSWAP gate.
1369
+
1370
+ Args:
1371
+ control: The control qubit
1372
+ target1: The first target qubit
1373
+ target2: The second target qubit
1374
+
1375
+ See Also:
1376
+ :meth:`iswap`
1377
+ """
1378
+
1379
+ def mciswap(self, controls: set[Control | int], target1: int, target2: int) -> None:
1380
+ """Apply a multi-controlled iSWAP gate.
1381
+
1382
+ Args:
1383
+ controls: The control qubits
1384
+ target1: The first target qubit
1385
+ target2: The second target qubit
1386
+
1387
+ See Also:
1388
+ :meth:`iswap`
1389
+ """
1390
+
1391
+ def iswapdg(self, target1: int, target2: int) -> None:
1392
+ r"""Apply an :math:`iSWAP^{\dagger}` gate.
1393
+
1394
+ .. math::
1395
+ iSWAP^{\dagger} =
1396
+ \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & -i & 0 \\ 0 & -i & 0 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix}
1397
+
1398
+ Args:
1399
+ target1: The first target qubit
1400
+ target2: The second target qubit
1401
+ """
1402
+
1403
+ def ciswapdg(self, control: Control | int, target1: int, target2: int) -> None:
1404
+ r"""Apply a controlled :math:`iSWAP^{\dagger}` gate.
1405
+
1406
+ Args:
1407
+ control: The control qubit
1408
+ target1: The first target qubit
1409
+ target2: The second target qubit
1410
+
1411
+ See Also:
1412
+ :meth:`iswapdg`
1413
+ """
1414
+
1415
+ def mciswapdg(self, controls: set[Control | int], target1: int, target2: int) -> None:
1416
+ r"""Apply a multi-controlled :math:`iSWAP^{\dagger}` gate.
1417
+
1418
+ Args:
1419
+ controls: The control qubits
1420
+ target1: The first target qubit
1421
+ target2: The second target qubit
1422
+
1423
+ See Also:
1424
+ :meth:`iswapdg`
1425
+ """
1426
+
1427
+ def peres(self, target1: int, target2: int) -> None:
1428
+ r"""Apply a Peres gate.
1429
+
1430
+ .. math::
1431
+ Peres = \begin{pmatrix} 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \\ 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \end{pmatrix}
1432
+
1433
+ Args:
1434
+ target1: The first target qubit
1435
+ target2: The second target qubit
1436
+ """
1437
+
1438
+ def cperes(self, control: Control | int, target1: int, target2: int) -> None:
1439
+ """Apply a controlled Peres gate.
1440
+
1441
+ Args:
1442
+ control: The control qubit
1443
+ target1: The first target qubit
1444
+ target2: The second target qubit
1445
+
1446
+ See Also:
1447
+ :meth:`peres`
1448
+ """
1449
+
1450
+ def mcperes(self, controls: set[Control | int], target1: int, target2: int) -> None:
1451
+ """Apply a multi-controlled Peres gate.
1452
+
1453
+ Args:
1454
+ controls: The control qubits
1455
+ target1: The first target qubit
1456
+ target2: The second target qubit
1457
+
1458
+ See Also:
1459
+ :meth:`peres`
1460
+ """
1461
+
1462
+ def peresdg(self, target1: int, target2: int) -> None:
1463
+ r"""Apply a :math:`Peres^{\dagger}` gate.
1464
+
1465
+ .. math::
1466
+ Peres^{\dagger} =
1467
+ \begin{pmatrix} 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 1 & 0 & 0 \\ 1 & 0 & 0 & 0 \end{pmatrix}
1468
+
1469
+ Args:
1470
+ target1: The first target qubit
1471
+ target2: The second target qubit
1472
+ """
1473
+
1474
+ def cperesdg(self, control: Control | int, target1: int, target2: int) -> None:
1475
+ r"""Apply a controlled :math:`Peres^{\dagger}` gate.
1476
+
1477
+ Args:
1478
+ control: The control qubit
1479
+ target1: The first target qubit
1480
+ target2: The second target qubit
1481
+
1482
+ See Also:
1483
+ :meth:`peresdg`
1484
+ """
1485
+
1486
+ def mcperesdg(self, controls: set[Control | int], target1: int, target2: int) -> None:
1487
+ r"""Apply a multi-controlled :math:`Peres^{\dagger}` gate.
1488
+
1489
+ Args:
1490
+ controls: The control qubits
1491
+ target1: The first target qubit
1492
+ target2: The second target qubit
1493
+
1494
+ See Also:
1495
+ :meth:`peresdg`
1496
+ """
1497
+
1498
+ def rxx(self, theta: float | Expression, target1: int, target2: int) -> None:
1499
+ r"""Apply an :math:`R_{xx}(\theta)` gate.
1500
+
1501
+ .. math::
1502
+ R_{xx}(\theta) = e^{-i\theta XX/2} = \cos(\theta/2) I\otimes I - i \sin(\theta/2) X \otimes X
1503
+ = \begin{pmatrix} \cos(\theta/2) & 0 & 0 & -i \sin(\theta/2) \\
1504
+ 0 & \cos(\theta/2) & -i \sin(\theta/2) & 0 \\
1505
+ 0 & -i \sin(\theta/2) & \cos(\theta/2) & 0 \\
1506
+ -i \sin(\theta/2) & 0 & 0 & \cos(\theta/2) \end{pmatrix}
1507
+
1508
+ Args:
1509
+ theta: The rotation angle
1510
+ target1: The first target qubit
1511
+ target2: The second target qubit
1512
+ """
1513
+
1514
+ def crxx(self, theta: float | Expression, control: Control | int, target1: int, target2: int) -> None:
1515
+ r"""Apply a controlled :math:`R_{xx}(\theta)` gate.
1516
+
1517
+ Args:
1518
+ theta: The rotation angle
1519
+ control: The control qubit
1520
+ target1: The first target qubit
1521
+ target2: The second target qubit
1522
+
1523
+ See Also:
1524
+ :meth:`rxx`
1525
+ """
1526
+
1527
+ def mcrxx(self, theta: float | Expression, controls: set[Control | int], target1: int, target2: int) -> None:
1528
+ r"""Apply a multi-controlled :math:`R_{xx}(\theta)` gate.
1529
+
1530
+ Args:
1531
+ theta: The rotation angle
1532
+ controls: The control qubits
1533
+ target1: The first target qubit
1534
+ target2: The second target qubit
1535
+
1536
+ See Also:
1537
+ :meth:`rxx`
1538
+ """
1539
+
1540
+ def ryy(self, theta: float | Expression, target1: int, target2: int) -> None:
1541
+ r"""Apply an :math:`R_{yy}(\theta)` gate.
1542
+
1543
+ .. math::
1544
+ R_{yy}(\theta) = e^{-i\theta YY/2} = \cos(\theta/2) I\otimes I - i \sin(\theta/2) Y \otimes Y
1545
+ = \begin{pmatrix} \cos(\theta/2) & 0 & 0 & i \sin(\theta/2) \\
1546
+ 0 & \cos(\theta/2) & -i \sin(\theta/2) & 0 \\
1547
+ 0 & -i \sin(\theta/2) & \cos(\theta/2) & 0 \\
1548
+ i \sin(\theta/2) & 0 & 0 & \cos(\theta/2) \end{pmatrix}
1549
+
1550
+ Args:
1551
+ theta: The rotation angle
1552
+ target1: The first target qubit
1553
+ target2: The second target qubit
1554
+ """
1555
+
1556
+ def cryy(self, theta: float | Expression, control: Control | int, target1: int, target2: int) -> None:
1557
+ r"""Apply a controlled :math:`R_{yy}(\theta)` gate.
1558
+
1559
+ Args:
1560
+ theta: The rotation angle
1561
+ control: The control qubit
1562
+ target1: The first target qubit
1563
+ target2: The second target qubit
1564
+
1565
+ See Also:
1566
+ :meth:`ryy`
1567
+ """
1568
+
1569
+ def mcryy(self, theta: float | Expression, controls: set[Control | int], target1: int, target2: int) -> None:
1570
+ r"""Apply a multi-controlled :math:`R_{yy}(\theta)` gate.
1571
+
1572
+ Args:
1573
+ theta: The rotation angle
1574
+ controls: The control qubits
1575
+ target1: The first target qubit
1576
+ target2: The second target qubit
1577
+
1578
+ See Also:
1579
+ :meth:`ryy`
1580
+ """
1581
+
1582
+ def rzz(self, theta: float | Expression, target1: int, target2: int) -> None:
1583
+ r"""Apply an :math:`R_{zz}(\theta)` gate.
1584
+
1585
+ .. math::
1586
+ R_{zz}(\theta) = e^{-i\theta ZZ/2} =
1587
+ \begin{pmatrix} e^{-i\theta/2} & 0 & 0 & 0 \\
1588
+ 0 & e^{i\theta/2} & 0 & 0 \\
1589
+ 0 & 0 & e^{i\theta/2} & 0 \\
1590
+ 0 & 0 & 0 & e^{-i\theta/2} \end{pmatrix}
1591
+
1592
+ Args:
1593
+ theta: The rotation angle
1594
+ target1: The first target qubit
1595
+ target2: The second target qubit
1596
+ """
1597
+
1598
+ def crzz(self, theta: float | Expression, control: Control | int, target1: int, target2: int) -> None:
1599
+ r"""Apply a controlled :math:`R_{zz}(\theta)` gate.
1600
+
1601
+ Args:
1602
+ theta: The rotation angle
1603
+ control: The control qubit
1604
+ target1: The first target qubit
1605
+ target2: The second target qubit
1606
+
1607
+ See Also:
1608
+ :meth:`rzz`
1609
+ """
1610
+
1611
+ def mcrzz(self, theta: float | Expression, controls: set[Control | int], target1: int, target2: int) -> None:
1612
+ r"""Apply a multi-controlled :math:`R_{zz}(\theta)` gate.
1613
+
1614
+ Args:
1615
+ theta: The rotation angle
1616
+ controls: The control qubits
1617
+ target1: The first target qubit
1618
+ target2: The second target qubit
1619
+
1620
+ See Also:
1621
+ :meth:`rzz`
1622
+ """
1623
+
1624
+ def rzx(self, theta: float | Expression, target1: int, target2: int) -> None:
1625
+ r"""Apply an :math:`R_{zx}(\theta)` gate.
1626
+
1627
+ .. math::
1628
+ R_{zx}(\theta) = e^{-i\theta ZX/2} = \cos(\theta/2) I\otimes I - i \sin(\theta/2) Z \otimes X =
1629
+ \begin{pmatrix} \cos(\theta/2) & -i \sin(\theta/2) & 0 & 0 \\
1630
+ -i \sin(\theta/2) & \cos(\theta/2) & 0 & 0 \\
1631
+ 0 & 0 & \cos(\theta/2) & i \sin(\theta/2) \\
1632
+ 0 & 0 & i \sin(\theta/2) & \cos(\theta/2) \end{pmatrix}
1633
+
1634
+ Args:
1635
+ theta: The rotation angle
1636
+ target1: The first target qubit
1637
+ target2: The second target qubit
1638
+ """
1639
+
1640
+ def crzx(self, theta: float | Expression, control: Control | int, target1: int, target2: int) -> None:
1641
+ r"""Apply a controlled :math:`R_{zx}(\theta)` gate.
1642
+
1643
+ Args:
1644
+ theta: The rotation angle
1645
+ control: The control qubit
1646
+ target1: The first target qubit
1647
+ target2: The second target qubit
1648
+
1649
+ See Also:
1650
+ :meth:`rzx`
1651
+ """
1652
+
1653
+ def mcrzx(self, theta: float | Expression, controls: set[Control | int], target1: int, target2: int) -> None:
1654
+ r"""Apply a multi-controlled :math:`R_{zx}(\theta)` gate.
1655
+
1656
+ Args:
1657
+ theta: The rotation angle
1658
+ controls: The control qubits
1659
+ target1: The first target qubit
1660
+ target2: The second target qubit
1661
+
1662
+ See Also:
1663
+ :meth:`rzx`
1664
+ """
1665
+
1666
+ def xx_minus_yy(self, theta: float | Expression, beta: float | Expression, target1: int, target2: int) -> None:
1667
+ r"""Apply an :math:`R_{XX - YY}(\theta, \beta)` gate.
1668
+
1669
+ .. math::
1670
+ R_{XX - YY}(\theta, \beta)
1671
+ = R_{z_2}(\beta) \cdot e^{-i\frac{\theta}{2} \frac{XX-YY}{2}} \cdot R_{z_2}(-\beta)
1672
+ = \begin{pmatrix} \cos(\theta/2) & 0 & 0 & -i \sin(\theta/2) e^{-i\beta} \\
1673
+ 0 & 1 & 0 & 0 \\
1674
+ 0 & 0 & 1 & 0 \\
1675
+ -i \sin(\theta/2) e^{i\beta} & 0 & 0 & \cos(\theta/2) \end{pmatrix}
1676
+
1677
+ Args:
1678
+ theta: The rotation angle
1679
+ beta: The rotation angle
1680
+ target1: The first target qubit
1681
+ target2: The second target qubit
1682
+ """
1683
+
1684
+ def cxx_minus_yy(
1685
+ self,
1686
+ theta: float | Expression,
1687
+ beta: float | Expression,
1688
+ control: Control | int,
1689
+ target1: int,
1690
+ target2: int,
1691
+ ) -> None:
1692
+ r"""Apply a controlled :math:`R_{XX - YY}(\theta, \beta)` gate.
1693
+
1694
+ Args:
1695
+ theta: The rotation angle
1696
+ beta: The rotation angle
1697
+ control: The control qubit
1698
+ target1: The first target qubit
1699
+ target2: The second target qubit
1700
+
1701
+ See Also:
1702
+ :meth:`xx_minus_yy`
1703
+ """
1704
+
1705
+ def mcxx_minus_yy(
1706
+ self,
1707
+ theta: float | Expression,
1708
+ beta: float | Expression,
1709
+ controls: set[Control | int],
1710
+ target1: int,
1711
+ target2: int,
1712
+ ) -> None:
1713
+ r"""Apply a multi-controlled :math:`R_{XX - YY}(\theta, \beta)` gate.
1714
+
1715
+ Args:
1716
+ theta: The rotation angle
1717
+ beta: The rotation angle
1718
+ controls: The control qubits
1719
+ target1: The first target qubit
1720
+ target2: The second target qubit
1721
+
1722
+ See Also:
1723
+ :meth:`xx_minus_yy`
1724
+ """
1725
+
1726
+ def xx_plus_yy(self, theta: float | Expression, beta: float | Expression, target1: int, target2: int) -> None:
1727
+ r"""Apply an :math:`R_{XX + YY}(\theta, \beta)` gate.
1728
+
1729
+ .. math::
1730
+ R_{XX + YY}(\theta, \beta)
1731
+ = R_{z_1}(\beta) \cdot e^{-i\frac{\theta}{2} \frac{XX+YY}{2}} \cdot R_{z_1}(-\beta)
1732
+ = \begin{pmatrix} 1 & 0 & 0 & 0 \\
1733
+ 0 & \cos(\theta/2) & -i \sin(\theta/2) e^{-i\beta} & 0 \\
1734
+ 0 & -i \sin(\theta/2) e^{i\beta} & \cos(\theta/2) & 0 \\
1735
+ 0 & 0 & 0 & 1 \end{pmatrix}
1736
+
1737
+ Args:
1738
+ theta: The rotation angle
1739
+ beta: The rotation angle
1740
+ target1: The first target qubit
1741
+ target2: The second target qubit
1742
+ """
1743
+
1744
+ def cxx_plus_yy(
1745
+ self,
1746
+ theta: float | Expression,
1747
+ beta: float | Expression,
1748
+ control: Control | int,
1749
+ target1: int,
1750
+ target2: int,
1751
+ ) -> None:
1752
+ r"""Apply a controlled :math:`R_{XX + YY}(\theta, \beta)` gate.
1753
+
1754
+ Args:
1755
+ theta: The rotation angle
1756
+ beta: The rotation angle
1757
+ control: The control qubit
1758
+ target1: The first target qubit
1759
+ target2: The second target qubit
1760
+
1761
+ See Also:
1762
+ :meth:`xx_plus_yy`
1763
+ """
1764
+
1765
+ def mcxx_plus_yy(
1766
+ self,
1767
+ theta: float | Expression,
1768
+ beta: float | Expression,
1769
+ controls: set[Control | int],
1770
+ target1: int,
1771
+ target2: int,
1772
+ ) -> None:
1773
+ r"""Apply a multi-controlled :math:`R_{XX + YY}(\theta, \beta)` gate.
1774
+
1775
+ Args:
1776
+ theta: The rotation angle
1777
+ beta: The rotation angle
1778
+ controls: The control qubits
1779
+ target1: The first target qubit
1780
+ target2: The second target qubit
1781
+
1782
+ See Also:
1783
+ :meth:`xx_plus_yy`
1784
+ """
1785
+
1786
+ def gphase(self, theta: float) -> None:
1787
+ r"""Apply a global phase gate.
1788
+
1789
+ .. math::
1790
+ GPhase(\theta) = (e^{i\theta})
1791
+
1792
+ Args:
1793
+ theta: The rotation angle
1794
+ """
1795
+
1796
+ @overload
1797
+ def measure(self, qubit: int, cbit: int) -> None:
1798
+ """Measure a qubit and store the result in a classical bit.
1799
+
1800
+ Args:
1801
+ qubit: The qubit to measure
1802
+ cbit: The classical bit to store the result
1803
+ """
1804
+
1805
+ @overload
1806
+ def measure(self, qubits: Sequence[int], cbits: Sequence[int]) -> None:
1807
+ """Measure multiple qubits and store the results in classical bits.
1808
+
1809
+ This method is equivalent to calling :meth:`measure` multiple times.
1810
+
1811
+ Args:
1812
+ qubits: The qubits to measure
1813
+ cbits: The classical bits to store the results
1814
+ """
1815
+
1816
+ def measure_all(self, *, add_bits: bool = True) -> None:
1817
+ """Measure all qubits and store the results in classical bits.
1818
+
1819
+ Details:
1820
+ If `add_bits` is `True`, a new classical register (named "`meas`") with
1821
+ the same size as the number of qubits will be added to the circuit
1822
+ and the results will be stored in it. If `add_bits` is `False`, the
1823
+ classical register must already exist and have a sufficient number
1824
+ of bits to store the results.
1825
+
1826
+ Args:
1827
+ add_bits: Whether to explicitly add a classical register
1828
+ """
1829
+
1830
+ @overload
1831
+ def reset(self, q: int) -> None:
1832
+ """Add a reset operation to the circuit.
1833
+
1834
+ Args:
1835
+ q: The qubit to reset
1836
+ """
1837
+
1838
+ @overload
1839
+ def reset(self, qubits: Sequence[int]) -> None:
1840
+ """Add a reset operation to the circuit.
1841
+
1842
+ Args:
1843
+ qubits: The qubits to reset
1844
+ """
1845
+
1846
+ @overload
1847
+ def barrier(self) -> None:
1848
+ """Add a barrier to the circuit."""
1849
+
1850
+ @overload
1851
+ def barrier(self, q: int) -> None:
1852
+ """Add a barrier to the circuit.
1853
+
1854
+ Args:
1855
+ q: The qubit to add the barrier to
1856
+ """
1857
+
1858
+ @overload
1859
+ def barrier(self, qubits: Sequence[int]) -> None:
1860
+ """Add a barrier to the circuit.
1861
+
1862
+ Args:
1863
+ qubits: The qubits to add the barrier to
1864
+ """
1865
+
1866
+ @overload
1867
+ def classic_controlled(
1868
+ self,
1869
+ op: OpType,
1870
+ target: int,
1871
+ creg: ClassicalRegister,
1872
+ expected_value: int = 1,
1873
+ comparison_kind: ComparisonKind = ComparisonKind.eq,
1874
+ params: Sequence[float] = (),
1875
+ ) -> None:
1876
+ """Add a classic-controlled operation to the circuit.
1877
+
1878
+ Args:
1879
+ op: The operation to apply
1880
+ target: The target qubit
1881
+ creg: The classical register
1882
+ expected_value: The expected value of the classical register
1883
+ comparison_kind: The kind of comparison to perform
1884
+ params: The parameters of the operation
1885
+ """
1886
+
1887
+ @overload
1888
+ def classic_controlled(
1889
+ self,
1890
+ op: OpType,
1891
+ target: int,
1892
+ control: Control | int,
1893
+ creg: ClassicalRegister,
1894
+ expected_value: int = 1,
1895
+ comparison_kind: ComparisonKind = ComparisonKind.eq,
1896
+ params: Sequence[float] = (),
1897
+ ) -> None:
1898
+ """Add a classic-controlled operation to the circuit.
1899
+
1900
+ Args:
1901
+ op: The operation to apply
1902
+ target: The target qubit
1903
+ control: The control qubit
1904
+ creg: The classical register
1905
+ expected_value: The expected value of the classical register
1906
+ comparison_kind: The kind of comparison to perform
1907
+ params: The parameters of the operation
1908
+ """
1909
+
1910
+ @overload
1911
+ def classic_controlled(
1912
+ self,
1913
+ op: OpType,
1914
+ target: int,
1915
+ controls: set[Control | int],
1916
+ creg: ClassicalRegister,
1917
+ expected_value: int = 1,
1918
+ comparison_kind: ComparisonKind = ComparisonKind.eq,
1919
+ params: Sequence[float] = (),
1920
+ ) -> None:
1921
+ """Add a classic-controlled operation to the circuit.
1922
+
1923
+ Args:
1924
+ op: The operation to apply
1925
+ target: The target qubit
1926
+ controls: The control qubits
1927
+ creg: The classical register
1928
+ expected_value: The expected value of the classical register
1929
+ comparison_kind: The kind of comparison to perform
1930
+ params: The parameters of the operation
1931
+ """
1932
+
1933
+ @overload
1934
+ def classic_controlled(
1935
+ self,
1936
+ op: OpType,
1937
+ target: int,
1938
+ cbit: int,
1939
+ expected_value: int = 1,
1940
+ comparison_kind: ComparisonKind = ComparisonKind.eq,
1941
+ params: Sequence[float] = (),
1942
+ ) -> None:
1943
+ """Add a classic-controlled operation to the circuit.
1944
+
1945
+ Args:
1946
+ op: The operation to apply
1947
+ target: The target qubit
1948
+ cbit: The classical bit index
1949
+ expected_value: The expected value of the classical register
1950
+ comparison_kind: The kind of comparison to perform
1951
+ params: The parameters of the operation
1952
+ """
1953
+
1954
+ @overload
1955
+ def classic_controlled(
1956
+ self,
1957
+ op: OpType,
1958
+ target: int,
1959
+ control: Control | int,
1960
+ cbit: int,
1961
+ expected_value: int = 1,
1962
+ comparison_kind: ComparisonKind = ComparisonKind.eq,
1963
+ params: Sequence[float] = (),
1964
+ ) -> None:
1965
+ """Add a classic-controlled operation to the circuit.
1966
+
1967
+ Args:
1968
+ op: The operation to apply
1969
+ target: The target qubit
1970
+ control: The control qubit
1971
+ cbit: The classical bit index
1972
+ expected_value: The expected value of the classical register
1973
+ comparison_kind: The kind of comparison to perform
1974
+ params: The parameters of the operation
1975
+ """
1976
+
1977
+ @overload
1978
+ def classic_controlled(
1979
+ self,
1980
+ op: OpType,
1981
+ target: int,
1982
+ controls: set[Control | int],
1983
+ cbit: int,
1984
+ expected_value: int = 1,
1985
+ comparison_kind: ComparisonKind = ComparisonKind.eq,
1986
+ params: Sequence[float] = (),
1987
+ ) -> None:
1988
+ """Add a classic-controlled operation to the circuit.
1989
+
1990
+ Args:
1991
+ op: The operation to apply
1992
+ target: The target qubit
1993
+ controls: The control qubits
1994
+ cbit: The classical bit index
1995
+ expected_value: The expected value of the classical register
1996
+ comparison_kind: The kind of comparison to perform
1997
+ params: The parameters of the operation
1998
+ """