classiq 0.93.0__py3-none-any.whl → 0.94.1__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.

Potentially problematic release.


This version of classiq might be problematic. Click here for more details.

Files changed (261) hide show
  1. classiq/__init__.py +6 -19
  2. classiq/_analyzer_extras/_ipywidgets_async_extension.py +7 -7
  3. classiq/_analyzer_extras/interactive_hardware.py +19 -12
  4. classiq/_internals/api_wrapper.py +38 -52
  5. classiq/_internals/async_utils.py +4 -7
  6. classiq/_internals/authentication/auth0.py +3 -3
  7. classiq/_internals/authentication/device.py +4 -4
  8. classiq/_internals/authentication/password_manager.py +13 -13
  9. classiq/_internals/authentication/token_manager.py +4 -5
  10. classiq/_internals/client.py +17 -44
  11. classiq/_internals/config.py +1 -2
  12. classiq/_internals/help.py +1 -2
  13. classiq/_internals/host_checker.py +3 -3
  14. classiq/_internals/jobs.py +14 -14
  15. classiq/_internals/type_validation.py +3 -3
  16. classiq/analyzer/analyzer.py +18 -18
  17. classiq/analyzer/rb.py +17 -8
  18. classiq/applications/chemistry/__init__.py +0 -30
  19. classiq/applications/chemistry/op_utils.py +4 -4
  20. classiq/applications/chemistry/problems.py +3 -3
  21. classiq/applications/chemistry/ucc.py +1 -2
  22. classiq/applications/chemistry/z2_symmetries.py +4 -4
  23. classiq/applications/combinatorial_helpers/allowed_constraints.py +1 -3
  24. classiq/applications/combinatorial_helpers/arithmetic/arithmetic_expression.py +2 -1
  25. classiq/applications/combinatorial_helpers/combinatorial_problem_utils.py +2 -2
  26. classiq/applications/combinatorial_helpers/encoding_mapping.py +2 -3
  27. classiq/applications/combinatorial_helpers/encoding_utils.py +2 -2
  28. classiq/applications/combinatorial_helpers/optimization_model.py +3 -4
  29. classiq/applications/combinatorial_helpers/pauli_helpers/pauli_sparsing.py +2 -2
  30. classiq/applications/combinatorial_helpers/pyomo_utils.py +8 -8
  31. classiq/applications/combinatorial_helpers/sympy_utils.py +1 -3
  32. classiq/applications/combinatorial_helpers/transformations/encoding.py +3 -3
  33. classiq/applications/combinatorial_helpers/transformations/fixed_variables.py +1 -2
  34. classiq/applications/combinatorial_optimization/combinatorial_optimization_config.py +2 -3
  35. classiq/applications/combinatorial_optimization/combinatorial_optimization_model_constructor.py +4 -6
  36. classiq/applications/combinatorial_optimization/combinatorial_problem.py +15 -10
  37. classiq/applications/hamiltonian/pauli_decomposition.py +6 -4
  38. classiq/applications/iqae/iqae.py +8 -8
  39. classiq/applications/qnn/datasets/dataset_base_classes.py +6 -6
  40. classiq/applications/qnn/datasets/dataset_parity.py +6 -6
  41. classiq/applications/qnn/qlayer.py +8 -7
  42. classiq/applications/qnn/torch_utils.py +3 -4
  43. classiq/applications/qnn/types.py +2 -1
  44. classiq/applications/qsp/qsp.py +5 -4
  45. classiq/applications/qsvm/qsvm_data_generation.py +1 -2
  46. classiq/evaluators/classical_expression.py +0 -4
  47. classiq/evaluators/parameter_types.py +7 -8
  48. classiq/evaluators/qmod_annotated_expression.py +24 -26
  49. classiq/evaluators/qmod_expression_visitors/qmod_expression_evaluator.py +14 -14
  50. classiq/evaluators/qmod_expression_visitors/qmod_expression_simplifier.py +2 -1
  51. classiq/evaluators/qmod_expression_visitors/sympy_wrappers.py +8 -8
  52. classiq/evaluators/qmod_node_evaluators/classical_function_evaluation.py +4 -4
  53. classiq/evaluators/qmod_node_evaluators/list_evaluation.py +2 -2
  54. classiq/evaluators/qmod_node_evaluators/numeric_attrs_utils.py +3 -3
  55. classiq/evaluators/qmod_node_evaluators/subscript_evaluation.py +9 -9
  56. classiq/evaluators/qmod_node_evaluators/utils.py +6 -6
  57. classiq/evaluators/qmod_type_inference/classical_type_inference.py +9 -10
  58. classiq/evaluators/qmod_type_inference/quantum_type_inference.py +5 -5
  59. classiq/execution/execution_session.py +18 -19
  60. classiq/execution/jobs.py +26 -26
  61. classiq/execution/qnn.py +1 -2
  62. classiq/execution/user_budgets.py +52 -7
  63. classiq/executor.py +1 -3
  64. classiq/interface/_version.py +1 -1
  65. classiq/interface/analyzer/analysis_params.py +4 -4
  66. classiq/interface/analyzer/cytoscape_graph.py +3 -3
  67. classiq/interface/analyzer/result.py +4 -4
  68. classiq/interface/applications/qsvm.py +5 -8
  69. classiq/interface/ast_node.py +3 -3
  70. classiq/interface/backend/backend_preferences.py +16 -16
  71. classiq/interface/backend/ionq/ionq_quantum_program.py +5 -5
  72. classiq/interface/chemistry/ansatz_library.py +3 -5
  73. classiq/interface/chemistry/operator.py +3 -3
  74. classiq/interface/combinatorial_optimization/examples/knapsack.py +2 -4
  75. classiq/interface/combinatorial_optimization/examples/tsp_digraph.py +1 -2
  76. classiq/interface/compression_utils.py +2 -3
  77. classiq/interface/debug_info/debug_info.py +7 -7
  78. classiq/interface/exceptions.py +2 -3
  79. classiq/interface/execution/iqcc.py +1 -3
  80. classiq/interface/execution/primitives.py +6 -6
  81. classiq/interface/executor/estimate_cost.py +1 -1
  82. classiq/interface/executor/execution_preferences.py +3 -5
  83. classiq/interface/executor/execution_request.py +10 -10
  84. classiq/interface/executor/execution_result.py +1 -2
  85. classiq/interface/executor/quantum_code.py +8 -8
  86. classiq/interface/executor/result.py +28 -18
  87. classiq/interface/executor/user_budget.py +2 -3
  88. classiq/interface/executor/vqe_result.py +5 -6
  89. classiq/interface/generator/ansatz_library.py +6 -8
  90. classiq/interface/generator/application_apis/__init__.py +0 -2
  91. classiq/interface/generator/arith/arithmetic.py +2 -2
  92. classiq/interface/generator/arith/arithmetic_arg_type_validator.py +2 -3
  93. classiq/interface/generator/arith/arithmetic_expression_abc.py +4 -5
  94. classiq/interface/generator/arith/arithmetic_expression_parser.py +11 -4
  95. classiq/interface/generator/arith/arithmetic_expression_validator.py +12 -15
  96. classiq/interface/generator/arith/arithmetic_operations.py +4 -6
  97. classiq/interface/generator/arith/arithmetic_param_getters.py +70 -107
  98. classiq/interface/generator/arith/arithmetic_result_builder.py +4 -4
  99. classiq/interface/generator/arith/ast_node_rewrite.py +8 -4
  100. classiq/interface/generator/arith/binary_ops.py +7 -36
  101. classiq/interface/generator/arith/logical_ops.py +2 -3
  102. classiq/interface/generator/arith/number_utils.py +2 -2
  103. classiq/interface/generator/arith/register_user_input.py +2 -2
  104. classiq/interface/generator/arith/unary_ops.py +2 -2
  105. classiq/interface/generator/circuit_code/circuit_code.py +8 -10
  106. classiq/interface/generator/circuit_code/types_and_constants.py +1 -1
  107. classiq/interface/generator/complex_type.py +2 -2
  108. classiq/interface/generator/copy.py +1 -3
  109. classiq/interface/generator/expressions/atomic_expression_functions.py +0 -5
  110. classiq/interface/generator/expressions/evaluated_expression.py +2 -3
  111. classiq/interface/generator/expressions/expression.py +2 -2
  112. classiq/interface/generator/expressions/proxies/classical/classical_array_proxy.py +4 -7
  113. classiq/interface/generator/function_param_list.py +0 -20
  114. classiq/interface/generator/function_params.py +5 -6
  115. classiq/interface/generator/functions/classical_function_declaration.py +2 -2
  116. classiq/interface/generator/functions/classical_type.py +3 -3
  117. classiq/interface/generator/functions/type_modifier.py +0 -14
  118. classiq/interface/generator/functions/type_name.py +2 -2
  119. classiq/interface/generator/generated_circuit_data.py +12 -13
  120. classiq/interface/generator/hamiltonian_evolution/exponentiation.py +2 -4
  121. classiq/interface/generator/hardware/hardware_data.py +8 -8
  122. classiq/interface/generator/hardware_efficient_ansatz.py +8 -8
  123. classiq/interface/generator/mcu.py +3 -3
  124. classiq/interface/generator/mcx.py +3 -3
  125. classiq/interface/generator/model/constraints.py +34 -5
  126. classiq/interface/generator/model/preferences/preferences.py +15 -21
  127. classiq/interface/generator/model/quantum_register.py +7 -10
  128. classiq/interface/generator/noise_properties.py +3 -7
  129. classiq/interface/generator/parameters.py +1 -1
  130. classiq/interface/generator/partitioned_register.py +1 -2
  131. classiq/interface/generator/preferences/qasm_to_qmod_params.py +11 -0
  132. classiq/interface/generator/qsvm.py +2 -2
  133. classiq/interface/generator/quantum_function_call.py +8 -11
  134. classiq/interface/generator/quantum_program.py +12 -15
  135. classiq/interface/generator/range_types.py +3 -3
  136. classiq/interface/generator/slice_parsing_utils.py +4 -5
  137. classiq/interface/generator/standard_gates/standard_gates.py +2 -4
  138. classiq/interface/generator/state_preparation/state_preparation.py +6 -8
  139. classiq/interface/generator/synthesis_execution_parameter.py +1 -3
  140. classiq/interface/generator/synthesis_metadata/synthesis_execution_data.py +2 -3
  141. classiq/interface/generator/transpiler_basis_gates.py +2 -4
  142. classiq/interface/generator/types/builtin_enum_declarations.py +0 -136
  143. classiq/interface/generator/types/compilation_metadata.py +12 -1
  144. classiq/interface/generator/types/enum_declaration.py +2 -1
  145. classiq/interface/generator/validations/flow_graph.py +3 -3
  146. classiq/interface/generator/visitor.py +10 -12
  147. classiq/interface/hardware.py +2 -2
  148. classiq/interface/helpers/classproperty.py +2 -2
  149. classiq/interface/helpers/custom_encoders.py +2 -1
  150. classiq/interface/helpers/custom_pydantic_types.py +1 -1
  151. classiq/interface/helpers/text_utils.py +1 -4
  152. classiq/interface/ide/visual_model.py +5 -5
  153. classiq/interface/jobs.py +3 -3
  154. classiq/interface/model/allocate.py +4 -4
  155. classiq/interface/model/block.py +2 -2
  156. classiq/interface/model/bounds.py +3 -3
  157. classiq/interface/model/control.py +1 -1
  158. classiq/interface/model/inplace_binary_operation.py +2 -2
  159. classiq/interface/model/model.py +4 -4
  160. classiq/interface/model/parameter.py +1 -3
  161. classiq/interface/model/port_declaration.py +1 -1
  162. classiq/interface/model/quantum_expressions/quantum_expression.py +1 -2
  163. classiq/interface/model/quantum_function_call.py +3 -6
  164. classiq/interface/model/quantum_function_declaration.py +1 -0
  165. classiq/interface/model/quantum_lambda_function.py +4 -4
  166. classiq/interface/model/quantum_statement.py +4 -4
  167. classiq/interface/model/quantum_type.py +14 -14
  168. classiq/interface/model/validation_handle.py +2 -3
  169. classiq/interface/model/variable_declaration_statement.py +2 -2
  170. classiq/interface/pretty_print/expression_to_qmod.py +3 -4
  171. classiq/interface/server/routes.py +0 -4
  172. classiq/interface/source_reference.py +3 -4
  173. classiq/model_expansions/arithmetic.py +6 -7
  174. classiq/model_expansions/arithmetic_compute_result_attrs.py +4 -5
  175. classiq/model_expansions/capturing/captured_vars.py +3 -3
  176. classiq/model_expansions/capturing/mangling_utils.py +1 -2
  177. classiq/model_expansions/closure.py +12 -11
  178. classiq/model_expansions/function_builder.py +14 -6
  179. classiq/model_expansions/generative_functions.py +1 -4
  180. classiq/model_expansions/interpreters/base_interpreter.py +2 -6
  181. classiq/model_expansions/interpreters/generative_interpreter.py +5 -3
  182. classiq/model_expansions/quantum_operations/allocate.py +4 -4
  183. classiq/model_expansions/quantum_operations/assignment_result_processor.py +2 -4
  184. classiq/model_expansions/quantum_operations/call_emitter.py +31 -37
  185. classiq/model_expansions/quantum_operations/declarative_call_emitter.py +2 -2
  186. classiq/model_expansions/quantum_operations/emitter.py +3 -5
  187. classiq/model_expansions/quantum_operations/expression_evaluator.py +3 -3
  188. classiq/model_expansions/quantum_operations/skip_control_verifier.py +1 -2
  189. classiq/model_expansions/quantum_operations/variable_decleration.py +2 -2
  190. classiq/model_expansions/scope.py +7 -7
  191. classiq/model_expansions/scope_initialization.py +4 -0
  192. classiq/model_expansions/visitors/symbolic_param_inference.py +3 -3
  193. classiq/model_expansions/visitors/uncomputation_signature_inference.py +317 -0
  194. classiq/model_expansions/visitors/variable_references.py +15 -14
  195. classiq/open_library/functions/__init__.py +6 -0
  196. classiq/open_library/functions/discrete_sine_cosine_transform.py +5 -5
  197. classiq/open_library/functions/grover.py +8 -10
  198. classiq/open_library/functions/modular_exponentiation.py +96 -8
  199. classiq/qmod/__init__.py +5 -2
  200. classiq/qmod/builtins/classical_execution_primitives.py +4 -11
  201. classiq/qmod/builtins/classical_functions.py +1 -42
  202. classiq/qmod/builtins/enums.py +0 -136
  203. classiq/qmod/builtins/functions/__init__.py +0 -13
  204. classiq/qmod/builtins/functions/allocation.py +4 -4
  205. classiq/qmod/builtins/functions/arithmetic.py +22 -27
  206. classiq/qmod/builtins/functions/standard_gates.py +27 -27
  207. classiq/qmod/builtins/operations.py +35 -58
  208. classiq/qmod/builtins/structs.py +2 -58
  209. classiq/qmod/cfunc.py +3 -2
  210. classiq/qmod/classical_function.py +2 -1
  211. classiq/qmod/cparam.py +2 -8
  212. classiq/qmod/create_model_function.py +7 -7
  213. classiq/qmod/declaration_inferrer.py +33 -30
  214. classiq/qmod/model_state_container.py +2 -2
  215. classiq/qmod/native/pretty_printer.py +25 -14
  216. classiq/qmod/pretty_print/expression_to_python.py +5 -3
  217. classiq/qmod/pretty_print/pretty_printer.py +39 -17
  218. classiq/qmod/python_classical_type.py +40 -13
  219. classiq/qmod/qfunc.py +139 -16
  220. classiq/qmod/qmod_constant.py +2 -2
  221. classiq/qmod/qmod_parameter.py +5 -2
  222. classiq/qmod/qmod_variable.py +47 -43
  223. classiq/qmod/quantum_callable.py +18 -13
  224. classiq/qmod/quantum_expandable.py +31 -26
  225. classiq/qmod/quantum_function.py +51 -32
  226. classiq/qmod/semantics/annotation/call_annotation.py +2 -2
  227. classiq/qmod/semantics/error_manager.py +5 -6
  228. classiq/qmod/semantics/lambdas.py +1 -2
  229. classiq/qmod/semantics/validation/types_validation.py +1 -2
  230. classiq/qmod/symbolic.py +2 -4
  231. classiq/qmod/utilities.py +13 -10
  232. classiq/qmod/write_qmod.py +3 -4
  233. classiq/quantum_program.py +1 -3
  234. classiq/synthesis.py +11 -7
  235. {classiq-0.93.0.dist-info → classiq-0.94.1.dist-info}/METADATA +2 -3
  236. {classiq-0.93.0.dist-info → classiq-0.94.1.dist-info}/RECORD +238 -260
  237. classiq/applications/chemistry/ansatz_parameters.py +0 -29
  238. classiq/applications/chemistry/chemistry_execution_parameters.py +0 -16
  239. classiq/applications/chemistry/chemistry_model_constructor.py +0 -532
  240. classiq/applications/chemistry/ground_state_problem.py +0 -42
  241. classiq/evaluators/qmod_expression_visitors/qmod_expression_bwc.py +0 -129
  242. classiq/interface/chemistry/elements.py +0 -120
  243. classiq/interface/chemistry/fermionic_operator.py +0 -208
  244. classiq/interface/chemistry/ground_state_problem.py +0 -132
  245. classiq/interface/chemistry/ground_state_result.py +0 -8
  246. classiq/interface/chemistry/molecule.py +0 -71
  247. classiq/interface/generator/application_apis/chemistry_declarations.py +0 -69
  248. classiq/interface/generator/application_apis/entangler_declarations.py +0 -29
  249. classiq/interface/generator/chemistry_function_params.py +0 -50
  250. classiq/interface/generator/entangler_params.py +0 -72
  251. classiq/interface/generator/entanglers.py +0 -14
  252. classiq/interface/generator/hartree_fock.py +0 -26
  253. classiq/interface/generator/hva.py +0 -22
  254. classiq/interface/generator/linear_pauli_rotations.py +0 -92
  255. classiq/interface/generator/qft.py +0 -37
  256. classiq/interface/generator/ucc.py +0 -74
  257. classiq/interface/helpers/backward_compatibility.py +0 -9
  258. classiq/model_expansions/transformers/type_modifier_inference.py +0 -392
  259. classiq/qmod/builtins/functions/chemistry.py +0 -123
  260. {classiq-0.93.0.dist-info → classiq-0.94.1.dist-info}/WHEEL +0 -0
  261. {classiq-0.93.0.dist-info → classiq-0.94.1.dist-info}/licenses/LICENSE.txt +0 -0
