classiq 0.45.1__py3-none-any.whl → 0.46.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.
Files changed (146) hide show
  1. classiq/__init__.py +0 -1
  2. classiq/_internals/__init__.py +20 -0
  3. classiq/_internals/authentication/authentication.py +11 -0
  4. classiq/analyzer/analyzer.py +12 -10
  5. classiq/applications/combinatorial_helpers/combinatorial_problem_utils.py +1 -1
  6. classiq/applications/combinatorial_helpers/pauli_helpers/pauli_utils.py +1 -1
  7. classiq/applications/combinatorial_optimization/combinatorial_optimization_model_constructor.py +1 -1
  8. classiq/applications/libraries/qmci_library.py +4 -9
  9. classiq/execution/execution_session.py +68 -7
  10. classiq/executor.py +14 -2
  11. classiq/interface/_version.py +1 -1
  12. classiq/interface/backend/backend_preferences.py +189 -0
  13. classiq/interface/backend/quantum_backend_providers.py +38 -0
  14. classiq/interface/debug_info/debug_info.py +22 -2
  15. classiq/interface/exceptions.py +16 -1
  16. classiq/interface/executor/execution_preferences.py +18 -0
  17. classiq/interface/generator/application_apis/chemistry_declarations.py +1 -177
  18. classiq/interface/generator/application_apis/combinatorial_optimization_declarations.py +0 -12
  19. classiq/interface/generator/application_apis/finance_declarations.py +8 -43
  20. classiq/interface/generator/application_apis/qsvm_declarations.py +0 -78
  21. classiq/interface/generator/builtin_api_builder.py +0 -3
  22. classiq/interface/generator/functions/__init__.py +0 -2
  23. classiq/interface/generator/functions/builtins/__init__.py +0 -15
  24. classiq/interface/generator/generated_circuit_data.py +2 -0
  25. classiq/interface/generator/hardware/hardware_data.py +37 -0
  26. classiq/interface/generator/model/constraints.py +18 -1
  27. classiq/interface/generator/model/preferences/preferences.py +53 -1
  28. classiq/interface/generator/model/quantum_register.py +1 -1
  29. classiq/interface/generator/quantum_program.py +10 -2
  30. classiq/interface/generator/transpiler_basis_gates.py +4 -0
  31. classiq/interface/generator/types/builtin_enum_declarations.py +136 -21
  32. classiq/interface/generator/types/enum_declaration.py +1 -3
  33. classiq/interface/generator/types/struct_declaration.py +1 -3
  34. classiq/interface/hardware.py +5 -0
  35. classiq/interface/ide/visual_model.py +1 -1
  36. classiq/interface/model/classical_parameter_declaration.py +6 -0
  37. classiq/interface/model/inplace_binary_operation.py +0 -14
  38. classiq/interface/model/model.py +1 -18
  39. classiq/interface/model/port_declaration.py +4 -2
  40. classiq/interface/model/quantum_function_declaration.py +19 -6
  41. classiq/interface/model/quantum_lambda_function.py +11 -1
  42. classiq/interface/model/quantum_variable_declaration.py +1 -1
  43. classiq/model_expansions/__init__.py +0 -0
  44. classiq/model_expansions/atomic_expression_functions_defs.py +250 -0
  45. classiq/model_expansions/capturing/__init__.py +0 -0
  46. classiq/model_expansions/capturing/captured_var_manager.py +50 -0
  47. classiq/model_expansions/capturing/mangling_utils.py +17 -0
  48. classiq/model_expansions/capturing/propagated_var_stack.py +180 -0
  49. classiq/model_expansions/closure.py +160 -0
  50. classiq/model_expansions/debug_flag.py +3 -0
  51. classiq/model_expansions/evaluators/__init__.py +0 -0
  52. classiq/model_expansions/evaluators/arg_type_match.py +160 -0
  53. classiq/model_expansions/evaluators/argument_types.py +42 -0
  54. classiq/model_expansions/evaluators/classical_expression.py +36 -0
  55. classiq/model_expansions/evaluators/control.py +144 -0
  56. classiq/model_expansions/evaluators/parameter_types.py +227 -0
  57. classiq/model_expansions/evaluators/quantum_type_utils.py +235 -0
  58. classiq/model_expansions/evaluators/type_type_match.py +90 -0
  59. classiq/model_expansions/expression_evaluator.py +125 -0
  60. classiq/model_expansions/expression_renamer.py +76 -0
  61. classiq/model_expansions/function_builder.py +192 -0
  62. classiq/model_expansions/generative_functions.py +101 -0
  63. classiq/model_expansions/interpreter.py +365 -0
  64. classiq/model_expansions/model_tables.py +105 -0
  65. classiq/model_expansions/quantum_operations/__init__.py +19 -0
  66. classiq/model_expansions/quantum_operations/bind.py +64 -0
  67. classiq/model_expansions/quantum_operations/classicalif.py +39 -0
  68. classiq/model_expansions/quantum_operations/control.py +235 -0
  69. classiq/model_expansions/quantum_operations/emitter.py +215 -0
  70. classiq/model_expansions/quantum_operations/expression_operation.py +218 -0
  71. classiq/model_expansions/quantum_operations/inplace_binary_operation.py +250 -0
  72. classiq/model_expansions/quantum_operations/invert.py +38 -0
  73. classiq/model_expansions/quantum_operations/power.py +74 -0
  74. classiq/model_expansions/quantum_operations/quantum_assignment_operation.py +174 -0
  75. classiq/model_expansions/quantum_operations/quantum_function_call.py +15 -0
  76. classiq/model_expansions/quantum_operations/repeat.py +33 -0
  77. classiq/model_expansions/quantum_operations/variable_decleration.py +28 -0
  78. classiq/model_expansions/quantum_operations/within_apply.py +46 -0
  79. classiq/model_expansions/scope.py +226 -0
  80. classiq/model_expansions/scope_initialization.py +136 -0
  81. classiq/model_expansions/sympy_conversion/__init__.py +0 -0
  82. classiq/model_expansions/sympy_conversion/arithmetics.py +49 -0
  83. classiq/model_expansions/sympy_conversion/expression_to_sympy.py +150 -0
  84. classiq/model_expansions/sympy_conversion/sympy_to_python.py +113 -0
  85. classiq/model_expansions/utils/__init__.py +0 -0
  86. classiq/model_expansions/utils/counted_name_allocator.py +11 -0
  87. classiq/model_expansions/visitors/__init__.py +0 -0
  88. classiq/model_expansions/visitors/boolean_expression_transformers.py +214 -0
  89. classiq/model_expansions/visitors/variable_references.py +115 -0
  90. classiq/qmod/__init__.py +1 -3
  91. classiq/qmod/builtins/enums.py +33 -2
  92. classiq/qmod/builtins/functions/__init__.py +251 -0
  93. classiq/qmod/builtins/functions/amplitude_estimation.py +27 -0
  94. classiq/qmod/builtins/functions/arithmetic.py +68 -0
  95. classiq/qmod/builtins/functions/benchmarking.py +8 -0
  96. classiq/qmod/builtins/functions/chemistry.py +91 -0
  97. classiq/qmod/builtins/functions/discrete_sine_cosine_transform.py +105 -0
  98. classiq/qmod/builtins/functions/exponentiation.py +111 -0
  99. classiq/qmod/builtins/functions/finance.py +34 -0
  100. classiq/qmod/builtins/functions/grover.py +178 -0
  101. classiq/qmod/builtins/functions/hea.py +59 -0
  102. classiq/qmod/builtins/functions/linear_pauli_rotation.py +65 -0
  103. classiq/qmod/builtins/functions/modular_exponentiation.py +137 -0
  104. classiq/qmod/builtins/functions/operators.py +22 -0
  105. classiq/qmod/builtins/functions/qaoa_penalty.py +116 -0
  106. classiq/qmod/builtins/functions/qft.py +23 -0
  107. classiq/qmod/builtins/functions/qpe.py +39 -0
  108. classiq/qmod/builtins/functions/qsvm.py +24 -0
  109. classiq/qmod/builtins/functions/qsvt.py +136 -0
  110. classiq/qmod/builtins/functions/standard_gates.py +739 -0
  111. classiq/qmod/builtins/functions/state_preparation.py +357 -0
  112. classiq/qmod/builtins/functions/swap_test.py +25 -0
  113. classiq/qmod/builtins/structs.py +50 -28
  114. classiq/qmod/cparam.py +64 -0
  115. classiq/qmod/create_model_function.py +190 -0
  116. classiq/qmod/declaration_inferrer.py +52 -81
  117. classiq/qmod/expression_query.py +16 -0
  118. classiq/qmod/generative.py +48 -0
  119. classiq/qmod/model_state_container.py +1 -2
  120. classiq/qmod/native/pretty_printer.py +7 -11
  121. classiq/qmod/pretty_print/pretty_printer.py +7 -11
  122. classiq/qmod/python_classical_type.py +67 -0
  123. classiq/qmod/qfunc.py +19 -4
  124. classiq/qmod/qmod_parameter.py +15 -64
  125. classiq/qmod/qmod_variable.py +27 -45
  126. classiq/qmod/quantum_callable.py +1 -1
  127. classiq/qmod/quantum_expandable.py +10 -4
  128. classiq/qmod/quantum_function.py +22 -40
  129. classiq/qmod/semantics/error_manager.py +22 -10
  130. classiq/qmod/semantics/static_semantics_visitor.py +10 -12
  131. classiq/qmod/semantics/validation/types_validation.py +6 -7
  132. classiq/qmod/utilities.py +2 -2
  133. classiq/qmod/write_qmod.py +14 -0
  134. classiq/show.py +10 -0
  135. classiq/synthesis.py +46 -2
  136. {classiq-0.45.1.dist-info → classiq-0.46.1.dist-info}/METADATA +1 -1
  137. {classiq-0.45.1.dist-info → classiq-0.46.1.dist-info}/RECORD +138 -74
  138. classiq/interface/generator/functions/builtins/core_library/__init__.py +0 -16
  139. classiq/interface/generator/functions/builtins/core_library/atomic_quantum_functions.py +0 -710
  140. classiq/interface/generator/functions/builtins/core_library/exponentiation_functions.py +0 -105
  141. classiq/interface/generator/functions/builtins/open_lib_functions.py +0 -2489
  142. classiq/interface/generator/functions/builtins/quantum_operators.py +0 -24
  143. classiq/interface/generator/types/builtin_struct_declarations/__init__.py +0 -1
  144. classiq/interface/generator/types/builtin_struct_declarations/pauli_struct_declarations.py +0 -21
  145. classiq/qmod/builtins/functions.py +0 -1029
  146. {classiq-0.45.1.dist-info → classiq-0.46.1.dist-info}/WHEEL +0 -0
