classiq 0.38.0__py3-none-any.whl → 0.40.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 (154) hide show
  1. classiq/__init__.py +22 -22
  2. classiq/_internals/api_wrapper.py +13 -1
  3. classiq/_internals/client.py +12 -2
  4. classiq/analyzer/analyzer.py +3 -1
  5. classiq/applications/__init__.py +1 -8
  6. classiq/applications/chemistry/__init__.py +6 -0
  7. classiq/{applications_model_constructors → applications/chemistry}/chemistry_model_constructor.py +1 -1
  8. classiq/{applications_model_constructors → applications}/combinatorial_helpers/arithmetic/arithmetic_expression.py +1 -1
  9. classiq/{applications_model_constructors → applications}/combinatorial_helpers/combinatorial_problem_utils.py +25 -6
  10. classiq/{applications_model_constructors → applications}/combinatorial_helpers/encoding_mapping.py +1 -1
  11. classiq/{applications_model_constructors → applications}/combinatorial_helpers/encoding_utils.py +1 -1
  12. classiq/{applications_model_constructors → applications}/combinatorial_helpers/memory.py +2 -4
  13. classiq/{applications_model_constructors → applications}/combinatorial_helpers/optimization_model.py +13 -16
  14. classiq/{applications_model_constructors → applications}/combinatorial_helpers/pyomo_utils.py +4 -2
  15. classiq/{applications_model_constructors → applications}/combinatorial_helpers/transformations/encoding.py +3 -10
  16. classiq/{applications_model_constructors → applications}/combinatorial_helpers/transformations/fixed_variables.py +4 -6
  17. classiq/{applications_model_constructors → applications}/combinatorial_helpers/transformations/ising_converter.py +3 -5
  18. classiq/{applications_model_constructors → applications}/combinatorial_helpers/transformations/penalty_support.py +3 -7
  19. classiq/{applications_model_constructors → applications}/combinatorial_helpers/transformations/slack_variables.py +4 -6
  20. classiq/applications/combinatorial_optimization/__init__.py +11 -3
  21. classiq/{applications_model_constructors → applications/combinatorial_optimization}/combinatorial_optimization_model_constructor.py +9 -10
  22. classiq/applications/finance/__init__.py +3 -2
  23. classiq/{applications_model_constructors → applications/finance}/finance_model_constructor.py +24 -14
  24. classiq/applications/grover/__init__.py +11 -0
  25. classiq/applications/libraries/qmci_library.py +35 -0
  26. classiq/applications/qsvm/__init__.py +5 -1
  27. classiq/execution/all_hardware_devices.py +13 -0
  28. classiq/executor.py +2 -1
  29. classiq/interface/_version.py +1 -1
  30. classiq/interface/analyzer/result.py +1 -5
  31. classiq/interface/applications/qsvm.py +4 -2
  32. classiq/interface/ast_node.py +23 -0
  33. classiq/interface/backend/backend_preferences.py +5 -5
  34. classiq/interface/backend/quantum_backend_providers.py +7 -7
  35. classiq/interface/combinatorial_optimization/examples/mht.py +8 -3
  36. classiq/interface/executor/execution_preferences.py +4 -9
  37. classiq/interface/executor/execution_request.py +2 -37
  38. classiq/interface/executor/vqe_result.py +1 -1
  39. classiq/interface/generator/application_apis/chemistry_declarations.py +2 -4
  40. classiq/interface/generator/application_apis/finance_declarations.py +1 -1
  41. classiq/interface/generator/arith/arithmetic_expression_validator.py +2 -0
  42. classiq/interface/generator/builtin_api_builder.py +0 -5
  43. classiq/interface/generator/constant.py +2 -3
  44. classiq/interface/generator/expressions/expression.py +2 -4
  45. classiq/interface/generator/expressions/qmod_qarray_proxy.py +82 -0
  46. classiq/interface/generator/expressions/qmod_qscalar_proxy.py +22 -1
  47. classiq/interface/generator/expressions/qmod_sized_proxy.py +22 -0
  48. classiq/interface/generator/functions/__init__.py +2 -2
  49. classiq/interface/generator/functions/builtins/__init__.py +15 -0
  50. classiq/interface/generator/functions/builtins/core_library/__init__.py +14 -0
  51. classiq/interface/generator/functions/{core_lib_declarations/quantum_functions → builtins/core_library}/atomic_quantum_functions.py +8 -6
  52. classiq/interface/generator/functions/{core_lib_declarations/quantum_functions → builtins/core_library}/exponentiation_functions.py +10 -4
  53. classiq/interface/generator/functions/builtins/internal_operators.py +62 -0
  54. classiq/interface/generator/functions/{core_lib_declarations/quantum_functions/std_lib_functions.py → builtins/open_lib_functions.py} +893 -319
  55. classiq/interface/generator/functions/builtins/quantum_operators.py +37 -0
  56. classiq/interface/generator/functions/classical_type.py +31 -21
  57. classiq/interface/generator/functions/function_declaration.py +2 -2
  58. classiq/interface/generator/hartree_fock.py +10 -2
  59. classiq/interface/generator/model/classical_main_validator.py +1 -1
  60. classiq/interface/generator/model/model.py +1 -1
  61. classiq/interface/generator/model/preferences/preferences.py +4 -2
  62. classiq/interface/generator/quantum_function_call.py +1 -1
  63. classiq/interface/generator/types/struct_declaration.py +2 -4
  64. classiq/interface/model/call_synthesis_data.py +3 -3
  65. classiq/interface/model/classical_if.py +13 -0
  66. classiq/interface/model/classical_parameter_declaration.py +2 -3
  67. classiq/interface/model/{quantum_if_operation.py → control.py} +39 -21
  68. classiq/interface/model/handle_binding.py +3 -2
  69. classiq/interface/model/invert.py +10 -0
  70. classiq/interface/model/model.py +2 -1
  71. classiq/interface/model/power.py +12 -0
  72. classiq/interface/model/quantum_function_call.py +9 -4
  73. classiq/interface/model/quantum_lambda_function.py +3 -9
  74. classiq/interface/model/quantum_statement.py +3 -2
  75. classiq/interface/model/quantum_type.py +8 -9
  76. classiq/interface/model/quantum_variable_declaration.py +2 -2
  77. classiq/interface/model/repeat.py +13 -0
  78. classiq/interface/model/resolvers/function_call_resolver.py +21 -0
  79. classiq/interface/model/statement_block.py +18 -4
  80. classiq/interface/model/validations/handles_validator.py +8 -12
  81. classiq/interface/model/within_apply_operation.py +4 -4
  82. classiq/interface/server/routes.py +0 -4
  83. classiq/qmod/__init__.py +6 -2
  84. classiq/qmod/builtins/classical_functions.py +34 -39
  85. classiq/qmod/builtins/functions.py +287 -300
  86. classiq/qmod/builtins/operations.py +217 -16
  87. classiq/qmod/builtins/structs.py +50 -48
  88. classiq/qmod/declaration_inferrer.py +30 -18
  89. classiq/qmod/native/expression_to_qmod.py +5 -4
  90. classiq/qmod/native/pretty_printer.py +48 -26
  91. classiq/qmod/qmod_constant.py +29 -5
  92. classiq/qmod/qmod_parameter.py +56 -34
  93. classiq/qmod/qmod_struct.py +2 -2
  94. classiq/qmod/qmod_variable.py +87 -43
  95. classiq/qmod/quantum_callable.py +8 -4
  96. classiq/qmod/quantum_expandable.py +25 -20
  97. classiq/qmod/quantum_function.py +29 -2
  98. classiq/qmod/symbolic.py +79 -69
  99. classiq/qmod/symbolic_expr.py +1 -1
  100. classiq/qmod/symbolic_type.py +1 -4
  101. classiq/qmod/utilities.py +29 -0
  102. {classiq-0.38.0.dist-info → classiq-0.40.0.dist-info}/METADATA +1 -1
  103. {classiq-0.38.0.dist-info → classiq-0.40.0.dist-info}/RECORD +122 -141
  104. classiq/applications/benchmarking/__init__.py +0 -9
  105. classiq/applications/benchmarking/mirror_benchmarking.py +0 -70
  106. classiq/applications/numpy_utils.py +0 -37
  107. classiq/applications_model_constructors/__init__.py +0 -25
  108. classiq/applications_model_constructors/combinatorial_helpers/multiple_comp_basis_sp.py +0 -34
  109. classiq/applications_model_constructors/libraries/qmci_library.py +0 -107
  110. classiq/builtin_functions/__init__.py +0 -43
  111. classiq/builtin_functions/amplitude_loading.py +0 -3
  112. classiq/builtin_functions/binary_ops.py +0 -1
  113. classiq/builtin_functions/exponentiation.py +0 -5
  114. classiq/builtin_functions/qpe.py +0 -4
  115. classiq/builtin_functions/qsvm.py +0 -7
  116. classiq/builtin_functions/range_types.py +0 -5
  117. classiq/builtin_functions/standard_gates.py +0 -1
  118. classiq/builtin_functions/state_preparation.py +0 -6
  119. classiq/builtin_functions/suzuki_trotter.py +0 -3
  120. classiq/interface/executor/error_mitigation.py +0 -6
  121. classiq/interface/generator/functions/core_lib_declarations/quantum_functions/__init__.py +0 -18
  122. classiq/interface/generator/functions/core_lib_declarations/quantum_functions/chemistry_functions.py +0 -0
  123. classiq/interface/generator/functions/core_lib_declarations/quantum_operators.py +0 -95
  124. classiq/model/__init__.py +0 -14
  125. classiq/model/composite_function_generator.py +0 -33
  126. classiq/model/function_handler.py +0 -462
  127. classiq/model/logic_flow.py +0 -149
  128. classiq/model/logic_flow_change_handler.py +0 -71
  129. classiq/model/model.py +0 -229
  130. classiq/quantum_functions/__init__.py +0 -17
  131. classiq/quantum_functions/annotation_parser.py +0 -205
  132. classiq/quantum_functions/decorators.py +0 -22
  133. classiq/quantum_functions/function_library.py +0 -181
  134. classiq/quantum_functions/function_parser.py +0 -74
  135. classiq/quantum_functions/quantum_function.py +0 -236
  136. /classiq/{applications_model_constructors → applications}/combinatorial_helpers/__init__.py +0 -0
  137. /classiq/{applications_model_constructors → applications}/combinatorial_helpers/allowed_constraints.py +0 -0
  138. /classiq/{applications_model_constructors → applications}/combinatorial_helpers/arithmetic/__init__.py +0 -0
  139. /classiq/{applications_model_constructors → applications}/combinatorial_helpers/arithmetic/isolation.py +0 -0
  140. /classiq/{applications_model_constructors → applications}/combinatorial_helpers/pauli_helpers/__init__.py +0 -0
  141. /classiq/{applications_model_constructors → applications}/combinatorial_helpers/pauli_helpers/pauli_sparsing.py +0 -0
  142. /classiq/{applications_model_constructors → applications}/combinatorial_helpers/pauli_helpers/pauli_utils.py +0 -0
  143. /classiq/{applications_model_constructors → applications}/combinatorial_helpers/py.typed +0 -0
  144. /classiq/{applications_model_constructors/combinatorial_helpers/transformations → applications/combinatorial_helpers/solvers}/__init__.py +0 -0
  145. /classiq/{applications_model_constructors → applications}/combinatorial_helpers/sympy_utils.py +0 -0
  146. /classiq/{applications_model_constructors/libraries → applications/combinatorial_helpers/transformations}/__init__.py +0 -0
  147. /classiq/{applications_model_constructors → applications}/combinatorial_helpers/transformations/penalty.py +0 -0
  148. /classiq/{applications_model_constructors → applications}/combinatorial_helpers/transformations/sign_seperation.py +0 -0
  149. /classiq/{applications_model_constructors → applications/grover}/grover_model_constructor.py +0 -0
  150. /classiq/{interface/generator/functions/core_lib_declarations → applications/libraries}/__init__.py +0 -0
  151. /classiq/{applications_model_constructors → applications}/libraries/ampltitude_estimation_library.py +0 -0
  152. /classiq/{applications_model_constructors → applications/qsvm}/qsvm_model_constructor.py +0 -0
  153. /classiq/{quantum_register.py → interface/model/quantum_register.py} +0 -0
  154. {classiq-0.38.0.dist-info → classiq-0.40.0.dist-info}/WHEEL +0 -0