@@ -8,11 +8,12 @@ from classiq.qmod.builtins.operations import (
8
8
  control,
9
9
  invert,
10
10
  repeat,
11
+ skip_control,
11
12
  within_apply,
12
13
  )
13
14
  from classiq.qmod.cparam import CInt
14
- from classiq.qmod.qfunc import qfunc
15
- from classiq.qmod.qmod_variable import Const, Permutable, QArray, QBit
15
+ from classiq.qmod.qfunc import qfunc, qperm
16
+ from classiq.qmod.qmod_variable import Const, QArray, QBit
16
17
  from classiq.qmod.symbolic import min, mod_inverse
17
18
 
18
19
 
@@ -51,9 +52,9 @@ def qft_space_add_const(value: CInt, phi_b: QArray[QBit]) -> None:
51
52
  )
52
53
 
53
54
 
54
- @qfunc(unchecked=["phi_b"])
55
+ @qperm(disable_perm_check=True)
55
56
  def cc_modular_add(
56
- n: CInt, a: CInt, phi_b: Permutable[QArray[QBit]], c1: Const[QBit], c2: Const[QBit]
57
+ n: CInt, a: CInt, phi_b: QArray[QBit], c1: Const[QBit], c2: Const[QBit]
57
58
  ) -> None:
58
59
  """
59
60
  [Qmod Classiq-library function]
@@ -91,11 +92,11 @@ def cc_modular_add(
91
92
  free(aux)
92
93
 
93
94
 
94
- @qfunc(unchecked=["b"])
95
+ @qperm(disable_perm_check=True)
95
96
  def c_modular_multiply(
96
97
  n: CInt,
97
98
  a: CInt,
98
- b: Permutable[QArray[QBit]],
99
+ b: QArray[QBit],
99
100
  x: Const[QArray[QBit]],
100
101
  ctrl: Const[QBit],
101
102
  ) -> None:
@@ -123,8 +124,8 @@ def c_modular_multiply(
123
124
  )
124
125
 
125
126
 
126
- @qfunc
127
- def multiswap(x: Permutable[QArray[QBit]], y: Permutable[QArray[QBit]]) -> None:
127
+ @qperm
128
+ def multiswap(x: QArray[QBit], y: QArray[QBit]) -> None:
128
129
  """
