classiq 0.38.0__py3-none-any.whl → 0.65.4__py3-none-any.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.
Files changed (499) hide show
  1. classiq/__init__.py +47 -32
  2. classiq/_analyzer_extras/_ipywidgets_async_extension.py +2 -1
  3. classiq/_internals/api_wrapper.py +235 -97
  4. classiq/_internals/async_utils.py +1 -3
  5. classiq/_internals/authentication/auth0.py +26 -10
  6. classiq/_internals/authentication/authentication.py +11 -0
  7. classiq/_internals/authentication/device.py +10 -5
  8. classiq/_internals/authentication/password_manager.py +18 -6
  9. classiq/_internals/authentication/token_manager.py +10 -5
  10. classiq/_internals/client.py +94 -33
  11. classiq/_internals/config.py +3 -4
  12. classiq/_internals/host_checker.py +38 -15
  13. classiq/_internals/jobs.py +60 -57
  14. classiq/_internals/type_validation.py +9 -9
  15. classiq/analyzer/__init__.py +1 -3
  16. classiq/analyzer/analyzer.py +24 -19
  17. classiq/analyzer/analyzer_utilities.py +10 -10
  18. classiq/analyzer/rb.py +15 -15
  19. classiq/analyzer/show_interactive_hack.py +27 -4
  20. classiq/analyzer/url_utils.py +2 -3
  21. classiq/applications/__init__.py +3 -12
  22. classiq/applications/chemistry/__init__.py +14 -10
  23. classiq/applications/chemistry/ansatz_parameters.py +4 -4
  24. classiq/{applications_model_constructors → applications/chemistry}/chemistry_model_constructor.py +165 -158
  25. classiq/applications/chemistry/ground_state_problem.py +1 -1
  26. classiq/{applications_model_constructors → applications}/combinatorial_helpers/allowed_constraints.py +4 -1
  27. classiq/{applications_model_constructors → applications}/combinatorial_helpers/arithmetic/arithmetic_expression.py +1 -1
  28. classiq/{applications_model_constructors → applications}/combinatorial_helpers/arithmetic/isolation.py +1 -1
  29. classiq/{applications_model_constructors → applications}/combinatorial_helpers/combinatorial_problem_utils.py +51 -15
  30. classiq/{applications_model_constructors → applications}/combinatorial_helpers/encoding_mapping.py +12 -12
  31. classiq/{applications_model_constructors → applications}/combinatorial_helpers/encoding_utils.py +8 -6
  32. classiq/{applications_model_constructors → applications}/combinatorial_helpers/memory.py +7 -11
  33. classiq/{applications_model_constructors → applications}/combinatorial_helpers/optimization_model.py +67 -40
  34. classiq/applications/combinatorial_helpers/pauli_helpers/pauli_utils.py +46 -0
  35. classiq/applications/combinatorial_helpers/pyomo_utils.py +447 -0
  36. classiq/{applications_model_constructors → applications}/combinatorial_helpers/sympy_utils.py +2 -2
  37. classiq/{applications_model_constructors → applications}/combinatorial_helpers/transformations/encoding.py +15 -20
  38. classiq/{applications_model_constructors → applications}/combinatorial_helpers/transformations/fixed_variables.py +14 -15
  39. classiq/{applications_model_constructors → applications}/combinatorial_helpers/transformations/ising_converter.py +11 -15
  40. classiq/{applications_model_constructors → applications}/combinatorial_helpers/transformations/penalty.py +1 -2
  41. classiq/{applications_model_constructors → applications}/combinatorial_helpers/transformations/penalty_support.py +3 -7
  42. classiq/{applications_model_constructors → applications}/combinatorial_helpers/transformations/sign_seperation.py +2 -3
  43. classiq/{applications_model_constructors → applications}/combinatorial_helpers/transformations/slack_variables.py +5 -8
  44. classiq/applications/combinatorial_optimization/__init__.py +20 -6
  45. classiq/applications/combinatorial_optimization/combinatorial_optimization_config.py +2 -2
  46. classiq/{applications_model_constructors → applications/combinatorial_optimization}/combinatorial_optimization_model_constructor.py +35 -33
  47. classiq/applications/combinatorial_optimization/combinatorial_problem.py +229 -0
  48. classiq/applications/combinatorial_optimization/examples/__init__.py +1 -3
  49. classiq/applications/finance/__init__.py +4 -5
  50. classiq/{applications_model_constructors → applications/finance}/finance_model_constructor.py +48 -42
  51. classiq/applications/grover/__init__.py +9 -0
  52. classiq/{applications_model_constructors → applications/grover}/grover_model_constructor.py +52 -51
  53. classiq/applications/hamiltonian/pauli_decomposition.py +113 -0
  54. classiq/applications/libraries/qmci_library.py +22 -0
  55. classiq/applications/qnn/__init__.py +2 -4
  56. classiq/applications/qnn/circuit_utils.py +6 -6
  57. classiq/applications/qnn/datasets/__init__.py +9 -11
  58. classiq/applications/qnn/datasets/dataset_base_classes.py +7 -5
  59. classiq/applications/qnn/datasets/dataset_not.py +2 -1
  60. classiq/applications/qnn/datasets/dataset_parity.py +2 -2
  61. classiq/applications/qnn/gradients/quantum_gradient.py +1 -1
  62. classiq/applications/qnn/gradients/simple_quantum_gradient.py +2 -1
  63. classiq/applications/qnn/qlayer.py +30 -10
  64. classiq/applications/qnn/torch_utils.py +4 -3
  65. classiq/applications/qnn/types.py +5 -5
  66. classiq/applications/qsvm/__init__.py +6 -4
  67. classiq/applications/qsvm/qsvm.py +3 -6
  68. classiq/applications/qsvm/qsvm_data_generation.py +3 -3
  69. classiq/{applications_model_constructors → applications/qsvm}/qsvm_model_constructor.py +30 -28
  70. classiq/execution/__init__.py +8 -3
  71. classiq/execution/all_hardware_devices.py +11 -0
  72. classiq/execution/execution_session.py +400 -0
  73. classiq/execution/iqcc.py +63 -0
  74. classiq/execution/jobs.py +197 -25
  75. classiq/execution/qnn.py +79 -0
  76. classiq/executor.py +20 -115
  77. classiq/interface/_version.py +1 -1
  78. classiq/interface/analyzer/analysis_params.py +43 -13
  79. classiq/interface/analyzer/cytoscape_graph.py +15 -9
  80. classiq/interface/analyzer/result.py +28 -32
  81. classiq/interface/applications/qsvm.py +20 -29
  82. classiq/interface/ast_node.py +16 -0
  83. classiq/interface/backend/backend_preferences.py +390 -121
  84. classiq/interface/backend/ionq/ionq_quantum_program.py +15 -23
  85. classiq/interface/backend/pydantic_backend.py +25 -22
  86. classiq/interface/backend/quantum_backend_providers.py +69 -16
  87. classiq/interface/chemistry/fermionic_operator.py +30 -21
  88. classiq/interface/chemistry/ground_state_problem.py +28 -25
  89. classiq/interface/chemistry/molecule.py +14 -10
  90. classiq/interface/chemistry/operator.py +64 -231
  91. classiq/interface/combinatorial_optimization/encoding_types.py +1 -1
  92. classiq/interface/combinatorial_optimization/examples/ascending_sequence.py +1 -3
  93. classiq/interface/combinatorial_optimization/examples/integer_portfolio_optimization.py +2 -4
  94. classiq/interface/combinatorial_optimization/examples/knapsack.py +3 -3
  95. classiq/interface/combinatorial_optimization/examples/mht.py +10 -6
  96. classiq/interface/combinatorial_optimization/examples/portfolio_variations.py +2 -2
  97. classiq/interface/combinatorial_optimization/examples/set_cover.py +1 -2
  98. classiq/interface/combinatorial_optimization/mht_qaoa_input.py +8 -9
  99. classiq/interface/combinatorial_optimization/optimization_problem.py +2 -2
  100. classiq/interface/combinatorial_optimization/result.py +1 -3
  101. classiq/interface/combinatorial_optimization/solver_types.py +1 -1
  102. classiq/interface/debug_info/debug_info.py +86 -0
  103. classiq/{exceptions.py → interface/exceptions.py} +37 -9
  104. classiq/interface/execution/iqcc.py +19 -0
  105. classiq/interface/execution/jobs.py +15 -12
  106. classiq/interface/execution/primitives.py +18 -0
  107. classiq/interface/executor/constants.py +1 -0
  108. classiq/interface/executor/execution_preferences.py +26 -114
  109. classiq/interface/executor/execution_request.py +24 -46
  110. classiq/interface/executor/execution_result.py +30 -8
  111. classiq/interface/executor/iqae_result.py +4 -6
  112. classiq/interface/executor/optimizer_preferences.py +17 -14
  113. classiq/interface/executor/quantum_code.py +28 -24
  114. classiq/interface/executor/quantum_instruction_set.py +2 -2
  115. classiq/interface/executor/register_initialization.py +11 -14
  116. classiq/interface/executor/result.py +83 -56
  117. classiq/interface/executor/vqe_result.py +10 -10
  118. classiq/interface/finance/function_input.py +35 -25
  119. classiq/interface/finance/gaussian_model_input.py +5 -5
  120. classiq/interface/finance/log_normal_model_input.py +4 -4
  121. classiq/interface/finance/model_input.py +4 -4
  122. classiq/interface/generator/adjacency.py +1 -3
  123. classiq/interface/generator/amplitude_loading.py +22 -12
  124. classiq/interface/generator/ansatz_library.py +5 -5
  125. classiq/interface/generator/application_apis/arithmetic_declarations.py +8 -5
  126. classiq/interface/generator/application_apis/chemistry_declarations.py +27 -187
  127. classiq/interface/generator/application_apis/combinatorial_optimization_declarations.py +18 -21
  128. classiq/interface/generator/application_apis/entangler_declarations.py +11 -6
  129. classiq/interface/generator/application_apis/finance_declarations.py +48 -69
  130. classiq/interface/generator/application_apis/qsvm_declarations.py +0 -70
  131. classiq/interface/generator/arith/argument_utils.py +46 -5
  132. classiq/interface/generator/arith/arithmetic.py +35 -16
  133. classiq/interface/generator/arith/arithmetic_arg_type_validator.py +6 -7
  134. classiq/interface/generator/arith/arithmetic_expression_abc.py +66 -25
  135. classiq/interface/generator/arith/arithmetic_expression_parser.py +11 -11
  136. classiq/interface/generator/arith/arithmetic_expression_validator.py +47 -43
  137. classiq/interface/generator/arith/arithmetic_operations.py +14 -6
  138. classiq/interface/generator/arith/arithmetic_param_getters.py +7 -8
  139. classiq/interface/generator/arith/arithmetic_result_builder.py +21 -17
  140. classiq/interface/generator/arith/ast_node_rewrite.py +3 -2
  141. classiq/interface/generator/arith/binary_ops.py +218 -130
  142. classiq/interface/generator/arith/endianness.py +1 -1
  143. classiq/interface/generator/arith/extremum_operations.py +96 -25
  144. classiq/interface/generator/arith/logical_ops.py +14 -12
  145. classiq/interface/generator/arith/number_utils.py +12 -6
  146. classiq/interface/generator/arith/register_user_input.py +60 -37
  147. classiq/interface/generator/arith/unary_ops.py +49 -29
  148. classiq/interface/generator/arith/uncomputation_methods.py +1 -1
  149. classiq/interface/generator/builtin_api_builder.py +2 -9
  150. classiq/interface/generator/chemistry_function_params.py +3 -3
  151. classiq/interface/generator/circuit_code/circuit_code.py +7 -7
  152. classiq/interface/generator/circuit_code/types_and_constants.py +4 -7
  153. classiq/interface/generator/commuting_pauli_exponentiation.py +7 -7
  154. classiq/interface/generator/compiler_keywords.py +5 -1
  155. classiq/interface/generator/complex_type.py +13 -18
  156. classiq/interface/generator/constant.py +3 -4
  157. classiq/interface/generator/control_state.py +34 -29
  158. classiq/interface/generator/copy.py +47 -0
  159. classiq/interface/generator/custom_ansatz.py +2 -5
  160. classiq/interface/generator/distance.py +3 -5
  161. classiq/interface/generator/excitations.py +3 -2
  162. classiq/interface/generator/expressions/atomic_expression_functions.py +21 -5
  163. classiq/interface/generator/expressions/enums/__init__.py +0 -10
  164. classiq/interface/generator/expressions/enums/finance_functions.py +12 -22
  165. classiq/interface/generator/expressions/evaluated_expression.py +5 -5
  166. classiq/interface/generator/expressions/expression.py +26 -14
  167. classiq/interface/generator/expressions/expression_constants.py +9 -3
  168. classiq/interface/generator/expressions/non_symbolic_expr.py +119 -0
  169. classiq/interface/generator/expressions/qmod_qarray_proxy.py +99 -0
  170. classiq/interface/generator/expressions/qmod_qscalar_proxy.py +34 -8
  171. classiq/interface/generator/expressions/qmod_qstruct_proxy.py +36 -0
  172. classiq/interface/generator/expressions/qmod_sized_proxy.py +30 -2
  173. classiq/interface/generator/expressions/qmod_struct_instance.py +14 -2
  174. classiq/interface/generator/expressions/sympy_supported_expressions.py +19 -11
  175. classiq/interface/generator/finance.py +2 -2
  176. classiq/interface/generator/function_param_library.py +6 -6
  177. classiq/interface/generator/function_param_list_without_self_reference.py +2 -10
  178. classiq/interface/generator/function_params.py +36 -64
  179. classiq/interface/generator/functions/__init__.py +0 -22
  180. classiq/interface/generator/functions/builtins/internal_operators.py +16 -0
  181. classiq/interface/generator/functions/classical_function_declaration.py +18 -9
  182. classiq/interface/generator/functions/classical_type.py +47 -166
  183. classiq/interface/generator/functions/concrete_types.py +55 -0
  184. classiq/interface/generator/functions/function_declaration.py +13 -14
  185. classiq/interface/generator/functions/port_declaration.py +1 -13
  186. classiq/interface/generator/functions/qmod_python_interface.py +2 -1
  187. classiq/interface/generator/functions/type_name.py +90 -0
  188. classiq/interface/generator/generated_circuit_data.py +153 -20
  189. classiq/interface/generator/grover_diffuser.py +32 -25
  190. classiq/interface/generator/grover_operator.py +34 -25
  191. classiq/interface/generator/hamiltonian_evolution/exponentiation.py +4 -6
  192. classiq/interface/generator/hamiltonian_evolution/qdrift.py +4 -4
  193. classiq/interface/generator/hamiltonian_evolution/suzuki_trotter.py +9 -9
  194. classiq/interface/generator/hardware/hardware_data.py +72 -34
  195. classiq/interface/generator/hardware_efficient_ansatz.py +20 -16
  196. classiq/interface/generator/hartree_fock.py +13 -5
  197. classiq/interface/generator/identity.py +10 -6
  198. classiq/interface/generator/linear_pauli_rotations.py +32 -20
  199. classiq/interface/generator/mcmt_method.py +1 -1
  200. classiq/interface/generator/mcu.py +17 -15
  201. classiq/interface/generator/mcx.py +24 -17
  202. classiq/interface/generator/model/__init__.py +2 -5
  203. classiq/interface/generator/model/constraints.py +26 -8
  204. classiq/interface/generator/model/model.py +27 -190
  205. classiq/interface/generator/model/preferences/preferences.py +115 -41
  206. classiq/{quantum_register.py → interface/generator/model/quantum_register.py} +14 -17
  207. classiq/interface/generator/oracles/arithmetic_oracle.py +2 -4
  208. classiq/interface/generator/oracles/custom_oracle.py +15 -13
  209. classiq/interface/generator/oracles/oracle_abc.py +7 -7
  210. classiq/interface/generator/partitioned_register.py +7 -7
  211. classiq/interface/generator/piecewise_linear_amplitude_loading.py +45 -29
  212. classiq/interface/generator/preferences/optimization.py +1 -2
  213. classiq/interface/generator/qpe.py +41 -30
  214. classiq/interface/generator/qsvm.py +9 -10
  215. classiq/interface/generator/quantum_function_call.py +88 -73
  216. classiq/interface/generator/quantum_program.py +41 -24
  217. classiq/interface/generator/range_types.py +11 -12
  218. classiq/interface/generator/register_role.py +18 -6
  219. classiq/interface/generator/slice_parsing_utils.py +5 -5
  220. classiq/interface/generator/standard_gates/controlled_standard_gates.py +30 -39
  221. classiq/interface/generator/standard_gates/standard_angle_metaclass.py +2 -6
  222. classiq/interface/generator/standard_gates/standard_gates.py +3 -3
  223. classiq/interface/generator/standard_gates/u_gate.py +7 -10
  224. classiq/interface/generator/state_preparation/bell_state_preparation.py +3 -3
  225. classiq/interface/generator/state_preparation/computational_basis_state_preparation.py +2 -1
  226. classiq/interface/generator/state_preparation/distributions.py +16 -15
  227. classiq/interface/generator/state_preparation/metrics.py +4 -7
  228. classiq/interface/generator/state_preparation/state_preparation.py +25 -20
  229. classiq/interface/generator/synthesis_metadata/synthesis_duration.py +0 -4
  230. classiq/interface/generator/synthesis_metadata/synthesis_execution_data.py +20 -6
  231. classiq/interface/generator/transpiler_basis_gates.py +7 -3
  232. classiq/interface/generator/types/builtin_enum_declarations.py +178 -0
  233. classiq/interface/generator/types/compilation_metadata.py +6 -0
  234. classiq/interface/generator/types/enum_declaration.py +54 -0
  235. classiq/interface/generator/types/qstruct_declaration.py +18 -0
  236. classiq/interface/generator/types/struct_declaration.py +7 -11
  237. classiq/interface/generator/ucc.py +5 -4
  238. classiq/interface/generator/unitary_gate.py +5 -5
  239. classiq/interface/generator/user_defined_function_params.py +4 -1
  240. classiq/interface/generator/validations/flow_graph.py +7 -7
  241. classiq/interface/generator/validations/validator_functions.py +4 -4
  242. classiq/interface/generator/visitor.py +23 -16
  243. classiq/interface/hardware.py +29 -8
  244. classiq/interface/helpers/classproperty.py +8 -0
  245. classiq/interface/helpers/custom_encoders.py +2 -2
  246. classiq/interface/helpers/custom_pydantic_types.py +40 -50
  247. classiq/interface/helpers/datastructures.py +26 -0
  248. classiq/interface/helpers/hashable_mixin.py +3 -2
  249. classiq/interface/helpers/hashable_pydantic_base_model.py +2 -1
  250. classiq/interface/helpers/pydantic_model_helpers.py +7 -5
  251. classiq/interface/helpers/validation_helpers.py +3 -20
  252. classiq/interface/helpers/versioned_model.py +1 -4
  253. classiq/interface/ide/ide_data.py +16 -20
  254. classiq/interface/ide/visual_model.py +130 -0
  255. classiq/interface/interface_version.py +1 -0
  256. classiq/interface/jobs.py +29 -69
  257. classiq/interface/model/allocate.py +16 -0
  258. classiq/interface/model/bind_operation.py +32 -9
  259. classiq/interface/model/classical_if.py +15 -0
  260. classiq/interface/model/classical_parameter_declaration.py +33 -3
  261. classiq/interface/model/control.py +45 -0
  262. classiq/interface/model/handle_binding.py +298 -20
  263. classiq/interface/model/inplace_binary_operation.py +29 -24
  264. classiq/interface/model/invert.py +12 -0
  265. classiq/interface/model/model.py +69 -61
  266. classiq/interface/model/native_function_definition.py +17 -20
  267. classiq/interface/model/parameter.py +13 -0
  268. classiq/interface/model/phase_operation.py +11 -0
  269. classiq/interface/model/port_declaration.py +27 -9
  270. classiq/interface/model/power.py +14 -0
  271. classiq/interface/model/quantum_expressions/amplitude_loading_operation.py +30 -18
  272. classiq/interface/model/quantum_expressions/arithmetic_operation.py +51 -14
  273. classiq/interface/model/quantum_expressions/quantum_expression.py +12 -35
  274. classiq/interface/model/quantum_function_call.py +141 -343
  275. classiq/interface/model/quantum_function_declaration.py +190 -157
  276. classiq/interface/model/quantum_lambda_function.py +33 -32
  277. classiq/interface/model/quantum_statement.py +71 -12
  278. classiq/interface/model/quantum_type.py +177 -40
  279. classiq/interface/model/quantum_variable_declaration.py +3 -25
  280. classiq/interface/model/repeat.py +15 -0
  281. classiq/interface/model/statement_block.py +40 -14
  282. classiq/interface/model/validation_handle.py +13 -6
  283. classiq/interface/model/variable_declaration_statement.py +3 -1
  284. classiq/interface/model/within_apply_operation.py +7 -5
  285. classiq/interface/server/global_versions.py +6 -7
  286. classiq/interface/server/routes.py +17 -21
  287. classiq/interface/source_reference.py +59 -0
  288. classiq/model_expansions/atomic_expression_functions_defs.py +253 -0
  289. classiq/model_expansions/capturing/__init__.py +0 -0
  290. classiq/model_expansions/capturing/captured_vars.py +435 -0
  291. classiq/model_expansions/capturing/mangling_utils.py +56 -0
  292. classiq/model_expansions/closure.py +171 -0
  293. classiq/model_expansions/debug_flag.py +3 -0
  294. classiq/model_expansions/evaluators/__init__.py +0 -0
  295. classiq/model_expansions/evaluators/arg_type_match.py +158 -0
  296. classiq/model_expansions/evaluators/argument_types.py +42 -0
  297. classiq/model_expansions/evaluators/classical_expression.py +36 -0
  298. classiq/model_expansions/evaluators/control.py +144 -0
  299. classiq/model_expansions/evaluators/parameter_types.py +226 -0
  300. classiq/model_expansions/evaluators/quantum_type_utils.py +239 -0
  301. classiq/model_expansions/evaluators/type_type_match.py +90 -0
  302. classiq/model_expansions/expression_evaluator.py +135 -0
  303. classiq/model_expansions/expression_renamer.py +76 -0
  304. classiq/model_expansions/function_builder.py +247 -0
  305. classiq/model_expansions/generative_functions.py +158 -0
  306. classiq/model_expansions/interpreters/__init__.py +0 -0
  307. classiq/model_expansions/interpreters/base_interpreter.py +263 -0
  308. classiq/model_expansions/interpreters/frontend_generative_interpreter.py +28 -0
  309. classiq/model_expansions/interpreters/generative_interpreter.py +249 -0
  310. classiq/model_expansions/model_tables.py +18 -0
  311. classiq/model_expansions/quantum_operations/__init__.py +9 -0
  312. classiq/model_expansions/quantum_operations/bind.py +60 -0
  313. classiq/model_expansions/quantum_operations/call_emitter.py +266 -0
  314. classiq/model_expansions/quantum_operations/classicalif.py +53 -0
  315. classiq/model_expansions/quantum_operations/declarative_call_emitter.py +87 -0
  316. classiq/model_expansions/quantum_operations/emitter.py +181 -0
  317. classiq/model_expansions/quantum_operations/quantum_function_call.py +33 -0
  318. classiq/model_expansions/quantum_operations/repeat.py +56 -0
  319. classiq/model_expansions/quantum_operations/shallow_emitter.py +180 -0
  320. classiq/model_expansions/quantum_operations/variable_decleration.py +28 -0
  321. classiq/model_expansions/scope.py +240 -0
  322. classiq/model_expansions/scope_initialization.py +150 -0
  323. classiq/model_expansions/sympy_conversion/__init__.py +0 -0
  324. classiq/model_expansions/sympy_conversion/arithmetics.py +49 -0
  325. classiq/model_expansions/sympy_conversion/expression_to_sympy.py +179 -0
  326. classiq/model_expansions/sympy_conversion/sympy_to_python.py +123 -0
  327. classiq/model_expansions/transformers/__init__.py +0 -0
  328. classiq/model_expansions/transformers/ast_renamer.py +26 -0
  329. classiq/model_expansions/transformers/var_splitter.py +299 -0
  330. classiq/model_expansions/utils/__init__.py +0 -0
  331. classiq/model_expansions/utils/counted_name_allocator.py +11 -0
  332. classiq/model_expansions/utils/handles_collector.py +33 -0
  333. classiq/model_expansions/visitors/__init__.py +0 -0
  334. classiq/model_expansions/visitors/boolean_expression_transformers.py +214 -0
  335. classiq/model_expansions/visitors/variable_references.py +144 -0
  336. classiq/open_library/__init__.py +4 -0
  337. classiq/open_library/functions/__init__.py +130 -0
  338. classiq/open_library/functions/amplitude_estimation.py +30 -0
  339. classiq/open_library/functions/discrete_sine_cosine_transform.py +181 -0
  340. classiq/open_library/functions/grover.py +157 -0
  341. classiq/open_library/functions/hea.py +115 -0
  342. classiq/open_library/functions/linear_pauli_rotation.py +82 -0
  343. classiq/open_library/functions/modular_exponentiation.py +201 -0
  344. classiq/open_library/functions/qaoa_penalty.py +117 -0
  345. classiq/open_library/functions/qft_functions.py +54 -0
  346. classiq/open_library/functions/qpe.py +46 -0
  347. classiq/open_library/functions/qsvt.py +331 -0
  348. classiq/open_library/functions/state_preparation.py +301 -0
  349. classiq/open_library/functions/swap_test.py +27 -0
  350. classiq/open_library/functions/utility_functions.py +81 -0
  351. classiq/open_library/functions/variational.py +52 -0
  352. classiq/qmod/__init__.py +10 -10
  353. classiq/qmod/builtins/__init__.py +19 -2
  354. classiq/qmod/builtins/classical_execution_primitives.py +36 -14
  355. classiq/qmod/builtins/classical_functions.py +39 -43
  356. classiq/qmod/builtins/constants.py +10 -0
  357. classiq/qmod/builtins/enums.py +208 -0
  358. classiq/qmod/builtins/functions/__init__.py +137 -0
  359. classiq/qmod/builtins/functions/allocation.py +150 -0
  360. classiq/qmod/builtins/functions/arithmetic.py +55 -0
  361. classiq/qmod/builtins/functions/benchmarking.py +8 -0
  362. classiq/qmod/builtins/functions/chemistry.py +91 -0
  363. classiq/qmod/builtins/functions/exponentiation.py +105 -0
  364. classiq/qmod/builtins/functions/finance.py +34 -0
  365. classiq/qmod/builtins/functions/operators.py +16 -0
  366. classiq/qmod/builtins/functions/qsvm.py +24 -0
  367. classiq/qmod/builtins/functions/standard_gates.py +651 -0
  368. classiq/qmod/builtins/operations.py +373 -40
  369. classiq/qmod/builtins/structs.py +103 -80
  370. classiq/qmod/cfunc.py +2 -2
  371. classiq/qmod/classical_function.py +4 -8
  372. classiq/qmod/cparam.py +64 -0
  373. classiq/qmod/create_model_function.py +56 -0
  374. classiq/qmod/declaration_inferrer.py +143 -101
  375. classiq/qmod/expression_query.py +20 -4
  376. classiq/qmod/generative.py +42 -0
  377. classiq/qmod/model_state_container.py +18 -6
  378. classiq/qmod/native/__init__.py +7 -0
  379. classiq/qmod/native/expression_to_qmod.py +16 -11
  380. classiq/qmod/native/pretty_printer.py +187 -97
  381. classiq/qmod/pretty_print/__init__.py +7 -0
  382. classiq/qmod/pretty_print/expression_to_python.py +222 -0
  383. classiq/qmod/pretty_print/pretty_printer.py +572 -0
  384. classiq/qmod/python_classical_type.py +67 -0
  385. classiq/qmod/qfunc.py +60 -8
  386. classiq/qmod/qmod_constant.py +93 -26
  387. classiq/qmod/qmod_parameter.py +68 -59
  388. classiq/qmod/qmod_variable.py +468 -155
  389. classiq/qmod/quantum_callable.py +17 -7
  390. classiq/qmod/quantum_expandable.py +269 -96
  391. classiq/qmod/quantum_function.py +196 -41
  392. classiq/qmod/semantics/__init__.py +0 -0
  393. classiq/qmod/semantics/annotation/__init__.py +0 -0
  394. classiq/qmod/semantics/annotation/call_annotation.py +92 -0
  395. classiq/qmod/semantics/annotation/qstruct_annotator.py +23 -0
  396. classiq/qmod/semantics/error_manager.py +88 -0
  397. classiq/qmod/semantics/lambdas.py +25 -0
  398. classiq/qmod/semantics/static_semantics_visitor.py +384 -0
  399. classiq/qmod/semantics/validation/__init__.py +0 -0
  400. classiq/qmod/semantics/validation/constants_validation.py +16 -0
  401. classiq/qmod/semantics/validation/func_call_validation.py +99 -0
  402. classiq/qmod/semantics/validation/function_name_collisions_validation.py +23 -0
  403. classiq/qmod/semantics/validation/handle_validation.py +85 -0
  404. classiq/qmod/semantics/validation/main_validation.py +33 -0
  405. classiq/qmod/semantics/validation/types_validation.py +128 -0
  406. classiq/qmod/symbolic.py +147 -123
  407. classiq/qmod/symbolic_expr.py +27 -12
  408. classiq/qmod/symbolic_type.py +2 -5
  409. classiq/qmod/type_attribute_remover.py +32 -0
  410. classiq/qmod/utilities.py +98 -4
  411. classiq/qmod/write_qmod.py +17 -3
  412. classiq/synthesis.py +210 -22
  413. {classiq-0.38.0.dist-info → classiq-0.65.4.dist-info}/METADATA +16 -9
  414. classiq-0.65.4.dist-info/RECORD +521 -0
  415. classiq/_internals/_qfunc_ext.py +0 -6
  416. classiq/applications/benchmarking/__init__.py +0 -9
  417. classiq/applications/benchmarking/mirror_benchmarking.py +0 -70
  418. classiq/applications/numpy_utils.py +0 -37
  419. classiq/applications_model_constructors/__init__.py +0 -25
  420. classiq/applications_model_constructors/combinatorial_helpers/multiple_comp_basis_sp.py +0 -34
  421. classiq/applications_model_constructors/combinatorial_helpers/pauli_helpers/pauli_utils.py +0 -65
  422. classiq/applications_model_constructors/combinatorial_helpers/pyomo_utils.py +0 -243
  423. classiq/applications_model_constructors/libraries/ampltitude_estimation_library.py +0 -11
  424. classiq/applications_model_constructors/libraries/qmci_library.py +0 -107
  425. classiq/builtin_functions/__init__.py +0 -43
  426. classiq/builtin_functions/amplitude_loading.py +0 -3
  427. classiq/builtin_functions/binary_ops.py +0 -1
  428. classiq/builtin_functions/exponentiation.py +0 -5
  429. classiq/builtin_functions/qpe.py +0 -4
  430. classiq/builtin_functions/qsvm.py +0 -7
  431. classiq/builtin_functions/range_types.py +0 -5
  432. classiq/builtin_functions/standard_gates.py +0 -1
  433. classiq/builtin_functions/state_preparation.py +0 -6
  434. classiq/builtin_functions/suzuki_trotter.py +0 -3
  435. classiq/interface/executor/aws_execution_cost.py +0 -73
  436. classiq/interface/executor/error_mitigation.py +0 -6
  437. classiq/interface/generator/credit_risk_example/linear_gci.py +0 -122
  438. classiq/interface/generator/credit_risk_example/weighted_adder.py +0 -69
  439. classiq/interface/generator/expressions/enums/chemistry.py +0 -28
  440. classiq/interface/generator/expressions/enums/classical_enum.py +0 -5
  441. classiq/interface/generator/expressions/enums/ladder_operator.py +0 -16
  442. classiq/interface/generator/expressions/enums/optimizers.py +0 -9
  443. classiq/interface/generator/expressions/enums/pauli.py +0 -8
  444. classiq/interface/generator/expressions/enums/qsvm_feature_map_entanglement.py +0 -9
  445. classiq/interface/generator/functions/core_lib_declarations/quantum_functions/__init__.py +0 -18
  446. classiq/interface/generator/functions/core_lib_declarations/quantum_functions/atomic_quantum_functions.py +0 -641
  447. classiq/interface/generator/functions/core_lib_declarations/quantum_functions/exponentiation_functions.py +0 -89
  448. classiq/interface/generator/functions/core_lib_declarations/quantum_functions/std_lib_functions.py +0 -1229
  449. classiq/interface/generator/functions/core_lib_declarations/quantum_operators.py +0 -95
  450. classiq/interface/generator/functions/foreign_function_definition.py +0 -114
  451. classiq/interface/generator/functions/function_implementation.py +0 -107
  452. classiq/interface/generator/functions/native_function_definition.py +0 -155
  453. classiq/interface/generator/functions/quantum_function_declaration.py +0 -69
  454. classiq/interface/generator/functions/register.py +0 -44
  455. classiq/interface/generator/functions/register_mapping_data.py +0 -106
  456. classiq/interface/generator/inequality_mixer.py +0 -51
  457. classiq/interface/generator/model/classical_main_validator.py +0 -106
  458. classiq/interface/generator/range_mixer.py +0 -56
  459. classiq/interface/generator/state_propagator.py +0 -74
  460. classiq/interface/generator/types/builtin_struct_declarations/__init__.py +0 -1
  461. classiq/interface/generator/types/builtin_struct_declarations/pauli_struct_declarations.py +0 -22
  462. classiq/interface/ide/show.py +0 -34
  463. classiq/interface/model/call_synthesis_data.py +0 -68
  464. classiq/interface/model/common_model_types.py +0 -23
  465. classiq/interface/model/quantum_expressions/control_state.py +0 -38
  466. classiq/interface/model/quantum_if_operation.py +0 -94
  467. classiq/interface/model/resolvers/function_call_resolver.py +0 -43
  468. classiq/interface/model/validations/handle_validation_base.py +0 -55
  469. classiq/interface/model/validations/handles_validator.py +0 -156
  470. classiq/interface/model/validations/port_to_wire_name_generator.py +0 -12
  471. classiq/model/__init__.py +0 -14
  472. classiq/model/composite_function_generator.py +0 -33
  473. classiq/model/function_handler.py +0 -462
  474. classiq/model/logic_flow.py +0 -149
  475. classiq/model/logic_flow_change_handler.py +0 -71
  476. classiq/model/model.py +0 -229
  477. classiq/qmod/builtins/functions.py +0 -913
  478. classiq/qmod/qmod_struct.py +0 -37
  479. classiq/quantum_functions/__init__.py +0 -17
  480. classiq/quantum_functions/annotation_parser.py +0 -205
  481. classiq/quantum_functions/decorators.py +0 -22
  482. classiq/quantum_functions/function_library.py +0 -181
  483. classiq/quantum_functions/function_parser.py +0 -74
  484. classiq/quantum_functions/quantum_function.py +0 -236
  485. classiq-0.38.0.dist-info/RECORD +0 -454
  486. /classiq/{applications_model_constructors → applications}/combinatorial_helpers/__init__.py +0 -0
  487. /classiq/{applications_model_constructors → applications}/combinatorial_helpers/arithmetic/__init__.py +0 -0
  488. /classiq/{applications_model_constructors → applications}/combinatorial_helpers/pauli_helpers/__init__.py +0 -0
  489. /classiq/{applications_model_constructors → applications}/combinatorial_helpers/pauli_helpers/pauli_sparsing.py +0 -0
  490. /classiq/{applications_model_constructors → applications}/combinatorial_helpers/py.typed +0 -0
  491. /classiq/{applications_model_constructors/combinatorial_helpers/transformations → applications/combinatorial_helpers/solvers}/__init__.py +0 -0
  492. /classiq/{applications_model_constructors/libraries → applications/combinatorial_helpers/transformations}/__init__.py +0 -0
  493. /classiq/{interface/generator/credit_risk_example → applications/hamiltonian}/__init__.py +0 -0
  494. /classiq/{interface/generator/functions/core_lib_declarations → applications/libraries}/__init__.py +0 -0
  495. /classiq/interface/{model/resolvers → debug_info}/__init__.py +0 -0
  496. /classiq/{_internals → interface}/enum_utils.py +0 -0
  497. /classiq/interface/{model/validations → generator/functions/builtins}/__init__.py +0 -0
  498. /classiq/{interface/generator/functions/core_lib_declarations/quantum_functions/chemistry_functions.py → model_expansions/__init__.py} +0 -0
  499. {classiq-0.38.0.dist-info → classiq-0.65.4.dist-info}/WHEEL +0 -0