@@ -1,2489 +0,0 @@
1
- # This file is auto generated by `generate_declarations.py`. #AUTOGENERATED
2
-
3
- from classiq.interface.model.quantum_function_declaration import (
4
- NamedParamsQuantumFunctionDeclaration,
5
- )
6
-
7
- QPE_FLEXIBLE = NamedParamsQuantumFunctionDeclaration.parse_raw(
8
- """{
9
- "source_ref": null,
10
- "name": "qpe_flexible",
11
- "positional_arg_declarations": [
12
- {
13
- "source_ref": null,
14
- "name": "unitary_with_power",
15
- "positional_arg_declarations": [
16
- {
17
- "source_ref": null,
18
- "name": null,
19
- "kind": "ClassicalParameterDeclaration",
20
- "classical_type": {
21
- "source_ref": null,
22
- "kind": "int"
23
- }
24
- }
25
- ],
26
- "kind": "QuantumOperandDeclaration",
27
- "is_list": false
28
- },
29
- {
30
- "source_ref": null,
31
- "name": "phase",
32
- "kind": "PortDeclaration",
33
- "quantum_type": {
34
- "source_ref": null,
35
- "kind": "qnum",
36
- "size": null,
37
- "is_signed": null,
38
- "fraction_digits": null
39
- },
40
- "size": null,
41
- "direction": "inout"
42
- }
43
- ]
44
- }"""
45
- )
46
-
47
- QPE = NamedParamsQuantumFunctionDeclaration.parse_raw(
48
- """{
49
- "source_ref": null,
50
- "name": "qpe",
51
- "positional_arg_declarations": [
52
- {
53
- "source_ref": null,
54
- "name": "unitary",
55
- "positional_arg_declarations": [],
56
- "kind": "QuantumOperandDeclaration",
57
- "is_list": false
58
- },
59
- {
60
- "source_ref": null,
61
- "name": "phase",
62
- "kind": "PortDeclaration",
63
- "quantum_type": {
64
- "source_ref": null,
65
- "kind": "qnum",
66
- "size": null,
67
- "is_signed": null,
68
- "fraction_digits": null
69
- },
70
- "size": null,
71
- "direction": "inout"
72
- }
73
- ]
74
- }"""
75
- )
76
-
77
- SINGLE_PAULI = NamedParamsQuantumFunctionDeclaration.parse_raw(
78
- """{
79
- "source_ref": null,
80
- "name": "single_pauli",
81
- "positional_arg_declarations": [
82
- {
83
- "name": "slope",
84
- "kind": "ClassicalParameterDeclaration",
85
- "classical_type": {
86
- "kind": "real"
87
- }
88
- },
89
- {
90
- "name": "offset",
91
- "kind": "ClassicalParameterDeclaration",
92
- "classical_type": {
93
- "kind": "real"
94
- }
95
- },
96
- {
97
- "name": "q1_qfunc",
98
- "positional_arg_declarations": [
99
- {
100
- "name": "theta",
101
- "kind": "ClassicalParameterDeclaration",
102
- "classical_type": {
103
- "kind": "real"
104
- }
105
- },
106
- {
107
- "name": "target",
108
- "kind": "PortDeclaration",
109
- "size": {
110
- "expr": "1"
111
- },
112
- "direction": "inout"
113
- }
114
- ],
115
- "kind": "QuantumOperandDeclaration"
116
- },
117
- {
118
- "name": "x",
119
- "kind": "PortDeclaration",
120
- "direction": "inout"
121
- },
122
- {
123
- "name": "q",
124
- "kind": "PortDeclaration",
125
- "size": {
126
- "expr": "1"
127
- },
128
- "direction": "inout"
129
- }
130
- ]
131
- }"""
132
- )
133
-
134
- LINEAR_PAULI_ROTATIONS = NamedParamsQuantumFunctionDeclaration.parse_raw(
135
- """{
136
- "source_ref": null,
137
- "name": "linear_pauli_rotations",
138
- "positional_arg_declarations": [
139
- {
140
- "name": "bases",
141
- "kind": "ClassicalParameterDeclaration",
142
- "classical_type": {
143
- "kind": "list",
144
- "element_type": {
145
- "kind": "struct_instance",
146
- "name": "Pauli"
147
- }
148
- }
149
- },
150
- {
151
- "name": "slopes",
152
- "kind": "ClassicalParameterDeclaration",
153
- "classical_type": {
154
- "kind": "list",
155
- "element_type": {
156
- "kind": "real"
157
- }
158
- }
159
- },
160
- {
161
- "name": "offsets",
162
- "kind": "ClassicalParameterDeclaration",
163
- "classical_type": {
164
- "kind": "list",
165
- "element_type": {
166
- "kind": "real"
167
- }
168
- }
169
- },
170
- {
171
- "name": "x",
172
- "kind": "PortDeclaration",
173
- "direction": "inout"
174
- },
175
- {
176
- "name": "q",
177
- "kind": "PortDeclaration",
178
- "direction": "inout"
179
- }
180
- ]
181
- }"""
182
- )
183
-
184
- AMPLITUDE_ESTIMATION = NamedParamsQuantumFunctionDeclaration.parse_raw(
185
- """{
186
- "source_ref": null,
187
- "name": "amplitude_estimation",
188
- "positional_arg_declarations": [
189
- {
190
- "source_ref": null,
191
- "name": "oracle",
192
- "positional_arg_declarations": [
193
- {
194
- "source_ref": null,
195
- "name": null,
196
- "kind": "PortDeclaration",
197
- "quantum_type": {
198
- "source_ref": null,
199
- "kind": "qvec",
200
- "element_type": {
201
- "source_ref": null,
202
- "kind": "qbit"
203
- },
204
- "length": null
205
- },
206
- "size": null,
207
- "direction": "inout"
208
- }
209
- ],
210
- "kind": "QuantumOperandDeclaration",
211
- "is_list": false
212
- },
213
- {
214
- "source_ref": null,
215
- "name": "space_transform",
216
- "positional_arg_declarations": [
217
- {
218
- "source_ref": null,
219
- "name": null,
220
- "kind": "PortDeclaration",
221
- "quantum_type": {
222
- "source_ref": null,
223
- "kind": "qvec",
224
- "element_type": {
225
- "source_ref": null,
226
- "kind": "qbit"
227
- },
228
- "length": null
229
- },
230
- "size": null,
231
- "direction": "inout"
232
- }
233
- ],
234
- "kind": "QuantumOperandDeclaration",
235
- "is_list": false
236
- },
237
- {
238
- "source_ref": null,
239
- "name": "phase",
240
- "kind": "PortDeclaration",
241
- "quantum_type": {
242
- "source_ref": null,
243
- "kind": "qnum",
244
- "size": null,
245
- "is_signed": null,
246
- "fraction_digits": null
247
- },
248
- "size": null,
249
- "direction": "inout"
250
- },
251
- {
252
- "source_ref": null,
253
- "name": "packed_vars",
254
- "kind": "PortDeclaration",
255
- "quantum_type": {
256
- "source_ref": null,
257
- "kind": "qvec",
258
- "element_type": {
259
- "source_ref": null,
260
- "kind": "qbit"
261
- },
262
- "length": null
263
- },
264
- "size": null,
265
- "direction": "inout"
266
- }
267
- ]
268
- }"""
269
- )
270
-
271
- PHASE_ORACLE = NamedParamsQuantumFunctionDeclaration.parse_raw(
272
- """{
273
- "source_ref": null,
274
- "name": "phase_oracle",
275
- "positional_arg_declarations": [
276
- {
277
- "source_ref": null,
278
- "name": "predicate",
279
- "positional_arg_declarations": [
280
- {
281
- "source_ref": null,
282
- "name": null,
283
- "kind": "PortDeclaration",
284
- "quantum_type": {
285
- "source_ref": null,
286
- "kind": "qvec",
287
- "element_type": {
288
- "source_ref": null,
289
- "kind": "qbit"
290
- },
291
- "length": null
292
- },
293
- "size": null,
294
- "direction": "inout"
295
- },
296
- {
297
- "source_ref": null,
298
- "name": null,
299
- "kind": "PortDeclaration",
300
- "quantum_type": {
301
- "source_ref": null,
302
- "kind": "qbit"
303
- },
304
- "size": null,
305
- "direction": "inout"
306
- }
307
- ],
308
- "kind": "QuantumOperandDeclaration",
309
- "is_list": false
310
- },
311
- {
312
- "source_ref": null,
313
- "name": "target",
314
- "kind": "PortDeclaration",
315
- "quantum_type": {
316
- "source_ref": null,
317
- "kind": "qvec",
318
- "element_type": {
319
- "source_ref": null,
320
- "kind": "qbit"
321
- },
322
- "length": null
323
- },
324
- "size": null,
325
- "direction": "inout"
326
- }
327
- ]
328
- }"""
329
- )
330
-
331
- REFLECT_ABOUT_ZERO = NamedParamsQuantumFunctionDeclaration.parse_raw(
332
- """{
333
- "source_ref": null,
334
- "name": "reflect_about_zero",
335
- "positional_arg_declarations": [
336
- {
337
- "source_ref": null,
338
- "name": "packed_vars",
339
- "kind": "PortDeclaration",
340
- "quantum_type": {
341
- "source_ref": null,
342
- "kind": "qvec",
343
- "element_type": {
344
- "source_ref": null,
345
- "kind": "qbit"
346
- },
347
- "length": null
348
- },
349
- "size": null,
350
- "direction": "inout"
351
- }
352
- ]
353
- }"""
354
- )
355
-
356
- GROVER_DIFFUSER = NamedParamsQuantumFunctionDeclaration.parse_raw(
357
- """{
358
- "source_ref": null,
359
- "name": "grover_diffuser",
360
- "positional_arg_declarations": [
361
- {
362
- "source_ref": null,
363
- "name": "space_transform",
364
- "positional_arg_declarations": [
365
- {
366
- "source_ref": null,
367
- "name": null,
368
- "kind": "PortDeclaration",
369
- "quantum_type": {
370
- "source_ref": null,
371
- "kind": "qvec",
372
- "element_type": {
373
- "source_ref": null,
374
- "kind": "qbit"
375
- },
376
- "length": null
377
- },
378
- "size": null,
379
- "direction": "inout"
380
- }
381
- ],
382
- "kind": "QuantumOperandDeclaration",
383
- "is_list": false
384
- },
385
- {
386
- "source_ref": null,
387
- "name": "packed_vars",
388
- "kind": "PortDeclaration",
389
- "quantum_type": {
390
- "source_ref": null,
391
- "kind": "qvec",
392
- "element_type": {
393
- "source_ref": null,
394
- "kind": "qbit"
395
- },
396
- "length": null
397
- },
398
- "size": null,
399
- "direction": "inout"
400
- }
401
- ]
402
- }"""
403
- )
404
-
405
- GROVER_OPERATOR = NamedParamsQuantumFunctionDeclaration.parse_raw(
406
- """{
407
- "source_ref": null,
408
- "name": "grover_operator",
409
- "positional_arg_declarations": [
410
- {
411
- "source_ref": null,
412
- "name": "oracle",
413
- "positional_arg_declarations": [
414
- {
415
- "source_ref": null,
416
- "name": null,
417
- "kind": "PortDeclaration",
418
- "quantum_type": {
419
- "source_ref": null,
420
- "kind": "qvec",
421
- "element_type": {
422
- "source_ref": null,
423
- "kind": "qbit"
424
- },
425
- "length": null
426
- },
427
- "size": null,
428
- "direction": "inout"
429
- }
430
- ],
431
- "kind": "QuantumOperandDeclaration",
432
- "is_list": false
433
- },
434
- {
435
- "source_ref": null,
436
- "name": "space_transform",
437
- "positional_arg_declarations": [
438
- {
439
- "source_ref": null,
440
- "name": null,
441
- "kind": "PortDeclaration",
442
- "quantum_type": {
443
- "source_ref": null,
444
- "kind": "qvec",
445
- "element_type": {
446
- "source_ref": null,
447
- "kind": "qbit"
448
- },
449
- "length": null
450
- },
451
- "size": null,
452
- "direction": "inout"
453
- }
454
- ],
455
- "kind": "QuantumOperandDeclaration",
456
- "is_list": false
457
- },
458
- {
459
- "source_ref": null,
460
- "name": "packed_vars",
461
- "kind": "PortDeclaration",
462
- "quantum_type": {
463
- "source_ref": null,
464
- "kind": "qvec",
465
- "element_type": {
466
- "source_ref": null,
467
- "kind": "qbit"
468
- },
469
- "length": null
470
- },
471
- "size": null,
472
- "direction": "inout"
473
- }
474
- ]
475
- }"""
476
- )
477
-
478
- GROVER_SEARCH = NamedParamsQuantumFunctionDeclaration.parse_raw(
479
- """{
480
- "source_ref": null,
481
- "name": "grover_search",
482
- "positional_arg_declarations": [
483
- {
484
- "source_ref": null,
485
- "name": "reps",
486
- "kind": "ClassicalParameterDeclaration",
487
- "classical_type": {
488
- "source_ref": null,
489
- "kind": "int"
490
- }
491
- },
492
- {
493
- "source_ref": null,
494
- "name": "oracle",
495
- "positional_arg_declarations": [
496
- {
497
- "source_ref": null,
498
- "name": null,
499
- "kind": "PortDeclaration",
500
- "quantum_type": {
501
- "source_ref": null,
502
- "kind": "qvec",
503
- "element_type": {
504
- "source_ref": null,
505
- "kind": "qbit"
506
- },
507
- "length": null
508
- },
509
- "size": null,
510
- "direction": "inout"
511
- }
512
- ],
513
- "kind": "QuantumOperandDeclaration",
514
- "is_list": false
515
- },
516
- {
517
- "source_ref": null,
518
- "name": "packed_vars",
519
- "kind": "PortDeclaration",
520
- "quantum_type": {
521
- "source_ref": null,
522
- "kind": "qvec",
523
- "element_type": {
524
- "source_ref": null,
525
- "kind": "qbit"
526
- },
527
- "length": null
528
- },
529
- "size": null,
530
- "direction": "inout"
531
- }
532
- ]
533
- }"""
534
- )
535
-
536
- HADAMARD_TRANSFORM = NamedParamsQuantumFunctionDeclaration.parse_raw(
537
- """{
538
- "source_ref": null,
539
- "name": "hadamard_transform",
540
- "positional_arg_declarations": [
541
- {
542
- "name": "target",
543
- "kind": "PortDeclaration",
544
- "direction": "inout"
545
- }
546
- ]
547
- }"""
548
- )
549
-
550
- APPLY_TO_ALL = NamedParamsQuantumFunctionDeclaration.parse_raw(
551
- """{
552
- "source_ref": null,
553
- "name": "apply_to_all",
554
- "positional_arg_declarations": [
555
- {
556
- "name": "gate_operand",
557
- "positional_arg_declarations": [
558
- {
559
- "name": "target",
560
- "kind": "PortDeclaration",
561
- "size": {
562
- "expr": "1"
563
- },
564
- "direction": "inout"
565
- }
566
- ],
567
- "kind": "QuantumOperandDeclaration"
568
- },
569
- {
570
- "name": "target",
571
- "kind": "PortDeclaration",
572
- "direction": "inout"
573
- }
574
- ]
575
- }"""
576
- )
577
-
578
- QFT_NO_SWAP = NamedParamsQuantumFunctionDeclaration.parse_raw(
579
- """{
580
- "source_ref": null,
581
- "name": "qft_no_swap",
582
- "positional_arg_declarations": [
583
- {
584
- "source_ref": null,
585
- "name": "qbv",
586
- "kind": "PortDeclaration",
587
- "quantum_type": {
588
- "source_ref": null,
589
- "kind": "qvec",
590
- "element_type": {
591
- "source_ref": null,
592
- "kind": "qbit"
593
- },
594
- "length": null
595
- },
596
- "size": null,
597
- "direction": "inout"
598
- }
599
- ]
600
- }"""
601
- )
602
-
603
- _CHECK_MSB = NamedParamsQuantumFunctionDeclaration.parse_raw(
604
- """{
605
- "source_ref": null,
606
- "name": "_check_msb",
607
- "positional_arg_declarations": [
608
- {
609
- "source_ref": null,
610
- "name": "ref",
611
- "kind": "ClassicalParameterDeclaration",
612
- "classical_type": {
613
- "source_ref": null,
614
- "kind": "int"
615
- }
616
- },
617
- {
618
- "source_ref": null,
619
- "name": "x",
620
- "kind": "PortDeclaration",
621
- "quantum_type": {
622
- "source_ref": null,
623
- "kind": "qvec",
624
- "element_type": {
625
- "source_ref": null,
626
- "kind": "qbit"
627
- },
628
- "length": null
629
- },
630
- "size": null,
631
- "direction": "inout"
632
- },
633
- {
634
- "source_ref": null,
635
- "name": "aux",
636
- "kind": "PortDeclaration",
637
- "quantum_type": {
638
- "source_ref": null,
639
- "kind": "qbit"
640
- },
641
- "size": null,
642
- "direction": "inout"
643
- }
644
- ]
645
- }"""
646
- )
647
-
648
- _CTRL_X = NamedParamsQuantumFunctionDeclaration.parse_raw(
649
- """{
650
- "source_ref": null,
651
- "name": "_ctrl_x",
652
- "positional_arg_declarations": [
653
- {
654
- "source_ref": null,
655
- "name": "ref",
656
- "kind": "ClassicalParameterDeclaration",
657
- "classical_type": {
658
- "source_ref": null,
659
- "kind": "int"
660
- }
661
- },
662
- {
663
- "source_ref": null,
664
- "name": "ctrl",
665
- "kind": "PortDeclaration",
666
- "quantum_type": {
667
- "source_ref": null,
668
- "kind": "qnum",
669
- "size": null,
670
- "is_signed": null,
671
- "fraction_digits": null
672
- },
673
- "size": null,
674
- "direction": "inout"
675
- },
676
- {
677
- "source_ref": null,
678
- "name": "aux",
679
- "kind": "PortDeclaration",
680
- "quantum_type": {
681
- "source_ref": null,
682
- "kind": "qbit"
683
- },
684
- "size": null,
685
- "direction": "inout"
686
- }
687
- ]
688
- }"""
689
- )
690
-
691
- QFT_SPACE_ADD_CONST = NamedParamsQuantumFunctionDeclaration.parse_raw(
692
- """{
693
- "source_ref": null,
694
- "name": "qft_space_add_const",
695
- "positional_arg_declarations": [
696
- {
697
- "source_ref": null,
698
- "name": "value",
699
- "kind": "ClassicalParameterDeclaration",
700
- "classical_type": {
701
- "source_ref": null,
702
- "kind": "int"
703
- }
704
- },
705
- {
706
- "source_ref": null,
707
- "name": "phi_b",
708
- "kind": "PortDeclaration",
709
- "quantum_type": {
710
- "source_ref": null,
711
- "kind": "qvec",
712
- "element_type": {
713
- "source_ref": null,
714
- "kind": "qbit"
715
- },
716
- "length": null
717
- },
718
- "size": null,
719
- "direction": "inout"
720
- }
721
- ]
722
- }"""
723
- )
724
-
725
- CC_MODULAR_ADD = NamedParamsQuantumFunctionDeclaration.parse_raw(
726
- """{
727
- "source_ref": null,
728
- "name": "cc_modular_add",
729
- "positional_arg_declarations": [
730
- {
731
- "source_ref": null,
732
- "name": "n",
733
- "kind": "ClassicalParameterDeclaration",
734
- "classical_type": {
735
- "source_ref": null,
736
- "kind": "int"
737
- }
738
- },
739
- {
740
- "source_ref": null,
741
- "name": "a",
742
- "kind": "ClassicalParameterDeclaration",
743
- "classical_type": {
744
- "source_ref": null,
745
- "kind": "int"
746
- }
747
- },
748
- {
749
- "source_ref": null,
750
- "name": "phi_b",
751
- "kind": "PortDeclaration",
752
- "quantum_type": {
753
- "source_ref": null,
754
- "kind": "qvec",
755
- "element_type": {
756
- "source_ref": null,
757
- "kind": "qbit"
758
- },
759
- "length": null
760
- },
761
- "size": null,
762
- "direction": "inout"
763
- },
764
- {
765
- "source_ref": null,
766
- "name": "c1",
767
- "kind": "PortDeclaration",
768
- "quantum_type": {
769
- "source_ref": null,
770
- "kind": "qbit"
771
- },
772
- "size": null,
773
- "direction": "inout"
774
- },
775
- {
776
- "source_ref": null,
777
- "name": "c2",
778
- "kind": "PortDeclaration",
779
- "quantum_type": {
780
- "source_ref": null,
781
- "kind": "qbit"
782
- },
783
- "size": null,
784
- "direction": "inout"
785
- }
786
- ]
787
- }"""
788
- )
789
-
790
- C_MODULAR_MULTIPLY = NamedParamsQuantumFunctionDeclaration.parse_raw(
791
- """{
792
- "source_ref": null,
793
- "name": "c_modular_multiply",
794
- "positional_arg_declarations": [
795
- {
796
- "source_ref": null,
797
- "name": "n",
798
- "kind": "ClassicalParameterDeclaration",
799
- "classical_type": {
800
- "source_ref": null,
801
- "kind": "int"
802
- }
803
- },
804
- {
805
- "source_ref": null,
806
- "name": "a",
807
- "kind": "ClassicalParameterDeclaration",
808
- "classical_type": {
809
- "source_ref": null,
810
- "kind": "int"
811
- }
812
- },
813
- {
814
- "source_ref": null,
815
- "name": "b",
816
- "kind": "PortDeclaration",
817
- "quantum_type": {
818
- "source_ref": null,
819
- "kind": "qvec",
820
- "element_type": {
821
- "source_ref": null,
822
- "kind": "qbit"
823
- },
824
- "length": null
825
- },
826
- "size": null,
827
- "direction": "inout"
828
- },
829
- {
830
- "source_ref": null,
831
- "name": "x",
832
- "kind": "PortDeclaration",
833
- "quantum_type": {
834
- "source_ref": null,
835
- "kind": "qvec",
836
- "element_type": {
837
- "source_ref": null,
838
- "kind": "qbit"
839
- },
840
- "length": null
841
- },
842
- "size": null,
843
- "direction": "inout"
844
- },
845
- {
846
- "source_ref": null,
847
- "name": "ctrl",
848
- "kind": "PortDeclaration",
849
- "quantum_type": {
850
- "source_ref": null,
851
- "kind": "qbit"
852
- },
853
- "size": null,
854
- "direction": "inout"
855
- }
856
- ]
857
- }"""
858
- )
859
-
860
- MULTISWAP = NamedParamsQuantumFunctionDeclaration.parse_raw(
861
- """{
862
- "source_ref": null,
863
- "name": "multiswap",
864
- "positional_arg_declarations": [
865
- {
866
- "source_ref": null,
867
- "name": "x",
868
- "kind": "PortDeclaration",
869
- "quantum_type": {
870
- "source_ref": null,
871
- "kind": "qvec",
872
- "element_type": {
873
- "source_ref": null,
874
- "kind": "qbit"
875
- },
876
- "length": null
877
- },
878
- "size": null,
879
- "direction": "inout"
880
- },
881
- {
882
- "source_ref": null,
883
- "name": "y",
884
- "kind": "PortDeclaration",
885
- "quantum_type": {
886
- "source_ref": null,
887
- "kind": "qvec",
888
- "element_type": {
889
- "source_ref": null,
890
- "kind": "qbit"
891
- },
892
- "length": null
893
- },
894
- "size": null,
895
- "direction": "inout"
896
- }
897
- ]
898
- }"""
899
- )
900
-
901
- INPLACE_C_MODULAR_MULTIPLY = NamedParamsQuantumFunctionDeclaration.parse_raw(
902
- """{
903
- "source_ref": null,
904
- "name": "inplace_c_modular_multiply",
905
- "positional_arg_declarations": [
906
- {
907
- "source_ref": null,
908
- "name": "n",
909
- "kind": "ClassicalParameterDeclaration",
910
- "classical_type": {
911
- "source_ref": null,
912
- "kind": "int"
913
- }
914
- },
915
- {
916
- "source_ref": null,
917
- "name": "a",
918
- "kind": "ClassicalParameterDeclaration",
919
- "classical_type": {
920
- "source_ref": null,
921
- "kind": "int"
922
- }
923
- },
924
- {
925
- "source_ref": null,
926
- "name": "x",
927
- "kind": "PortDeclaration",
928
- "quantum_type": {
929
- "source_ref": null,
930
- "kind": "qvec",
931
- "element_type": {
932
- "source_ref": null,
933
- "kind": "qbit"
934
- },
935
- "length": null
936
- },
937
- "size": null,
938
- "direction": "inout"
939
- },
940
- {
941
- "source_ref": null,
942
- "name": "ctrl",
943
- "kind": "PortDeclaration",
944
- "quantum_type": {
945
- "source_ref": null,
946
- "kind": "qbit"
947
- },
948
- "size": null,
949
- "direction": "inout"
950
- }
951
- ]
952
- }"""
953
- )
954
-
955
- MODULAR_EXP = NamedParamsQuantumFunctionDeclaration.parse_raw(
956
- """{
957
- "source_ref": null,
958
- "name": "modular_exp",
959
- "positional_arg_declarations": [
960
- {
961
- "source_ref": null,
962
- "name": "n",
963
- "kind": "ClassicalParameterDeclaration",
964
- "classical_type": {
965
- "source_ref": null,
966
- "kind": "int"
967
- }
968
- },
969
- {
970
- "source_ref": null,
971
- "name": "a",
972
- "kind": "ClassicalParameterDeclaration",
973
- "classical_type": {
974
- "source_ref": null,
975
- "kind": "int"
976
- }
977
- },
978
- {
979
- "source_ref": null,
980
- "name": "x",
981
- "kind": "PortDeclaration",
982
- "quantum_type": {
983
- "source_ref": null,
984
- "kind": "qvec",
985
- "element_type": {
986
- "source_ref": null,
987
- "kind": "qbit"
988
- },
989
- "length": null
990
- },
991
- "size": null,
992
- "direction": "inout"
993
- },
994
- {
995
- "source_ref": null,
996
- "name": "power",
997
- "kind": "PortDeclaration",
998
- "quantum_type": {
999
- "source_ref": null,
1000
- "kind": "qvec",
1001
- "element_type": {
1002
- "source_ref": null,
1003
- "kind": "qbit"
1004
- },
1005
- "length": null
1006
- },
1007
- "size": null,
1008
- "direction": "inout"
1009
- }
1010
- ]
1011
- }"""
1012
- )
1013
-
1014
- QSVT_STEP = NamedParamsQuantumFunctionDeclaration.parse_raw(
1015
- """{
1016
- "source_ref": null,
1017
- "name": "qsvt_step",
1018
- "positional_arg_declarations": [
1019
- {
1020
- "source_ref": null,
1021
- "name": "phase1",
1022
- "kind": "ClassicalParameterDeclaration",
1023
- "classical_type": {
1024
- "source_ref": null,
1025
- "kind": "real"
1026
- }
1027
- },
1028
- {
1029
- "source_ref": null,
1030
- "name": "phase2",
1031
- "kind": "ClassicalParameterDeclaration",
1032
- "classical_type": {
1033
- "source_ref": null,
1034
- "kind": "real"
1035
- }
1036
- },
1037
- {
1038
- "source_ref": null,
1039
- "name": "proj_cnot_1",
1040
- "positional_arg_declarations": [
1041
- {
1042
- "source_ref": null,
1043
- "name": null,
1044
- "kind": "PortDeclaration",
1045
- "quantum_type": {
1046
- "source_ref": null,
1047
- "kind": "qvec",
1048
- "element_type": {
1049
- "source_ref": null,
1050
- "kind": "qbit"
1051
- },
1052
- "length": null
1053
- },
1054
- "size": null,
1055
- "direction": "inout"
1056
- },
1057
- {
1058
- "source_ref": null,
1059
- "name": null,
1060
- "kind": "PortDeclaration",
1061
- "quantum_type": {
1062
- "source_ref": null,
1063
- "kind": "qbit"
1064
- },
1065
- "size": null,
1066
- "direction": "inout"
1067
- }
1068
- ],
1069
- "kind": "QuantumOperandDeclaration",
1070
- "is_list": false
1071
- },
1072
- {
1073
- "source_ref": null,
1074
- "name": "proj_cnot_2",
1075
- "positional_arg_declarations": [
1076
- {
1077
- "source_ref": null,
1078
- "name": null,
1079
- "kind": "PortDeclaration",
1080
- "quantum_type": {
1081
- "source_ref": null,
1082
- "kind": "qvec",
1083
- "element_type": {
1084
- "source_ref": null,
1085
- "kind": "qbit"
1086
- },
1087
- "length": null
1088
- },
1089
- "size": null,
1090
- "direction": "inout"
1091
- },
1092
- {
1093
- "source_ref": null,
1094
- "name": null,
1095
- "kind": "PortDeclaration",
1096
- "quantum_type": {
1097
- "source_ref": null,
1098
- "kind": "qbit"
1099
- },
1100
- "size": null,
1101
- "direction": "inout"
1102
- }
1103
- ],
1104
- "kind": "QuantumOperandDeclaration",
1105
- "is_list": false
1106
- },
1107
- {
1108
- "source_ref": null,
1109
- "name": "u",
1110
- "positional_arg_declarations": [
1111
- {
1112
- "source_ref": null,
1113
- "name": null,
1114
- "kind": "PortDeclaration",
1115
- "quantum_type": {
1116
- "source_ref": null,
1117
- "kind": "qvec",
1118
- "element_type": {
1119
- "source_ref": null,
1120
- "kind": "qbit"
1121
- },
1122
- "length": null
1123
- },
1124
- "size": null,
1125
- "direction": "inout"
1126
- }
1127
- ],
1128
- "kind": "QuantumOperandDeclaration",
1129
- "is_list": false
1130
- },
1131
- {
1132
- "source_ref": null,
1133
- "name": "qvar",
1134
- "kind": "PortDeclaration",
1135
- "quantum_type": {
1136
- "source_ref": null,
1137
- "kind": "qvec",
1138
- "element_type": {
1139
- "source_ref": null,
1140
- "kind": "qbit"
1141
- },
1142
- "length": null
1143
- },
1144
- "size": null,
1145
- "direction": "inout"
1146
- },
1147
- {
1148
- "source_ref": null,
1149
- "name": "aux",
1150
- "kind": "PortDeclaration",
1151
- "quantum_type": {
1152
- "source_ref": null,
1153
- "kind": "qbit"
1154
- },
1155
- "size": null,
1156
- "direction": "inout"
1157
- }
1158
- ]
1159
- }"""
1160
- )
1161
-
1162
- QSVT = NamedParamsQuantumFunctionDeclaration.parse_raw(
1163
- """{
1164
- "source_ref": null,
1165
- "name": "qsvt",
1166
- "positional_arg_declarations": [
1167
- {
1168
- "source_ref": null,
1169
- "name": "phase_seq",
1170
- "kind": "ClassicalParameterDeclaration",
1171
- "classical_type": {
1172
- "source_ref": null,
1173
- "kind": "list",
1174
- "element_type": {
1175
- "source_ref": null,
1176
- "kind": "real"
1177
- }
1178
- }
1179
- },
1180
- {
1181
- "source_ref": null,
1182
- "name": "proj_cnot_1",
1183
- "positional_arg_declarations": [
1184
- {
1185
- "source_ref": null,
1186
- "name": null,
1187
- "kind": "PortDeclaration",
1188
- "quantum_type": {
1189
- "source_ref": null,
1190
- "kind": "qvec",
1191
- "element_type": {
1192
- "source_ref": null,
1193
- "kind": "qbit"
1194
- },
1195
- "length": null
1196
- },
1197
- "size": null,
1198
- "direction": "inout"
1199
- },
1200
- {
1201
- "source_ref": null,
1202
- "name": null,
1203
- "kind": "PortDeclaration",
1204
- "quantum_type": {
1205
- "source_ref": null,
1206
- "kind": "qbit"
1207
- },
1208
- "size": null,
1209
- "direction": "inout"
1210
- }
1211
- ],
1212
- "kind": "QuantumOperandDeclaration",
1213
- "is_list": false
1214
- },
1215
- {
1216
- "source_ref": null,
1217
- "name": "proj_cnot_2",
1218
- "positional_arg_declarations": [
1219
- {
1220
- "source_ref": null,
1221
- "name": null,
1222
- "kind": "PortDeclaration",
1223
- "quantum_type": {
1224
- "source_ref": null,
1225
- "kind": "qvec",
1226
- "element_type": {
1227
- "source_ref": null,
1228
- "kind": "qbit"
1229
- },
1230
- "length": null
1231
- },
1232
- "size": null,
1233
- "direction": "inout"
1234
- },
1235
- {
1236
- "source_ref": null,
1237
- "name": null,
1238
- "kind": "PortDeclaration",
1239
- "quantum_type": {
1240
- "source_ref": null,
1241
- "kind": "qbit"
1242
- },
1243
- "size": null,
1244
- "direction": "inout"
1245
- }
1246
- ],
1247
- "kind": "QuantumOperandDeclaration",
1248
- "is_list": false
1249
- },
1250
- {
1251
- "source_ref": null,
1252
- "name": "u",
1253
- "positional_arg_declarations": [
1254
- {
1255
- "source_ref": null,
1256
- "name": null,
1257
- "kind": "PortDeclaration",
1258
- "quantum_type": {
1259
- "source_ref": null,
1260
- "kind": "qvec",
1261
- "element_type": {
1262
- "source_ref": null,
1263
- "kind": "qbit"
1264
- },
1265
- "length": null
1266
- },
1267
- "size": null,
1268
- "direction": "inout"
1269
- }
1270
- ],
1271
- "kind": "QuantumOperandDeclaration",
1272
- "is_list": false
1273
- },
1274
- {
1275
- "source_ref": null,
1276
- "name": "qvar",
1277
- "kind": "PortDeclaration",
1278
- "quantum_type": {
1279
- "source_ref": null,
1280
- "kind": "qvec",
1281
- "element_type": {
1282
- "source_ref": null,
1283
- "kind": "qbit"
1284
- },
1285
- "length": null
1286
- },
1287
- "size": null,
1288
- "direction": "inout"
1289
- },
1290
- {
1291
- "source_ref": null,
1292
- "name": "aux",
1293
- "kind": "PortDeclaration",
1294
- "quantum_type": {
1295
- "source_ref": null,
1296
- "kind": "qbit"
1297
- },
1298
- "size": null,
1299
- "direction": "inout"
1300
- }
1301
- ]
1302
- }"""
1303
- )
1304
-
1305
- PROJECTOR_CONTROLLED_PHASE = NamedParamsQuantumFunctionDeclaration.parse_raw(
1306
- """{
1307
- "source_ref": null,
1308
- "name": "projector_controlled_phase",
1309
- "positional_arg_declarations": [
1310
- {
1311
- "source_ref": null,
1312
- "name": "phase",
1313
- "kind": "ClassicalParameterDeclaration",
1314
- "classical_type": {
1315
- "source_ref": null,
1316
- "kind": "real"
1317
- }
1318
- },
1319
- {
1320
- "source_ref": null,
1321
- "name": "proj_cnot",
1322
- "positional_arg_declarations": [
1323
- {
1324
- "source_ref": null,
1325
- "name": null,
1326
- "kind": "PortDeclaration",
1327
- "quantum_type": {
1328
- "source_ref": null,
1329
- "kind": "qvec",
1330
- "element_type": {
1331
- "source_ref": null,
1332
- "kind": "qbit"
1333
- },
1334
- "length": null
1335
- },
1336
- "size": null,
1337
- "direction": "inout"
1338
- },
1339
- {
1340
- "source_ref": null,
1341
- "name": null,
1342
- "kind": "PortDeclaration",
1343
- "quantum_type": {
1344
- "source_ref": null,
1345
- "kind": "qbit"
1346
- },
1347
- "size": null,
1348
- "direction": "inout"
1349
- }
1350
- ],
1351
- "kind": "QuantumOperandDeclaration",
1352
- "is_list": false
1353
- },
1354
- {
1355
- "source_ref": null,
1356
- "name": "qvar",
1357
- "kind": "PortDeclaration",
1358
- "quantum_type": {
1359
- "source_ref": null,
1360
- "kind": "qvec",
1361
- "element_type": {
1362
- "source_ref": null,
1363
- "kind": "qbit"
1364
- },
1365
- "length": null
1366
- },
1367
- "size": null,
1368
- "direction": "inout"
1369
- },
1370
- {
1371
- "source_ref": null,
1372
- "name": "aux",
1373
- "kind": "PortDeclaration",
1374
- "quantum_type": {
1375
- "source_ref": null,
1376
- "kind": "qbit"
1377
- },
1378
- "size": null,
1379
- "direction": "inout"
1380
- }
1381
- ]
1382
- }"""
1383
- )
1384
-
1385
- QSVT_INVERSION = NamedParamsQuantumFunctionDeclaration.parse_raw(
1386
- """{
1387
- "source_ref": null,
1388
- "name": "qsvt_inversion",
1389
- "positional_arg_declarations": [
1390
- {
1391
- "source_ref": null,
1392
- "name": "phase_seq",
1393
- "kind": "ClassicalParameterDeclaration",
1394
- "classical_type": {
1395
- "source_ref": null,
1396
- "kind": "list",
1397
- "element_type": {
1398
- "source_ref": null,
1399
- "kind": "real"
1400
- }
1401
- }
1402
- },
1403
- {
1404
- "source_ref": null,
1405
- "name": "block_encoding_cnot",
1406
- "positional_arg_declarations": [
1407
- {
1408
- "source_ref": null,
1409
- "name": null,
1410
- "kind": "PortDeclaration",
1411
- "quantum_type": {
1412
- "source_ref": null,
1413
- "kind": "qvec",
1414
- "element_type": {
1415
- "source_ref": null,
1416
- "kind": "qbit"
1417
- },
1418
- "length": null
1419
- },
1420
- "size": null,
1421
- "direction": "inout"
1422
- },
1423
- {
1424
- "source_ref": null,
1425
- "name": null,
1426
- "kind": "PortDeclaration",
1427
- "quantum_type": {
1428
- "source_ref": null,
1429
- "kind": "qbit"
1430
- },
1431
- "size": null,
1432
- "direction": "inout"
1433
- }
1434
- ],
1435
- "kind": "QuantumOperandDeclaration",
1436
- "is_list": false
1437
- },
1438
- {
1439
- "source_ref": null,
1440
- "name": "u",
1441
- "positional_arg_declarations": [
1442
- {
1443
- "source_ref": null,
1444
- "name": null,
1445
- "kind": "PortDeclaration",
1446
- "quantum_type": {
1447
- "source_ref": null,
1448
- "kind": "qvec",
1449
- "element_type": {
1450
- "source_ref": null,
1451
- "kind": "qbit"
1452
- },
1453
- "length": null
1454
- },
1455
- "size": null,
1456
- "direction": "inout"
1457
- }
1458
- ],
1459
- "kind": "QuantumOperandDeclaration",
1460
- "is_list": false
1461
- },
1462
- {
1463
- "source_ref": null,
1464
- "name": "qvar",
1465
- "kind": "PortDeclaration",
1466
- "quantum_type": {
1467
- "source_ref": null,
1468
- "kind": "qvec",
1469
- "element_type": {
1470
- "source_ref": null,
1471
- "kind": "qbit"
1472
- },
1473
- "length": null
1474
- },
1475
- "size": null,
1476
- "direction": "inout"
1477
- },
1478
- {
1479
- "source_ref": null,
1480
- "name": "aux",
1481
- "kind": "PortDeclaration",
1482
- "quantum_type": {
1483
- "source_ref": null,
1484
- "kind": "qbit"
1485
- },
1486
- "size": null,
1487
- "direction": "inout"
1488
- }
1489
- ]
1490
- }"""
1491
- )
1492
-
1493
- ALLOCATE_NUM = NamedParamsQuantumFunctionDeclaration.parse_raw(
1494
- """{
1495
- "source_ref": null,
1496
- "name": "allocate_num",
1497
- "positional_arg_declarations": [
1498
- {
1499
- "name": "num_qubits",
1500
- "kind": "ClassicalParameterDeclaration",
1501
- "classical_type": {
1502
- "kind": "int"
1503
- }
1504
- },
1505
- {
1506
- "name": "is_signed",
1507
- "kind": "ClassicalParameterDeclaration",
1508
- "classical_type": {
1509
- "kind": "bool"
1510
- }
1511
- },
1512
- {
1513
- "name": "fraction_digits",
1514
- "kind": "ClassicalParameterDeclaration",
1515
- "classical_type": {
1516
- "kind": "int"
1517
- }
1518
- },
1519
- {
1520
- "name": "out",
1521
- "kind": "PortDeclaration",
1522
- "quantum_type": {
1523
- "kind": "qnum",
1524
- "size": {
1525
- "expr": "num_qubits"
1526
- },
1527
- "is_signed": {
1528
- "expr": "is_signed"
1529
- },
1530
- "fraction_digits": {
1531
- "expr": "fraction_digits"
1532
- }
1533
- },
1534
- "direction": "output"
1535
- }
1536
- ]
1537
- }"""
1538
- )
1539
-
1540
- QAOA_MIXER_LAYER = NamedParamsQuantumFunctionDeclaration.parse_raw(
1541
- """{
1542
- "source_ref": null,
1543
- "name": "qaoa_mixer_layer",
1544
- "positional_arg_declarations": [
1545
- {
1546
- "name": "b",
1547
- "kind": "ClassicalParameterDeclaration",
1548
- "classical_type": {
1549
- "kind": "real"
1550
- }
1551
- },
1552
- {
1553
- "name": "target",
1554
- "kind": "PortDeclaration",
1555
- "direction": "inout"
1556
- }
1557
- ]
1558
- }"""
1559
- )
1560
-
1561
- QAOA_COST_LAYER = NamedParamsQuantumFunctionDeclaration.parse_raw(
1562
- """{
1563
- "source_ref": null,
1564
- "name": "qaoa_cost_layer",
1565
- "positional_arg_declarations": [
1566
- {
1567
- "name": "g",
1568
- "kind": "ClassicalParameterDeclaration",
1569
- "classical_type": {
1570
- "kind": "real"
1571
- }
1572
- },
1573
- {
1574
- "name": "hamiltonian",
1575
- "kind": "ClassicalParameterDeclaration",
1576
- "classical_type": {
1577
- "kind": "list",
1578
- "element_type": {
1579
- "kind": "struct_instance",
1580
- "name": "PauliTerm"
1581
- }
1582
- }
1583
- },
1584
- {
1585
- "name": "target",
1586
- "kind": "PortDeclaration",
1587
- "direction": "inout"
1588
- }
1589
- ]
1590
- }"""
1591
- )
1592
-
1593
- QAOA_LAYER = NamedParamsQuantumFunctionDeclaration.parse_raw(
1594
- """{
1595
- "source_ref": null,
1596
- "name": "qaoa_layer",
1597
- "positional_arg_declarations": [
1598
- {
1599
- "name": "g",
1600
- "kind": "ClassicalParameterDeclaration",
1601
- "classical_type": {
1602
- "kind": "real"
1603
- }
1604
- },
1605
- {
1606
- "name": "b",
1607
- "kind": "ClassicalParameterDeclaration",
1608
- "classical_type": {
1609
- "kind": "real"
1610
- }
1611
- },
1612
- {
1613
- "name": "hamiltonian",
1614
- "kind": "ClassicalParameterDeclaration",
1615
- "classical_type": {
1616
- "kind": "list",
1617
- "element_type": {
1618
- "kind": "struct_instance",
1619
- "name": "PauliTerm"
1620
- }
1621
- }
1622
- },
1623
- {
1624
- "name": "target",
1625
- "kind": "PortDeclaration",
1626
- "direction": "inout"
1627
- }
1628
- ]
1629
- }"""
1630
- )
1631
-
1632
- QAOA_INIT = NamedParamsQuantumFunctionDeclaration.parse_raw(
1633
- """{
1634
- "source_ref": null,
1635
- "name": "qaoa_init",
1636
- "positional_arg_declarations": [
1637
- {
1638
- "name": "target",
1639
- "kind": "PortDeclaration",
1640
- "direction": "inout"
1641
- }
1642
- ]
1643
- }"""
1644
- )
1645
-
1646
- QAOA_PENALTY = NamedParamsQuantumFunctionDeclaration.parse_raw(
1647
- """{
1648
- "source_ref": null,
1649
- "name": "qaoa_penalty",
1650
- "positional_arg_declarations": [
1651
- {
1652
- "name": "num_qubits",
1653
- "kind": "ClassicalParameterDeclaration",
1654
- "classical_type": {
1655
- "kind": "int"
1656
- }
1657
- },
1658
- {
1659
- "name": "params_list",
1660
- "kind": "ClassicalParameterDeclaration",
1661
- "classical_type": {
1662
- "kind": "list",
1663
- "element_type": {
1664
- "kind": "real"
1665
- }
1666
- }
1667
- },
1668
- {
1669
- "name": "hamiltonian",
1670
- "kind": "ClassicalParameterDeclaration",
1671
- "classical_type": {
1672
- "kind": "list",
1673
- "element_type": {
1674
- "kind": "struct_instance",
1675
- "name": "PauliTerm"
1676
- }
1677
- }
1678
- },
1679
- {
1680
- "name": "target",
1681
- "kind": "PortDeclaration",
1682
- "size": {
1683
- "expr": "num_qubits"
1684
- },
1685
- "direction": "inout"
1686
- }
1687
- ]
1688
- }"""
1689
- )
1690
-
1691
- FULL_HEA = NamedParamsQuantumFunctionDeclaration.parse_raw(
1692
- """{
1693
- "source_ref": null,
1694
- "name": "full_hea",
1695
- "positional_arg_declarations": [
1696
- {
1697
- "name": "num_qubits",
1698
- "kind": "ClassicalParameterDeclaration",
1699
- "classical_type": {
1700
- "kind": "int"
1701
- }
1702
- },
1703
- {
1704
- "name": "is_parametrized",
1705
- "kind": "ClassicalParameterDeclaration",
1706
- "classical_type": {
1707
- "kind": "list",
1708
- "element_type": {
1709
- "kind": "int"
1710
- }
1711
- }
1712
- },
1713
- {
1714
- "name": "angle_params",
1715
- "kind": "ClassicalParameterDeclaration",
1716
- "classical_type": {
1717
- "kind": "list",
1718
- "element_type": {
1719
- "kind": "real"
1720
- }
1721
- }
1722
- },
1723
- {
1724
- "name": "connectivity_map",
1725
- "kind": "ClassicalParameterDeclaration",
1726
- "classical_type": {
1727
- "kind": "list",
1728
- "element_type": {
1729
- "kind": "list",
1730
- "element_type": {
1731
- "kind": "int"
1732
- }
1733
- }
1734
- }
1735
- },
1736
- {
1737
- "name": "reps",
1738
- "kind": "ClassicalParameterDeclaration",
1739
- "classical_type": {
1740
- "kind": "int"
1741
- }
1742
- },
1743
- {
1744
- "name": "operands_1qubit",
1745
- "positional_arg_declarations": [
1746
- {
1747
- "name": "angle",
1748
- "kind": "ClassicalParameterDeclaration",
1749
- "classical_type": {
1750
- "kind": "real"
1751
- }
1752
- },
1753
- {
1754
- "name": "q",
1755
- "kind": "PortDeclaration",
1756
- "size": {
1757
- "expr": "1"
1758
- },
1759
- "direction": "inout"
1760
- }
1761
- ],
1762
- "kind": "QuantumOperandDeclaration",
1763
- "is_list": true
1764
- },
1765
- {
1766
- "name": "operands_2qubit",
1767
- "positional_arg_declarations": [
1768
- {
1769
- "name": "angle",
1770
- "kind": "ClassicalParameterDeclaration",
1771
- "classical_type": {
1772
- "kind": "real"
1773
- }
1774
- },
1775
- {
1776
- "name": "q1",
1777
- "kind": "PortDeclaration",
1778
- "size": {
1779
- "expr": "1"
1780
- },
1781
- "direction": "inout"
1782
- },
1783
- {
1784
- "name": "q2",
1785
- "kind": "PortDeclaration",
1786
- "size": {
1787
- "expr": "1"
1788
- },
1789
- "direction": "inout"
1790
- }
1791
- ],
1792
- "kind": "QuantumOperandDeclaration",
1793
- "is_list": true
1794
- },
1795
- {
1796
- "name": "x",
1797
- "kind": "PortDeclaration",
1798
- "size": {
1799
- "expr": "num_qubits"
1800
- },
1801
- "direction": "inout"
1802
- }
1803
- ]
1804
- }"""
1805
- )
1806
-
1807
- SWAP_TEST = NamedParamsQuantumFunctionDeclaration.parse_raw(
1808
- """{
1809
- "source_ref": null,
1810
- "name": "swap_test",
1811
- "positional_arg_declarations": [
1812
- {
1813
- "source_ref": null,
1814
- "name": "state1",
1815
- "kind": "PortDeclaration",
1816
- "quantum_type": {
1817
- "source_ref": null,
1818
- "kind": "qvec",
1819
- "element_type": {
1820
- "source_ref": null,
1821
- "kind": "qbit"
1822
- },
1823
- "length": null
1824
- },
1825
- "size": null,
1826
- "direction": "inout"
1827
- },
1828
- {
1829
- "source_ref": null,
1830
- "name": "state2",
1831
- "kind": "PortDeclaration",
1832
- "quantum_type": {
1833
- "source_ref": null,
1834
- "kind": "qvec",
1835
- "element_type": {
1836
- "source_ref": null,
1837
- "kind": "qbit"
1838
- },
1839
- "length": null
1840
- },
1841
- "size": null,
1842
- "direction": "inout"
1843
- },
1844
- {
1845
- "source_ref": null,
1846
- "name": "test",
1847
- "kind": "PortDeclaration",
1848
- "quantum_type": {
1849
- "source_ref": null,
1850
- "kind": "qbit"
1851
- },
1852
- "size": null,
1853
- "direction": "output"
1854
- }
1855
- ]
1856
- }"""
1857
- )
1858
-
1859
- _PREPARE_UNIFORM_TRIMMED_STATE_STEP = NamedParamsQuantumFunctionDeclaration.parse_raw(
1860
- """{
1861
- "source_ref": null,
1862
- "name": "_prepare_uniform_trimmed_state_step",
1863
- "positional_arg_declarations": [
1864
- {
1865
- "source_ref": null,
1866
- "name": "size_lsb",
1867
- "kind": "ClassicalParameterDeclaration",
1868
- "classical_type": {
1869
- "source_ref": null,
1870
- "kind": "int"
1871
- }
1872
- },
1873
- {
1874
- "source_ref": null,
1875
- "name": "ctrl_val",
1876
- "kind": "ClassicalParameterDeclaration",
1877
- "classical_type": {
1878
- "source_ref": null,
1879
- "kind": "int"
1880
- }
1881
- },
1882
- {
1883
- "source_ref": null,
1884
- "name": "lsbs_val",
1885
- "kind": "ClassicalParameterDeclaration",
1886
- "classical_type": {
1887
- "source_ref": null,
1888
- "kind": "int"
1889
- }
1890
- },
1891
- {
1892
- "source_ref": null,
1893
- "name": "ctrl_var",
1894
- "kind": "PortDeclaration",
1895
- "quantum_type": {
1896
- "source_ref": null,
1897
- "kind": "qnum",
1898
- "size": null,
1899
- "is_signed": null,
1900
- "fraction_digits": null
1901
- },
1902
- "size": null,
1903
- "direction": "inout"
1904
- },
1905
- {
1906
- "source_ref": null,
1907
- "name": "rotation_var",
1908
- "kind": "PortDeclaration",
1909
- "quantum_type": {
1910
- "source_ref": null,
1911
- "kind": "qbit"
1912
- },
1913
- "size": null,
1914
- "direction": "inout"
1915
- }
1916
- ]
1917
- }"""
1918
- )
1919
-
1920
- PREPARE_UNIFORM_TRIMMED_STATE = NamedParamsQuantumFunctionDeclaration.parse_raw(
1921
- """{
1922
- "source_ref": null,
1923
- "name": "prepare_uniform_trimmed_state",
1924
- "positional_arg_declarations": [
1925
- {
1926
- "source_ref": null,
1927
- "name": "m",
1928
- "kind": "ClassicalParameterDeclaration",
1929
- "classical_type": {
1930
- "source_ref": null,
1931
- "kind": "int"
1932
- }
1933
- },
1934
- {
1935
- "source_ref": null,
1936
- "name": "q",
1937
- "kind": "PortDeclaration",
1938
- "quantum_type": {
1939
- "source_ref": null,
1940
- "kind": "qvec",
1941
- "element_type": {
1942
- "source_ref": null,
1943
- "kind": "qbit"
1944
- },
1945
- "length": null
1946
- },
1947
- "size": null,
1948
- "direction": "inout"
1949
- }
1950
- ]
1951
- }"""
1952
- )
1953
-
1954
- PREPARE_UNIFORM_INTERVAL_STATE = NamedParamsQuantumFunctionDeclaration.parse_raw(
1955
- """{
1956
- "source_ref": null,
1957
- "name": "prepare_uniform_interval_state",
1958
- "positional_arg_declarations": [
1959
- {
1960
- "source_ref": null,
1961
- "name": "start",
1962
- "kind": "ClassicalParameterDeclaration",
1963
- "classical_type": {
1964
- "source_ref": null,
1965
- "kind": "int"
1966
- }
1967
- },
1968
- {
1969
- "source_ref": null,
1970
- "name": "end",
1971
- "kind": "ClassicalParameterDeclaration",
1972
- "classical_type": {
1973
- "source_ref": null,
1974
- "kind": "int"
1975
- }
1976
- },
1977
- {
1978
- "source_ref": null,
1979
- "name": "q",
1980
- "kind": "PortDeclaration",
1981
- "quantum_type": {
1982
- "source_ref": null,
1983
- "kind": "qvec",
1984
- "element_type": {
1985
- "source_ref": null,
1986
- "kind": "qbit"
1987
- },
1988
- "length": null
1989
- },
1990
- "size": null,
1991
- "direction": "inout"
1992
- }
1993
- ]
1994
- }"""
1995
- )
1996
-
1997
- PREPARE_GHZ_STATE = NamedParamsQuantumFunctionDeclaration.parse_raw(
1998
- """{
1999
- "source_ref": null,
2000
- "name": "prepare_ghz_state",
2001
- "positional_arg_declarations": [
2002
- {
2003
- "source_ref": null,
2004
- "name": "size",
2005
- "kind": "ClassicalParameterDeclaration",
2006
- "classical_type": {
2007
- "source_ref": null,
2008
- "kind": "int"
2009
- }
2010
- },
2011
- {
2012
- "source_ref": null,
2013
- "name": "q",
2014
- "kind": "PortDeclaration",
2015
- "quantum_type": {
2016
- "source_ref": null,
2017
- "kind": "qvec",
2018
- "element_type": {
2019
- "source_ref": null,
2020
- "kind": "qbit"
2021
- },
2022
- "length": null
2023
- },
2024
- "size": null,
2025
- "direction": "output"
2026
- }
2027
- ]
2028
- }"""
2029
- )
2030
-
2031
- PREPARE_EXPONENTIAL_STATE = NamedParamsQuantumFunctionDeclaration.parse_raw(
2032
- """{
2033
- "source_ref": null,
2034
- "name": "prepare_exponential_state",
2035
- "positional_arg_declarations": [
2036
- {
2037
- "source_ref": null,
2038
- "name": "rate",
2039
- "kind": "ClassicalParameterDeclaration",
2040
- "classical_type": {
2041
- "source_ref": null,
2042
- "kind": "int"
2043
- }
2044
- },
2045
- {
2046
- "source_ref": null,
2047
- "name": "q",
2048
- "kind": "PortDeclaration",
2049
- "quantum_type": {
2050
- "source_ref": null,
2051
- "kind": "qvec",
2052
- "element_type": {
2053
- "source_ref": null,
2054
- "kind": "qbit"
2055
- },
2056
- "length": null
2057
- },
2058
- "size": null,
2059
- "direction": "inout"
2060
- }
2061
- ]
2062
- }"""
2063
- )
2064
-
2065
- PREPARE_BELL_STATE = NamedParamsQuantumFunctionDeclaration.parse_raw(
2066
- """{
2067
- "source_ref": null,
2068
- "name": "prepare_bell_state",
2069
- "positional_arg_declarations": [
2070
- {
2071
- "source_ref": null,
2072
- "name": "state_num",
2073
- "kind": "ClassicalParameterDeclaration",
2074
- "classical_type": {
2075
- "source_ref": null,
2076
- "kind": "int"
2077
- }
2078
- },
2079
- {
2080
- "source_ref": null,
2081
- "name": "q",
2082
- "kind": "PortDeclaration",
2083
- "quantum_type": {
2084
- "source_ref": null,
2085
- "kind": "qvec",
2086
- "element_type": {
2087
- "source_ref": null,
2088
- "kind": "qbit"
2089
- },
2090
- "length": {
2091
- "source_ref": null,
2092
- "expr": "2"
2093
- }
2094
- },
2095
- "size": null,
2096
- "direction": "output"
2097
- }
2098
- ]
2099
- }"""
2100
- )
2101
-
2102
- INPLACE_PREPARE_INT = NamedParamsQuantumFunctionDeclaration.parse_raw(
2103
- """{
2104
- "source_ref": null,
2105
- "name": "inplace_prepare_int",
2106
- "positional_arg_declarations": [
2107
- {
2108
- "source_ref": null,
2109
- "name": "value",
2110
- "kind": "ClassicalParameterDeclaration",
2111
- "classical_type": {
2112
- "source_ref": null,
2113
- "kind": "int"
2114
- }
2115
- },
2116
- {
2117
- "source_ref": null,
2118
- "name": "target",
2119
- "kind": "PortDeclaration",
2120
- "quantum_type": {
2121
- "source_ref": null,
2122
- "kind": "qvec",
2123
- "element_type": {
2124
- "source_ref": null,
2125
- "kind": "qbit"
2126
- },
2127
- "length": null
2128
- },
2129
- "size": null,
2130
- "direction": "inout"
2131
- }
2132
- ]
2133
- }"""
2134
- )
2135
-
2136
- PREPARE_INT = NamedParamsQuantumFunctionDeclaration.parse_raw(
2137
- """{
2138
- "source_ref": null,
2139
- "name": "prepare_int",
2140
- "positional_arg_declarations": [
2141
- {
2142
- "source_ref": null,
2143
- "name": "value",
2144
- "kind": "ClassicalParameterDeclaration",
2145
- "classical_type": {
2146
- "source_ref": null,
2147
- "kind": "int"
2148
- }
2149
- },
2150
- {
2151
- "source_ref": null,
2152
- "name": "out",
2153
- "kind": "PortDeclaration",
2154
- "quantum_type": {
2155
- "source_ref": null,
2156
- "kind": "qnum",
2157
- "size": null,
2158
- "is_signed": null,
2159
- "fraction_digits": null
2160
- },
2161
- "size": null,
2162
- "direction": "output"
2163
- }
2164
- ]
2165
- }"""
2166
- )
2167
-
2168
- SWITCH = NamedParamsQuantumFunctionDeclaration.parse_raw(
2169
- """{
2170
- "source_ref": null,
2171
- "name": "switch",
2172
- "positional_arg_declarations": [
2173
- {
2174
- "source_ref": null,
2175
- "name": "selector",
2176
- "kind": "ClassicalParameterDeclaration",
2177
- "classical_type": {
2178
- "source_ref": null,
2179
- "kind": "int"
2180
- }
2181
- },
2182
- {
2183
- "source_ref": null,
2184
- "name": "cases",
2185
- "positional_arg_declarations": [],
2186
- "kind": "QuantumOperandDeclaration",
2187
- "is_list": true
2188
- }
2189
- ]
2190
- }"""
2191
- )
2192
-
2193
- _QCT_D_OPERATOR = NamedParamsQuantumFunctionDeclaration.parse_raw(
2194
- """{
2195
- "source_ref": null,
2196
- "name": "_qct_d_operator",
2197
- "positional_arg_declarations": [
2198
- {
2199
- "source_ref": null,
2200
- "name": "x",
2201
- "kind": "PortDeclaration",
2202
- "quantum_type": {
2203
- "source_ref": null,
2204
- "kind": "qnum",
2205
- "size": null,
2206
- "is_signed": null,
2207
- "fraction_digits": null
2208
- },
2209
- "size": null,
2210
- "direction": "inout"
2211
- },
2212
- {
2213
- "source_ref": null,
2214
- "name": "q",
2215
- "kind": "PortDeclaration",
2216
- "quantum_type": {
2217
- "source_ref": null,
2218
- "kind": "qbit"
2219
- },
2220
- "size": null,
2221
- "direction": "inout"
2222
- }
2223
- ]
2224
- }"""
2225
- )
2226
-
2227
- _QCT_PI_OPERATOR = NamedParamsQuantumFunctionDeclaration.parse_raw(
2228
- """{
2229
- "source_ref": null,
2230
- "name": "_qct_pi_operator",
2231
- "positional_arg_declarations": [
2232
- {
2233
- "source_ref": null,
2234
- "name": "x",
2235
- "kind": "PortDeclaration",
2236
- "quantum_type": {
2237
- "source_ref": null,
2238
- "kind": "qvec",
2239
- "element_type": {
2240
- "source_ref": null,
2241
- "kind": "qbit"
2242
- },
2243
- "length": null
2244
- },
2245
- "size": null,
2246
- "direction": "inout"
2247
- },
2248
- {
2249
- "source_ref": null,
2250
- "name": "q",
2251
- "kind": "PortDeclaration",
2252
- "quantum_type": {
2253
- "source_ref": null,
2254
- "kind": "qbit"
2255
- },
2256
- "size": null,
2257
- "direction": "inout"
2258
- }
2259
- ]
2260
- }"""
2261
- )
2262
-
2263
- QCT_QST_TYPE1 = NamedParamsQuantumFunctionDeclaration.parse_raw(
2264
- """{
2265
- "source_ref": null,
2266
- "name": "qct_qst_type1",
2267
- "positional_arg_declarations": [
2268
- {
2269
- "source_ref": null,
2270
- "name": "x",
2271
- "kind": "PortDeclaration",
2272
- "quantum_type": {
2273
- "source_ref": null,
2274
- "kind": "qvec",
2275
- "element_type": {
2276
- "source_ref": null,
2277
- "kind": "qbit"
2278
- },
2279
- "length": null
2280
- },
2281
- "size": null,
2282
- "direction": "inout"
2283
- }
2284
- ]
2285
- }"""
2286
- )
2287
-
2288
- QCT_QST_TYPE2 = NamedParamsQuantumFunctionDeclaration.parse_raw(
2289
- """{
2290
- "source_ref": null,
2291
- "name": "qct_qst_type2",
2292
- "positional_arg_declarations": [
2293
- {
2294
- "source_ref": null,
2295
- "name": "x",
2296
- "kind": "PortDeclaration",
2297
- "quantum_type": {
2298
- "source_ref": null,
2299
- "kind": "qvec",
2300
- "element_type": {
2301
- "source_ref": null,
2302
- "kind": "qbit"
2303
- },
2304
- "length": null
2305
- },
2306
- "size": null,
2307
- "direction": "inout"
2308
- },
2309
- {
2310
- "source_ref": null,
2311
- "name": "q",
2312
- "kind": "PortDeclaration",
2313
- "quantum_type": {
2314
- "source_ref": null,
2315
- "kind": "qbit"
2316
- },
2317
- "size": null,
2318
- "direction": "inout"
2319
- }
2320
- ]
2321
- }"""
2322
- )
2323
-
2324
- QCT_TYPE2 = NamedParamsQuantumFunctionDeclaration.parse_raw(
2325
- """{
2326
- "source_ref": null,
2327
- "name": "qct_type2",
2328
- "positional_arg_declarations": [
2329
- {
2330
- "source_ref": null,
2331
- "name": "x",
2332
- "kind": "PortDeclaration",
2333
- "quantum_type": {
2334
- "source_ref": null,
2335
- "kind": "qvec",
2336
- "element_type": {
2337
- "source_ref": null,
2338
- "kind": "qbit"
2339
- },
2340
- "length": null
2341
- },
2342
- "size": null,
2343
- "direction": "inout"
2344
- }
2345
- ]
2346
- }"""
2347
- )
2348
-
2349
- QST_TYPE2 = NamedParamsQuantumFunctionDeclaration.parse_raw(
2350
- """{
2351
- "source_ref": null,
2352
- "name": "qst_type2",
2353
- "positional_arg_declarations": [
2354
- {
2355
- "source_ref": null,
2356
- "name": "x",
2357
- "kind": "PortDeclaration",
2358
- "quantum_type": {
2359
- "source_ref": null,
2360
- "kind": "qvec",
2361
- "element_type": {
2362
- "source_ref": null,
2363
- "kind": "qbit"
2364
- },
2365
- "length": null
2366
- },
2367
- "size": null,
2368
- "direction": "inout"
2369
- }
2370
- ]
2371
- }"""
2372
- )
2373
-
2374
- MODULAR_INCREMENT = NamedParamsQuantumFunctionDeclaration.parse_raw(
2375
- """{
2376
- "source_ref": null,
2377
- "name": "modular_increment",
2378
- "positional_arg_declarations": [
2379
- {
2380
- "source_ref": null,
2381
- "name": "a",
2382
- "kind": "ClassicalParameterDeclaration",
2383
- "classical_type": {
2384
- "source_ref": null,
2385
- "kind": "int"
2386
- }
2387
- },
2388
- {
2389
- "source_ref": null,
2390
- "name": "x",
2391
- "kind": "PortDeclaration",
2392
- "quantum_type": {
2393
- "source_ref": null,
2394
- "kind": "qvec",
2395
- "element_type": {
2396
- "source_ref": null,
2397
- "kind": "qbit"
2398
- },
2399
- "length": null
2400
- },
2401
- "size": null,
2402
- "direction": "inout"
2403
- }
2404
- ]
2405
- }"""
2406
- )
2407
-
2408
- QFT = NamedParamsQuantumFunctionDeclaration.parse_raw(
2409
- """{
2410
- "source_ref": null,
2411
- "name": "qft",
2412
- "positional_arg_declarations": [
2413
- {
2414
- "source_ref": null,
2415
- "name": "target",
2416
- "kind": "PortDeclaration",
2417
- "quantum_type": {
2418
- "kind": "qvec",
2419
- "element_type": {
2420
- "kind": "qbit"
2421
- },
2422
- "length": null
2423
- },
2424
- "size": null,
2425
- "direction": "inout"
2426
- }
2427
- ]
2428
- }"""
2429
- )
2430
-
2431
- OPEN_LIB_DECLS = [
2432
- func
2433
- for func in vars().values()
2434
- if isinstance(func, NamedParamsQuantumFunctionDeclaration)
2435
- ]
2436
-
2437
- __all__ = [
2438
- "QPE_FLEXIBLE",
2439
- "QPE",
2440
- "SINGLE_PAULI",
2441
- "LINEAR_PAULI_ROTATIONS",
2442
- "AMPLITUDE_ESTIMATION",
2443
- "PHASE_ORACLE",
2444
- "REFLECT_ABOUT_ZERO",
2445
- "GROVER_DIFFUSER",
2446
- "GROVER_OPERATOR",
2447
- "GROVER_SEARCH",
2448
- "HADAMARD_TRANSFORM",
2449
- "APPLY_TO_ALL",
2450
- "QFT_NO_SWAP",
2451
- "_CHECK_MSB",
2452
- "_CTRL_X",
2453
- "QFT_SPACE_ADD_CONST",
2454
- "CC_MODULAR_ADD",
2455
- "C_MODULAR_MULTIPLY",
2456
- "MULTISWAP",
2457
- "INPLACE_C_MODULAR_MULTIPLY",
2458
- "MODULAR_EXP",
2459
- "QSVT_STEP",
2460
- "QSVT",
2461
- "PROJECTOR_CONTROLLED_PHASE",
2462
- "QSVT_INVERSION",
2463
- "ALLOCATE_NUM",
2464
- "QAOA_MIXER_LAYER",
2465
- "QAOA_COST_LAYER",
2466
- "QAOA_LAYER",
2467
- "QAOA_INIT",
2468
- "QAOA_PENALTY",
2469
- "FULL_HEA",
2470
- "SWAP_TEST",
2471
- "_PREPARE_UNIFORM_TRIMMED_STATE_STEP",
2472
- "PREPARE_UNIFORM_TRIMMED_STATE",
2473
- "PREPARE_UNIFORM_INTERVAL_STATE",
2474
- "PREPARE_GHZ_STATE",
2475
- "PREPARE_EXPONENTIAL_STATE",
2476
- "PREPARE_BELL_STATE",
2477
- "INPLACE_PREPARE_INT",
2478
- "PREPARE_INT",
2479
- "SWITCH",
2480
- "_QCT_D_OPERATOR",
2481
- "_QCT_PI_OPERATOR",
2482
- "QCT_QST_TYPE1",
2483
- "QCT_QST_TYPE2",
2484
- "QCT_TYPE2",
2485
- "QST_TYPE2",
2486
- "MODULAR_INCREMENT",
2487
- "QFT",
2488
- "OPEN_LIB_DECLS",
2489
- ]