classiq 0.37.0__py3-none-any.whl → 0.38.0__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 (228) hide show
  1. classiq/__init__.py +2 -2
  2. classiq/_analyzer_extras/_ipywidgets_async_extension.py +1 -1
  3. classiq/_analyzer_extras/interactive_hardware.py +3 -3
  4. classiq/_internals/api_wrapper.py +24 -16
  5. classiq/_internals/async_utils.py +1 -74
  6. classiq/_internals/authentication/device.py +9 -4
  7. classiq/_internals/authentication/password_manager.py +25 -10
  8. classiq/_internals/authentication/token_manager.py +2 -2
  9. classiq/_internals/client.py +13 -5
  10. classiq/_internals/jobs.py +10 -7
  11. classiq/analyzer/analyzer.py +26 -28
  12. classiq/analyzer/analyzer_utilities.py +5 -5
  13. classiq/analyzer/rb.py +4 -5
  14. classiq/analyzer/show_interactive_hack.py +6 -6
  15. classiq/applications/benchmarking/mirror_benchmarking.py +9 -6
  16. classiq/applications/combinatorial_optimization/__init__.py +5 -0
  17. classiq/applications/qnn/circuit_utils.py +2 -2
  18. classiq/applications/qnn/gradients/quantum_gradient.py +2 -2
  19. classiq/applications/qnn/types.py +2 -2
  20. classiq/applications/qsvm/qsvm.py +4 -7
  21. classiq/applications/qsvm/qsvm_data_generation.py +2 -5
  22. classiq/applications_model_constructors/__init__.py +9 -1
  23. classiq/applications_model_constructors/chemistry_model_constructor.py +9 -16
  24. classiq/applications_model_constructors/combinatorial_helpers/__init__.py +0 -0
  25. classiq/applications_model_constructors/combinatorial_helpers/allowed_constraints.py +20 -0
  26. classiq/applications_model_constructors/combinatorial_helpers/arithmetic/__init__.py +0 -0
  27. classiq/applications_model_constructors/combinatorial_helpers/arithmetic/arithmetic_expression.py +35 -0
  28. classiq/applications_model_constructors/combinatorial_helpers/arithmetic/isolation.py +42 -0
  29. classiq/applications_model_constructors/combinatorial_helpers/combinatorial_problem_utils.py +130 -0
  30. classiq/applications_model_constructors/combinatorial_helpers/encoding_mapping.py +107 -0
  31. classiq/applications_model_constructors/combinatorial_helpers/encoding_utils.py +122 -0
  32. classiq/applications_model_constructors/combinatorial_helpers/memory.py +79 -0
  33. classiq/applications_model_constructors/combinatorial_helpers/multiple_comp_basis_sp.py +34 -0
  34. classiq/applications_model_constructors/combinatorial_helpers/optimization_model.py +166 -0
  35. classiq/applications_model_constructors/combinatorial_helpers/pauli_helpers/__init__.py +0 -0
  36. classiq/applications_model_constructors/combinatorial_helpers/pauli_helpers/pauli_sparsing.py +31 -0
  37. classiq/applications_model_constructors/combinatorial_helpers/pauli_helpers/pauli_utils.py +65 -0
  38. classiq/applications_model_constructors/combinatorial_helpers/py.typed +0 -0
  39. classiq/applications_model_constructors/combinatorial_helpers/pyomo_utils.py +243 -0
  40. classiq/applications_model_constructors/combinatorial_helpers/sympy_utils.py +22 -0
  41. classiq/applications_model_constructors/combinatorial_helpers/transformations/__init__.py +0 -0
  42. classiq/applications_model_constructors/combinatorial_helpers/transformations/encoding.py +194 -0
  43. classiq/applications_model_constructors/combinatorial_helpers/transformations/fixed_variables.py +144 -0
  44. classiq/applications_model_constructors/combinatorial_helpers/transformations/ising_converter.py +124 -0
  45. classiq/applications_model_constructors/combinatorial_helpers/transformations/penalty.py +32 -0
  46. classiq/applications_model_constructors/combinatorial_helpers/transformations/penalty_support.py +41 -0
  47. classiq/applications_model_constructors/combinatorial_helpers/transformations/sign_seperation.py +75 -0
  48. classiq/applications_model_constructors/combinatorial_helpers/transformations/slack_variables.py +90 -0
  49. classiq/applications_model_constructors/combinatorial_optimization_model_constructor.py +48 -91
  50. classiq/applications_model_constructors/finance_model_constructor.py +4 -17
  51. classiq/applications_model_constructors/grover_model_constructor.py +20 -91
  52. classiq/applications_model_constructors/libraries/qmci_library.py +17 -19
  53. classiq/builtin_functions/standard_gates.py +1 -1
  54. classiq/exceptions.py +43 -1
  55. classiq/executor.py +10 -9
  56. classiq/interface/_version.py +1 -1
  57. classiq/interface/analyzer/analysis_params.py +6 -3
  58. classiq/interface/analyzer/result.py +12 -4
  59. classiq/interface/applications/qsvm.py +13 -1
  60. classiq/interface/backend/backend_preferences.py +4 -2
  61. classiq/interface/backend/pydantic_backend.py +3 -1
  62. classiq/interface/backend/quantum_backend_providers.py +1 -0
  63. classiq/interface/chemistry/fermionic_operator.py +15 -13
  64. classiq/interface/chemistry/ground_state_problem.py +18 -3
  65. classiq/interface/chemistry/molecule.py +8 -6
  66. classiq/interface/chemistry/operator.py +20 -14
  67. classiq/interface/combinatorial_optimization/examples/ascending_sequence.py +1 -1
  68. classiq/interface/combinatorial_optimization/examples/greater_than_ilp.py +1 -1
  69. classiq/interface/combinatorial_optimization/examples/ilp.py +2 -1
  70. classiq/interface/combinatorial_optimization/examples/integer_portfolio_optimization.py +2 -2
  71. classiq/interface/combinatorial_optimization/examples/mds.py +2 -1
  72. classiq/interface/combinatorial_optimization/examples/mht.py +3 -3
  73. classiq/interface/combinatorial_optimization/examples/mis.py +4 -1
  74. classiq/interface/combinatorial_optimization/examples/mvc.py +2 -1
  75. classiq/interface/combinatorial_optimization/examples/set_cover.py +2 -1
  76. classiq/interface/combinatorial_optimization/examples/tsp.py +4 -3
  77. classiq/interface/combinatorial_optimization/examples/tsp_digraph.py +6 -2
  78. classiq/interface/combinatorial_optimization/mht_qaoa_input.py +9 -3
  79. classiq/interface/executor/aws_execution_cost.py +4 -3
  80. classiq/interface/executor/estimation.py +2 -2
  81. classiq/interface/executor/execution_preferences.py +5 -34
  82. classiq/interface/executor/execution_request.py +19 -17
  83. classiq/interface/executor/optimizer_preferences.py +22 -13
  84. classiq/interface/executor/{quantum_program.py → quantum_code.py} +21 -15
  85. classiq/interface/executor/quantum_instruction_set.py +2 -1
  86. classiq/interface/executor/register_initialization.py +1 -3
  87. classiq/interface/executor/result.py +41 -10
  88. classiq/interface/executor/vqe_result.py +1 -1
  89. classiq/interface/finance/function_input.py +17 -4
  90. classiq/interface/finance/gaussian_model_input.py +3 -1
  91. classiq/interface/finance/log_normal_model_input.py +3 -1
  92. classiq/interface/finance/model_input.py +2 -0
  93. classiq/interface/generator/amplitude_loading.py +6 -3
  94. classiq/interface/generator/application_apis/__init__.py +1 -0
  95. classiq/interface/generator/application_apis/arithmetic_declarations.py +14 -0
  96. classiq/interface/generator/arith/argument_utils.py +14 -4
  97. classiq/interface/generator/arith/arithmetic.py +3 -1
  98. classiq/interface/generator/arith/arithmetic_arg_type_validator.py +12 -13
  99. classiq/interface/generator/arith/arithmetic_expression_abc.py +4 -1
  100. classiq/interface/generator/arith/arithmetic_expression_parser.py +8 -2
  101. classiq/interface/generator/arith/arithmetic_expression_validator.py +16 -2
  102. classiq/interface/generator/arith/arithmetic_operations.py +5 -10
  103. classiq/interface/generator/arith/ast_node_rewrite.py +1 -1
  104. classiq/interface/generator/arith/binary_ops.py +202 -54
  105. classiq/interface/generator/arith/extremum_operations.py +5 -3
  106. classiq/interface/generator/arith/logical_ops.py +4 -2
  107. classiq/interface/generator/arith/machine_precision.py +3 -0
  108. classiq/interface/generator/arith/number_utils.py +34 -44
  109. classiq/interface/generator/arith/register_user_input.py +21 -1
  110. classiq/interface/generator/arith/unary_ops.py +16 -25
  111. classiq/interface/generator/chemistry_function_params.py +4 -4
  112. classiq/interface/generator/commuting_pauli_exponentiation.py +3 -1
  113. classiq/interface/generator/compiler_keywords.py +4 -0
  114. classiq/interface/generator/complex_type.py +3 -10
  115. classiq/interface/generator/control_state.py +5 -3
  116. classiq/interface/generator/credit_risk_example/linear_gci.py +10 -3
  117. classiq/interface/generator/credit_risk_example/weighted_adder.py +14 -4
  118. classiq/interface/generator/expressions/atomic_expression_functions.py +5 -3
  119. classiq/interface/generator/expressions/evaluated_expression.py +18 -4
  120. classiq/interface/generator/expressions/expression.py +1 -1
  121. classiq/interface/generator/expressions/qmod_qscalar_proxy.py +33 -0
  122. classiq/interface/generator/expressions/sympy_supported_expressions.py +2 -1
  123. classiq/interface/generator/finance.py +1 -1
  124. classiq/interface/generator/function_params.py +7 -6
  125. classiq/interface/generator/functions/__init__.py +1 -1
  126. classiq/interface/generator/functions/core_lib_declarations/quantum_functions/std_lib_functions.py +505 -138
  127. classiq/interface/generator/functions/core_lib_declarations/quantum_operators.py +25 -99
  128. classiq/interface/generator/functions/foreign_function_definition.py +12 -4
  129. classiq/interface/generator/functions/function_implementation.py +8 -4
  130. classiq/interface/generator/functions/native_function_definition.py +4 -2
  131. classiq/interface/generator/functions/register.py +4 -2
  132. classiq/interface/generator/functions/register_mapping_data.py +14 -10
  133. classiq/interface/generator/generated_circuit_data.py +2 -2
  134. classiq/interface/generator/grover_operator.py +5 -3
  135. classiq/interface/generator/hamiltonian_evolution/suzuki_trotter.py +5 -1
  136. classiq/interface/generator/hardware/hardware_data.py +6 -4
  137. classiq/interface/generator/hardware_efficient_ansatz.py +25 -8
  138. classiq/interface/generator/hartree_fock.py +3 -1
  139. classiq/interface/generator/linear_pauli_rotations.py +3 -1
  140. classiq/interface/generator/mcu.py +5 -3
  141. classiq/interface/generator/mcx.py +7 -5
  142. classiq/interface/generator/model/constraints.py +2 -1
  143. classiq/interface/generator/model/model.py +11 -19
  144. classiq/interface/generator/model/preferences/preferences.py +4 -3
  145. classiq/interface/generator/oracles/custom_oracle.py +4 -2
  146. classiq/interface/generator/oracles/oracle_abc.py +2 -2
  147. classiq/interface/generator/qpe.py +6 -4
  148. classiq/interface/generator/qsvm.py +5 -8
  149. classiq/interface/generator/quantum_function_call.py +21 -16
  150. classiq/interface/generator/{generated_circuit.py → quantum_program.py} +10 -14
  151. classiq/interface/generator/range_types.py +3 -1
  152. classiq/interface/generator/slice_parsing_utils.py +8 -3
  153. classiq/interface/generator/standard_gates/controlled_standard_gates.py +4 -2
  154. classiq/interface/generator/state_preparation/metrics.py +2 -1
  155. classiq/interface/generator/state_preparation/state_preparation.py +7 -5
  156. classiq/interface/generator/state_propagator.py +16 -5
  157. classiq/interface/generator/types/builtin_struct_declarations/__init__.py +0 -1
  158. classiq/interface/generator/types/struct_declaration.py +8 -3
  159. classiq/interface/generator/ucc.py +6 -4
  160. classiq/interface/generator/unitary_gate.py +7 -3
  161. classiq/interface/generator/validations/flow_graph.py +6 -4
  162. classiq/interface/generator/validations/validator_functions.py +6 -4
  163. classiq/interface/hardware.py +2 -2
  164. classiq/interface/helpers/custom_encoders.py +3 -0
  165. classiq/interface/helpers/pydantic_model_helpers.py +0 -6
  166. classiq/interface/helpers/validation_helpers.py +1 -1
  167. classiq/interface/helpers/versioned_model.py +4 -1
  168. classiq/interface/ide/show.py +2 -2
  169. classiq/interface/jobs.py +72 -3
  170. classiq/interface/model/bind_operation.py +18 -11
  171. classiq/interface/model/call_synthesis_data.py +68 -0
  172. classiq/interface/model/inplace_binary_operation.py +2 -2
  173. classiq/interface/model/model.py +27 -21
  174. classiq/interface/model/native_function_definition.py +3 -5
  175. classiq/interface/model/quantum_expressions/amplitude_loading_operation.py +9 -4
  176. classiq/interface/model/quantum_expressions/control_state.py +2 -2
  177. classiq/interface/model/quantum_function_call.py +25 -139
  178. classiq/interface/model/quantum_function_declaration.py +8 -0
  179. classiq/interface/model/quantum_if_operation.py +2 -3
  180. classiq/interface/model/quantum_lambda_function.py +64 -0
  181. classiq/interface/model/quantum_type.py +57 -56
  182. classiq/interface/model/quantum_variable_declaration.py +1 -1
  183. classiq/interface/model/statement_block.py +32 -0
  184. classiq/interface/model/validations/handles_validator.py +14 -12
  185. classiq/interface/model/within_apply_operation.py +11 -0
  186. classiq/interface/pyomo_extension/pyomo_sympy_bimap.py +4 -1
  187. classiq/interface/server/routes.py +5 -0
  188. classiq/model/function_handler.py +5 -9
  189. classiq/model/model.py +2 -19
  190. classiq/qmod/__init__.py +13 -6
  191. classiq/qmod/builtins/classical_execution_primitives.py +27 -36
  192. classiq/qmod/builtins/classical_functions.py +24 -14
  193. classiq/qmod/builtins/functions.py +162 -145
  194. classiq/qmod/builtins/operations.py +24 -35
  195. classiq/qmod/builtins/structs.py +15 -15
  196. classiq/qmod/cfunc.py +42 -0
  197. classiq/qmod/classical_function.py +6 -14
  198. classiq/qmod/declaration_inferrer.py +12 -21
  199. classiq/qmod/expression_query.py +23 -0
  200. classiq/qmod/model_state_container.py +2 -0
  201. classiq/qmod/native/__init__.py +0 -0
  202. classiq/qmod/native/expression_to_qmod.py +189 -0
  203. classiq/qmod/native/pretty_printer.py +311 -0
  204. classiq/qmod/qfunc.py +27 -0
  205. classiq/qmod/qmod_constant.py +76 -0
  206. classiq/qmod/qmod_parameter.py +34 -12
  207. classiq/qmod/qmod_struct.py +3 -3
  208. classiq/qmod/qmod_variable.py +102 -18
  209. classiq/qmod/quantum_expandable.py +16 -16
  210. classiq/qmod/quantum_function.py +37 -8
  211. classiq/qmod/symbolic.py +47 -4
  212. classiq/qmod/symbolic_expr.py +9 -0
  213. classiq/qmod/utilities.py +13 -0
  214. classiq/qmod/write_qmod.py +39 -0
  215. classiq/quantum_functions/__init__.py +2 -2
  216. classiq/quantum_functions/annotation_parser.py +9 -11
  217. classiq/quantum_functions/function_parser.py +1 -1
  218. classiq/quantum_functions/quantum_function.py +3 -3
  219. classiq/quantum_register.py +17 -9
  220. {classiq-0.37.0.dist-info → classiq-0.38.0.dist-info}/METADATA +2 -1
  221. {classiq-0.37.0.dist-info → classiq-0.38.0.dist-info}/RECORD +222 -186
  222. {classiq-0.37.0.dist-info → classiq-0.38.0.dist-info}/WHEEL +1 -1
  223. classiq/interface/generator/expressions/qmod_qnum_proxy.py +0 -22
  224. classiq/interface/generator/types/builtin_struct_declarations/qaoa_declarations.py +0 -23
  225. classiq/interface/generator/types/combinatorial_problem.py +0 -26
  226. classiq/interface/model/numeric_reinterpretation.py +0 -25
  227. classiq/interface/model/operator_synthesis_data.py +0 -48
  228. classiq/model/function_handler.pyi +0 -152