@@ -6,6 +6,7 @@ from classiq.interface.model.quantum_function_declaration import (
6
6
 
7
7
  QFT_STEP = QuantumFunctionDeclaration.parse_raw(
8
8
  """{
9
+ "source_ref": null,
9
10
  "name": "qft_step",
10
11
  "param_decls": {},
11
12
  "port_declarations": {
@@ -21,6 +22,7 @@ QFT_STEP = QuantumFunctionDeclaration.parse_raw(
21
22
 
22
23
  QFT = QuantumFunctionDeclaration.parse_raw(
23
24
  """{
25
+ "source_ref": null,
24
26
  "name": "qft",
25
27
  "param_decls": {},
26
28
  "port_declarations": {
@@ -36,6 +38,7 @@ QFT = QuantumFunctionDeclaration.parse_raw(
36
38
 
37
39
  QPE_FLEXIBLE = QuantumFunctionDeclaration.parse_raw(
38
40
  """{
41
+ "source_ref": null,
39
42
  "name": "qpe_flexible",
40
43
  "param_decls": {},
41
44
  "port_declarations": {
@@ -87,6 +90,7 @@ QPE_FLEXIBLE = QuantumFunctionDeclaration.parse_raw(
87
90
 
88
91
  QPE = QuantumFunctionDeclaration.parse_raw(
89
92
  """{
93
+ "source_ref": null,
90
94
  "name": "qpe",
91
95
  "param_decls": {},
92
96
  "port_declarations": {
@@ -122,34 +126,9 @@ QPE = QuantumFunctionDeclaration.parse_raw(
122
126
  }"""
123
127
  )
124
128
 
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
129
  SINGLE_PAULI = QuantumFunctionDeclaration.parse_raw(
152
130
  """{
131
+ "source_ref": null,
153
132
  "name": "single_pauli",
154
133
  "param_decls": {
155
134
  "slope": {
@@ -197,6 +176,7 @@ SINGLE_PAULI = QuantumFunctionDeclaration.parse_raw(
197
176
 
198
177
  LINEAR_PAULI_ROTATIONS = QuantumFunctionDeclaration.parse_raw(
199
178
  """{
179
+ "source_ref": null,
200
180
  "name": "linear_pauli_rotations",
201
181
  "param_decls": {
202
182
  "bases": {
@@ -235,93 +215,115 @@ LINEAR_PAULI_ROTATIONS = QuantumFunctionDeclaration.parse_raw(
235
215
 
236
216
  AMPLITUDE_ESTIMATION = QuantumFunctionDeclaration.parse_raw(
237
217
  """{
218
+ "source_ref": null,
238
219
  "name": "amplitude_estimation",
239
- "param_decls": {
240
- "num_phase_qubits": {
241
- "kind": "int"
242
- },
243
- "num_unitary_qubits": {
244
- "kind": "int"
245
- }
246
- },
220
+ "param_decls": {},
247
221
  "port_declarations": {
248
- "phase_port": {
249
- "name": "phase_port",
222
+ "phase": {
223
+ "name": "phase",
250
224
  "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"
225
+ "kind": "qnum"
264
226
  },
265
- "direction": "output"
227
+ "direction": "inout"
266
228
  },
267
- "unitary_port": {
268
- "name": "unitary_port",
269
- "size": {
270
- "expr": "num_unitary_qubits"
229
+ "packed_vars": {
230
+ "name": "packed_vars",
231
+ "quantum_type": {
232
+ "kind": "qvec",
233
+ "length": null
271
234
  },
272
- "direction": "output"
235
+ "direction": "inout"
273
236
  }
274
237
  },
275
238
  "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"
239
+ "oracle": {
240
+ "name": "oracle",
241
+ "positional_arg_declarations": [
242
+ {
243
+ "name": "arg0",
244
+ "quantum_type": {
245
+ "kind": "qvec",
246
+ "length": null
288
247
  },
289
248
  "direction": "inout"
290
249
  }
291
- }
250
+ ],
251
+ "is_list": false
292
252
  },
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"
253
+ "space_transform": {
254
+ "name": "space_transform",
255
+ "positional_arg_declarations": [
256
+ {
257
+ "name": "arg0",
258
+ "quantum_type": {
259
+ "kind": "qvec",
260
+ "length": null
305
261
  },
306
262
  "direction": "inout"
307
263
  }
308
- }
264
+ ],
265
+ "is_list": false
309
266
  }
310
267
  },
311
- "positional_arg_declarations": []
268
+ "positional_arg_declarations": [
269
+ {
270
+ "name": "oracle",
271
+ "positional_arg_declarations": [
272
+ {
273
+ "name": "arg0",
274
+ "quantum_type": {
275
+ "kind": "qvec",
276
+ "length": null
277
+ },
278
+ "direction": "inout"
279
+ }
280
+ ],
281
+ "is_list": false
282
+ },
283
+ {
284
+ "name": "space_transform",
285
+ "positional_arg_declarations": [
286
+ {
287
+ "name": "arg0",
288
+ "quantum_type": {
289
+ "kind": "qvec",
290
+ "length": null
291
+ },
292
+ "direction": "inout"
293
+ }
294
+ ],
295
+ "is_list": false
296
+ },
297
+ {
298
+ "name": "phase",
299
+ "quantum_type": {
300
+ "kind": "qnum"
301
+ },
302
+ "direction": "inout"
303
+ },
304
+ {
305
+ "name": "packed_vars",
306
+ "quantum_type": {
307
+ "kind": "qvec",
308
+ "length": null
309
+ },
310
+ "direction": "inout"
311
+ }
312
+ ]
312
313
  }"""
313
314
  )
314
315
 
315
316
  PHASE_ORACLE = QuantumFunctionDeclaration.parse_raw(
316
317
  """{
318
+ "source_ref": null,
317
319
  "name": "phase_oracle",
318
320
  "param_decls": {},
319
321
  "port_declarations": {
320
322
  "target": {
321
323
  "name": "target",
322
324
  "quantum_type": {
323
- "length": null,
324
- "kind": "qvec"
325
+ "kind": "qvec",
326
+ "length": null
325
327
  },
326
328
  "direction": "inout"
327
329
  }
@@ -333,8 +335,8 @@ PHASE_ORACLE = QuantumFunctionDeclaration.parse_raw(
333
335
  {
334
336
  "name": "arg0",
335
337
  "quantum_type": {
336
- "length": null,
337
- "kind": "qvec"
338
+ "kind": "qvec",
339
+ "length": null
338
340
  },
339
341
  "direction": "inout"
340
342
  },
@@ -356,8 +358,8 @@ PHASE_ORACLE = QuantumFunctionDeclaration.parse_raw(
356
358
  {
357
359
  "name": "arg0",
358
360
  "quantum_type": {
359
- "length": null,
360
- "kind": "qvec"
361
+ "kind": "qvec",
362
+ "length": null
361
363
  },
362
364
  "direction": "inout"
363
365
  },
@@ -372,38 +374,650 @@ PHASE_ORACLE = QuantumFunctionDeclaration.parse_raw(
372
374
  "is_list": false
373
375
  },
374
376
  {
375
- "name": "target",
377
+ "name": "target",
378
+ "quantum_type": {
379
+ "kind": "qvec",
380
+ "length": null
381
+ },
382
+ "direction": "inout"
383
+ }
384
+ ]
385
+ }"""
386
+ )
387
+
388
+ REFLECT_ABOUT_ZERO = QuantumFunctionDeclaration.parse_raw(
389
+ """{
390
+ "source_ref": null,
391
+ "name": "reflect_about_zero",
392
+ "param_decls": {},
393
+ "port_declarations": {
394
+ "packed_vars": {
395
+ "name": "packed_vars",
396
+ "quantum_type": {
397
+ "kind": "qvec",
398
+ "length": null
399
+ },
400
+ "direction": "inout"
401
+ }
402
+ },
403
+ "operand_declarations": {},
404
+ "positional_arg_declarations": [
405
+ {
406
+ "name": "packed_vars",
407
+ "quantum_type": {
408
+ "kind": "qvec",
409
+ "length": null
410
+ },
411
+ "direction": "inout"
412
+ }
413
+ ]
414
+ }"""
415
+ )
416
+
417
+ GROVER_DIFFUSER = QuantumFunctionDeclaration.parse_raw(
418
+ """{
419
+ "source_ref": null,
420
+ "name": "grover_diffuser",
421
+ "param_decls": {},
422
+ "port_declarations": {
423
+ "packed_vars": {
424
+ "name": "packed_vars",
425
+ "quantum_type": {
426
+ "kind": "qvec",
427
+ "length": null
428
+ },
429
+ "direction": "inout"
430
+ }
431
+ },
432
+ "operand_declarations": {
433
+ "space_transform": {
434
+ "name": "space_transform",
435
+ "positional_arg_declarations": [
436
+ {
437
+ "name": "arg0",
438
+ "quantum_type": {
439
+ "kind": "qvec",
440
+ "length": null
441
+ },
442
+ "direction": "inout"
443
+ }
444
+ ],
445
+ "is_list": false
446
+ }
447
+ },
448
+ "positional_arg_declarations": [
449
+ {
450
+ "name": "space_transform",
451
+ "positional_arg_declarations": [
452
+ {
453
+ "name": "arg0",
454
+ "quantum_type": {
455
+ "kind": "qvec",
456
+ "length": null
457
+ },
458
+ "direction": "inout"
459
+ }
460
+ ],
461
+ "is_list": false
462
+ },
463
+ {
464
+ "name": "packed_vars",
465
+ "quantum_type": {
466
+ "kind": "qvec",
467
+ "length": null
468
+ },
469
+ "direction": "inout"
470
+ }
471
+ ]
472
+ }"""
473
+ )
474
+
475
+ GROVER_OPERATOR = QuantumFunctionDeclaration.parse_raw(
476
+ """{
477
+ "source_ref": null,
478
+ "name": "grover_operator",
479
+ "param_decls": {},
480
+ "port_declarations": {
481
+ "packed_vars": {
482
+ "name": "packed_vars",
483
+ "quantum_type": {
484
+ "kind": "qvec",
485
+ "length": null
486
+ },
487
+ "direction": "inout"
488
+ }
489
+ },
490
+ "operand_declarations": {
491
+ "oracle": {
492
+ "name": "oracle",
493
+ "positional_arg_declarations": [
494
+ {
495
+ "name": "arg0",
496
+ "quantum_type": {
497
+ "kind": "qvec",
498
+ "length": null
499
+ },
500
+ "direction": "inout"
501
+ }
502
+ ],
503
+ "is_list": false
504
+ },
505
+ "space_transform": {
506
+ "name": "space_transform",
507
+ "positional_arg_declarations": [
508
+ {
509
+ "name": "arg0",
510
+ "quantum_type": {
511
+ "kind": "qvec",
512
+ "length": null
513
+ },
514
+ "direction": "inout"
515
+ }
516
+ ],
517
+ "is_list": false
518
+ }
519
+ },
520
+ "positional_arg_declarations": [
521
+ {
522
+ "name": "oracle",
523
+ "positional_arg_declarations": [
524
+ {
525
+ "name": "arg0",
526
+ "quantum_type": {
527
+ "kind": "qvec",
528
+ "length": null
529
+ },
530
+ "direction": "inout"
531
+ }
532
+ ],
533
+ "is_list": false
534
+ },
535
+ {
536
+ "name": "space_transform",
537
+ "positional_arg_declarations": [
538
+ {
539
+ "name": "arg0",
540
+ "quantum_type": {
541
+ "kind": "qvec",
542
+ "length": null
543
+ },
544
+ "direction": "inout"
545
+ }
546
+ ],
547
+ "is_list": false
548
+ },
549
+ {
550
+ "name": "packed_vars",
551
+ "quantum_type": {
552
+ "kind": "qvec",
553
+ "length": null
554
+ },
555
+ "direction": "inout"
556
+ }
557
+ ]
558
+ }"""
559
+ )
560
+
561
+ GROVER_SEARCH = QuantumFunctionDeclaration.parse_raw(
562
+ """{
563
+ "source_ref": null,
564
+ "name": "grover_search",
565
+ "param_decls": {
566
+ "reps": {
567
+ "kind": "int"
568
+ }
569
+ },
570
+ "port_declarations": {
571
+ "packed_vars": {
572
+ "name": "packed_vars",
573
+ "quantum_type": {
574
+ "kind": "qvec",
575
+ "length": null
576
+ },
577
+ "direction": "inout"
578
+ }
579
+ },
580
+ "operand_declarations": {
581
+ "oracle": {
582
+ "name": "oracle",
583
+ "positional_arg_declarations": [
584
+ {
585
+ "name": "arg0",
586
+ "quantum_type": {
587
+ "kind": "qvec",
588
+ "length": null
589
+ },
590
+ "direction": "inout"
591
+ }
592
+ ],
593
+ "is_list": false
594
+ }
595
+ },
596
+ "positional_arg_declarations": [
597
+ {
598
+ "name": "reps",
599
+ "classical_type": {
600
+ "kind": "int"
601
+ }
602
+ },
603
+ {
604
+ "name": "oracle",
605
+ "positional_arg_declarations": [
606
+ {
607
+ "name": "arg0",
608
+ "quantum_type": {
609
+ "kind": "qvec",
610
+ "length": null
611
+ },
612
+ "direction": "inout"
613
+ }
614
+ ],
615
+ "is_list": false
616
+ },
617
+ {
618
+ "name": "packed_vars",
619
+ "quantum_type": {
620
+ "kind": "qvec",
621
+ "length": null
622
+ },
623
+ "direction": "inout"
624
+ }
625
+ ]
626
+ }"""
627
+ )
628
+
629
+ HADAMARD_TRANSFORM = QuantumFunctionDeclaration.parse_raw(
630
+ """{
631
+ "source_ref": null,
632
+ "name": "hadamard_transform",
633
+ "param_decls": {},
634
+ "port_declarations": {
635
+ "target": {
636
+ "name": "target",
637
+ "direction": "inout"
638
+ }
639
+ },
640
+ "operand_declarations": {},
641
+ "positional_arg_declarations": []
642
+ }"""
643
+ )
644
+
645
+ APPLY_TO_ALL = QuantumFunctionDeclaration.parse_raw(
646
+ """{
647
+ "source_ref": null,
648
+ "name": "apply_to_all",
649
+ "param_decls": {},
650
+ "port_declarations": {
651
+ "target": {
652
+ "name": "target",
653
+ "direction": "inout"
654
+ }
655
+ },
656
+ "operand_declarations": {
657
+ "gate_operand": {
658
+ "name": "gate_operand",
659
+ "port_declarations": {
660
+ "target": {
661
+ "name": "target",
662
+ "size": {
663
+ "expr": "1"
664
+ },
665
+ "direction": "inout"
666
+ }
667
+ }
668
+ }
669
+ },
670
+ "positional_arg_declarations": []
671
+ }"""
672
+ )
673
+
674
+ QFT_NO_SWAP = QuantumFunctionDeclaration.parse_raw(
675
+ """{
676
+ "source_ref": null,
677
+ "name": "qft_no_swap",
678
+ "param_decls": {},
679
+ "port_declarations": {
680
+ "qbv": {
681
+ "name": "qbv",
682
+ "quantum_type": {
683
+ "kind": "qvec",
684
+ "length": null
685
+ },
686
+ "direction": "inout"
687
+ }
688
+ },
689
+ "operand_declarations": {},
690
+ "positional_arg_declarations": [
691
+ {
692
+ "name": "qbv",
693
+ "quantum_type": {
694
+ "kind": "qvec",
695
+ "length": null
696
+ },
697
+ "direction": "inout"
698
+ }
699
+ ]
700
+ }"""
701
+ )
702
+
703
+ _CHECK_MSB = QuantumFunctionDeclaration.parse_raw(
704
+ """{
705
+ "source_ref": null,
706
+ "name": "_check_msb",
707
+ "param_decls": {
708
+ "ref": {
709
+ "kind": "int"
710
+ }
711
+ },
712
+ "port_declarations": {
713
+ "x": {
714
+ "name": "x",
715
+ "quantum_type": {
716
+ "kind": "qvec",
717
+ "length": null
718
+ },
719
+ "direction": "inout"
720
+ },
721
+ "aux": {
722
+ "name": "aux",
723
+ "quantum_type": {
724
+ "kind": "qbit"
725
+ },
726
+ "direction": "inout"
727
+ }
728
+ },
729
+ "operand_declarations": {},
730
+ "positional_arg_declarations": [
731
+ {
732
+ "name": "ref",
733
+ "classical_type": {
734
+ "kind": "int"
735
+ }
736
+ },
737
+ {
738
+ "name": "x",
739
+ "quantum_type": {
740
+ "kind": "qvec",
741
+ "length": null
742
+ },
743
+ "direction": "inout"
744
+ },
745
+ {
746
+ "name": "aux",
747
+ "quantum_type": {
748
+ "kind": "qbit"
749
+ },
750
+ "direction": "inout"
751
+ }
752
+ ]
753
+ }"""
754
+ )
755
+
756
+ _CTRL_X = QuantumFunctionDeclaration.parse_raw(
757
+ """{
758
+ "source_ref": null,
759
+ "name": "_ctrl_x",
760
+ "param_decls": {
761
+ "ref": {
762
+ "kind": "int"
763
+ }
764
+ },
765
+ "port_declarations": {
766
+ "ctrl": {
767
+ "name": "ctrl",
768
+ "quantum_type": {
769
+ "kind": "qnum"
770
+ },
771
+ "direction": "inout"
772
+ },
773
+ "aux": {
774
+ "name": "aux",
775
+ "quantum_type": {
776
+ "kind": "qbit"
777
+ },
778
+ "direction": "inout"
779
+ }
780
+ },
781
+ "operand_declarations": {},
782
+ "positional_arg_declarations": [
783
+ {
784
+ "name": "ref",
785
+ "classical_type": {
786
+ "kind": "int"
787
+ }
788
+ },
789
+ {
790
+ "name": "ctrl",
791
+ "quantum_type": {
792
+ "kind": "qnum"
793
+ },
794
+ "direction": "inout"
795
+ },
796
+ {
797
+ "name": "aux",
798
+ "quantum_type": {
799
+ "kind": "qbit"
800
+ },
801
+ "direction": "inout"
802
+ }
803
+ ]
804
+ }"""
805
+ )
806
+
807
+ QFT_SPACE_ADD_CONST = QuantumFunctionDeclaration.parse_raw(
808
+ """{
809
+ "source_ref": null,
810
+ "name": "qft_space_add_const",
811
+ "param_decls": {
812
+ "value": {
813
+ "kind": "int"
814
+ }
815
+ },
816
+ "port_declarations": {
817
+ "phi_b": {
818
+ "name": "phi_b",
819
+ "quantum_type": {
820
+ "kind": "qvec",
821
+ "length": null
822
+ },
823
+ "direction": "inout"
824
+ }
825
+ },
826
+ "operand_declarations": {},
827
+ "positional_arg_declarations": [
828
+ {
829
+ "name": "value",
830
+ "classical_type": {
831
+ "kind": "int"
832
+ }
833
+ },
834
+ {
835
+ "name": "phi_b",
836
+ "quantum_type": {
837
+ "kind": "qvec",
838
+ "length": null
839
+ },
840
+ "direction": "inout"
841
+ }
842
+ ]
843
+ }"""
844
+ )
845
+
846
+ CC_MODULAR_ADD = QuantumFunctionDeclaration.parse_raw(
847
+ """{
848
+ "source_ref": null,
849
+ "name": "cc_modular_add",
850
+ "param_decls": {
851
+ "n": {
852
+ "kind": "int"
853
+ },
854
+ "a": {
855
+ "kind": "int"
856
+ }
857
+ },
858
+ "port_declarations": {
859
+ "phi_b": {
860
+ "name": "phi_b",
861
+ "quantum_type": {
862
+ "kind": "qvec",
863
+ "length": null
864
+ },
865
+ "direction": "inout"
866
+ },
867
+ "c1": {
868
+ "name": "c1",
869
+ "quantum_type": {
870
+ "kind": "qbit"
871
+ },
872
+ "direction": "inout"
873
+ },
874
+ "c2": {
875
+ "name": "c2",
876
+ "quantum_type": {
877
+ "kind": "qbit"
878
+ },
879
+ "direction": "inout"
880
+ },
881
+ "aux": {
882
+ "name": "aux",
883
+ "quantum_type": {
884
+ "kind": "qbit"
885
+ },
886
+ "direction": "inout"
887
+ }
888
+ },
889
+ "operand_declarations": {},
890
+ "positional_arg_declarations": [
891
+ {
892
+ "name": "n",
893
+ "classical_type": {
894
+ "kind": "int"
895
+ }
896
+ },
897
+ {
898
+ "name": "a",
899
+ "classical_type": {
900
+ "kind": "int"
901
+ }
902
+ },
903
+ {
904
+ "name": "phi_b",
905
+ "quantum_type": {
906
+ "kind": "qvec",
907
+ "length": null
908
+ },
909
+ "direction": "inout"
910
+ },
911
+ {
912
+ "name": "c1",
913
+ "quantum_type": {
914
+ "kind": "qbit"
915
+ },
916
+ "direction": "inout"
917
+ },
918
+ {
919
+ "name": "c2",
920
+ "quantum_type": {
921
+ "kind": "qbit"
922
+ },
923
+ "direction": "inout"
924
+ },
925
+ {
926
+ "name": "aux",
927
+ "quantum_type": {
928
+ "kind": "qbit"
929
+ },
930
+ "direction": "inout"
931
+ }
932
+ ]
933
+ }"""
934
+ )
935
+
936
+ C_MODULAR_MULTIPLY = QuantumFunctionDeclaration.parse_raw(
937
+ """{
938
+ "source_ref": null,
939
+ "name": "c_modular_multiply",
940
+ "param_decls": {
941
+ "n": {
942
+ "kind": "int"
943
+ },
944
+ "a": {
945
+ "kind": "int"
946
+ }
947
+ },
948
+ "port_declarations": {
949
+ "b": {
950
+ "name": "b",
951
+ "quantum_type": {
952
+ "kind": "qvec",
953
+ "length": null
954
+ },
955
+ "direction": "inout"
956
+ },
957
+ "x": {
958
+ "name": "x",
959
+ "quantum_type": {
960
+ "kind": "qvec",
961
+ "length": null
962
+ },
963
+ "direction": "inout"
964
+ },
965
+ "ctrl": {
966
+ "name": "ctrl",
967
+ "quantum_type": {
968
+ "kind": "qbit"
969
+ },
970
+ "direction": "inout"
971
+ },
972
+ "aux": {
973
+ "name": "aux",
974
+ "quantum_type": {
975
+ "kind": "qbit"
976
+ },
977
+ "direction": "inout"
978
+ }
979
+ },
980
+ "operand_declarations": {},
981
+ "positional_arg_declarations": [
982
+ {
983
+ "name": "n",
984
+ "classical_type": {
985
+ "kind": "int"
986
+ }
987
+ },
988
+ {
989
+ "name": "a",
990
+ "classical_type": {
991
+ "kind": "int"
992
+ }
993
+ },
994
+ {
995
+ "name": "b",
376
996
  "quantum_type": {
377
- "length": null,
378
- "kind": "qvec"
997
+ "kind": "qvec",
998
+ "length": null
379
999
  },
380
1000
  "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",
1001
+ },
1002
+ {
1003
+ "name": "x",
393
1004
  "quantum_type": {
394
- "length": null,
395
- "kind": "qvec"
1005
+ "kind": "qvec",
1006
+ "length": null
396
1007
  },
397
1008
  "direction": "inout"
398
- }
399
- },
400
- "operand_declarations": {},
401
- "positional_arg_declarations": [
1009
+ },
402
1010
  {
403
- "name": "packed_vars",
1011
+ "name": "ctrl",
1012
+ "quantum_type": {
1013
+ "kind": "qbit"
1014
+ },
1015
+ "direction": "inout"
1016
+ },
1017
+ {
1018
+ "name": "aux",
404
1019
  "quantum_type": {
405
- "length": null,
406
- "kind": "qvec"
1020
+ "kind": "qbit"
407
1021
  },
408
1022
  "direction": "inout"
409
1023
  }
@@ -411,56 +1025,44 @@ REFLECT_ABOUT_ZERO = QuantumFunctionDeclaration.parse_raw(
411
1025
  }"""
412
1026
  )
413
1027
 
414
- GROVER_DIFFUSER = QuantumFunctionDeclaration.parse_raw(
1028
+ MULTISWAP = QuantumFunctionDeclaration.parse_raw(
415
1029
  """{
416
- "name": "grover_diffuser",
1030
+ "source_ref": null,
1031
+ "name": "multiswap",
417
1032
  "param_decls": {},
418
1033
  "port_declarations": {
419
- "packed_vars": {
420
- "name": "packed_vars",
1034
+ "x": {
1035
+ "name": "x",
421
1036
  "quantum_type": {
422
- "length": null,
423
- "kind": "qvec"
1037
+ "kind": "qvec",
1038
+ "length": null
1039
+ },
1040
+ "direction": "inout"
1041
+ },
1042
+ "y": {
1043
+ "name": "y",
1044
+ "quantum_type": {
1045
+ "kind": "qvec",
1046
+ "length": null
424
1047
  },
425
1048
  "direction": "inout"
426
1049
  }
427
1050
  },
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
- },
1051
+ "operand_declarations": {},
444
1052
  "positional_arg_declarations": [
445
1053
  {
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
1054
+ "name": "x",
1055
+ "quantum_type": {
1056
+ "kind": "qvec",
1057
+ "length": null
1058
+ },
1059
+ "direction": "inout"
458
1060
  },
459
1061
  {
460
- "name": "packed_vars",
1062
+ "name": "y",
461
1063
  "quantum_type": {
462
- "length": null,
463
- "kind": "qvec"
1064
+ "kind": "qvec",
1065
+ "length": null
464
1066
  },
465
1067
  "direction": "inout"
466
1068
  }
@@ -468,84 +1070,75 @@ GROVER_DIFFUSER = QuantumFunctionDeclaration.parse_raw(
468
1070
  }"""
469
1071
  )
470
1072
 
471
- GROVER_OPERATOR = QuantumFunctionDeclaration.parse_raw(
1073
+ INPLACE_C_MODULAR_MULTIPLY = QuantumFunctionDeclaration.parse_raw(
472
1074
  """{
473
- "name": "grover_operator",
474
- "param_decls": {},
1075
+ "source_ref": null,
1076
+ "name": "inplace_c_modular_multiply",
1077
+ "param_decls": {
1078
+ "n": {
1079
+ "kind": "int"
1080
+ },
1081
+ "a": {
1082
+ "kind": "int"
1083
+ }
1084
+ },
475
1085
  "port_declarations": {
476
- "packed_vars": {
477
- "name": "packed_vars",
1086
+ "x": {
1087
+ "name": "x",
478
1088
  "quantum_type": {
479
- "length": null,
480
- "kind": "qvec"
1089
+ "kind": "qvec",
1090
+ "length": null
481
1091
  },
482
1092
  "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
1093
  },
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
1094
+ "ctrl": {
1095
+ "name": "ctrl",
1096
+ "quantum_type": {
1097
+ "kind": "qbit"
1098
+ },
1099
+ "direction": "inout"
1100
+ },
1101
+ "aux": {
1102
+ "name": "aux",
1103
+ "quantum_type": {
1104
+ "kind": "qbit"
1105
+ },
1106
+ "direction": "inout"
513
1107
  }
514
1108
  },
1109
+ "operand_declarations": {},
515
1110
  "positional_arg_declarations": [
516
1111
  {
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
1112
+ "name": "n",
1113
+ "classical_type": {
1114
+ "kind": "int"
1115
+ }
529
1116
  },
530
1117
  {
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
1118
+ "name": "a",
1119
+ "classical_type": {
1120
+ "kind": "int"
1121
+ }
543
1122
  },
544
1123
  {
545
- "name": "packed_vars",
1124
+ "name": "x",
1125
+ "quantum_type": {
1126
+ "kind": "qvec",
1127
+ "length": null
1128
+ },
1129
+ "direction": "inout"
1130
+ },
1131
+ {
1132
+ "name": "ctrl",
1133
+ "quantum_type": {
1134
+ "kind": "qbit"
1135
+ },
1136
+ "direction": "inout"
1137
+ },
1138
+ {
1139
+ "name": "aux",
546
1140
  "quantum_type": {
547
- "length": null,
548
- "kind": "qvec"
1141
+ "kind": "qbit"
549
1142
  },
550
1143
  "direction": "inout"
551
1144
  }
@@ -553,118 +1146,73 @@ GROVER_OPERATOR = QuantumFunctionDeclaration.parse_raw(
553
1146
  }"""
554
1147
  )
555
1148
 
556
- GROVER_SEARCH = QuantumFunctionDeclaration.parse_raw(
1149
+ MODULAR_EXP = QuantumFunctionDeclaration.parse_raw(
557
1150
  """{
558
- "name": "grover_search",
1151
+ "source_ref": null,
1152
+ "name": "modular_exp",
559
1153
  "param_decls": {
560
- "reps": {
1154
+ "n": {
1155
+ "kind": "int"
1156
+ },
1157
+ "a": {
561
1158
  "kind": "int"
562
1159
  }
563
1160
  },
564
1161
  "port_declarations": {
565
- "packed_vars": {
566
- "name": "packed_vars",
1162
+ "x": {
1163
+ "name": "x",
567
1164
  "quantum_type": {
568
- "length": null,
569
- "kind": "qvec"
1165
+ "kind": "qvec",
1166
+ "length": null
1167
+ },
1168
+ "direction": "inout"
1169
+ },
1170
+ "power": {
1171
+ "name": "power",
1172
+ "quantum_type": {
1173
+ "kind": "qvec",
1174
+ "length": null
570
1175
  },
571
1176
  "direction": "inout"
572
1177
  }
573
1178
  },
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
- },
1179
+ "operand_declarations": {},
590
1180
  "positional_arg_declarations": [
591
1181
  {
592
- "name": "reps",
1182
+ "name": "n",
593
1183
  "classical_type": {
594
1184
  "kind": "int"
595
1185
  }
596
1186
  },
597
1187
  {
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
1188
+ "name": "a",
1189
+ "classical_type": {
1190
+ "kind": "int"
1191
+ }
610
1192
  },
611
1193
  {
612
- "name": "packed_vars",
1194
+ "name": "x",
613
1195
  "quantum_type": {
614
- "length": null,
615
- "kind": "qvec"
1196
+ "kind": "qvec",
1197
+ "length": null
616
1198
  },
617
1199
  "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",
1200
+ },
1201
+ {
1202
+ "name": "power",
1203
+ "quantum_type": {
1204
+ "kind": "qvec",
1205
+ "length": null
1206
+ },
645
1207
  "direction": "inout"
646
1208
  }
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": []
1209
+ ]
663
1210
  }"""
664
1211
  )
665
1212
 
666
1213
  ALLOCATE_NUM = QuantumFunctionDeclaration.parse_raw(
667
1214
  """{
1215
+ "source_ref": null,
668
1216
  "name": "allocate_num",
669
1217
  "param_decls": {
670
1218
  "num_qubits": {
@@ -702,6 +1250,7 @@ ALLOCATE_NUM = QuantumFunctionDeclaration.parse_raw(
702
1250
 
703
1251
  QAOA_MIXER_LAYER = QuantumFunctionDeclaration.parse_raw(
704
1252
  """{
1253
+ "source_ref": null,
705
1254
  "name": "qaoa_mixer_layer",
706
1255
  "param_decls": {
707
1256
  "b": {
@@ -721,6 +1270,7 @@ QAOA_MIXER_LAYER = QuantumFunctionDeclaration.parse_raw(
721
1270
 
722
1271
  QAOA_COST_LAYER = QuantumFunctionDeclaration.parse_raw(
723
1272
  """{
1273
+ "source_ref": null,
724
1274
  "name": "qaoa_cost_layer",
725
1275
  "param_decls": {
726
1276
  "g": {
@@ -747,6 +1297,7 @@ QAOA_COST_LAYER = QuantumFunctionDeclaration.parse_raw(
747
1297
 
748
1298
  QAOA_LAYER = QuantumFunctionDeclaration.parse_raw(
749
1299
  """{
1300
+ "source_ref": null,
750
1301
  "name": "qaoa_layer",
751
1302
  "param_decls": {
752
1303
  "g": {
@@ -776,6 +1327,7 @@ QAOA_LAYER = QuantumFunctionDeclaration.parse_raw(
776
1327
 
777
1328
  QAOA_INIT = QuantumFunctionDeclaration.parse_raw(
778
1329
  """{
1330
+ "source_ref": null,
779
1331
  "name": "qaoa_init",
780
1332
  "param_decls": {},
781
1333
  "port_declarations": {
@@ -791,6 +1343,7 @@ QAOA_INIT = QuantumFunctionDeclaration.parse_raw(
791
1343
 
792
1344
  QAOA_PENALTY = QuantumFunctionDeclaration.parse_raw(
793
1345
  """{
1346
+ "source_ref": null,
794
1347
  "name": "qaoa_penalty",
795
1348
  "param_decls": {
796
1349
  "num_qubits": {
@@ -826,6 +1379,7 @@ QAOA_PENALTY = QuantumFunctionDeclaration.parse_raw(
826
1379
 
827
1380
  FULL_HEA = QuantumFunctionDeclaration.parse_raw(
828
1381
  """{
1382
+ "source_ref": null,
829
1383
  "name": "full_hea",
830
1384
  "param_decls": {
831
1385
  "num_qubits": {
@@ -916,22 +1470,23 @@ FULL_HEA = QuantumFunctionDeclaration.parse_raw(
916
1470
 
917
1471
  SWAP_TEST = QuantumFunctionDeclaration.parse_raw(
918
1472
  """{
1473
+ "source_ref": null,
919
1474
  "name": "swap_test",
920
1475
  "param_decls": {},
921
1476
  "port_declarations": {
922
1477
  "state1": {
923
1478
  "name": "state1",
924
1479
  "quantum_type": {
925
- "length": null,
926
- "kind": "qvec"
1480
+ "kind": "qvec",
1481
+ "length": null
927
1482
  },
928
1483
  "direction": "inout"
929
1484
  },
930
1485
  "state2": {
931
1486
  "name": "state2",
932
1487
  "quantum_type": {
933
- "length": null,
934
- "kind": "qvec"
1488
+ "kind": "qvec",
1489
+ "length": null
935
1490
  },
936
1491
  "direction": "inout"
937
1492
  },
@@ -948,16 +1503,16 @@ SWAP_TEST = QuantumFunctionDeclaration.parse_raw(
948
1503
  {
949
1504
  "name": "state1",
950
1505
  "quantum_type": {
951
- "length": null,
952
- "kind": "qvec"
1506
+ "kind": "qvec",
1507
+ "length": null
953
1508
  },
954
1509
  "direction": "inout"
955
1510
  },
956
1511
  {
957
1512
  "name": "state2",
958
1513
  "quantum_type": {
959
- "length": null,
960
- "kind": "qvec"
1514
+ "kind": "qvec",
1515
+ "length": null
961
1516
  },
962
1517
  "direction": "inout"
963
1518
  },
@@ -974,6 +1529,7 @@ SWAP_TEST = QuantumFunctionDeclaration.parse_raw(
974
1529
 
975
1530
  PREPARE_GHZ_STATE = QuantumFunctionDeclaration.parse_raw(
976
1531
  """{
1532
+ "source_ref": null,
977
1533
  "name": "prepare_ghz_state",
978
1534
  "param_decls": {
979
1535
  "size": {
@@ -984,8 +1540,8 @@ PREPARE_GHZ_STATE = QuantumFunctionDeclaration.parse_raw(
984
1540
  "q": {
985
1541
  "name": "q",
986
1542
  "quantum_type": {
987
- "length": null,
988
- "kind": "qvec"
1543
+ "kind": "qvec",
1544
+ "length": null
989
1545
  },
990
1546
  "direction": "output"
991
1547
  }
@@ -1001,8 +1557,8 @@ PREPARE_GHZ_STATE = QuantumFunctionDeclaration.parse_raw(
1001
1557
  {
1002
1558
  "name": "q",
1003
1559
  "quantum_type": {
1004
- "length": null,
1005
- "kind": "qvec"
1560
+ "kind": "qvec",
1561
+ "length": null
1006
1562
  },
1007
1563
  "direction": "output"
1008
1564
  }
@@ -1012,6 +1568,7 @@ PREPARE_GHZ_STATE = QuantumFunctionDeclaration.parse_raw(
1012
1568
 
1013
1569
  PREPARE_EXPONENTIAL_STATE = QuantumFunctionDeclaration.parse_raw(
1014
1570
  """{
1571
+ "source_ref": null,
1015
1572
  "name": "prepare_exponential_state",
1016
1573
  "param_decls": {
1017
1574
  "rate": {
@@ -1022,8 +1579,8 @@ PREPARE_EXPONENTIAL_STATE = QuantumFunctionDeclaration.parse_raw(
1022
1579
  "q": {
1023
1580
  "name": "q",
1024
1581
  "quantum_type": {
1025
- "length": null,
1026
- "kind": "qvec"
1582
+ "kind": "qvec",
1583
+ "length": null
1027
1584
  },
1028
1585
  "direction": "inout"
1029
1586
  }
@@ -1039,8 +1596,8 @@ PREPARE_EXPONENTIAL_STATE = QuantumFunctionDeclaration.parse_raw(
1039
1596
  {
1040
1597
  "name": "q",
1041
1598
  "quantum_type": {
1042
- "length": null,
1043
- "kind": "qvec"
1599
+ "kind": "qvec",
1600
+ "length": null
1044
1601
  },
1045
1602
  "direction": "inout"
1046
1603
  }
@@ -1050,6 +1607,7 @@ PREPARE_EXPONENTIAL_STATE = QuantumFunctionDeclaration.parse_raw(
1050
1607
 
1051
1608
  PREPARE_BELL_STATE = QuantumFunctionDeclaration.parse_raw(
1052
1609
  """{
1610
+ "source_ref": null,
1053
1611
  "name": "prepare_bell_state",
1054
1612
  "param_decls": {
1055
1613
  "state_num": {
@@ -1060,10 +1618,10 @@ PREPARE_BELL_STATE = QuantumFunctionDeclaration.parse_raw(
1060
1618
  "q": {
1061
1619
  "name": "q",
1062
1620
  "quantum_type": {
1621
+ "kind": "qvec",
1063
1622
  "length": {
1064
1623
  "expr": "2"
1065
- },
1066
- "kind": "qvec"
1624
+ }
1067
1625
  },
1068
1626
  "direction": "output"
1069
1627
  }
@@ -1079,10 +1637,10 @@ PREPARE_BELL_STATE = QuantumFunctionDeclaration.parse_raw(
1079
1637
  {
1080
1638
  "name": "q",
1081
1639
  "quantum_type": {
1640
+ "kind": "qvec",
1082
1641
  "length": {
1083
1642
  "expr": "2"
1084
- },
1085
- "kind": "qvec"
1643
+ }
1086
1644
  },
1087
1645
  "direction": "output"
1088
1646
  }
@@ -1092,6 +1650,7 @@ PREPARE_BELL_STATE = QuantumFunctionDeclaration.parse_raw(
1092
1650
 
1093
1651
  INPLACE_PREPARE_INT = QuantumFunctionDeclaration.parse_raw(
1094
1652
  """{
1653
+ "source_ref": null,
1095
1654
  "name": "inplace_prepare_int",
1096
1655
  "param_decls": {
1097
1656
  "value": {
@@ -1102,8 +1661,8 @@ INPLACE_PREPARE_INT = QuantumFunctionDeclaration.parse_raw(
1102
1661
  "target": {
1103
1662
  "name": "target",
1104
1663
  "quantum_type": {
1105
- "length": null,
1106
- "kind": "qvec"
1664
+ "kind": "qvec",
1665
+ "length": null
1107
1666
  },
1108
1667
  "direction": "inout"
1109
1668
  }
@@ -1119,8 +1678,8 @@ INPLACE_PREPARE_INT = QuantumFunctionDeclaration.parse_raw(
1119
1678
  {
1120
1679
  "name": "target",
1121
1680
  "quantum_type": {
1122
- "length": null,
1123
- "kind": "qvec"
1681
+ "kind": "qvec",
1682
+ "length": null
1124
1683
  },
1125
1684
  "direction": "inout"
1126
1685
  }
@@ -1130,6 +1689,7 @@ INPLACE_PREPARE_INT = QuantumFunctionDeclaration.parse_raw(
1130
1689
 
1131
1690
  PREPARE_INT = QuantumFunctionDeclaration.parse_raw(
1132
1691
  """{
1692
+ "source_ref": null,
1133
1693
  "name": "prepare_int",
1134
1694
  "param_decls": {
1135
1695
  "value": {
@@ -1166,6 +1726,7 @@ PREPARE_INT = QuantumFunctionDeclaration.parse_raw(
1166
1726
 
1167
1727
  SWITCH = QuantumFunctionDeclaration.parse_raw(
1168
1728
  """{
1729
+ "source_ref": null,
1169
1730
  "name": "switch",
1170
1731
  "param_decls": {
1171
1732
  "selector": {
@@ -1196,12 +1757,15 @@ SWITCH = QuantumFunctionDeclaration.parse_raw(
1196
1757
  }"""
1197
1758
  )
1198
1759
 
1760
+ OPEN_LIB_DECLS = [
1761
+ func for func in vars().values() if isinstance(func, QuantumFunctionDeclaration)
1762
+ ]
1763
+
1199
1764
  __all__ = [
1200
1765
  "QFT_STEP",
1201
1766
  "QFT",
1202
1767
  "QPE_FLEXIBLE",
1203
1768
  "QPE",
1204
- "STANDARD_QPE",
1205
1769
  "SINGLE_PAULI",
1206
1770
  "LINEAR_PAULI_ROTATIONS",
1207
1771
  "AMPLITUDE_ESTIMATION",
@@ -1212,6 +1776,15 @@ __all__ = [
1212
1776
  "GROVER_SEARCH",
1213
1777
  "HADAMARD_TRANSFORM",
1214
1778
  "APPLY_TO_ALL",
1779
+ "QFT_NO_SWAP",
1780
+ "_CHECK_MSB",
1781
+ "_CTRL_X",
1782
+ "QFT_SPACE_ADD_CONST",
1783
+ "CC_MODULAR_ADD",
1784
+ "C_MODULAR_MULTIPLY",
1785
+ "MULTISWAP",
1786
+ "INPLACE_C_MODULAR_MULTIPLY",
1787
+ "MODULAR_EXP",
1215
1788
  "ALLOCATE_NUM",
1216
1789
  "QAOA_MIXER_LAYER",
1217
1790
  "QAOA_COST_LAYER",
@@ -1226,4 +1799,5 @@ __all__ = [
1226
1799
  "INPLACE_PREPARE_INT",
1227
1800
  "PREPARE_INT",
1228
1801
  "SWITCH",
1802
+ "OPEN_LIB_DECLS",
1229
1803
  ]