129
130
  [Qmod Classiq-library function]
130
131
 
@@ -164,6 +165,93 @@ def inplace_c_modular_multiply(n: CInt, a: CInt, x: QArray[QBit], ctrl: QBit) ->
164
165
  free(b)
165
166
 
166
167
 
168
+ @qperm(disable_perm_check=True)
169
+ def modular_add_qft_space(n: CInt, a: CInt, phi_b: QArray[QBit]) -> None:
170
+ """
171
+ [Qmod Classiq-library function]
172
+
173
+ Adds a constant `a` to a quantum number `phi_b` modulo the constant `n`.
174
+ The quantum number `phi_b` is assumed to be in the QFT space.
175
+
176
+ Args:
177
+ n: The modulo number.
178
+ a: The constant to add to the quantum number.
179
+ phi_b: The quantum number to which the constant is added.
180
+
181
+ """
182
+ aux = QBit()
183
+
184
+ allocate(aux)
185
+ qft_space_add_const(a, phi_b),
186
+ skip_control(
187
+ lambda: (
188
+ invert(lambda: qft_space_add_const(n, phi_b)),
189
+ _check_msb(1, phi_b, aux),
190
+ control(aux, lambda: qft_space_add_const(n, phi_b)),
191
+ )
192
+ )
193
+ invert(lambda: qft_space_add_const(a, phi_b))
194
+ skip_control(lambda: _check_msb(0, phi_b, aux))
195
+ qft_space_add_const(a, phi_b)
196
+ free(aux)
197
+
198
+
199
+ @qperm(disable_perm_check=True)
200
+ def modular_multiply(
201
+ n: CInt,
202
+ a: CInt,
203
+ b: QArray[QBit],
204
+ x: Const[QArray[QBit]],
205
+ ) -> None:
206
+ """
207
+ [Qmod Classiq-library function]
208
+
209
+ Performs out-of-place multiplication of a quantum number `x` by a classical number `a` modulo classical number `n`,
210
+ and adds the result to a quantum array `b` (Applies $b += xa \\mod n$).
211
+
212
+ Args:
213
+ n: The modulo number. Should be non-negative.
214
+ a: The classical factor. Should be non-negative.
215
+ b: The quantum number added to the multiplication result. Stores the result of the multiplication.
216
+ x: The quantum factor.
217
+ """
218
+ within_apply(
219
+ lambda: qft(b),
220
+ lambda: repeat(
221
+ count=x.len,
222
+ iteration=lambda index: control(
223
+ x[index], lambda: modular_add_qft_space(n, (a * (2**index)) % n, b)
224
+ ),
225
+ ),
226
+ )
227
+
228
+
229
+ @qfunc
230
+ def inplace_modular_multiply(n: CInt, a: CInt, x: QArray[QBit]) -> None:
231
+ """
232
+ [Qmod Classiq-library function]
233
+
234
+ Performs multiplication of a quantum number `x` by a classical number `a` modulo classical number `n`
235
+ (Applies $x=xa \\mod n$).
236
+
237
+ Args:
238
+ n: The modulo number. Should be non-negative.
239
+ a: The classical factor. Should be non-negative.
240
+ x: The quantum factor.
241
+
242
+ Comment: It is assumed that `a` has an inverse modulo `n`
243
+ """
244
+ b: QArray[QBit] = QArray(length=x.len + 1)
245
+ within_apply(
246
+ lambda: allocate(b),
247
+ lambda: (
248
+ modular_multiply(n, a, b, x),
249
+ multiswap(x, b),
250
+ invert(lambda: modular_multiply(n, mod_inverse(a, n), b, x)),
251
+ ),
252
+ )
253
+
254
+
167
255
  @qfunc