@@ -2,78 +2,78 @@
2
2
 
3
3
  from typing import List, Literal
4
4
 
5
+ from classiq.qmod.qfunc import qfunc
5
6
  from classiq.qmod.qmod_parameter import QParam
6
7
  from classiq.qmod.qmod_variable import Input, Output, QArray, QBit, QNum
7
8
  from classiq.qmod.quantum_callable import QCallable, QCallableList
8
- from classiq.qmod.quantum_function import ExternalQFunc
9
9
 
10
10
  from .structs import *
11
11
 
12
12
 
13
- @ExternalQFunc
13
+ @qfunc(external=True)
14
14
  def H(
15
15
  target: QBit,
16
16
  ) -> None:
17
17
  pass
18
18
 
19
19
 
20
- @ExternalQFunc
20
+ @qfunc(external=True)
21
21
  def X(
22
22
  target: QBit,
23
23
  ) -> None:
24
24
  pass
25
25
 
26
26
 
27
- @ExternalQFunc
27
+ @qfunc(external=True)
28
28
  def Y(
29
29
  target: QBit,
30
30
  ) -> None:
31
31
  pass
32
32
 
33
33
 
34
- @ExternalQFunc
34
+ @qfunc(external=True)
35
35
  def Z(
36
36
  target: QBit,
37
37
  ) -> None:
38
38
  pass
39
39
 
40
40
 
41
- @ExternalQFunc
41
+ @qfunc(external=True)
42
42
  def I(
43
43
  target: QBit,
44
44
  ) -> None:
45
45
  pass
46
46
 
47
47
 
48
- @ExternalQFunc
48
+ @qfunc(external=True)
49
49
  def S(
50
50
  target: QBit,
51
51
  ) -> None:
52
52
  pass
53
53
 
54
54
 
55
- @ExternalQFunc
55
+ @qfunc(external=True)
56
56
  def T(
57
57
  target: QBit,
58
58
  ) -> None:
59
59
  pass
60
60
 
61
61
 
62
- @ExternalQFunc
62
+ @qfunc(external=True)
63
63
  def SDG(
64
64
  target: QBit,
65
65
  ) -> None:
66
66
  pass
67
67
 
68
68
 
69
- @ExternalQFunc
69
+ @qfunc(external=True)
70
70
  def TDG(
71
71
  target: QBit,
72
72
  ) -> None:
73
73
  pass
74
74
 
75
75
 
76
- @ExternalQFunc
76
+ @qfunc(external=True)
77
77
  def PHASE(
78
78
  theta: QParam[float],
79
79
  target: QBit,
@@ -81,7 +81,7 @@ def PHASE(
81
81
  pass
82
82
 
83
83
 
84
- @ExternalQFunc
84
+ @qfunc(external=True)
85
85
  def RX(
86
86
  theta: QParam[float],
87
87
  target: QBit,
@@ -89,7 +89,7 @@ def RX(
89
89
  pass
90
90
 
91
91
 
92
- @ExternalQFunc
92
+ @qfunc(external=True)
93
93
  def RY(
94
94
  theta: QParam[float],
95
95
  target: QBit,
@@ -97,7 +97,7 @@ def RY(
97
97
  pass
98
98
 
99
99
 
100
- @ExternalQFunc
100
+ @qfunc(external=True)
101
101
  def RZ(
102
102
  theta: QParam[float],
103
103
  target: QBit,
@@ -105,7 +105,7 @@ def RZ(
105
105
  pass
106
106
 
107
107
 
108
- @ExternalQFunc
108
+ @qfunc(external=True)
109
109
  def R(
110
110
  theta: QParam[float],
111
111
  phi: QParam[float],
@@ -114,7 +114,7 @@ def R(
114
114
  pass
115
115
 
116
116
 
117
- @ExternalQFunc
117
+ @qfunc(external=True)
118
118
  def RXX(
119
119
  theta: QParam[float],
120
120
  target: QArray[QBit, Literal[2]],
@@ -122,7 +122,7 @@ def RXX(
122
122
  pass
123
123
 
124
124
 
125
- @ExternalQFunc
125
+ @qfunc(external=True)
126
126
  def RYY(
127
127
  theta: QParam[float],
128
128
  target: QArray[QBit, Literal[2]],
@@ -130,7 +130,7 @@ def RYY(
130
130
  pass
131
131
 
132
132
 
133
- @ExternalQFunc
133
+ @qfunc(external=True)
134
134
  def RZZ(
135
135
  theta: QParam[float],
136
136
  target: QArray[QBit, Literal[2]],
@@ -138,7 +138,7 @@ def RZZ(
138
138
  pass
139
139
 
140
140
 
141
- @ExternalQFunc
141
+ @qfunc(external=True)
142
142
  def CH(
143
143
  control: QBit,
144
144
  target: QBit,
@@ -146,7 +146,7 @@ def CH(
146
146
  pass
147
147
 
148
148
 
149
- @ExternalQFunc
149
+ @qfunc(external=True)
150
150
  def CX(
151
151
  control: QBit,
152
152
  target: QBit,
@@ -154,7 +154,7 @@ def CX(
154
154
  pass
155
155
 
156
156
 
157
- @ExternalQFunc
157
+ @qfunc(external=True)
158
158
  def CY(
159
159
  control: QBit,
160
160
  target: QBit,
@@ -162,7 +162,7 @@ def CY(
162
162
  pass
163
163
 
164
164
 
165
- @ExternalQFunc
165
+ @qfunc(external=True)
166
166
  def CZ(
167
167
  control: QBit,
168
168
  target: QBit,
@@ -170,7 +170,7 @@ def CZ(
170
170
  pass
171
171
 
172
172
 
173
- @ExternalQFunc
173
+ @qfunc(external=True)
174
174
  def CRX(
175
175
  theta: QParam[float],
176
176
  control: QBit,
@@ -179,7 +179,7 @@ def CRX(
179
179
  pass
180
180
 
181
181
 
182
- @ExternalQFunc
182
+ @qfunc(external=True)
183
183
  def CRY(
184
184
  theta: QParam[float],
185
185
  control: QBit,
@@ -188,7 +188,7 @@ def CRY(
188
188
  pass
189
189
 
190
190
 
191
- @ExternalQFunc
191
+ @qfunc(external=True)
192
192
  def CRZ(
193
193
  theta: QParam[float],
194
194
  control: QBit,
@@ -197,7 +197,7 @@ def CRZ(
197
197
  pass
198
198
 
199
199
 
200
- @ExternalQFunc
200
+ @qfunc(external=True)
201
201
  def CPHASE(
202
202
  theta: QParam[float],
203
203
  control: QBit,
@@ -206,7 +206,7 @@ def CPHASE(
206
206
  pass
207
207
 
208
208
 
209
- @ExternalQFunc
209
+ @qfunc(external=True)
210
210
  def SWAP(
211
211
  qbit0: QBit,
212
212
  qbit1: QBit,
@@ -214,14 +214,14 @@ def SWAP(
214
214
  pass
215
215
 
216
216
 
217
- @ExternalQFunc
217
+ @qfunc(external=True)
218
218
  def IDENTITY(
219
219
  target: QArray[QBit],
220
220
  ) -> None:
221
221
  pass
222
222
 
223
223
 
224
- @ExternalQFunc
224
+ @qfunc(external=True)
225
225
  def prepare_state(
226
226
  probabilities: QParam[List[float]],
227
227
  bound: QParam[float],
@@ -230,7 +230,7 @@ def prepare_state(
230
230
  pass
231
231
 
232
232
 
233
- @ExternalQFunc
233
+ @qfunc(external=True)
234
234
  def prepare_amplitudes(
235
235
  amplitudes: QParam[List[float]],
236
236
  bound: QParam[float],
@@ -239,7 +239,7 @@ def prepare_amplitudes(
239
239
  pass
240
240
 
241
241
 
242
- @ExternalQFunc
242
+ @qfunc(external=True)
243
243
  def unitary(
244
244
  elements: QParam[List[List[float]]],
245
245
  target: QArray[QBit, Literal["log(len(elements[0]), 2)"]],
@@ -247,7 +247,7 @@ def unitary(
247
247
  pass
248
248
 
249
249
 
250
- @ExternalQFunc
250
+ @qfunc(external=True)
251
251
  def add(
252
252
  left: QArray[QBit],
253
253
  right: QArray[QBit],
@@ -256,7 +256,7 @@ def add(
256
256
  pass
257
257
 
258
258
 
259
- @ExternalQFunc
259
+ @qfunc(external=True)
260
260
  def modular_add(
261
261
  left: QArray[QBit],
262
262
  right: QArray[QBit],
@@ -264,7 +264,7 @@ def modular_add(
264
264
  pass
265
265
 
266
266
 
267
- @ExternalQFunc
267
+ @qfunc(external=True)
268
268
  def integer_xor(
269
269
  left: QArray[QBit],
270
270
  right: QArray[QBit],
@@ -272,7 +272,7 @@ def integer_xor(
272
272
  pass
273
273
 
274
274
 
275
- @ExternalQFunc
275
+ @qfunc(external=True)
276
276
  def U(
277
277
  theta: QParam[float],
278
278
  phi: QParam[float],
@@ -283,7 +283,7 @@ def U(
283
283
  pass
284
284
 
285
285
 
286
- @ExternalQFunc
286
+ @qfunc(external=True)
287
287
  def CCX(
288
288
  control: QArray[QBit, Literal[2]],
289
289
  target: QBit,
@@ -291,7 +291,7 @@ def CCX(
291
291
  pass
292
292
 
293
293
 
294
- @ExternalQFunc
294
+ @qfunc(external=True)
295
295
  def allocate(
296
296
  num_qubits: QParam[int],
297
297
  out: Output[QArray[QBit, Literal["num_qubits"]]],
@@ -299,14 +299,14 @@ def allocate(
299
299
  pass
300
300
 
301
301
 
302
- @ExternalQFunc
302
+ @qfunc(external=True)
303
303
  def free(
304
304
  in_: Input[QArray[QBit]],
305
305
  ) -> None:
306
306
  pass
307
307
 
308
308
 
309
- @ExternalQFunc
309
+ @qfunc(external=True)
310
310
  def randomized_benchmarking(
311
311
  num_of_cliffords: QParam[int],
312
312
  target: QArray[QBit],
@@ -314,7 +314,7 @@ def randomized_benchmarking(
314
314
  pass
315
315
 
316
316
 
317
- @ExternalQFunc
317
+ @qfunc(external=True)
318
318
  def inplace_prepare_state(
319
319
  probabilities: QParam[List[float]],
320
320
  bound: QParam[float],
@@ -323,7 +323,7 @@ def inplace_prepare_state(
323
323
  pass
324
324
 
325
325
 
326
- @ExternalQFunc
326
+ @qfunc(external=True)
327
327
  def inplace_prepare_amplitudes(
328
328
  amplitudes: QParam[List[float]],
329
329
  bound: QParam[float],
@@ -332,7 +332,7 @@ def inplace_prepare_amplitudes(
332
332
  pass
333
333
 
334
334
 
335
- @ExternalQFunc
335
+ @qfunc(external=True)
336
336
  def single_pauli_exponent(
337
337
  pauli_string: QParam[List[int]],
338
338
  coefficient: QParam[float],
@@ -341,7 +341,7 @@ def single_pauli_exponent(
341
341
  pass
342
342
 
343
343
 
344
- @ExternalQFunc
344
+ @qfunc(external=True)
345
345
  def suzuki_trotter(
346
346
  pauli_operator: QParam[List[PauliTerm]],
347
347
  evolution_coefficient: QParam[float],
@@ -352,7 +352,7 @@ def suzuki_trotter(
352
352
  pass
353
353
 
354
354
 
355
- @ExternalQFunc
355
+ @qfunc(external=True)
356
356
  def qdrift(
357
357
  pauli_operator: QParam[List[PauliTerm]],
358
358
  evolution_coefficient: QParam[float],
@@ -362,7 +362,7 @@ def qdrift(
362
362
  pass
363
363
 
364
364
 
365
- @ExternalQFunc
365
+ @qfunc(external=True)
366
366
  def exponentiation_with_depth_constraint(
367
367
  pauli_operator: QParam[List[PauliTerm]],
368
368
  evolution_coefficient: QParam[float],
@@ -372,21 +372,21 @@ def exponentiation_with_depth_constraint(
372
372
  pass
373
373
 
374
374
 
375
- @ExternalQFunc
375
+ @qfunc(external=True)
376
376
  def qft_step(
377
377
  target: QArray[QBit],
378
378
  ) -> None:
379
379
  pass
380
380
 
381
381
 
382
- @ExternalQFunc
382
+ @qfunc(external=True)
383
383
  def qft(
384
384
  target: QArray[QBit],
385
385
  ) -> None:
386
386
  pass
387
387
 
388
388
 
389
- @ExternalQFunc
389
+ @qfunc(external=True)
390
390
  def qpe_flexible(
391
391
  unitary_with_power: QCallable[QParam[int]],
392
392
  phase: QNum,
@@ -394,7 +394,7 @@ def qpe_flexible(
394
394
  pass
395
395
 
396
396
 
397
- @ExternalQFunc
397
+ @qfunc(external=True)
398
398
  def qpe(
399
399
  unitary: QCallable,
400
400
  phase: QNum,
@@ -402,7 +402,7 @@ def qpe(
402
402
  pass
403
403
 
404
404
 
405
- @ExternalQFunc
405
+ @qfunc(external=True)
406
406
  def standard_qpe(
407
407
  precision: QParam[int],
408
408
  unitary: QCallable,
@@ -411,7 +411,7 @@ def standard_qpe(
411
411
  pass
412
412
 
413
413
 
414
- @ExternalQFunc
414
+ @qfunc(external=True)
415
415
  def single_pauli(
416
416
  slope: QParam[float],
417
417
  offset: QParam[float],
@@ -422,7 +422,7 @@ def single_pauli(
422
422
  pass
423
423
 
424
424
 
425
- @ExternalQFunc
425
+ @qfunc(external=True)
426
426
  def linear_pauli_rotations(
427
427
  bases: QParam[List[int]],
428
428
  slopes: QParam[List[float]],
@@ -433,78 +433,75 @@ def linear_pauli_rotations(
433
433
  pass
434
434
 
435
435
 
436
- @ExternalQFunc
436
+ @qfunc(external=True)
437
437
  def amplitude_estimation(
438
438
  num_phase_qubits: QParam[int],
439
439
  num_unitary_qubits: QParam[int],
440
440
  sp_op: QCallable[QParam[int], QArray[QBit, Literal["num_unitary_qubits"]]],
441
441
  oracle_op: QCallable[QParam[int], QArray[QBit, Literal["num_unitary_qubits"]]],
442
- phase_port: Output[QArray[QBit, Literal["num_phase_qubits"]]],
442
+ phase_port: Output[QNum],
443
443
  unitary_port: Output[QArray[QBit, Literal["num_unitary_qubits"]]],
444
444
  ) -> None:
445
445
  pass
446
446
 
447
447
 
448
- @ExternalQFunc
449
- def simple_oracle(
450
- predicate: QCallable[QArray[QBit, Literal["len(target)"]], QBit],
448
+ @qfunc(external=True)
449
+ def phase_oracle(
450
+ predicate: QCallable[QArray[QBit], QArray[QBit]],
451
451
  target: QArray[QBit],
452
452
  ) -> None:
453
453
  pass
454
454
 
455
455
 
456
- @ExternalQFunc
457
- def grover_diffuser(
458
- num_qubits: QParam[int],
459
- p: QArray[QBit, Literal["num_qubits"]],
456
+ @qfunc(external=True)
457
+ def reflect_about_zero(
458
+ packed_vars: QArray[QBit],
460
459
  ) -> None:
461
460
  pass
462
461
 
463
462
 
464
- @ExternalQFunc
465
- def grover_operator(
466
- num_qubits: QParam[int],
467
- sp_op: QCallable[QParam[int], QArray[QBit, Literal["num_qubits"]]],
468
- oracle_op: QCallable[QParam[int], QArray[QBit, Literal["num_qubits"]]],
469
- p: QArray[QBit, Literal["num_qubits"]],
463
+ @qfunc(external=True)
464
+ def grover_diffuser(
465
+ space_transform: QCallable[QArray[QBit]],
466
+ packed_vars: QArray[QBit],
470
467
  ) -> None:
471
468
  pass
472
469
 
473
470
 
474
- @ExternalQFunc
475
- def hadamard_transform(
476
- target: QArray[QBit],
471
+ @qfunc(external=True)
472
+ def grover_operator(
473
+ oracle: QCallable[QArray[QBit]],
474
+ space_transform: QCallable[QArray[QBit]],
475
+ packed_vars: QArray[QBit],
477
476
  ) -> None:
478
477
  pass
479
478
 
480
479
 
481
- @ExternalQFunc
482
- def apply_to_all(
483
- gate_operand: QCallable[QBit],
484
- target: QArray[QBit],
480
+ @qfunc(external=True)
481
+ def grover_search(
482
+ reps: QParam[int],
483
+ oracle: QCallable[QArray[QBit]],
484
+ packed_vars: QArray[QBit],
485
485
  ) -> None:
486
486
  pass
487
487
 
488
488
 
489
- @ExternalQFunc
490
- def grover_search(
491
- num_qubits: QParam[int],
492
- reps: QParam[int],
493
- oracle_op: QCallable[QParam[int], QArray[QBit, Literal["num_qubits"]]],
494
- gsq: QArray[QBit, Literal["num_qubits"]],
489
+ @qfunc(external=True)
490
+ def hadamard_transform(
491
+ target: QArray[QBit],
495
492
  ) -> None:
496
493
  pass
497
494
 
498
495
 
499
- @ExternalQFunc
500
- def prepare_int(
501
- val: QParam[int],
502
- out: Output[QNum],
496
+ @qfunc(external=True)
497
+ def apply_to_all(
498
+ gate_operand: QCallable[QBit],
499
+ target: QArray[QBit],
503
500
  ) -> None:
504
501
  pass
505
502
 
506
503
 
507
- @ExternalQFunc
504
+ @qfunc(external=True)
508
505
  def allocate_num(
509
506
  num_qubits: QParam[int],
510
507
  is_signed: QParam[bool],
@@ -514,7 +511,7 @@ def allocate_num(
514
511
  pass
515
512
 
516
513
 
517
- @ExternalQFunc
514
+ @qfunc(external=True)
518
515
  def qaoa_mixer_layer(
519
516
  b: QParam[float],
520
517
  target: QArray[QBit],
@@ -522,46 +519,43 @@ def qaoa_mixer_layer(
522
519
  pass
523
520
 
524
521
 
525
- @ExternalQFunc
522
+ @qfunc(external=True)
526
523
  def qaoa_cost_layer(
527
524
  g: QParam[float],
528
525
  hamiltonian: QParam[List[PauliTerm]],
529
- is_st: QParam[bool],
530
526
  target: QArray[QBit],
531
527
  ) -> None:
532
528
  pass
533
529
 
534
530
 
535
- @ExternalQFunc
531
+ @qfunc(external=True)
536
532
  def qaoa_layer(
537
533
  g: QParam[float],
538
534
  b: QParam[float],
539
535
  hamiltonian: QParam[List[PauliTerm]],
540
- is_st: QParam[bool],
541
536
  target: QArray[QBit],
542
537
  ) -> None:
543
538
  pass
544
539
 
545
540
 
546
- @ExternalQFunc
541
+ @qfunc(external=True)
547
542
  def qaoa_init(
548
543
  target: QArray[QBit],
549
544
  ) -> None:
550
545
  pass
551
546
 
552
547
 
553
- @ExternalQFunc
548
+ @qfunc(external=True)
554
549
  def qaoa_penalty(
555
550
  num_qubits: QParam[int],
556
551
  params_list: QParam[List[float]],
557
552
  hamiltonian: QParam[List[PauliTerm]],
558
- is_st: QParam[bool],
559
553
  target: QArray[QBit, Literal["num_qubits"]],
560
554
  ) -> None:
561
555
  pass
562
556
 
563
557
 
564
- @ExternalQFunc
558
+ @qfunc(external=True)
565
559
  def full_hea(
566
560
  num_qubits: QParam[int],
567
561
  is_parametrized: QParam[List[int]],
@@ -575,7 +569,7 @@ def full_hea(
575
569
  pass
576
570
 
577
571
 
578
- @ExternalQFunc
572
+ @qfunc(external=True)
579
573
  def swap_test(
580
574
  state1: QArray[QBit],
581
575
  state2: QArray[QBit],
@@ -584,39 +578,47 @@ def swap_test(
584
578
  pass
585
579
 
586
580
 
587
- @ExternalQFunc
588
- def repeat(
589
- count: QParam[int],
590
- iteration: QCallable[QParam[int]],
581
+ @qfunc(external=True)
582
+ def prepare_ghz_state(
583
+ size: QParam[int],
584
+ q: Output[QArray[QBit]],
591
585
  ) -> None:
592
586
  pass
593
587
 
594
588
 
595
- @ExternalQFunc
596
- def invert(
597
- operand: QCallable,
589
+ @qfunc(external=True)
590
+ def prepare_exponential_state(
591
+ rate: QParam[int],
592
+ q: QArray[QBit],
598
593
  ) -> None:
599
594
  pass
600
595
 
601
596
 
602
- @ExternalQFunc
603
- def control(
604
- operand: QCallable,
605
- ctrl: QArray[QBit],
597
+ @qfunc(external=True)
598
+ def prepare_bell_state(
599
+ state_num: QParam[int],
600
+ q: Output[QArray[QBit]],
606
601
  ) -> None:
607
602
  pass
608
603
 
609
604
 
610
- @ExternalQFunc
611
- def if_(
612
- condition: QParam[bool],
613
- then: QCallable,
614
- else_: QCallable,
605
+ @qfunc(external=True)
606
+ def inplace_prepare_int(
607
+ value: QParam[int],
608
+ target: QArray[QBit],
615
609
  ) -> None:
616
610
  pass
617
611
 
618
612
 
619
- @ExternalQFunc
613
+ @qfunc(external=True)
614
+ def prepare_int(
615
+ value: QParam[int],
616
+ out: Output[QNum],
617
+ ) -> None:
618
+ pass
619
+
620
+
621
+ @qfunc(external=True)
620
622
  def switch(
621
623
  selector: QParam[int],
622
624
  cases: QCallableList,
@@ -624,34 +626,46 @@ def switch(
624
626
  pass
625
627
 
626
628
 
627
- @ExternalQFunc
628
- def join(
629
- in1: Input[QArray[QBit]],
630
- in2: Input[QArray[QBit]],
631
- out: Output[QArray[QBit, Literal["len(in1)+len(in2)"]]],
629
+ @qfunc(external=True)
630
+ def repeat(
631
+ count: QParam[int],
632
+ iteration: QCallable[QParam[int]],
633
+ ) -> None:
634
+ pass
635
+
636
+
637
+ @qfunc(external=True)
638
+ def invert(
639
+ operand: QCallable,
640
+ ) -> None:
641
+ pass
642
+
643
+
644
+ @qfunc(external=True)
645
+ def control(
646
+ operand: QCallable,
647
+ ctrl: QArray[QBit],
632
648
  ) -> None:
633
649
  pass
634
650
 
635
651
 
636
- @ExternalQFunc
637
- def split(
638
- out1_size: QParam[int],
639
- out2_size: QParam[int],
640
- in_: Input[QArray[QBit, Literal["out1_size+out2_size"]]],
641
- out1: Output[QArray[QBit, Literal["out1_size"]]],
642
- out2: Output[QArray[QBit, Literal["out2_size"]]],
652
+ @qfunc(external=True)
653
+ def if_(
654
+ condition: QParam[bool],
655
+ then: QCallable,
656
+ else_: QCallable,
643
657
  ) -> None:
644
658
  pass
645
659
 
646
660
 
647
- @ExternalQFunc
661
+ @qfunc(external=True)
648
662
  def permute(
649
663
  functions: QCallableList,
650
664
  ) -> None:
651
665
  pass
652
666
 
653
667
 
654
- @ExternalQFunc
668
+ @qfunc(external=True)
655
669
  def power(
656
670
  power: QParam[int],
657
671
  operand: QCallable,
@@ -659,28 +673,28 @@ def power(
659
673
  pass
660
674
 
661
675
 
662
- @ExternalQFunc
676
+ @qfunc(external=True)
663
677
  def apply(
664
678
  operand: QCallable,
665
679
  ) -> None:
666
680
  pass
667
681
 
668
682
 
669
- @ExternalQFunc
683
+ @qfunc(external=True)
670
684
  def compute(
671
685
  operand: QCallable,
672
686
  ) -> None:
673
687
  pass
674
688
 
675
689
 
676
- @ExternalQFunc
690
+ @qfunc(external=True)
677
691
  def uncompute(
678
692
  operand: QCallable,
679
693
  ) -> None:
680
694
  pass
681
695
 
682
696
 
683
- @ExternalQFunc
697
+ @qfunc(external=True)
684
698
  def molecule_ucc(
685
699
  molecule_problem: QParam[MoleculeProblem],
686
700
  excitations: QParam[List[int]],
@@ -694,7 +708,7 @@ def molecule_ucc(
694
708
  pass
695
709
 
696
710
 
697
- @ExternalQFunc
711
+ @qfunc(external=True)
698
712
  def molecule_hva(
699
713
  molecule_problem: QParam[MoleculeProblem],
700
714
  reps: QParam[int],
@@ -708,7 +722,7 @@ def molecule_hva(
708
722
  pass
709
723
 
710
724
 
711
- @ExternalQFunc
725
+ @qfunc(external=True)
712
726
  def molecule_hartree_fock(
713
727
  molecule_problem: QParam[MoleculeProblem],
714
728
  qbv: QArray[
@@ -721,7 +735,7 @@ def molecule_hartree_fock(
721
735
  pass
722
736
 
723
737
 
724
- @ExternalQFunc
738
+ @qfunc(external=True)
725
739
  def fock_hamiltonian_ucc(
726
740
  fock_hamiltonian_problem: QParam[FockHamiltonianProblem],
727
741
  excitations: QParam[List[int]],
@@ -735,7 +749,7 @@ def fock_hamiltonian_ucc(
735
749
  pass
736
750
 
737
751
 
738
- @ExternalQFunc
752
+ @qfunc(external=True)
739
753
  def fock_hamiltonian_hva(
740
754
  fock_hamiltonian_problem: QParam[FockHamiltonianProblem],
741
755
  reps: QParam[int],
@@ -749,7 +763,7 @@ def fock_hamiltonian_hva(
749
763
  pass
750
764
 
751
765
 
752
- @ExternalQFunc
766
+ @qfunc(external=True)
753
767
  def fock_hamiltonian_hartree_fock(
754
768
  fock_hamiltonian_problem: QParam[FockHamiltonianProblem],
755
769
  qbv: QArray[
@@ -762,7 +776,7 @@ def fock_hamiltonian_hartree_fock(
762
776
  pass
763
777
 
764
778
 
765
- @ExternalQFunc
779
+ @qfunc(external=True)
766
780
  def log_normal_finance(
767
781
  finance_model: QParam[LogNormalModel],
768
782
  finance_function: QParam[FinanceFunction],
@@ -772,7 +786,7 @@ def log_normal_finance(
772
786
  pass
773
787
 
774
788
 
775
- @ExternalQFunc
789
+ @qfunc(external=True)
776
790
  def gaussian_finance(
777
791
  finance_model: QParam[GaussianModel],
778
792
  finance_function: QParam[FinanceFunction],
@@ -787,7 +801,7 @@ def gaussian_finance(
787
801
  pass
788
802
 
789
803
 
790
- @ExternalQFunc
804
+ @qfunc(external=True)
791
805
  def pauli_feature_map(
792
806
  feature_map: QParam[QSVMFeatureMapPauli],
793
807
  qbv: QArray[QBit, Literal["get_field(feature_map, 'feature_dimension')"]],
@@ -795,7 +809,7 @@ def pauli_feature_map(
795
809
  pass
796
810
 
797
811
 
798
- @ExternalQFunc
812
+ @qfunc(external=True)
799
813
  def bloch_sphere_feature_map(
800
814
  feature_dimension: QParam[int],
801
815
  qbv: QArray[QBit, Literal["ceiling(feature_dimension/2)"]],
@@ -856,13 +870,13 @@ __all__ = [
856
870
  "single_pauli",
857
871
  "linear_pauli_rotations",
858
872
  "amplitude_estimation",
859
- "simple_oracle",
873
+ "phase_oracle",
874
+ "reflect_about_zero",
860
875
  "grover_diffuser",
861
876
  "grover_operator",
877
+ "grover_search",
862
878
  "hadamard_transform",
863
879
  "apply_to_all",
864
- "grover_search",
865
- "prepare_int",
866
880
  "allocate_num",
867
881
  "qaoa_mixer_layer",
868
882
  "qaoa_cost_layer",
@@ -871,13 +885,16 @@ __all__ = [
871
885
  "qaoa_penalty",
872
886
  "full_hea",
873
887
  "swap_test",
888
+ "prepare_ghz_state",
889
+ "prepare_exponential_state",
890
+ "prepare_bell_state",
891
+ "inplace_prepare_int",
892
+ "prepare_int",
893
+ "switch",
874
894
  "repeat",
875
895
  "invert",
876
896
  "control",
877
897
  "if_",
878
- "switch",
879
- "join",
880
- "split",
881
898
  "permute",
882
899
  "power",
883
900
  "apply",