@@ -1,1229 +0,0 @@
1
- # This file is auto generated by `generate_declarations.py`. #AUTOGENERATED
2
-
3
- from classiq.interface.model.quantum_function_declaration import (
4
- QuantumFunctionDeclaration,
5
- )
6
-
7
- QFT_STEP = QuantumFunctionDeclaration.parse_raw(
8
- """{
9
- "name": "qft_step",
10
- "param_decls": {},
11
- "port_declarations": {
12
- "target": {
13
- "name": "target",
14
- "direction": "inout"
15
- }
16
- },
17
- "operand_declarations": {},
18
- "positional_arg_declarations": []
19
- }"""
20
- )
21
-
22
- QFT = QuantumFunctionDeclaration.parse_raw(
23
- """{
24
- "name": "qft",
25
- "param_decls": {},
26
- "port_declarations": {
27
- "target": {
28
- "name": "target",
29
- "direction": "inout"
30
- }
31
- },
32
- "operand_declarations": {},
33
- "positional_arg_declarations": []
34
- }"""
35
- )
36
-
37
- QPE_FLEXIBLE = QuantumFunctionDeclaration.parse_raw(
38
- """{
39
- "name": "qpe_flexible",
40
- "param_decls": {},
41
- "port_declarations": {
42
- "phase": {
43
- "name": "phase",
44
- "quantum_type": {
45
- "kind": "qnum"
46
- },
47
- "direction": "inout"
48
- }
49
- },
50
- "operand_declarations": {
51
- "unitary_with_power": {
52
- "name": "unitary_with_power",
53
- "positional_arg_declarations": [
54
- {
55
- "name": "arg0",
56
- "classical_type": {
57
- "kind": "int"
58
- }
59
- }
60
- ],
61
- "is_list": false
62
- }
63
- },
64
- "positional_arg_declarations": [
65
- {
66
- "name": "unitary_with_power",
67
- "positional_arg_declarations": [
68
- {
69
- "name": "arg0",
70
- "classical_type": {
71
- "kind": "int"
72
- }
73
- }
74
- ],
75
- "is_list": false
76
- },
77
- {
78
- "name": "phase",
79
- "quantum_type": {
80
- "kind": "qnum"
81
- },
82
- "direction": "inout"
83
- }
84
- ]
85
- }"""
86
- )
87
-
88
- QPE = QuantumFunctionDeclaration.parse_raw(
89
- """{
90
- "name": "qpe",
91
- "param_decls": {},
92
- "port_declarations": {
93
- "phase": {
94
- "name": "phase",
95
- "quantum_type": {
96
- "kind": "qnum"
97
- },
98
- "direction": "inout"
99
- }
100
- },
101
- "operand_declarations": {
102
- "unitary": {
103
- "name": "unitary",
104
- "positional_arg_declarations": [],
105
- "is_list": false
106
- }
107
- },
108
- "positional_arg_declarations": [
109
- {
110
- "name": "unitary",
111
- "positional_arg_declarations": [],
112
- "is_list": false
113
- },
114
- {
115
- "name": "phase",
116
- "quantum_type": {
117
- "kind": "qnum"
118
- },
119
- "direction": "inout"
120
- }
121
- ]
122
- }"""
123
- )
124
-
125
- STANDARD_QPE = QuantumFunctionDeclaration.parse_raw(
126
- """{
127
- "name": "standard_qpe",
128
- "param_decls": {
129
- "precision": {
130
- "kind": "int"
131
- }
132
- },
133
- "port_declarations": {
134
- "phase": {
135
- "name": "phase",
136
- "size": {
137
- "expr": "precision"
138
- },
139
- "direction": "inout"
140
- }
141
- },
142
- "operand_declarations": {
143
- "unitary": {
144
- "name": "unitary"
145
- }
146
- },
147
- "positional_arg_declarations": []
148
- }"""
149
- )
150
-
151
- SINGLE_PAULI = QuantumFunctionDeclaration.parse_raw(
152
- """{
153
- "name": "single_pauli",
154
- "param_decls": {
155
- "slope": {
156
- "kind": "real"
157
- },
158
- "offset": {
159
- "kind": "real"
160
- }
161
- },
162
- "port_declarations": {
163
- "x": {
164
- "name": "x",
165
- "direction": "inout"
166
- },
167
- "q": {
168
- "name": "q",
169
- "size": {
170
- "expr": "1"
171
- },
172
- "direction": "inout"
173
- }
174
- },
175
- "operand_declarations": {
176
- "q1_qfunc": {
177
- "name": "q1_qfunc",
178
- "param_decls": {
179
- "theta": {
180
- "kind": "real"
181
- }
182
- },
183
- "port_declarations": {
184
- "target": {
185
- "name": "target",
186
- "size": {
187
- "expr": "1"
188
- },
189
- "direction": "inout"
190
- }
191
- }
192
- }
193
- },
194
- "positional_arg_declarations": []
195
- }"""
196
- )
197
-
198
- LINEAR_PAULI_ROTATIONS = QuantumFunctionDeclaration.parse_raw(
199
- """{
200
- "name": "linear_pauli_rotations",
201
- "param_decls": {
202
- "bases": {
203
- "kind": "list",
204
- "element_type": {
205
- "kind": "pauli"
206
- }
207
- },
208
- "slopes": {
209
- "kind": "list",
210
- "element_type": {
211
- "kind": "real"
212
- }
213
- },
214
- "offsets": {
215
- "kind": "list",
216
- "element_type": {
217
- "kind": "real"
218
- }
219
- }
220
- },
221
- "port_declarations": {
222
- "x": {
223
- "name": "x",
224
- "direction": "inout"
225
- },
226
- "q": {
227
- "name": "q",
228
- "direction": "inout"
229
- }
230
- },
231
- "operand_declarations": {},
232
- "positional_arg_declarations": []
233
- }"""
234
- )
235
-
236
- AMPLITUDE_ESTIMATION = QuantumFunctionDeclaration.parse_raw(
237
- """{
238
- "name": "amplitude_estimation",
239
- "param_decls": {
240
- "num_phase_qubits": {
241
- "kind": "int"
242
- },
243
- "num_unitary_qubits": {
244
- "kind": "int"
245
- }
246
- },
247
- "port_declarations": {
248
- "phase_port": {
249
- "name": "phase_port",
250
- "quantum_type": {
251
- "kind": "qnum",
252
- "size": {
253
- "expr": "num_phase_qubits"
254
- },
255
- "is_signed": {
256
- "expr": "False"
257
- },
258
- "fraction_digits": {
259
- "expr": "num_phase_qubits"
260
- }
261
- },
262
- "size": {
263
- "expr": "num_phase_qubits"
264
- },
265
- "direction": "output"
266
- },
267
- "unitary_port": {
268
- "name": "unitary_port",
269
- "size": {
270
- "expr": "num_unitary_qubits"
271
- },
272
- "direction": "output"
273
- }
274
- },
275
- "operand_declarations": {
276
- "sp_op": {
277
- "name": "sp_op",
278
- "param_decls": {
279
- "num_unitary_qubits": {
280
- "kind": "int"
281
- }
282
- },
283
- "port_declarations": {
284
- "spq": {
285
- "name": "spq",
286
- "size": {
287
- "expr": "num_unitary_qubits"
288
- },
289
- "direction": "inout"
290
- }
291
- }
292
- },
293
- "oracle_op": {
294
- "name": "oracle_op",
295
- "param_decls": {
296
- "num_unitary_qubits": {
297
- "kind": "int"
298
- }
299
- },
300
- "port_declarations": {
301
- "oq": {
302
- "name": "oq",
303
- "size": {
304
- "expr": "num_unitary_qubits"
305
- },
306
- "direction": "inout"
307
- }
308
- }
309
- }
310
- },
311
- "positional_arg_declarations": []
312
- }"""
313
- )
314
-
315
- PHASE_ORACLE = QuantumFunctionDeclaration.parse_raw(
316
- """{
317
- "name": "phase_oracle",
318
- "param_decls": {},
319
- "port_declarations": {
320
- "target": {
321
- "name": "target",
322
- "quantum_type": {
323
- "length": null,
324
- "kind": "qvec"
325
- },
326
- "direction": "inout"
327
- }
328
- },
329
- "operand_declarations": {
330
- "predicate": {
331
- "name": "predicate",
332
- "positional_arg_declarations": [
333
- {
334
- "name": "arg0",
335
- "quantum_type": {
336
- "length": null,
337
- "kind": "qvec"
338
- },
339
- "direction": "inout"
340
- },
341
- {
342
- "name": "arg1",
343
- "quantum_type": {
344
- "kind": "qbit"
345
- },
346
- "direction": "inout"
347
- }
348
- ],
349
- "is_list": false
350
- }
351
- },
352
- "positional_arg_declarations": [
353
- {
354
- "name": "predicate",
355
- "positional_arg_declarations": [
356
- {
357
- "name": "arg0",
358
- "quantum_type": {
359
- "length": null,
360
- "kind": "qvec"
361
- },
362
- "direction": "inout"
363
- },
364
- {
365
- "name": "arg1",
366
- "quantum_type": {
367
- "kind": "qbit"
368
- },
369
- "direction": "inout"
370
- }
371
- ],
372
- "is_list": false
373
- },
374
- {
375
- "name": "target",
376
- "quantum_type": {
377
- "length": null,
378
- "kind": "qvec"
379
- },
380
- "direction": "inout"
381
- }
382
- ]
383
- }"""
384
- )
385
-
386
- REFLECT_ABOUT_ZERO = QuantumFunctionDeclaration.parse_raw(
387
- """{
388
- "name": "reflect_about_zero",
389
- "param_decls": {},
390
- "port_declarations": {
391
- "packed_vars": {
392
- "name": "packed_vars",
393
- "quantum_type": {
394
- "length": null,
395
- "kind": "qvec"
396
- },
397
- "direction": "inout"
398
- }
399
- },
400
- "operand_declarations": {},
401
- "positional_arg_declarations": [
402
- {
403
- "name": "packed_vars",
404
- "quantum_type": {
405
- "length": null,
406
- "kind": "qvec"
407
- },
408
- "direction": "inout"
409
- }
410
- ]
411
- }"""
412
- )
413
-
414
- GROVER_DIFFUSER = QuantumFunctionDeclaration.parse_raw(
415
- """{
416
- "name": "grover_diffuser",
417
- "param_decls": {},
418
- "port_declarations": {
419
- "packed_vars": {
420
- "name": "packed_vars",
421
- "quantum_type": {
422
- "length": null,
423
- "kind": "qvec"
424
- },
425
- "direction": "inout"
426
- }
427
- },
428
- "operand_declarations": {
429
- "space_transform": {
430
- "name": "space_transform",
431
- "positional_arg_declarations": [
432
- {
433
- "name": "arg0",
434
- "quantum_type": {
435
- "length": null,
436
- "kind": "qvec"
437
- },
438
- "direction": "inout"
439
- }
440
- ],
441
- "is_list": false
442
- }
443
- },
444
- "positional_arg_declarations": [
445
- {
446
- "name": "space_transform",
447
- "positional_arg_declarations": [
448
- {
449
- "name": "arg0",
450
- "quantum_type": {
451
- "length": null,
452
- "kind": "qvec"
453
- },
454
- "direction": "inout"
455
- }
456
- ],
457
- "is_list": false
458
- },
459
- {
460
- "name": "packed_vars",
461
- "quantum_type": {
462
- "length": null,
463
- "kind": "qvec"
464
- },
465
- "direction": "inout"
466
- }
467
- ]
468
- }"""
469
- )
470
-
471
- GROVER_OPERATOR = QuantumFunctionDeclaration.parse_raw(
472
- """{
473
- "name": "grover_operator",
474
- "param_decls": {},
475
- "port_declarations": {
476
- "packed_vars": {
477
- "name": "packed_vars",
478
- "quantum_type": {
479
- "length": null,
480
- "kind": "qvec"
481
- },
482
- "direction": "inout"
483
- }
484
- },
485
- "operand_declarations": {
486
- "oracle": {
487
- "name": "oracle",
488
- "positional_arg_declarations": [
489
- {
490
- "name": "arg0",
491
- "quantum_type": {
492
- "length": null,
493
- "kind": "qvec"
494
- },
495
- "direction": "inout"
496
- }
497
- ],
498
- "is_list": false
499
- },
500
- "space_transform": {
501
- "name": "space_transform",
502
- "positional_arg_declarations": [
503
- {
504
- "name": "arg0",
505
- "quantum_type": {
506
- "length": null,
507
- "kind": "qvec"
508
- },
509
- "direction": "inout"
510
- }
511
- ],
512
- "is_list": false
513
- }
514
- },
515
- "positional_arg_declarations": [
516
- {
517
- "name": "oracle",
518
- "positional_arg_declarations": [
519
- {
520
- "name": "arg0",
521
- "quantum_type": {
522
- "length": null,
523
- "kind": "qvec"
524
- },
525
- "direction": "inout"
526
- }
527
- ],
528
- "is_list": false
529
- },
530
- {
531
- "name": "space_transform",
532
- "positional_arg_declarations": [
533
- {
534
- "name": "arg0",
535
- "quantum_type": {
536
- "length": null,
537
- "kind": "qvec"
538
- },
539
- "direction": "inout"
540
- }
541
- ],
542
- "is_list": false
543
- },
544
- {
545
- "name": "packed_vars",
546
- "quantum_type": {
547
- "length": null,
548
- "kind": "qvec"
549
- },
550
- "direction": "inout"
551
- }
552
- ]
553
- }"""
554
- )
555
-
556
- GROVER_SEARCH = QuantumFunctionDeclaration.parse_raw(
557
- """{
558
- "name": "grover_search",
559
- "param_decls": {
560
- "reps": {
561
- "kind": "int"
562
- }
563
- },
564
- "port_declarations": {
565
- "packed_vars": {
566
- "name": "packed_vars",
567
- "quantum_type": {
568
- "length": null,
569
- "kind": "qvec"
570
- },
571
- "direction": "inout"
572
- }
573
- },
574
- "operand_declarations": {
575
- "oracle": {
576
- "name": "oracle",
577
- "positional_arg_declarations": [
578
- {
579
- "name": "arg0",
580
- "quantum_type": {
581
- "length": null,
582
- "kind": "qvec"
583
- },
584
- "direction": "inout"
585
- }
586
- ],
587
- "is_list": false
588
- }
589
- },
590
- "positional_arg_declarations": [
591
- {
592
- "name": "reps",
593
- "classical_type": {
594
- "kind": "int"
595
- }
596
- },
597
- {
598
- "name": "oracle",
599
- "positional_arg_declarations": [
600
- {
601
- "name": "arg0",
602
- "quantum_type": {
603
- "length": null,
604
- "kind": "qvec"
605
- },
606
- "direction": "inout"
607
- }
608
- ],
609
- "is_list": false
610
- },
611
- {
612
- "name": "packed_vars",
613
- "quantum_type": {
614
- "length": null,
615
- "kind": "qvec"
616
- },
617
- "direction": "inout"
618
- }
619
- ]
620
- }"""
621
- )
622
-
623
- HADAMARD_TRANSFORM = QuantumFunctionDeclaration.parse_raw(
624
- """{
625
- "name": "hadamard_transform",
626
- "param_decls": {},
627
- "port_declarations": {
628
- "target": {
629
- "name": "target",
630
- "direction": "inout"
631
- }
632
- },
633
- "operand_declarations": {},
634
- "positional_arg_declarations": []
635
- }"""
636
- )
637
-
638
- APPLY_TO_ALL = QuantumFunctionDeclaration.parse_raw(
639
- """{
640
- "name": "apply_to_all",
641
- "param_decls": {},
642
- "port_declarations": {
643
- "target": {
644
- "name": "target",
645
- "direction": "inout"
646
- }
647
- },
648
- "operand_declarations": {
649
- "gate_operand": {
650
- "name": "gate_operand",
651
- "port_declarations": {
652
- "target": {
653
- "name": "target",
654
- "size": {
655
- "expr": "1"
656
- },
657
- "direction": "inout"
658
- }
659
- }
660
- }
661
- },
662
- "positional_arg_declarations": []
663
- }"""
664
- )
665
-
666
- ALLOCATE_NUM = QuantumFunctionDeclaration.parse_raw(
667
- """{
668
- "name": "allocate_num",
669
- "param_decls": {
670
- "num_qubits": {
671
- "kind": "int"
672
- },
673
- "is_signed": {
674
- "kind": "bool"
675
- },
676
- "fraction_digits": {
677
- "kind": "int"
678
- }
679
- },
680
- "port_declarations": {
681
- "out": {
682
- "name": "out",
683
- "quantum_type": {
684
- "kind": "qnum",
685
- "size": {
686
- "expr": "num_qubits"
687
- },
688
- "is_signed": {
689
- "expr": "is_signed"
690
- },
691
- "fraction_digits": {
692
- "expr": "fraction_digits"
693
- }
694
- },
695
- "direction": "output"
696
- }
697
- },
698
- "operand_declarations": {},
699
- "positional_arg_declarations": []
700
- }"""
701
- )
702
-
703
- QAOA_MIXER_LAYER = QuantumFunctionDeclaration.parse_raw(
704
- """{
705
- "name": "qaoa_mixer_layer",
706
- "param_decls": {
707
- "b": {
708
- "kind": "real"
709
- }
710
- },
711
- "port_declarations": {
712
- "target": {
713
- "name": "target",
714
- "direction": "inout"
715
- }
716
- },
717
- "operand_declarations": {},
718
- "positional_arg_declarations": []
719
- }"""
720
- )
721
-
722
- QAOA_COST_LAYER = QuantumFunctionDeclaration.parse_raw(
723
- """{
724
- "name": "qaoa_cost_layer",
725
- "param_decls": {
726
- "g": {
727
- "kind": "real"
728
- },
729
- "hamiltonian": {
730
- "kind": "list",
731
- "element_type": {
732
- "kind": "struct_instance",
733
- "name": "PauliTerm"
734
- }
735
- }
736
- },
737
- "port_declarations": {
738
- "target": {
739
- "name": "target",
740
- "direction": "inout"
741
- }
742
- },
743
- "operand_declarations": {},
744
- "positional_arg_declarations": []
745
- }"""
746
- )
747
-
748
- QAOA_LAYER = QuantumFunctionDeclaration.parse_raw(
749
- """{
750
- "name": "qaoa_layer",
751
- "param_decls": {
752
- "g": {
753
- "kind": "real"
754
- },
755
- "b": {
756
- "kind": "real"
757
- },
758
- "hamiltonian": {
759
- "kind": "list",
760
- "element_type": {
761
- "kind": "struct_instance",
762
- "name": "PauliTerm"
763
- }
764
- }
765
- },
766
- "port_declarations": {
767
- "target": {
768
- "name": "target",
769
- "direction": "inout"
770
- }
771
- },
772
- "operand_declarations": {},
773
- "positional_arg_declarations": []
774
- }"""
775
- )
776
-
777
- QAOA_INIT = QuantumFunctionDeclaration.parse_raw(
778
- """{
779
- "name": "qaoa_init",
780
- "param_decls": {},
781
- "port_declarations": {
782
- "target": {
783
- "name": "target",
784
- "direction": "inout"
785
- }
786
- },
787
- "operand_declarations": {},
788
- "positional_arg_declarations": []
789
- }"""
790
- )
791
-
792
- QAOA_PENALTY = QuantumFunctionDeclaration.parse_raw(
793
- """{
794
- "name": "qaoa_penalty",
795
- "param_decls": {
796
- "num_qubits": {
797
- "kind": "int"
798
- },
799
- "params_list": {
800
- "kind": "list",
801
- "element_type": {
802
- "kind": "real"
803
- }
804
- },
805
- "hamiltonian": {
806
- "kind": "list",
807
- "element_type": {
808
- "kind": "struct_instance",
809
- "name": "PauliTerm"
810
- }
811
- }
812
- },
813
- "port_declarations": {
814
- "target": {
815
- "name": "target",
816
- "size": {
817
- "expr": "num_qubits"
818
- },
819
- "direction": "inout"
820
- }
821
- },
822
- "operand_declarations": {},
823
- "positional_arg_declarations": []
824
- }"""
825
- )
826
-
827
- FULL_HEA = QuantumFunctionDeclaration.parse_raw(
828
- """{
829
- "name": "full_hea",
830
- "param_decls": {
831
- "num_qubits": {
832
- "kind": "int"
833
- },
834
- "is_parametrized": {
835
- "kind": "list",
836
- "element_type": {
837
- "kind": "int"
838
- }
839
- },
840
- "angle_params": {
841
- "kind": "list",
842
- "element_type": {
843
- "kind": "real"
844
- }
845
- },
846
- "connectivity_map": {
847
- "kind": "list",
848
- "element_type": {
849
- "kind": "list",
850
- "element_type": {
851
- "kind": "int"
852
- }
853
- }
854
- },
855
- "reps": {
856
- "kind": "int"
857
- }
858
- },
859
- "port_declarations": {
860
- "x": {
861
- "name": "x",
862
- "size": {
863
- "expr": "num_qubits"
864
- },
865
- "direction": "inout"
866
- }
867
- },
868
- "operand_declarations": {
869
- "operands_1qubit": {
870
- "name": "operands_1qubit",
871
- "param_decls": {
872
- "angle": {
873
- "kind": "real"
874
- }
875
- },
876
- "port_declarations": {
877
- "q": {
878
- "name": "q",
879
- "size": {
880
- "expr": "1"
881
- },
882
- "direction": "inout"
883
- }
884
- },
885
- "is_list": true
886
- },
887
- "operands_2qubit": {
888
- "name": "operands_2qubit",
889
- "param_decls": {
890
- "angle": {
891
- "kind": "real"
892
- }
893
- },
894
- "port_declarations": {
895
- "q1": {
896
- "name": "q1",
897
- "size": {
898
- "expr": "1"
899
- },
900
- "direction": "inout"
901
- },
902
- "q2": {
903
- "name": "q2",
904
- "size": {
905
- "expr": "1"
906
- },
907
- "direction": "inout"
908
- }
909
- },
910
- "is_list": true
911
- }
912
- },
913
- "positional_arg_declarations": []
914
- }"""
915
- )
916
-
917
- SWAP_TEST = QuantumFunctionDeclaration.parse_raw(
918
- """{
919
- "name": "swap_test",
920
- "param_decls": {},
921
- "port_declarations": {
922
- "state1": {
923
- "name": "state1",
924
- "quantum_type": {
925
- "length": null,
926
- "kind": "qvec"
927
- },
928
- "direction": "inout"
929
- },
930
- "state2": {
931
- "name": "state2",
932
- "quantum_type": {
933
- "length": null,
934
- "kind": "qvec"
935
- },
936
- "direction": "inout"
937
- },
938
- "test": {
939
- "name": "test",
940
- "quantum_type": {
941
- "kind": "qbit"
942
- },
943
- "direction": "output"
944
- }
945
- },
946
- "operand_declarations": {},
947
- "positional_arg_declarations": [
948
- {
949
- "name": "state1",
950
- "quantum_type": {
951
- "length": null,
952
- "kind": "qvec"
953
- },
954
- "direction": "inout"
955
- },
956
- {
957
- "name": "state2",
958
- "quantum_type": {
959
- "length": null,
960
- "kind": "qvec"
961
- },
962
- "direction": "inout"
963
- },
964
- {
965
- "name": "test",
966
- "quantum_type": {
967
- "kind": "qbit"
968
- },
969
- "direction": "output"
970
- }
971
- ]
972
- }"""
973
- )
974
-
975
- PREPARE_GHZ_STATE = QuantumFunctionDeclaration.parse_raw(
976
- """{
977
- "name": "prepare_ghz_state",
978
- "param_decls": {
979
- "size": {
980
- "kind": "int"
981
- }
982
- },
983
- "port_declarations": {
984
- "q": {
985
- "name": "q",
986
- "quantum_type": {
987
- "length": null,
988
- "kind": "qvec"
989
- },
990
- "direction": "output"
991
- }
992
- },
993
- "operand_declarations": {},
994
- "positional_arg_declarations": [
995
- {
996
- "name": "size",
997
- "classical_type": {
998
- "kind": "int"
999
- }
1000
- },
1001
- {
1002
- "name": "q",
1003
- "quantum_type": {
1004
- "length": null,
1005
- "kind": "qvec"
1006
- },
1007
- "direction": "output"
1008
- }
1009
- ]
1010
- }"""
1011
- )
1012
-
1013
- PREPARE_EXPONENTIAL_STATE = QuantumFunctionDeclaration.parse_raw(
1014
- """{
1015
- "name": "prepare_exponential_state",
1016
- "param_decls": {
1017
- "rate": {
1018
- "kind": "int"
1019
- }
1020
- },
1021
- "port_declarations": {
1022
- "q": {
1023
- "name": "q",
1024
- "quantum_type": {
1025
- "length": null,
1026
- "kind": "qvec"
1027
- },
1028
- "direction": "inout"
1029
- }
1030
- },
1031
- "operand_declarations": {},
1032
- "positional_arg_declarations": [
1033
- {
1034
- "name": "rate",
1035
- "classical_type": {
1036
- "kind": "int"
1037
- }
1038
- },
1039
- {
1040
- "name": "q",
1041
- "quantum_type": {
1042
- "length": null,
1043
- "kind": "qvec"
1044
- },
1045
- "direction": "inout"
1046
- }
1047
- ]
1048
- }"""
1049
- )
1050
-
1051
- PREPARE_BELL_STATE = QuantumFunctionDeclaration.parse_raw(
1052
- """{
1053
- "name": "prepare_bell_state",
1054
- "param_decls": {
1055
- "state_num": {
1056
- "kind": "int"
1057
- }
1058
- },
1059
- "port_declarations": {
1060
- "q": {
1061
- "name": "q",
1062
- "quantum_type": {
1063
- "length": {
1064
- "expr": "2"
1065
- },
1066
- "kind": "qvec"
1067
- },
1068
- "direction": "output"
1069
- }
1070
- },
1071
- "operand_declarations": {},
1072
- "positional_arg_declarations": [
1073
- {
1074
- "name": "state_num",
1075
- "classical_type": {
1076
- "kind": "int"
1077
- }
1078
- },
1079
- {
1080
- "name": "q",
1081
- "quantum_type": {
1082
- "length": {
1083
- "expr": "2"
1084
- },
1085
- "kind": "qvec"
1086
- },
1087
- "direction": "output"
1088
- }
1089
- ]
1090
- }"""
1091
- )
1092
-
1093
- INPLACE_PREPARE_INT = QuantumFunctionDeclaration.parse_raw(
1094
- """{
1095
- "name": "inplace_prepare_int",
1096
- "param_decls": {
1097
- "value": {
1098
- "kind": "int"
1099
- }
1100
- },
1101
- "port_declarations": {
1102
- "target": {
1103
- "name": "target",
1104
- "quantum_type": {
1105
- "length": null,
1106
- "kind": "qvec"
1107
- },
1108
- "direction": "inout"
1109
- }
1110
- },
1111
- "operand_declarations": {},
1112
- "positional_arg_declarations": [
1113
- {
1114
- "name": "value",
1115
- "classical_type": {
1116
- "kind": "int"
1117
- }
1118
- },
1119
- {
1120
- "name": "target",
1121
- "quantum_type": {
1122
- "length": null,
1123
- "kind": "qvec"
1124
- },
1125
- "direction": "inout"
1126
- }
1127
- ]
1128
- }"""
1129
- )
1130
-
1131
- PREPARE_INT = QuantumFunctionDeclaration.parse_raw(
1132
- """{
1133
- "name": "prepare_int",
1134
- "param_decls": {
1135
- "value": {
1136
- "kind": "int"
1137
- }
1138
- },
1139
- "port_declarations": {
1140
- "out": {
1141
- "name": "out",
1142
- "quantum_type": {
1143
- "kind": "qnum"
1144
- },
1145
- "direction": "output"
1146
- }
1147
- },
1148
- "operand_declarations": {},
1149
- "positional_arg_declarations": [
1150
- {
1151
- "name": "value",
1152
- "classical_type": {
1153
- "kind": "int"
1154
- }
1155
- },
1156
- {
1157
- "name": "out",
1158
- "quantum_type": {
1159
- "kind": "qnum"
1160
- },
1161
- "direction": "output"
1162
- }
1163
- ]
1164
- }"""
1165
- )
1166
-
1167
- SWITCH = QuantumFunctionDeclaration.parse_raw(
1168
- """{
1169
- "name": "switch",
1170
- "param_decls": {
1171
- "selector": {
1172
- "kind": "int"
1173
- }
1174
- },
1175
- "port_declarations": {},
1176
- "operand_declarations": {
1177
- "cases": {
1178
- "name": "cases",
1179
- "positional_arg_declarations": [],
1180
- "is_list": true
1181
- }
1182
- },
1183
- "positional_arg_declarations": [
1184
- {
1185
- "name": "selector",
1186
- "classical_type": {
1187
- "kind": "int"
1188
- }
1189
- },
1190
- {
1191
- "name": "cases",
1192
- "positional_arg_declarations": [],
1193
- "is_list": true
1194
- }
1195
- ]
1196
- }"""
1197
- )
1198
-
1199
- __all__ = [
1200
- "QFT_STEP",
1201
- "QFT",
1202
- "QPE_FLEXIBLE",
1203
- "QPE",
1204
- "STANDARD_QPE",
1205
- "SINGLE_PAULI",
1206
- "LINEAR_PAULI_ROTATIONS",
1207
- "AMPLITUDE_ESTIMATION",
1208
- "PHASE_ORACLE",
1209
- "REFLECT_ABOUT_ZERO",
1210
- "GROVER_DIFFUSER",
1211
- "GROVER_OPERATOR",
1212
- "GROVER_SEARCH",
1213
- "HADAMARD_TRANSFORM",
1214
- "APPLY_TO_ALL",
1215
- "ALLOCATE_NUM",
1216
- "QAOA_MIXER_LAYER",
1217
- "QAOA_COST_LAYER",
1218
- "QAOA_LAYER",
1219
- "QAOA_INIT",
1220
- "QAOA_PENALTY",
1221
- "FULL_HEA",
1222
- "SWAP_TEST",
1223
- "PREPARE_GHZ_STATE",
1224
- "PREPARE_EXPONENTIAL_STATE",
1225
- "PREPARE_BELL_STATE",
1226
- "INPLACE_PREPARE_INT",
1227
- "PREPARE_INT",
1228
- "SWITCH",
1229
- ]