168
256
  def modular_exp(n: CInt, a: CInt, x: QArray[QBit], power: QArray[QBit]) -> None:
169
257
  """
classiq/qmod/__init__.py CHANGED
@@ -4,11 +4,11 @@ from .cfunc import cfunc
4
4
  from .classical_variable import measure
5
5
  from .create_model_function import create_model
6
6
  from .expression_query import get_expression_numeric_attributes
7
- from .qfunc import qfunc
7
+ from .qfunc import qfunc, qperm
8
8
  from .qmod_constant import QConstant
9
9
  from .qmod_parameter import Array, CArray, CBool, CInt, CReal
10
10
  from .qmod_variable import Const, Input, Output, Permutable, QArray, QBit, QNum, QStruct
11
- from .quantum_callable import QCallable, QCallableList
11
+ from .quantum_callable import QCallable, QCallableList, QPerm, QPermList
12
12
  from .write_qmod import write_qmod
13
13
 
14
14
  __all__ = [
@@ -27,11 +27,14 @@ __all__ = [
27
27
  "QCallable",
28
28
  "QCallableList",
29
29
  "QConstant",
30
+ "QPerm",
31
+ "QPermList",
30
32
  "QStruct",
31
33
  "cfunc",
32
34
  "create_model",
33
35
  "measure",
34
36
  "get_expression_numeric_attributes",
35
37
  "qfunc",
38
+ "qperm",
36
39
  "write_qmod",
37
40
  ] + _builtins_all
@@ -1,4 +1,4 @@
1
- from typing import Final, Optional
1
+ from typing import Final
2
2
 
3
3
  from classiq.interface.applications.iqae.iqae_result import IQAEResult
4
4
  from classiq.interface.exceptions import ClassiqError
@@ -32,7 +32,7 @@ def save(values_to_save: dict) -> None:
32
32
 
33
33
 
34
34
  def sample( # type: ignore[return]
35
- execution_params: Optional[ExecutionParams] = None,
35
+ execution_params: ExecutionParams | None = None,
36
36
  ) -> ExecutionDetails:
37
37
  _raise_error("sample")
38
38
 
@@ -44,7 +44,7 @@ def batch_sample( # type: ignore[return]
44
44
 
45
45
 
46
46
  def estimate( # type: ignore[return]
47
- hamiltonian: list[QmodPyStruct], execution_params: Optional[ExecutionParams] = None
47
+ hamiltonian: list[QmodPyStruct], execution_params: ExecutionParams | None = None
48
48
  ) -> EstimationResult:
49
49
  _raise_error("estimate")
50
50
 
@@ -91,23 +91,16 @@ def qsvm_full_run( # type: ignore[return]
91
91
  def iqae( # type: ignore[return]
92
92
  epsilon: float,
93
93
  alpha: float,
94
- execution_params: Optional[ExecutionParams] = None,
94
+ execution_params: ExecutionParams | None = None,
95
95
  ) -> IQAEResult:
96
96
  _raise_error("iqae")
97
97
 
98
98
 
99
- def molecule_ground_state_solution_post_process( # type: ignore[return]
100
- problem: QmodPyStruct, vqe_result: VQESolverResult
101
- ) -> QmodPyStruct:
102
- _raise_error("molecule_ground_state_solution_post_process")
103
-
104
-
105
99
  __all__ = [
106
100
  "batch_estimate",
107
101
  "batch_sample",
108
102
  "estimate",
109
103
  "iqae",
110
- "molecule_ground_state_solution_post_process",
111
104
  "qae_with_qpe_result_post_processing",
112
105
  "qsvm_full_run",
113
106
  "sample",
@@ -1,7 +1,7 @@
1
1
  # This file was generated automatically - do not edit manually
2
2
 
3
3
 
4
- from classiq.qmod.qmod_parameter import CArray, CBool, CInt, CReal
4
+ from classiq.qmod.qmod_parameter import CInt, CReal
5
5
  from classiq.qmod.symbolic import symbolic_function
6
6
 
7
7
  from .structs import *
@@ -17,47 +17,6 @@ def qft_const_adder_phase(
17
17
  )
18
18
 
19
19
 
20
- def fock_hamiltonian_problem_to_hamiltonian(
21
- problem: FockHamiltonianProblem,
22
- ) -> CArray[PauliTerm]:
23
- return symbolic_function(
24
- problem, return_type=CArray[PauliTerm] # type:ignore[type-abstract]
25
- )
26
-
27
-
28
- def molecule_problem_to_hamiltonian(
29
- problem: MoleculeProblem,
30
- ) -> CArray[PauliTerm]:
31
- return symbolic_function(
32
- problem, return_type=CArray[PauliTerm] # type:ignore[type-abstract]
33
- )
34
-
35
-
36
- def grid_entangler_graph(
37
- num_qubits: CInt,
38
- schmidt_rank: CInt,
39
- grid_randomization: CBool,
40
- ) -> CArray[CArray[CInt]]:
41
- return symbolic_function(
42
- num_qubits,
43
- schmidt_rank,
44
- grid_randomization,
45
- return_type=CArray[CArray[CInt]], # type:ignore[type-abstract]
46
- )
47
-
48
-
49
- def hypercube_entangler_graph(
50
- num_qubits: CInt,
51
- ) -> CArray[CArray[CInt]]:
52
- return symbolic_function(
53
- num_qubits, return_type=CArray[CArray[CInt]] # type:ignore[type-abstract]
54
- )
55
-
56
-
57
20
  __all__ = [
58
21
  "qft_const_adder_phase",
59
- "fock_hamiltonian_problem_to_hamiltonian",
60
- "molecule_problem_to_hamiltonian",
61
- "grid_entangler_graph",
62
- "hypercube_entangler_graph",
63
22
  ]
@@ -7,139 +7,6 @@ if TYPE_CHECKING:
7
7
  from classiq.qmod.builtins.structs import SparsePauliOp
8
8
 
9
9
 
10
- class Element(IntEnum):
11
- H = 0
12
- He = 1
13
- Li = 2
14
- Be = 3
15
- B = 4
16
- C = 5
17
- N = 6
18
- O = 7 # noqa: E741
19
- F = 8
20
- Ne = 9
21
- Na = 10
22
- Mg = 11
23
- Al = 12
24
- Si = 13
25
- P = 14
26
- S = 15
27
- Cl = 16
28
- Ar = 17
29
- K = 18
30
- Ca = 19
31
- Sc = 20
32
- Ti = 21
33
- V = 22
34
- Cr = 23
35
- Mn = 24
36
- Fe = 25
37
- Co = 26
38
- Ni = 27
39
- Cu = 28
40
- Zn = 29
41
- Ga = 30
42
- Ge = 31
43
- As = 32
44
- Se = 33
45
- Br = 34
46
- Kr = 35
47
- Rb = 36
48
- Sr = 37
49
- Y = 38
50
- Zr = 39
51
- Nb = 40
52
- Mo = 41
53
- Tc = 42
54
- Ru = 43
55
- Rh = 44
56
- Pd = 45
57
- Ag = 46
58
- Cd = 47
59
- In = 48
60
- Sn = 49
61
- Sb = 50
62
- Te = 51
63
- I = 52 # noqa: E741
64
- Xe = 53
65
- Cs = 54
66
- Ba = 55
67
- La = 56
68
- Ce = 57
69
- Pr = 58
70
- Nd = 59
71
- Pm = 60
72
- Sm = 61
73
- Eu = 62
74
- Gd = 63
75
- Tb = 64
76
- Dy = 65
77
- Ho = 66
78
- Er = 67
79
- Tm = 68
80
- Yb = 69
81
- Lu = 70
82
- Hf = 71
83
- Ta = 72
84
- W = 73
85
- Re = 74
86
- Os = 75
87
- Ir = 76
88
- Pt = 77
89
- Au = 78
90
- Hg = 79
91
- Tl = 80
92
- Pb = 81
93
- Bi = 82
94
- Po = 83
95
- At = 84
96
- Rn = 85
97
- Fr = 86
98
- Ra = 87
99
- Ac = 88
100
- Th = 89
101
- Pa = 90
102
- U = 91
103
- Np = 92
104
- Pu = 93
105
- Am = 94
106
- Cm = 95
107
- Bk = 96
108
- Cf = 97
109
- Es = 98
110
- Fm = 99
111
- Md = 100
112
- No = 101
113
- Lr = 102
114
- Rf = 103
115
- Db = 104
116
- Sg = 105
117
- Bh = 106
118
- Hs = 107
119
- Mt = 108
120
- Ds = 109
121
- Rg = 110
122
- Cn = 111
123
- Nh = 112
124
- Fl = 113
125
- Mc = 114
126
- Lv = 115
127
- Ts = 116
128
- Og = 117
129
-
130
-
131
- class FermionMapping(IntEnum):
132
- JORDAN_WIGNER = 0
133
- PARITY = 1
134
- BRAVYI_KITAEV = 2
135
- FAST_BRAVYI_KITAEV = 3
136
-
137
-
138
- class LadderOperator(IntEnum):
139
- PLUS = 0
140
- MINUS = 1
141
-
142
-
143
10
  class Optimizer(IntEnum):
144
11
  COBYLA = 1
145
12
  SPSA = 2
@@ -229,9 +96,6 @@ BUILTIN_ENUM_DECLARATIONS = {
229
96
  }
230
97
 
231
98
  __all__ = [
232
- "Element",
233
- "FermionMapping",
234
- "LadderOperator",
235
99
  "Optimizer",
236
100
  "Pauli",
237
101
  "QSVMFeatureMapEntanglement",
@@ -1,7 +1,6 @@
1
1
  from .allocation import *
2
2
  from .arithmetic import *
3
3
  from .benchmarking import *
4
- from .chemistry import *
5
4
  from .exponentiation import *
6
5
  from .mid_circuit_measurement import *
7
6
  from .operators import *
@@ -11,12 +10,6 @@ from .standard_gates import *
11
10
  CORE_LIB_DECLS = [
12
11
  func.func_decl
13
12
  for func in (
14
- molecule_ucc,
15
- molecule_hva,
16
- molecule_hartree_fock,
17
- fock_hamiltonian_ucc,
18
- fock_hamiltonian_hva,
19
- fock_hamiltonian_hartree_fock,
20
13
  pauli_feature_map,
21
14
  bloch_sphere_feature_map,
22
15
  H,
@@ -114,9 +107,6 @@ __all__ = [ # noqa: RUF022
114
107
  "apply",
115
108
  "bloch_sphere_feature_map",
116
109
  "exponentiation_with_depth_constraint",
117
- "fock_hamiltonian_hartree_fock",
118
- "fock_hamiltonian_hva",
119
- "fock_hamiltonian_ucc",
120
110
  "free",
121
111
  "inplace_prepare_amplitudes",
122
112
  "inplace_prepare_amplitudes_approx",
@@ -125,9 +115,6 @@ __all__ = [ # noqa: RUF022
125
115
  "integer_xor",
126
116
  "modular_add",
127
117
  "modular_add_constant",
128
- "molecule_hartree_fock",
129
- "molecule_hva",
130
- "molecule_ucc",
131
118
  "multi_suzuki_trotter",
132
119
  "parametric_suzuki_trotter",
133
120
  "pauli_feature_map",
@@ -1,12 +1,12 @@
1
1
  from typing import Literal
2
2
 
3
- from classiq.qmod.qfunc import qfunc
3
+ from classiq.qmod.qfunc import qfunc, qperm
4
4
  from classiq.qmod.qmod_parameter import CArray, CReal
5
- from classiq.qmod.qmod_variable import Input, Output, Permutable, QArray, QBit
5
+ from classiq.qmod.qmod_variable import Input, Output, QArray, QBit
6
6
 
7
7
 
8
- @qfunc(external=True)
9
- def free(in_: Permutable[Input[QArray[QBit]]]) -> None:
8
+ @qperm(external=True)
9
+ def free(in_: Input[QArray[QBit]]) -> None:
10
10
  """
11
11
  [Qmod core-library function]
12
12
 
@@ -1,12 +1,11 @@
1
1
  from typing import Literal
2
2
 
3
- from classiq.qmod.qfunc import qfunc
3
+ from classiq.qmod.qfunc import qfunc, qperm
4
4
  from classiq.qmod.qmod_parameter import CArray, CBool, CReal
5
5
  from classiq.qmod.qmod_variable import (
6
6
  Const,
7
7
  Input,
8
8
  Output,
9
- Permutable,
10
9
  QArray,
11
10
  QBit,
12
11
  QNum,
@@ -30,17 +29,15 @@ def unitary(
30
29
  pass
31
30
 
32
31
 
33
- @qfunc(external=True)
32
+ @qperm(external=True)
34
33
  def add(
35
34
  left: Const[QNum],
36
35
  right: Const[QNum],
37
- result: Permutable[
38
- Output[
39
- QNum[
40
- Literal["result_size"],
41
- Literal["result_is_signed"],
42
- Literal["result_fraction_places"],
43
- ]
36
+ result: Output[
37
+ QNum[
38
+ Literal["result_size"],
39
+ Literal["result_is_signed"],
40
+ Literal["result_fraction_places"],
44
41
  ]
45
42
  ],
46
43
  result_size: CReal,
@@ -50,17 +47,15 @@ def add(
50
47
  pass
51
48
 
52
49
 
53
- @qfunc(external=True)
50
+ @qperm(external=True)
54
51
  def add_inplace_right(
55
52
  left: Const[QNum],
56
- right: Permutable[Input[QNum]],
57
- result: Permutable[
58
- Output[
59
- QNum[
60
- Literal["result_size"],
61
- Literal["result_is_signed"],
62
- Literal["result_fraction_places"],
63
- ]
53
+ right: Input[QNum],
54
+ result: Output[
55
+ QNum[
56
+ Literal["result_size"],
57
+ Literal["result_is_signed"],
58
+ Literal["result_fraction_places"],
64
59
  ]
65
60
  ],
66
61
  result_size: CReal,
@@ -70,21 +65,21 @@ def add_inplace_right(
70
65
  pass
71
66
 
72
67
 
73
- @qfunc(external=True)
74
- def modular_add(left: Const[QArray[QBit]], right: Permutable[QArray[QBit]]) -> None:
68
+ @qperm(external=True)
69
+ def modular_add(left: Const[QArray[QBit]], right: QArray[QBit]) -> None:
75
70
  pass
76
71
 
77
72
 
78
- @qfunc(external=True)
79
- def modular_add_constant(left: CReal, right: Permutable[QNum]) -> None:
73
+ @qperm(external=True)
74
+ def modular_add_constant(left: CReal, right: QNum) -> None:
80
75
  pass
81
76
 
82
77
 
83
- @qfunc(external=True)
84
- def integer_xor(left: Const[QArray[QBit]], right: Permutable[QArray[QBit]]) -> None:
78
+ @qperm(external=True)
79
+ def integer_xor(left: Const[QArray[QBit]], right: QArray[QBit]) -> None:
85
80
  pass
86
81
 
87
82
 
88
- @qfunc(external=True)
89
- def real_xor_constant(left: CReal, right: Permutable[QNum]) -> None:
83
+ @qperm(external=True)
84
+ def real_xor_constant(left: CReal, right: QNum) -> None:
90
85
  pass