classiq 0.39.0__py3-none-any.whl → 0.41.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 (100) hide show
  1. classiq/__init__.py +5 -2
  2. classiq/_internals/api_wrapper.py +3 -21
  3. classiq/applications/chemistry/chemistry_model_constructor.py +87 -101
  4. classiq/applications/combinatorial_helpers/combinatorial_problem_utils.py +7 -26
  5. classiq/applications/combinatorial_helpers/optimization_model.py +7 -6
  6. classiq/applications/combinatorial_helpers/pauli_helpers/pauli_utils.py +33 -55
  7. classiq/applications/combinatorial_optimization/__init__.py +4 -0
  8. classiq/applications/combinatorial_optimization/combinatorial_optimization_model_constructor.py +29 -26
  9. classiq/applications/finance/finance_model_constructor.py +23 -26
  10. classiq/applications/grover/grover_model_constructor.py +37 -38
  11. classiq/applications/qsvm/qsvm.py +1 -2
  12. classiq/applications/qsvm/qsvm_model_constructor.py +15 -16
  13. classiq/execution/__init__.py +4 -0
  14. classiq/execution/execution_session.py +151 -0
  15. classiq/execution/qnn.py +80 -0
  16. classiq/executor.py +2 -109
  17. classiq/interface/_version.py +1 -1
  18. classiq/interface/analyzer/analysis_params.py +11 -0
  19. classiq/interface/applications/qsvm.py +0 -8
  20. classiq/interface/ast_node.py +12 -2
  21. classiq/interface/backend/backend_preferences.py +30 -6
  22. classiq/interface/backend/quantum_backend_providers.py +11 -11
  23. classiq/interface/executor/execution_preferences.py +7 -67
  24. classiq/interface/executor/execution_result.py +22 -1
  25. classiq/interface/generator/application_apis/chemistry_declarations.py +2 -4
  26. classiq/interface/generator/application_apis/finance_declarations.py +1 -1
  27. classiq/interface/generator/arith/binary_ops.py +88 -25
  28. classiq/interface/generator/arith/unary_ops.py +28 -19
  29. classiq/interface/generator/expressions/atomic_expression_functions.py +6 -2
  30. classiq/interface/generator/expressions/enums/__init__.py +10 -0
  31. classiq/interface/generator/expressions/enums/classical_enum.py +5 -1
  32. classiq/interface/generator/expressions/expression.py +9 -2
  33. classiq/interface/generator/expressions/qmod_qarray_proxy.py +89 -0
  34. classiq/interface/generator/expressions/qmod_qscalar_proxy.py +20 -0
  35. classiq/interface/generator/expressions/qmod_sized_proxy.py +22 -0
  36. classiq/interface/generator/expressions/sympy_supported_expressions.py +10 -1
  37. classiq/interface/generator/functions/builtins/core_library/atomic_quantum_functions.py +8 -6
  38. classiq/interface/generator/functions/builtins/core_library/exponentiation_functions.py +10 -4
  39. classiq/interface/generator/functions/builtins/internal_operators.py +7 -62
  40. classiq/interface/generator/functions/builtins/open_lib_functions.py +1627 -271
  41. classiq/interface/generator/functions/classical_type.py +27 -17
  42. classiq/interface/generator/model/preferences/preferences.py +4 -2
  43. classiq/interface/generator/synthesis_metadata/synthesis_duration.py +0 -4
  44. classiq/interface/model/bind_operation.py +3 -1
  45. classiq/interface/model/call_synthesis_data.py +2 -13
  46. classiq/interface/model/classical_if.py +3 -1
  47. classiq/interface/model/classical_parameter_declaration.py +13 -0
  48. classiq/interface/model/control.py +6 -8
  49. classiq/interface/model/inplace_binary_operation.py +3 -1
  50. classiq/interface/model/invert.py +3 -1
  51. classiq/interface/model/port_declaration.py +8 -1
  52. classiq/interface/model/power.py +3 -1
  53. classiq/interface/model/quantum_expressions/amplitude_loading_operation.py +4 -2
  54. classiq/interface/model/quantum_expressions/arithmetic_operation.py +3 -1
  55. classiq/interface/model/quantum_expressions/quantum_expression.py +11 -1
  56. classiq/interface/model/quantum_function_call.py +4 -10
  57. classiq/interface/model/quantum_function_declaration.py +26 -4
  58. classiq/interface/model/quantum_lambda_function.py +1 -20
  59. classiq/interface/model/quantum_statement.py +9 -2
  60. classiq/interface/model/quantum_type.py +6 -5
  61. classiq/interface/model/repeat.py +3 -1
  62. classiq/interface/model/resolvers/function_call_resolver.py +0 -5
  63. classiq/interface/model/statement_block.py +19 -16
  64. classiq/interface/model/validations/handles_validator.py +8 -2
  65. classiq/interface/model/variable_declaration_statement.py +3 -1
  66. classiq/interface/model/within_apply_operation.py +3 -1
  67. classiq/interface/server/routes.py +0 -5
  68. classiq/qmod/__init__.py +5 -2
  69. classiq/qmod/builtins/classical_execution_primitives.py +22 -2
  70. classiq/qmod/builtins/classical_functions.py +30 -35
  71. classiq/qmod/builtins/functions.py +263 -153
  72. classiq/qmod/builtins/operations.py +50 -26
  73. classiq/qmod/builtins/structs.py +50 -48
  74. classiq/qmod/declaration_inferrer.py +32 -27
  75. classiq/qmod/native/__init__.py +9 -0
  76. classiq/qmod/native/expression_to_qmod.py +8 -4
  77. classiq/qmod/native/pretty_printer.py +11 -18
  78. classiq/qmod/pretty_print/__init__.py +9 -0
  79. classiq/qmod/pretty_print/expression_to_python.py +221 -0
  80. classiq/qmod/pretty_print/pretty_printer.py +421 -0
  81. classiq/qmod/qmod_constant.py +7 -7
  82. classiq/qmod/qmod_parameter.py +57 -33
  83. classiq/qmod/qmod_struct.py +2 -2
  84. classiq/qmod/qmod_variable.py +40 -29
  85. classiq/qmod/quantum_callable.py +8 -4
  86. classiq/qmod/quantum_expandable.py +22 -15
  87. classiq/qmod/quantum_function.py +15 -4
  88. classiq/qmod/symbolic.py +73 -68
  89. classiq/qmod/symbolic_expr.py +1 -1
  90. classiq/qmod/symbolic_type.py +1 -4
  91. classiq/qmod/utilities.py +29 -0
  92. classiq/synthesis.py +15 -16
  93. {classiq-0.39.0.dist-info → classiq-0.41.0.dist-info}/METADATA +5 -4
  94. {classiq-0.39.0.dist-info → classiq-0.41.0.dist-info}/RECORD +95 -94
  95. classiq/interface/executor/error_mitigation.py +0 -6
  96. classiq/interface/generator/functions/builtins/core_library/chemistry_functions.py +0 -0
  97. classiq/interface/model/common_model_types.py +0 -23
  98. classiq/interface/model/quantum_expressions/control_state.py +0 -38
  99. classiq/interface/model/quantum_if_operation.py +0 -94
  100. {classiq-0.39.0.dist-info → classiq-0.41.0.dist-info}/WHEEL +0 -0
@@ -12,6 +12,7 @@ QFT_STEP = QuantumFunctionDeclaration.parse_raw(
12
12
  "port_declarations": {
13
13
  "target": {
14
14
  "name": "target",
15
+ "kind": "PortDeclaration",
15
16
  "direction": "inout"
16
17
  }
17
18
  },
@@ -28,6 +29,7 @@ QFT = QuantumFunctionDeclaration.parse_raw(
28
29
  "port_declarations": {
29
30
  "target": {
30
31
  "name": "target",
32
+ "kind": "PortDeclaration",
31
33
  "direction": "inout"
32
34
  }
33
35
  },
@@ -47,6 +49,7 @@ QPE_FLEXIBLE = QuantumFunctionDeclaration.parse_raw(
47
49
  "quantum_type": {
48
50
  "kind": "qnum"
49
51
  },
52
+ "kind": "PortDeclaration",
50
53
  "direction": "inout"
51
54
  }
52
55
  },
@@ -55,12 +58,14 @@ QPE_FLEXIBLE = QuantumFunctionDeclaration.parse_raw(
55
58
  "name": "unitary_with_power",
56
59
  "positional_arg_declarations": [
57
60
  {
61
+ "kind": "ClassicalParameterDeclaration",
58
62
  "name": "arg0",
59
63
  "classical_type": {
60
64
  "kind": "int"
61
65
  }
62
66
  }
63
67
  ],
68
+ "kind": "QuantumOperandDeclaration",
64
69
  "is_list": false
65
70
  }
66
71
  },
@@ -69,12 +74,14 @@ QPE_FLEXIBLE = QuantumFunctionDeclaration.parse_raw(
69
74
  "name": "unitary_with_power",
70
75
  "positional_arg_declarations": [
71
76
  {
77
+ "kind": "ClassicalParameterDeclaration",
72
78
  "name": "arg0",
73
79
  "classical_type": {
74
80
  "kind": "int"
75
81
  }
76
82
  }
77
83
  ],
84
+ "kind": "QuantumOperandDeclaration",
78
85
  "is_list": false
79
86
  },
80
87
  {
@@ -82,6 +89,7 @@ QPE_FLEXIBLE = QuantumFunctionDeclaration.parse_raw(
82
89
  "quantum_type": {
83
90
  "kind": "qnum"
84
91
  },
92
+ "kind": "PortDeclaration",
85
93
  "direction": "inout"
86
94
  }
87
95
  ]
@@ -99,6 +107,7 @@ QPE = QuantumFunctionDeclaration.parse_raw(
99
107
  "quantum_type": {
100
108
  "kind": "qnum"
101
109
  },
110
+ "kind": "PortDeclaration",
102
111
  "direction": "inout"
103
112
  }
104
113
  },
@@ -106,6 +115,7 @@ QPE = QuantumFunctionDeclaration.parse_raw(
106
115
  "unitary": {
107
116
  "name": "unitary",
108
117
  "positional_arg_declarations": [],
118
+ "kind": "QuantumOperandDeclaration",
109
119
  "is_list": false
110
120
  }
111
121
  },
@@ -113,6 +123,7 @@ QPE = QuantumFunctionDeclaration.parse_raw(
113
123
  {
114
124
  "name": "unitary",
115
125
  "positional_arg_declarations": [],
126
+ "kind": "QuantumOperandDeclaration",
116
127
  "is_list": false
117
128
  },
118
129
  {
@@ -120,6 +131,7 @@ QPE = QuantumFunctionDeclaration.parse_raw(
120
131
  "quantum_type": {
121
132
  "kind": "qnum"
122
133
  },
134
+ "kind": "PortDeclaration",
123
135
  "direction": "inout"
124
136
  }
125
137
  ]
@@ -141,6 +153,7 @@ SINGLE_PAULI = QuantumFunctionDeclaration.parse_raw(
141
153
  "port_declarations": {
142
154
  "x": {
143
155
  "name": "x",
156
+ "kind": "PortDeclaration",
144
157
  "direction": "inout"
145
158
  },
146
159
  "q": {
@@ -148,6 +161,7 @@ SINGLE_PAULI = QuantumFunctionDeclaration.parse_raw(
148
161
  "size": {
149
162
  "expr": "1"
150
163
  },
164
+ "kind": "PortDeclaration",
151
165
  "direction": "inout"
152
166
  }
153
167
  },
@@ -165,9 +179,11 @@ SINGLE_PAULI = QuantumFunctionDeclaration.parse_raw(
165
179
  "size": {
166
180
  "expr": "1"
167
181
  },
182
+ "kind": "PortDeclaration",
168
183
  "direction": "inout"
169
184
  }
170
- }
185
+ },
186
+ "kind": "QuantumOperandDeclaration"
171
187
  }
172
188
  },
173
189
  "positional_arg_declarations": []
@@ -201,10 +217,12 @@ LINEAR_PAULI_ROTATIONS = QuantumFunctionDeclaration.parse_raw(
201
217
  "port_declarations": {
202
218
  "x": {
203
219
  "name": "x",
220
+ "kind": "PortDeclaration",
204
221
  "direction": "inout"
205
222
  },
206
223
  "q": {
207
224
  "name": "q",
225
+ "kind": "PortDeclaration",
208
226
  "direction": "inout"
209
227
  }
210
228
  },
@@ -224,14 +242,295 @@ AMPLITUDE_ESTIMATION = QuantumFunctionDeclaration.parse_raw(
224
242
  "quantum_type": {
225
243
  "kind": "qnum"
226
244
  },
245
+ "kind": "PortDeclaration",
246
+ "direction": "inout"
247
+ },
248
+ "packed_vars": {
249
+ "name": "packed_vars",
250
+ "quantum_type": {
251
+ "kind": "qvec",
252
+ "length": null
253
+ },
254
+ "kind": "PortDeclaration",
255
+ "direction": "inout"
256
+ }
257
+ },
258
+ "operand_declarations": {
259
+ "oracle": {
260
+ "name": "oracle",
261
+ "positional_arg_declarations": [
262
+ {
263
+ "name": "arg0",
264
+ "quantum_type": {
265
+ "kind": "qvec",
266
+ "length": null
267
+ },
268
+ "kind": "PortDeclaration",
269
+ "direction": "inout"
270
+ }
271
+ ],
272
+ "kind": "QuantumOperandDeclaration",
273
+ "is_list": false
274
+ },
275
+ "space_transform": {
276
+ "name": "space_transform",
277
+ "positional_arg_declarations": [
278
+ {
279
+ "name": "arg0",
280
+ "quantum_type": {
281
+ "kind": "qvec",
282
+ "length": null
283
+ },
284
+ "kind": "PortDeclaration",
285
+ "direction": "inout"
286
+ }
287
+ ],
288
+ "kind": "QuantumOperandDeclaration",
289
+ "is_list": false
290
+ }
291
+ },
292
+ "positional_arg_declarations": [
293
+ {
294
+ "name": "oracle",
295
+ "positional_arg_declarations": [
296
+ {
297
+ "name": "arg0",
298
+ "quantum_type": {
299
+ "kind": "qvec",
300
+ "length": null
301
+ },
302
+ "kind": "PortDeclaration",
303
+ "direction": "inout"
304
+ }
305
+ ],
306
+ "kind": "QuantumOperandDeclaration",
307
+ "is_list": false
308
+ },
309
+ {
310
+ "name": "space_transform",
311
+ "positional_arg_declarations": [
312
+ {
313
+ "name": "arg0",
314
+ "quantum_type": {
315
+ "kind": "qvec",
316
+ "length": null
317
+ },
318
+ "kind": "PortDeclaration",
319
+ "direction": "inout"
320
+ }
321
+ ],
322
+ "kind": "QuantumOperandDeclaration",
323
+ "is_list": false
324
+ },
325
+ {
326
+ "name": "phase",
327
+ "quantum_type": {
328
+ "kind": "qnum"
329
+ },
330
+ "kind": "PortDeclaration",
331
+ "direction": "inout"
332
+ },
333
+ {
334
+ "name": "packed_vars",
335
+ "quantum_type": {
336
+ "kind": "qvec",
337
+ "length": null
338
+ },
339
+ "kind": "PortDeclaration",
340
+ "direction": "inout"
341
+ }
342
+ ]
343
+ }"""
344
+ )
345
+
346
+ PHASE_ORACLE = QuantumFunctionDeclaration.parse_raw(
347
+ """{
348
+ "source_ref": null,
349
+ "name": "phase_oracle",
350
+ "param_decls": {},
351
+ "port_declarations": {
352
+ "target": {
353
+ "name": "target",
354
+ "quantum_type": {
355
+ "kind": "qvec",
356
+ "length": null
357
+ },
358
+ "kind": "PortDeclaration",
359
+ "direction": "inout"
360
+ }
361
+ },
362
+ "operand_declarations": {
363
+ "predicate": {
364
+ "name": "predicate",
365
+ "positional_arg_declarations": [
366
+ {
367
+ "name": "arg0",
368
+ "quantum_type": {
369
+ "kind": "qvec",
370
+ "length": null
371
+ },
372
+ "kind": "PortDeclaration",
373
+ "direction": "inout"
374
+ },
375
+ {
376
+ "name": "arg1",
377
+ "quantum_type": {
378
+ "kind": "qbit"
379
+ },
380
+ "kind": "PortDeclaration",
381
+ "direction": "inout"
382
+ }
383
+ ],
384
+ "kind": "QuantumOperandDeclaration",
385
+ "is_list": false
386
+ }
387
+ },
388
+ "positional_arg_declarations": [
389
+ {
390
+ "name": "predicate",
391
+ "positional_arg_declarations": [
392
+ {
393
+ "name": "arg0",
394
+ "quantum_type": {
395
+ "kind": "qvec",
396
+ "length": null
397
+ },
398
+ "kind": "PortDeclaration",
399
+ "direction": "inout"
400
+ },
401
+ {
402
+ "name": "arg1",
403
+ "quantum_type": {
404
+ "kind": "qbit"
405
+ },
406
+ "kind": "PortDeclaration",
407
+ "direction": "inout"
408
+ }
409
+ ],
410
+ "kind": "QuantumOperandDeclaration",
411
+ "is_list": false
412
+ },
413
+ {
414
+ "name": "target",
415
+ "quantum_type": {
416
+ "kind": "qvec",
417
+ "length": null
418
+ },
419
+ "kind": "PortDeclaration",
420
+ "direction": "inout"
421
+ }
422
+ ]
423
+ }"""
424
+ )
425
+
426
+ REFLECT_ABOUT_ZERO = QuantumFunctionDeclaration.parse_raw(
427
+ """{
428
+ "source_ref": null,
429
+ "name": "reflect_about_zero",
430
+ "param_decls": {},
431
+ "port_declarations": {
432
+ "packed_vars": {
433
+ "name": "packed_vars",
434
+ "quantum_type": {
435
+ "kind": "qvec",
436
+ "length": null
437
+ },
438
+ "kind": "PortDeclaration",
439
+ "direction": "inout"
440
+ }
441
+ },
442
+ "operand_declarations": {},
443
+ "positional_arg_declarations": [
444
+ {
445
+ "name": "packed_vars",
446
+ "quantum_type": {
447
+ "kind": "qvec",
448
+ "length": null
449
+ },
450
+ "kind": "PortDeclaration",
451
+ "direction": "inout"
452
+ }
453
+ ]
454
+ }"""
455
+ )
456
+
457
+ GROVER_DIFFUSER = QuantumFunctionDeclaration.parse_raw(
458
+ """{
459
+ "source_ref": null,
460
+ "name": "grover_diffuser",
461
+ "param_decls": {},
462
+ "port_declarations": {
463
+ "packed_vars": {
464
+ "name": "packed_vars",
465
+ "quantum_type": {
466
+ "kind": "qvec",
467
+ "length": null
468
+ },
469
+ "kind": "PortDeclaration",
227
470
  "direction": "inout"
471
+ }
472
+ },
473
+ "operand_declarations": {
474
+ "space_transform": {
475
+ "name": "space_transform",
476
+ "positional_arg_declarations": [
477
+ {
478
+ "name": "arg0",
479
+ "quantum_type": {
480
+ "kind": "qvec",
481
+ "length": null
482
+ },
483
+ "kind": "PortDeclaration",
484
+ "direction": "inout"
485
+ }
486
+ ],
487
+ "kind": "QuantumOperandDeclaration",
488
+ "is_list": false
489
+ }
490
+ },
491
+ "positional_arg_declarations": [
492
+ {
493
+ "name": "space_transform",
494
+ "positional_arg_declarations": [
495
+ {
496
+ "name": "arg0",
497
+ "quantum_type": {
498
+ "kind": "qvec",
499
+ "length": null
500
+ },
501
+ "kind": "PortDeclaration",
502
+ "direction": "inout"
503
+ }
504
+ ],
505
+ "kind": "QuantumOperandDeclaration",
506
+ "is_list": false
228
507
  },
508
+ {
509
+ "name": "packed_vars",
510
+ "quantum_type": {
511
+ "kind": "qvec",
512
+ "length": null
513
+ },
514
+ "kind": "PortDeclaration",
515
+ "direction": "inout"
516
+ }
517
+ ]
518
+ }"""
519
+ )
520
+
521
+ GROVER_OPERATOR = QuantumFunctionDeclaration.parse_raw(
522
+ """{
523
+ "source_ref": null,
524
+ "name": "grover_operator",
525
+ "param_decls": {},
526
+ "port_declarations": {
229
527
  "packed_vars": {
230
528
  "name": "packed_vars",
231
529
  "quantum_type": {
232
- "length": null,
233
- "kind": "qvec"
530
+ "kind": "qvec",
531
+ "length": null
234
532
  },
533
+ "kind": "PortDeclaration",
235
534
  "direction": "inout"
236
535
  }
237
536
  },
@@ -242,12 +541,14 @@ AMPLITUDE_ESTIMATION = QuantumFunctionDeclaration.parse_raw(
242
541
  {
243
542
  "name": "arg0",
244
543
  "quantum_type": {
245
- "length": null,
246
- "kind": "qvec"
544
+ "kind": "qvec",
545
+ "length": null
247
546
  },
547
+ "kind": "PortDeclaration",
248
548
  "direction": "inout"
249
549
  }
250
550
  ],
551
+ "kind": "QuantumOperandDeclaration",
251
552
  "is_list": false
252
553
  },
253
554
  "space_transform": {
@@ -256,88 +557,1214 @@ AMPLITUDE_ESTIMATION = QuantumFunctionDeclaration.parse_raw(
256
557
  {
257
558
  "name": "arg0",
258
559
  "quantum_type": {
259
- "length": null,
260
- "kind": "qvec"
560
+ "kind": "qvec",
561
+ "length": null
562
+ },
563
+ "kind": "PortDeclaration",
564
+ "direction": "inout"
565
+ }
566
+ ],
567
+ "kind": "QuantumOperandDeclaration",
568
+ "is_list": false
569
+ }
570
+ },
571
+ "positional_arg_declarations": [
572
+ {
573
+ "name": "oracle",
574
+ "positional_arg_declarations": [
575
+ {
576
+ "name": "arg0",
577
+ "quantum_type": {
578
+ "kind": "qvec",
579
+ "length": null
580
+ },
581
+ "kind": "PortDeclaration",
582
+ "direction": "inout"
583
+ }
584
+ ],
585
+ "kind": "QuantumOperandDeclaration",
586
+ "is_list": false
587
+ },
588
+ {
589
+ "name": "space_transform",
590
+ "positional_arg_declarations": [
591
+ {
592
+ "name": "arg0",
593
+ "quantum_type": {
594
+ "kind": "qvec",
595
+ "length": null
596
+ },
597
+ "kind": "PortDeclaration",
598
+ "direction": "inout"
599
+ }
600
+ ],
601
+ "kind": "QuantumOperandDeclaration",
602
+ "is_list": false
603
+ },
604
+ {
605
+ "name": "packed_vars",
606
+ "quantum_type": {
607
+ "kind": "qvec",
608
+ "length": null
609
+ },
610
+ "kind": "PortDeclaration",
611
+ "direction": "inout"
612
+ }
613
+ ]
614
+ }"""
615
+ )
616
+
617
+ GROVER_SEARCH = QuantumFunctionDeclaration.parse_raw(
618
+ """{
619
+ "source_ref": null,
620
+ "name": "grover_search",
621
+ "param_decls": {
622
+ "reps": {
623
+ "kind": "int"
624
+ }
625
+ },
626
+ "port_declarations": {
627
+ "packed_vars": {
628
+ "name": "packed_vars",
629
+ "quantum_type": {
630
+ "kind": "qvec",
631
+ "length": null
632
+ },
633
+ "kind": "PortDeclaration",
634
+ "direction": "inout"
635
+ }
636
+ },
637
+ "operand_declarations": {
638
+ "oracle": {
639
+ "name": "oracle",
640
+ "positional_arg_declarations": [
641
+ {
642
+ "name": "arg0",
643
+ "quantum_type": {
644
+ "kind": "qvec",
645
+ "length": null
646
+ },
647
+ "kind": "PortDeclaration",
648
+ "direction": "inout"
649
+ }
650
+ ],
651
+ "kind": "QuantumOperandDeclaration",
652
+ "is_list": false
653
+ }
654
+ },
655
+ "positional_arg_declarations": [
656
+ {
657
+ "kind": "ClassicalParameterDeclaration",
658
+ "name": "reps",
659
+ "classical_type": {
660
+ "kind": "int"
661
+ }
662
+ },
663
+ {
664
+ "name": "oracle",
665
+ "positional_arg_declarations": [
666
+ {
667
+ "name": "arg0",
668
+ "quantum_type": {
669
+ "kind": "qvec",
670
+ "length": null
671
+ },
672
+ "kind": "PortDeclaration",
673
+ "direction": "inout"
674
+ }
675
+ ],
676
+ "kind": "QuantumOperandDeclaration",
677
+ "is_list": false
678
+ },
679
+ {
680
+ "name": "packed_vars",
681
+ "quantum_type": {
682
+ "kind": "qvec",
683
+ "length": null
684
+ },
685
+ "kind": "PortDeclaration",
686
+ "direction": "inout"
687
+ }
688
+ ]
689
+ }"""
690
+ )
691
+
692
+ HADAMARD_TRANSFORM = QuantumFunctionDeclaration.parse_raw(
693
+ """{
694
+ "source_ref": null,
695
+ "name": "hadamard_transform",
696
+ "param_decls": {},
697
+ "port_declarations": {
698
+ "target": {
699
+ "name": "target",
700
+ "kind": "PortDeclaration",
701
+ "direction": "inout"
702
+ }
703
+ },
704
+ "operand_declarations": {},
705
+ "positional_arg_declarations": []
706
+ }"""
707
+ )
708
+
709
+ APPLY_TO_ALL = QuantumFunctionDeclaration.parse_raw(
710
+ """{
711
+ "source_ref": null,
712
+ "name": "apply_to_all",
713
+ "param_decls": {},
714
+ "port_declarations": {
715
+ "target": {
716
+ "name": "target",
717
+ "kind": "PortDeclaration",
718
+ "direction": "inout"
719
+ }
720
+ },
721
+ "operand_declarations": {
722
+ "gate_operand": {
723
+ "name": "gate_operand",
724
+ "port_declarations": {
725
+ "target": {
726
+ "name": "target",
727
+ "size": {
728
+ "expr": "1"
729
+ },
730
+ "kind": "PortDeclaration",
731
+ "direction": "inout"
732
+ }
733
+ },
734
+ "kind": "QuantumOperandDeclaration"
735
+ }
736
+ },
737
+ "positional_arg_declarations": []
738
+ }"""
739
+ )
740
+
741
+ QFT_NO_SWAP = QuantumFunctionDeclaration.parse_raw(
742
+ """{
743
+ "source_ref": null,
744
+ "name": "qft_no_swap",
745
+ "param_decls": {},
746
+ "port_declarations": {
747
+ "qbv": {
748
+ "name": "qbv",
749
+ "quantum_type": {
750
+ "kind": "qvec",
751
+ "length": null
752
+ },
753
+ "kind": "PortDeclaration",
754
+ "direction": "inout"
755
+ }
756
+ },
757
+ "operand_declarations": {},
758
+ "positional_arg_declarations": [
759
+ {
760
+ "name": "qbv",
761
+ "quantum_type": {
762
+ "kind": "qvec",
763
+ "length": null
764
+ },
765
+ "kind": "PortDeclaration",
766
+ "direction": "inout"
767
+ }
768
+ ]
769
+ }"""
770
+ )
771
+
772
+ _CHECK_MSB = QuantumFunctionDeclaration.parse_raw(
773
+ """{
774
+ "source_ref": null,
775
+ "name": "_check_msb",
776
+ "param_decls": {
777
+ "ref": {
778
+ "kind": "int"
779
+ }
780
+ },
781
+ "port_declarations": {
782
+ "x": {
783
+ "name": "x",
784
+ "quantum_type": {
785
+ "kind": "qvec",
786
+ "length": null
787
+ },
788
+ "kind": "PortDeclaration",
789
+ "direction": "inout"
790
+ },
791
+ "aux": {
792
+ "name": "aux",
793
+ "quantum_type": {
794
+ "kind": "qbit"
795
+ },
796
+ "kind": "PortDeclaration",
797
+ "direction": "inout"
798
+ }
799
+ },
800
+ "operand_declarations": {},
801
+ "positional_arg_declarations": [
802
+ {
803
+ "kind": "ClassicalParameterDeclaration",
804
+ "name": "ref",
805
+ "classical_type": {
806
+ "kind": "int"
807
+ }
808
+ },
809
+ {
810
+ "name": "x",
811
+ "quantum_type": {
812
+ "kind": "qvec",
813
+ "length": null
814
+ },
815
+ "kind": "PortDeclaration",
816
+ "direction": "inout"
817
+ },
818
+ {
819
+ "name": "aux",
820
+ "quantum_type": {
821
+ "kind": "qbit"
822
+ },
823
+ "kind": "PortDeclaration",
824
+ "direction": "inout"
825
+ }
826
+ ]
827
+ }"""
828
+ )
829
+
830
+ _CTRL_X = QuantumFunctionDeclaration.parse_raw(
831
+ """{
832
+ "source_ref": null,
833
+ "name": "_ctrl_x",
834
+ "param_decls": {
835
+ "ref": {
836
+ "kind": "int"
837
+ }
838
+ },
839
+ "port_declarations": {
840
+ "ctrl": {
841
+ "name": "ctrl",
842
+ "quantum_type": {
843
+ "kind": "qnum"
844
+ },
845
+ "kind": "PortDeclaration",
846
+ "direction": "inout"
847
+ },
848
+ "aux": {
849
+ "name": "aux",
850
+ "quantum_type": {
851
+ "kind": "qbit"
852
+ },
853
+ "kind": "PortDeclaration",
854
+ "direction": "inout"
855
+ }
856
+ },
857
+ "operand_declarations": {},
858
+ "positional_arg_declarations": [
859
+ {
860
+ "kind": "ClassicalParameterDeclaration",
861
+ "name": "ref",
862
+ "classical_type": {
863
+ "kind": "int"
864
+ }
865
+ },
866
+ {
867
+ "name": "ctrl",
868
+ "quantum_type": {
869
+ "kind": "qnum"
870
+ },
871
+ "kind": "PortDeclaration",
872
+ "direction": "inout"
873
+ },
874
+ {
875
+ "name": "aux",
876
+ "quantum_type": {
877
+ "kind": "qbit"
878
+ },
879
+ "kind": "PortDeclaration",
880
+ "direction": "inout"
881
+ }
882
+ ]
883
+ }"""
884
+ )
885
+
886
+ QFT_SPACE_ADD_CONST = QuantumFunctionDeclaration.parse_raw(
887
+ """{
888
+ "source_ref": null,
889
+ "name": "qft_space_add_const",
890
+ "param_decls": {
891
+ "value": {
892
+ "kind": "int"
893
+ }
894
+ },
895
+ "port_declarations": {
896
+ "phi_b": {
897
+ "name": "phi_b",
898
+ "quantum_type": {
899
+ "kind": "qvec",
900
+ "length": null
901
+ },
902
+ "kind": "PortDeclaration",
903
+ "direction": "inout"
904
+ }
905
+ },
906
+ "operand_declarations": {},
907
+ "positional_arg_declarations": [
908
+ {
909
+ "kind": "ClassicalParameterDeclaration",
910
+ "name": "value",
911
+ "classical_type": {
912
+ "kind": "int"
913
+ }
914
+ },
915
+ {
916
+ "name": "phi_b",
917
+ "quantum_type": {
918
+ "kind": "qvec",
919
+ "length": null
920
+ },
921
+ "kind": "PortDeclaration",
922
+ "direction": "inout"
923
+ }
924
+ ]
925
+ }"""
926
+ )
927
+
928
+ CC_MODULAR_ADD = QuantumFunctionDeclaration.parse_raw(
929
+ """{
930
+ "source_ref": null,
931
+ "name": "cc_modular_add",
932
+ "param_decls": {
933
+ "n": {
934
+ "kind": "int"
935
+ },
936
+ "a": {
937
+ "kind": "int"
938
+ }
939
+ },
940
+ "port_declarations": {
941
+ "phi_b": {
942
+ "name": "phi_b",
943
+ "quantum_type": {
944
+ "kind": "qvec",
945
+ "length": null
946
+ },
947
+ "kind": "PortDeclaration",
948
+ "direction": "inout"
949
+ },
950
+ "c1": {
951
+ "name": "c1",
952
+ "quantum_type": {
953
+ "kind": "qbit"
954
+ },
955
+ "kind": "PortDeclaration",
956
+ "direction": "inout"
957
+ },
958
+ "c2": {
959
+ "name": "c2",
960
+ "quantum_type": {
961
+ "kind": "qbit"
962
+ },
963
+ "kind": "PortDeclaration",
964
+ "direction": "inout"
965
+ },
966
+ "aux": {
967
+ "name": "aux",
968
+ "quantum_type": {
969
+ "kind": "qbit"
970
+ },
971
+ "kind": "PortDeclaration",
972
+ "direction": "inout"
973
+ }
974
+ },
975
+ "operand_declarations": {},
976
+ "positional_arg_declarations": [
977
+ {
978
+ "kind": "ClassicalParameterDeclaration",
979
+ "name": "n",
980
+ "classical_type": {
981
+ "kind": "int"
982
+ }
983
+ },
984
+ {
985
+ "kind": "ClassicalParameterDeclaration",
986
+ "name": "a",
987
+ "classical_type": {
988
+ "kind": "int"
989
+ }
990
+ },
991
+ {
992
+ "name": "phi_b",
993
+ "quantum_type": {
994
+ "kind": "qvec",
995
+ "length": null
996
+ },
997
+ "kind": "PortDeclaration",
998
+ "direction": "inout"
999
+ },
1000
+ {
1001
+ "name": "c1",
1002
+ "quantum_type": {
1003
+ "kind": "qbit"
1004
+ },
1005
+ "kind": "PortDeclaration",
1006
+ "direction": "inout"
1007
+ },
1008
+ {
1009
+ "name": "c2",
1010
+ "quantum_type": {
1011
+ "kind": "qbit"
1012
+ },
1013
+ "kind": "PortDeclaration",
1014
+ "direction": "inout"
1015
+ },
1016
+ {
1017
+ "name": "aux",
1018
+ "quantum_type": {
1019
+ "kind": "qbit"
1020
+ },
1021
+ "kind": "PortDeclaration",
1022
+ "direction": "inout"
1023
+ }
1024
+ ]
1025
+ }"""
1026
+ )
1027
+
1028
+ C_MODULAR_MULTIPLY = QuantumFunctionDeclaration.parse_raw(
1029
+ """{
1030
+ "source_ref": null,
1031
+ "name": "c_modular_multiply",
1032
+ "param_decls": {
1033
+ "n": {
1034
+ "kind": "int"
1035
+ },
1036
+ "a": {
1037
+ "kind": "int"
1038
+ }
1039
+ },
1040
+ "port_declarations": {
1041
+ "b": {
1042
+ "name": "b",
1043
+ "quantum_type": {
1044
+ "kind": "qvec",
1045
+ "length": null
1046
+ },
1047
+ "kind": "PortDeclaration",
1048
+ "direction": "inout"
1049
+ },
1050
+ "x": {
1051
+ "name": "x",
1052
+ "quantum_type": {
1053
+ "kind": "qvec",
1054
+ "length": null
1055
+ },
1056
+ "kind": "PortDeclaration",
1057
+ "direction": "inout"
1058
+ },
1059
+ "ctrl": {
1060
+ "name": "ctrl",
1061
+ "quantum_type": {
1062
+ "kind": "qbit"
1063
+ },
1064
+ "kind": "PortDeclaration",
1065
+ "direction": "inout"
1066
+ },
1067
+ "aux": {
1068
+ "name": "aux",
1069
+ "quantum_type": {
1070
+ "kind": "qbit"
1071
+ },
1072
+ "kind": "PortDeclaration",
1073
+ "direction": "inout"
1074
+ }
1075
+ },
1076
+ "operand_declarations": {},
1077
+ "positional_arg_declarations": [
1078
+ {
1079
+ "kind": "ClassicalParameterDeclaration",
1080
+ "name": "n",
1081
+ "classical_type": {
1082
+ "kind": "int"
1083
+ }
1084
+ },
1085
+ {
1086
+ "kind": "ClassicalParameterDeclaration",
1087
+ "name": "a",
1088
+ "classical_type": {
1089
+ "kind": "int"
1090
+ }
1091
+ },
1092
+ {
1093
+ "name": "b",
1094
+ "quantum_type": {
1095
+ "kind": "qvec",
1096
+ "length": null
1097
+ },
1098
+ "kind": "PortDeclaration",
1099
+ "direction": "inout"
1100
+ },
1101
+ {
1102
+ "name": "x",
1103
+ "quantum_type": {
1104
+ "kind": "qvec",
1105
+ "length": null
1106
+ },
1107
+ "kind": "PortDeclaration",
1108
+ "direction": "inout"
1109
+ },
1110
+ {
1111
+ "name": "ctrl",
1112
+ "quantum_type": {
1113
+ "kind": "qbit"
1114
+ },
1115
+ "kind": "PortDeclaration",
1116
+ "direction": "inout"
1117
+ },
1118
+ {
1119
+ "name": "aux",
1120
+ "quantum_type": {
1121
+ "kind": "qbit"
1122
+ },
1123
+ "kind": "PortDeclaration",
1124
+ "direction": "inout"
1125
+ }
1126
+ ]
1127
+ }"""
1128
+ )
1129
+
1130
+ MULTISWAP = QuantumFunctionDeclaration.parse_raw(
1131
+ """{
1132
+ "source_ref": null,
1133
+ "name": "multiswap",
1134
+ "param_decls": {},
1135
+ "port_declarations": {
1136
+ "x": {
1137
+ "name": "x",
1138
+ "quantum_type": {
1139
+ "kind": "qvec",
1140
+ "length": null
1141
+ },
1142
+ "kind": "PortDeclaration",
1143
+ "direction": "inout"
1144
+ },
1145
+ "y": {
1146
+ "name": "y",
1147
+ "quantum_type": {
1148
+ "kind": "qvec",
1149
+ "length": null
1150
+ },
1151
+ "kind": "PortDeclaration",
1152
+ "direction": "inout"
1153
+ }
1154
+ },
1155
+ "operand_declarations": {},
1156
+ "positional_arg_declarations": [
1157
+ {
1158
+ "name": "x",
1159
+ "quantum_type": {
1160
+ "kind": "qvec",
1161
+ "length": null
1162
+ },
1163
+ "kind": "PortDeclaration",
1164
+ "direction": "inout"
1165
+ },
1166
+ {
1167
+ "name": "y",
1168
+ "quantum_type": {
1169
+ "kind": "qvec",
1170
+ "length": null
1171
+ },
1172
+ "kind": "PortDeclaration",
1173
+ "direction": "inout"
1174
+ }
1175
+ ]
1176
+ }"""
1177
+ )
1178
+
1179
+ INPLACE_C_MODULAR_MULTIPLY = QuantumFunctionDeclaration.parse_raw(
1180
+ """{
1181
+ "source_ref": null,
1182
+ "name": "inplace_c_modular_multiply",
1183
+ "param_decls": {
1184
+ "n": {
1185
+ "kind": "int"
1186
+ },
1187
+ "a": {
1188
+ "kind": "int"
1189
+ }
1190
+ },
1191
+ "port_declarations": {
1192
+ "x": {
1193
+ "name": "x",
1194
+ "quantum_type": {
1195
+ "kind": "qvec",
1196
+ "length": null
1197
+ },
1198
+ "kind": "PortDeclaration",
1199
+ "direction": "inout"
1200
+ },
1201
+ "ctrl": {
1202
+ "name": "ctrl",
1203
+ "quantum_type": {
1204
+ "kind": "qbit"
1205
+ },
1206
+ "kind": "PortDeclaration",
1207
+ "direction": "inout"
1208
+ },
1209
+ "aux": {
1210
+ "name": "aux",
1211
+ "quantum_type": {
1212
+ "kind": "qbit"
1213
+ },
1214
+ "kind": "PortDeclaration",
1215
+ "direction": "inout"
1216
+ }
1217
+ },
1218
+ "operand_declarations": {},
1219
+ "positional_arg_declarations": [
1220
+ {
1221
+ "kind": "ClassicalParameterDeclaration",
1222
+ "name": "n",
1223
+ "classical_type": {
1224
+ "kind": "int"
1225
+ }
1226
+ },
1227
+ {
1228
+ "kind": "ClassicalParameterDeclaration",
1229
+ "name": "a",
1230
+ "classical_type": {
1231
+ "kind": "int"
1232
+ }
1233
+ },
1234
+ {
1235
+ "name": "x",
1236
+ "quantum_type": {
1237
+ "kind": "qvec",
1238
+ "length": null
1239
+ },
1240
+ "kind": "PortDeclaration",
1241
+ "direction": "inout"
1242
+ },
1243
+ {
1244
+ "name": "ctrl",
1245
+ "quantum_type": {
1246
+ "kind": "qbit"
1247
+ },
1248
+ "kind": "PortDeclaration",
1249
+ "direction": "inout"
1250
+ },
1251
+ {
1252
+ "name": "aux",
1253
+ "quantum_type": {
1254
+ "kind": "qbit"
1255
+ },
1256
+ "kind": "PortDeclaration",
1257
+ "direction": "inout"
1258
+ }
1259
+ ]
1260
+ }"""
1261
+ )
1262
+
1263
+ MODULAR_EXP = QuantumFunctionDeclaration.parse_raw(
1264
+ """{
1265
+ "source_ref": null,
1266
+ "name": "modular_exp",
1267
+ "param_decls": {
1268
+ "n": {
1269
+ "kind": "int"
1270
+ },
1271
+ "a": {
1272
+ "kind": "int"
1273
+ }
1274
+ },
1275
+ "port_declarations": {
1276
+ "x": {
1277
+ "name": "x",
1278
+ "quantum_type": {
1279
+ "kind": "qvec",
1280
+ "length": null
1281
+ },
1282
+ "kind": "PortDeclaration",
1283
+ "direction": "inout"
1284
+ },
1285
+ "power": {
1286
+ "name": "power",
1287
+ "quantum_type": {
1288
+ "kind": "qvec",
1289
+ "length": null
1290
+ },
1291
+ "kind": "PortDeclaration",
1292
+ "direction": "inout"
1293
+ }
1294
+ },
1295
+ "operand_declarations": {},
1296
+ "positional_arg_declarations": [
1297
+ {
1298
+ "kind": "ClassicalParameterDeclaration",
1299
+ "name": "n",
1300
+ "classical_type": {
1301
+ "kind": "int"
1302
+ }
1303
+ },
1304
+ {
1305
+ "kind": "ClassicalParameterDeclaration",
1306
+ "name": "a",
1307
+ "classical_type": {
1308
+ "kind": "int"
1309
+ }
1310
+ },
1311
+ {
1312
+ "name": "x",
1313
+ "quantum_type": {
1314
+ "kind": "qvec",
1315
+ "length": null
1316
+ },
1317
+ "kind": "PortDeclaration",
1318
+ "direction": "inout"
1319
+ },
1320
+ {
1321
+ "name": "power",
1322
+ "quantum_type": {
1323
+ "kind": "qvec",
1324
+ "length": null
1325
+ },
1326
+ "kind": "PortDeclaration",
1327
+ "direction": "inout"
1328
+ }
1329
+ ]
1330
+ }"""
1331
+ )
1332
+
1333
+ QSVT_STEP = QuantumFunctionDeclaration.parse_raw(
1334
+ """{
1335
+ "source_ref": null,
1336
+ "name": "qsvt_step",
1337
+ "param_decls": {
1338
+ "phase_seq": {
1339
+ "kind": "list",
1340
+ "element_type": {
1341
+ "kind": "real"
1342
+ }
1343
+ },
1344
+ "index": {
1345
+ "kind": "int"
1346
+ }
1347
+ },
1348
+ "port_declarations": {
1349
+ "qvar": {
1350
+ "name": "qvar",
1351
+ "quantum_type": {
1352
+ "kind": "qvec",
1353
+ "length": null
1354
+ },
1355
+ "kind": "PortDeclaration",
1356
+ "direction": "inout"
1357
+ },
1358
+ "aux": {
1359
+ "name": "aux",
1360
+ "quantum_type": {
1361
+ "kind": "qbit"
1362
+ },
1363
+ "kind": "PortDeclaration",
1364
+ "direction": "inout"
1365
+ }
1366
+ },
1367
+ "operand_declarations": {
1368
+ "proj_cnot_1": {
1369
+ "name": "proj_cnot_1",
1370
+ "positional_arg_declarations": [
1371
+ {
1372
+ "name": "arg0",
1373
+ "quantum_type": {
1374
+ "kind": "qvec",
1375
+ "length": null
1376
+ },
1377
+ "kind": "PortDeclaration",
1378
+ "direction": "inout"
1379
+ },
1380
+ {
1381
+ "name": "arg1",
1382
+ "quantum_type": {
1383
+ "kind": "qbit"
1384
+ },
1385
+ "kind": "PortDeclaration",
1386
+ "direction": "inout"
1387
+ }
1388
+ ],
1389
+ "kind": "QuantumOperandDeclaration",
1390
+ "is_list": false
1391
+ },
1392
+ "proj_cnot_2": {
1393
+ "name": "proj_cnot_2",
1394
+ "positional_arg_declarations": [
1395
+ {
1396
+ "name": "arg0",
1397
+ "quantum_type": {
1398
+ "kind": "qvec",
1399
+ "length": null
1400
+ },
1401
+ "kind": "PortDeclaration",
1402
+ "direction": "inout"
1403
+ },
1404
+ {
1405
+ "name": "arg1",
1406
+ "quantum_type": {
1407
+ "kind": "qbit"
1408
+ },
1409
+ "kind": "PortDeclaration",
1410
+ "direction": "inout"
1411
+ }
1412
+ ],
1413
+ "kind": "QuantumOperandDeclaration",
1414
+ "is_list": false
1415
+ },
1416
+ "u": {
1417
+ "name": "u",
1418
+ "positional_arg_declarations": [
1419
+ {
1420
+ "name": "arg0",
1421
+ "quantum_type": {
1422
+ "kind": "qvec",
1423
+ "length": null
1424
+ },
1425
+ "kind": "PortDeclaration",
1426
+ "direction": "inout"
1427
+ }
1428
+ ],
1429
+ "kind": "QuantumOperandDeclaration",
1430
+ "is_list": false
1431
+ }
1432
+ },
1433
+ "positional_arg_declarations": [
1434
+ {
1435
+ "kind": "ClassicalParameterDeclaration",
1436
+ "name": "phase_seq",
1437
+ "classical_type": {
1438
+ "kind": "list",
1439
+ "element_type": {
1440
+ "kind": "real"
1441
+ }
1442
+ }
1443
+ },
1444
+ {
1445
+ "kind": "ClassicalParameterDeclaration",
1446
+ "name": "index",
1447
+ "classical_type": {
1448
+ "kind": "int"
1449
+ }
1450
+ },
1451
+ {
1452
+ "name": "proj_cnot_1",
1453
+ "positional_arg_declarations": [
1454
+ {
1455
+ "name": "arg0",
1456
+ "quantum_type": {
1457
+ "kind": "qvec",
1458
+ "length": null
1459
+ },
1460
+ "kind": "PortDeclaration",
1461
+ "direction": "inout"
1462
+ },
1463
+ {
1464
+ "name": "arg1",
1465
+ "quantum_type": {
1466
+ "kind": "qbit"
1467
+ },
1468
+ "kind": "PortDeclaration",
1469
+ "direction": "inout"
1470
+ }
1471
+ ],
1472
+ "kind": "QuantumOperandDeclaration",
1473
+ "is_list": false
1474
+ },
1475
+ {
1476
+ "name": "proj_cnot_2",
1477
+ "positional_arg_declarations": [
1478
+ {
1479
+ "name": "arg0",
1480
+ "quantum_type": {
1481
+ "kind": "qvec",
1482
+ "length": null
1483
+ },
1484
+ "kind": "PortDeclaration",
1485
+ "direction": "inout"
1486
+ },
1487
+ {
1488
+ "name": "arg1",
1489
+ "quantum_type": {
1490
+ "kind": "qbit"
1491
+ },
1492
+ "kind": "PortDeclaration",
1493
+ "direction": "inout"
1494
+ }
1495
+ ],
1496
+ "kind": "QuantumOperandDeclaration",
1497
+ "is_list": false
1498
+ },
1499
+ {
1500
+ "name": "u",
1501
+ "positional_arg_declarations": [
1502
+ {
1503
+ "name": "arg0",
1504
+ "quantum_type": {
1505
+ "kind": "qvec",
1506
+ "length": null
1507
+ },
1508
+ "kind": "PortDeclaration",
1509
+ "direction": "inout"
1510
+ }
1511
+ ],
1512
+ "kind": "QuantumOperandDeclaration",
1513
+ "is_list": false
1514
+ },
1515
+ {
1516
+ "name": "qvar",
1517
+ "quantum_type": {
1518
+ "kind": "qvec",
1519
+ "length": null
1520
+ },
1521
+ "kind": "PortDeclaration",
1522
+ "direction": "inout"
1523
+ },
1524
+ {
1525
+ "name": "aux",
1526
+ "quantum_type": {
1527
+ "kind": "qbit"
1528
+ },
1529
+ "kind": "PortDeclaration",
1530
+ "direction": "inout"
1531
+ }
1532
+ ]
1533
+ }"""
1534
+ )
1535
+
1536
+ QSVT = QuantumFunctionDeclaration.parse_raw(
1537
+ """{
1538
+ "source_ref": null,
1539
+ "name": "qsvt",
1540
+ "param_decls": {
1541
+ "phase_seq": {
1542
+ "kind": "list",
1543
+ "element_type": {
1544
+ "kind": "real"
1545
+ }
1546
+ }
1547
+ },
1548
+ "port_declarations": {
1549
+ "qvar": {
1550
+ "name": "qvar",
1551
+ "quantum_type": {
1552
+ "kind": "qvec",
1553
+ "length": null
1554
+ },
1555
+ "kind": "PortDeclaration",
1556
+ "direction": "inout"
1557
+ },
1558
+ "aux": {
1559
+ "name": "aux",
1560
+ "quantum_type": {
1561
+ "kind": "qbit"
1562
+ },
1563
+ "kind": "PortDeclaration",
1564
+ "direction": "inout"
1565
+ }
1566
+ },
1567
+ "operand_declarations": {
1568
+ "proj_cnot_1": {
1569
+ "name": "proj_cnot_1",
1570
+ "positional_arg_declarations": [
1571
+ {
1572
+ "name": "arg0",
1573
+ "quantum_type": {
1574
+ "kind": "qvec",
1575
+ "length": null
1576
+ },
1577
+ "kind": "PortDeclaration",
1578
+ "direction": "inout"
1579
+ },
1580
+ {
1581
+ "name": "arg1",
1582
+ "quantum_type": {
1583
+ "kind": "qbit"
1584
+ },
1585
+ "kind": "PortDeclaration",
1586
+ "direction": "inout"
1587
+ }
1588
+ ],
1589
+ "kind": "QuantumOperandDeclaration",
1590
+ "is_list": false
1591
+ },
1592
+ "proj_cnot_2": {
1593
+ "name": "proj_cnot_2",
1594
+ "positional_arg_declarations": [
1595
+ {
1596
+ "name": "arg0",
1597
+ "quantum_type": {
1598
+ "kind": "qvec",
1599
+ "length": null
1600
+ },
1601
+ "kind": "PortDeclaration",
1602
+ "direction": "inout"
1603
+ },
1604
+ {
1605
+ "name": "arg1",
1606
+ "quantum_type": {
1607
+ "kind": "qbit"
1608
+ },
1609
+ "kind": "PortDeclaration",
1610
+ "direction": "inout"
1611
+ }
1612
+ ],
1613
+ "kind": "QuantumOperandDeclaration",
1614
+ "is_list": false
1615
+ },
1616
+ "u": {
1617
+ "name": "u",
1618
+ "positional_arg_declarations": [
1619
+ {
1620
+ "name": "arg0",
1621
+ "quantum_type": {
1622
+ "kind": "qvec",
1623
+ "length": null
1624
+ },
1625
+ "kind": "PortDeclaration",
1626
+ "direction": "inout"
1627
+ }
1628
+ ],
1629
+ "kind": "QuantumOperandDeclaration",
1630
+ "is_list": false
1631
+ }
1632
+ },
1633
+ "positional_arg_declarations": [
1634
+ {
1635
+ "kind": "ClassicalParameterDeclaration",
1636
+ "name": "phase_seq",
1637
+ "classical_type": {
1638
+ "kind": "list",
1639
+ "element_type": {
1640
+ "kind": "real"
1641
+ }
1642
+ }
1643
+ },
1644
+ {
1645
+ "name": "proj_cnot_1",
1646
+ "positional_arg_declarations": [
1647
+ {
1648
+ "name": "arg0",
1649
+ "quantum_type": {
1650
+ "kind": "qvec",
1651
+ "length": null
1652
+ },
1653
+ "kind": "PortDeclaration",
1654
+ "direction": "inout"
1655
+ },
1656
+ {
1657
+ "name": "arg1",
1658
+ "quantum_type": {
1659
+ "kind": "qbit"
261
1660
  },
1661
+ "kind": "PortDeclaration",
262
1662
  "direction": "inout"
263
1663
  }
264
1664
  ],
1665
+ "kind": "QuantumOperandDeclaration",
265
1666
  "is_list": false
266
- }
267
- },
268
- "positional_arg_declarations": [
1667
+ },
269
1668
  {
270
- "name": "oracle",
1669
+ "name": "proj_cnot_2",
271
1670
  "positional_arg_declarations": [
272
1671
  {
273
1672
  "name": "arg0",
274
1673
  "quantum_type": {
275
- "length": null,
276
- "kind": "qvec"
1674
+ "kind": "qvec",
1675
+ "length": null
1676
+ },
1677
+ "kind": "PortDeclaration",
1678
+ "direction": "inout"
1679
+ },
1680
+ {
1681
+ "name": "arg1",
1682
+ "quantum_type": {
1683
+ "kind": "qbit"
277
1684
  },
1685
+ "kind": "PortDeclaration",
278
1686
  "direction": "inout"
279
1687
  }
280
1688
  ],
1689
+ "kind": "QuantumOperandDeclaration",
281
1690
  "is_list": false
282
1691
  },
283
1692
  {
284
- "name": "space_transform",
1693
+ "name": "u",
285
1694
  "positional_arg_declarations": [
286
1695
  {
287
1696
  "name": "arg0",
288
1697
  "quantum_type": {
289
- "length": null,
290
- "kind": "qvec"
1698
+ "kind": "qvec",
1699
+ "length": null
291
1700
  },
1701
+ "kind": "PortDeclaration",
292
1702
  "direction": "inout"
293
1703
  }
294
1704
  ],
1705
+ "kind": "QuantumOperandDeclaration",
295
1706
  "is_list": false
296
1707
  },
297
1708
  {
298
- "name": "phase",
1709
+ "name": "qvar",
299
1710
  "quantum_type": {
300
- "kind": "qnum"
1711
+ "kind": "qvec",
1712
+ "length": null
301
1713
  },
1714
+ "kind": "PortDeclaration",
302
1715
  "direction": "inout"
303
1716
  },
304
1717
  {
305
- "name": "packed_vars",
1718
+ "name": "aux",
306
1719
  "quantum_type": {
307
- "length": null,
308
- "kind": "qvec"
1720
+ "kind": "qbit"
309
1721
  },
1722
+ "kind": "PortDeclaration",
310
1723
  "direction": "inout"
311
1724
  }
312
1725
  ]
313
1726
  }"""
314
1727
  )
315
1728
 
316
- PHASE_ORACLE = QuantumFunctionDeclaration.parse_raw(
1729
+ PROJECTOR_CONTROLLED_PHASE = QuantumFunctionDeclaration.parse_raw(
317
1730
  """{
318
1731
  "source_ref": null,
319
- "name": "phase_oracle",
320
- "param_decls": {},
1732
+ "name": "projector_controlled_phase",
1733
+ "param_decls": {
1734
+ "phase": {
1735
+ "kind": "real"
1736
+ }
1737
+ },
321
1738
  "port_declarations": {
322
- "target": {
323
- "name": "target",
1739
+ "qvar": {
1740
+ "name": "qvar",
1741
+ "quantum_type": {
1742
+ "kind": "qvec",
1743
+ "length": null
1744
+ },
1745
+ "kind": "PortDeclaration",
1746
+ "direction": "inout"
1747
+ },
1748
+ "aux": {
1749
+ "name": "aux",
324
1750
  "quantum_type": {
325
- "length": null,
326
- "kind": "qvec"
1751
+ "kind": "qbit"
327
1752
  },
1753
+ "kind": "PortDeclaration",
328
1754
  "direction": "inout"
329
1755
  }
330
1756
  },
331
1757
  "operand_declarations": {
332
- "predicate": {
333
- "name": "predicate",
1758
+ "proj_cnot": {
1759
+ "name": "proj_cnot",
334
1760
  "positional_arg_declarations": [
335
1761
  {
336
1762
  "name": "arg0",
337
1763
  "quantum_type": {
338
- "length": null,
339
- "kind": "qvec"
1764
+ "kind": "qvec",
1765
+ "length": null
340
1766
  },
1767
+ "kind": "PortDeclaration",
341
1768
  "direction": "inout"
342
1769
  },
343
1770
  {
@@ -345,22 +1772,32 @@ PHASE_ORACLE = QuantumFunctionDeclaration.parse_raw(
345
1772
  "quantum_type": {
346
1773
  "kind": "qbit"
347
1774
  },
1775
+ "kind": "PortDeclaration",
348
1776
  "direction": "inout"
349
1777
  }
350
1778
  ],
1779
+ "kind": "QuantumOperandDeclaration",
351
1780
  "is_list": false
352
1781
  }
353
1782
  },
354
1783
  "positional_arg_declarations": [
355
1784
  {
356
- "name": "predicate",
1785
+ "kind": "ClassicalParameterDeclaration",
1786
+ "name": "phase",
1787
+ "classical_type": {
1788
+ "kind": "real"
1789
+ }
1790
+ },
1791
+ {
1792
+ "name": "proj_cnot",
357
1793
  "positional_arg_declarations": [
358
1794
  {
359
1795
  "name": "arg0",
360
1796
  "quantum_type": {
361
- "length": null,
362
- "kind": "qvec"
1797
+ "kind": "qvec",
1798
+ "length": null
363
1799
  },
1800
+ "kind": "PortDeclaration",
364
1801
  "direction": "inout"
365
1802
  },
366
1803
  {
@@ -368,306 +1805,176 @@ PHASE_ORACLE = QuantumFunctionDeclaration.parse_raw(
368
1805
  "quantum_type": {
369
1806
  "kind": "qbit"
370
1807
  },
1808
+ "kind": "PortDeclaration",
371
1809
  "direction": "inout"
372
1810
  }
373
1811
  ],
1812
+ "kind": "QuantumOperandDeclaration",
374
1813
  "is_list": false
375
1814
  },
376
1815
  {
377
- "name": "target",
378
- "quantum_type": {
379
- "length": null,
380
- "kind": "qvec"
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",
1816
+ "name": "qvar",
396
1817
  "quantum_type": {
397
- "length": null,
398
- "kind": "qvec"
1818
+ "kind": "qvec",
1819
+ "length": null
399
1820
  },
1821
+ "kind": "PortDeclaration",
400
1822
  "direction": "inout"
401
- }
402
- },
403
- "operand_declarations": {},
404
- "positional_arg_declarations": [
1823
+ },
405
1824
  {
406
- "name": "packed_vars",
1825
+ "name": "aux",
407
1826
  "quantum_type": {
408
- "length": null,
409
- "kind": "qvec"
1827
+ "kind": "qbit"
410
1828
  },
1829
+ "kind": "PortDeclaration",
411
1830
  "direction": "inout"
412
1831
  }
413
1832
  ]
414
1833
  }"""
415
1834
  )
416
1835
 
417
- GROVER_DIFFUSER = QuantumFunctionDeclaration.parse_raw(
1836
+ QSVT_INVERSION = QuantumFunctionDeclaration.parse_raw(
418
1837
  """{
419
1838
  "source_ref": null,
420
- "name": "grover_diffuser",
421
- "param_decls": {},
422
- "port_declarations": {
423
- "packed_vars": {
424
- "name": "packed_vars",
425
- "quantum_type": {
426
- "length": null,
427
- "kind": "qvec"
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
- "length": null,
440
- "kind": "qvec"
441
- },
442
- "direction": "inout"
443
- }
444
- ],
445
- "is_list": false
1839
+ "name": "qsvt_inversion",
1840
+ "param_decls": {
1841
+ "phase_seq": {
1842
+ "kind": "list",
1843
+ "element_type": {
1844
+ "kind": "real"
1845
+ }
446
1846
  }
447
1847
  },
448
- "positional_arg_declarations": [
449
- {
450
- "name": "space_transform",
451
- "positional_arg_declarations": [
452
- {
453
- "name": "arg0",
454
- "quantum_type": {
455
- "length": null,
456
- "kind": "qvec"
457
- },
458
- "direction": "inout"
459
- }
460
- ],
461
- "is_list": false
462
- },
463
- {
464
- "name": "packed_vars",
1848
+ "port_declarations": {
1849
+ "qvar": {
1850
+ "name": "qvar",
465
1851
  "quantum_type": {
466
- "length": null,
467
- "kind": "qvec"
1852
+ "kind": "qvec",
1853
+ "length": null
468
1854
  },
1855
+ "kind": "PortDeclaration",
469
1856
  "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",
1857
+ },
1858
+ "aux": {
1859
+ "name": "aux",
483
1860
  "quantum_type": {
484
- "length": null,
485
- "kind": "qvec"
1861
+ "kind": "qbit"
486
1862
  },
1863
+ "kind": "PortDeclaration",
487
1864
  "direction": "inout"
488
1865
  }
489
1866
  },
490
1867
  "operand_declarations": {
491
- "oracle": {
492
- "name": "oracle",
1868
+ "block_encoding_cnot": {
1869
+ "name": "block_encoding_cnot",
493
1870
  "positional_arg_declarations": [
494
1871
  {
495
1872
  "name": "arg0",
496
1873
  "quantum_type": {
497
- "length": null,
498
- "kind": "qvec"
1874
+ "kind": "qvec",
1875
+ "length": null
499
1876
  },
1877
+ "kind": "PortDeclaration",
1878
+ "direction": "inout"
1879
+ },
1880
+ {
1881
+ "name": "arg1",
1882
+ "quantum_type": {
1883
+ "kind": "qbit"
1884
+ },
1885
+ "kind": "PortDeclaration",
500
1886
  "direction": "inout"
501
1887
  }
502
1888
  ],
1889
+ "kind": "QuantumOperandDeclaration",
503
1890
  "is_list": false
504
1891
  },
505
- "space_transform": {
506
- "name": "space_transform",
1892
+ "u": {
1893
+ "name": "u",
507
1894
  "positional_arg_declarations": [
508
1895
  {
509
1896
  "name": "arg0",
510
1897
  "quantum_type": {
511
- "length": null,
512
- "kind": "qvec"
1898
+ "kind": "qvec",
1899
+ "length": null
513
1900
  },
1901
+ "kind": "PortDeclaration",
514
1902
  "direction": "inout"
515
1903
  }
516
1904
  ],
1905
+ "kind": "QuantumOperandDeclaration",
517
1906
  "is_list": false
518
1907
  }
519
1908
  },
520
1909
  "positional_arg_declarations": [
521
1910
  {
522
- "name": "oracle",
523
- "positional_arg_declarations": [
524
- {
525
- "name": "arg0",
526
- "quantum_type": {
527
- "length": null,
528
- "kind": "qvec"
529
- },
530
- "direction": "inout"
1911
+ "kind": "ClassicalParameterDeclaration",
1912
+ "name": "phase_seq",
1913
+ "classical_type": {
1914
+ "kind": "list",
1915
+ "element_type": {
1916
+ "kind": "real"
531
1917
  }
532
- ],
533
- "is_list": false
1918
+ }
534
1919
  },
535
1920
  {
536
- "name": "space_transform",
1921
+ "name": "block_encoding_cnot",
537
1922
  "positional_arg_declarations": [
538
1923
  {
539
1924
  "name": "arg0",
540
1925
  "quantum_type": {
541
- "length": null,
542
- "kind": "qvec"
1926
+ "kind": "qvec",
1927
+ "length": null
543
1928
  },
1929
+ "kind": "PortDeclaration",
544
1930
  "direction": "inout"
545
- }
546
- ],
547
- "is_list": false
548
- },
549
- {
550
- "name": "packed_vars",
551
- "quantum_type": {
552
- "length": null,
553
- "kind": "qvec"
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
- "length": null,
575
- "kind": "qvec"
576
- },
577
- "direction": "inout"
578
- }
579
- },
580
- "operand_declarations": {
581
- "oracle": {
582
- "name": "oracle",
583
- "positional_arg_declarations": [
1931
+ },
584
1932
  {
585
- "name": "arg0",
1933
+ "name": "arg1",
586
1934
  "quantum_type": {
587
- "length": null,
588
- "kind": "qvec"
1935
+ "kind": "qbit"
589
1936
  },
1937
+ "kind": "PortDeclaration",
590
1938
  "direction": "inout"
591
1939
  }
592
1940
  ],
1941
+ "kind": "QuantumOperandDeclaration",
593
1942
  "is_list": false
594
- }
595
- },
596
- "positional_arg_declarations": [
597
- {
598
- "name": "reps",
599
- "classical_type": {
600
- "kind": "int"
601
- }
602
1943
  },
603
1944
  {
604
- "name": "oracle",
1945
+ "name": "u",
605
1946
  "positional_arg_declarations": [
606
1947
  {
607
1948
  "name": "arg0",
608
1949
  "quantum_type": {
609
- "length": null,
610
- "kind": "qvec"
1950
+ "kind": "qvec",
1951
+ "length": null
611
1952
  },
1953
+ "kind": "PortDeclaration",
612
1954
  "direction": "inout"
613
1955
  }
614
1956
  ],
1957
+ "kind": "QuantumOperandDeclaration",
615
1958
  "is_list": false
616
1959
  },
617
1960
  {
618
- "name": "packed_vars",
1961
+ "name": "qvar",
619
1962
  "quantum_type": {
620
- "length": null,
621
- "kind": "qvec"
1963
+ "kind": "qvec",
1964
+ "length": null
622
1965
  },
1966
+ "kind": "PortDeclaration",
623
1967
  "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",
1968
+ },
1969
+ {
1970
+ "name": "aux",
1971
+ "quantum_type": {
1972
+ "kind": "qbit"
1973
+ },
1974
+ "kind": "PortDeclaration",
653
1975
  "direction": "inout"
654
1976
  }
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": []
1977
+ ]
671
1978
  }"""
672
1979
  )
673
1980
 
@@ -701,6 +2008,7 @@ ALLOCATE_NUM = QuantumFunctionDeclaration.parse_raw(
701
2008
  "expr": "fraction_digits"
702
2009
  }
703
2010
  },
2011
+ "kind": "PortDeclaration",
704
2012
  "direction": "output"
705
2013
  }
706
2014
  },
@@ -721,6 +2029,7 @@ QAOA_MIXER_LAYER = QuantumFunctionDeclaration.parse_raw(
721
2029
  "port_declarations": {
722
2030
  "target": {
723
2031
  "name": "target",
2032
+ "kind": "PortDeclaration",
724
2033
  "direction": "inout"
725
2034
  }
726
2035
  },
@@ -748,6 +2057,7 @@ QAOA_COST_LAYER = QuantumFunctionDeclaration.parse_raw(
748
2057
  "port_declarations": {
749
2058
  "target": {
750
2059
  "name": "target",
2060
+ "kind": "PortDeclaration",
751
2061
  "direction": "inout"
752
2062
  }
753
2063
  },
@@ -778,6 +2088,7 @@ QAOA_LAYER = QuantumFunctionDeclaration.parse_raw(
778
2088
  "port_declarations": {
779
2089
  "target": {
780
2090
  "name": "target",
2091
+ "kind": "PortDeclaration",
781
2092
  "direction": "inout"
782
2093
  }
783
2094
  },
@@ -794,6 +2105,7 @@ QAOA_INIT = QuantumFunctionDeclaration.parse_raw(
794
2105
  "port_declarations": {
795
2106
  "target": {
796
2107
  "name": "target",
2108
+ "kind": "PortDeclaration",
797
2109
  "direction": "inout"
798
2110
  }
799
2111
  },
@@ -830,6 +2142,7 @@ QAOA_PENALTY = QuantumFunctionDeclaration.parse_raw(
830
2142
  "size": {
831
2143
  "expr": "num_qubits"
832
2144
  },
2145
+ "kind": "PortDeclaration",
833
2146
  "direction": "inout"
834
2147
  }
835
2148
  },
@@ -877,6 +2190,7 @@ FULL_HEA = QuantumFunctionDeclaration.parse_raw(
877
2190
  "size": {
878
2191
  "expr": "num_qubits"
879
2192
  },
2193
+ "kind": "PortDeclaration",
880
2194
  "direction": "inout"
881
2195
  }
882
2196
  },
@@ -894,9 +2208,11 @@ FULL_HEA = QuantumFunctionDeclaration.parse_raw(
894
2208
  "size": {
895
2209
  "expr": "1"
896
2210
  },
2211
+ "kind": "PortDeclaration",
897
2212
  "direction": "inout"
898
2213
  }
899
2214
  },
2215
+ "kind": "QuantumOperandDeclaration",
900
2216
  "is_list": true
901
2217
  },
902
2218
  "operands_2qubit": {
@@ -912,6 +2228,7 @@ FULL_HEA = QuantumFunctionDeclaration.parse_raw(
912
2228
  "size": {
913
2229
  "expr": "1"
914
2230
  },
2231
+ "kind": "PortDeclaration",
915
2232
  "direction": "inout"
916
2233
  },
917
2234
  "q2": {
@@ -919,9 +2236,11 @@ FULL_HEA = QuantumFunctionDeclaration.parse_raw(
919
2236
  "size": {
920
2237
  "expr": "1"
921
2238
  },
2239
+ "kind": "PortDeclaration",
922
2240
  "direction": "inout"
923
2241
  }
924
2242
  },
2243
+ "kind": "QuantumOperandDeclaration",
925
2244
  "is_list": true
926
2245
  }
927
2246
  },
@@ -938,17 +2257,19 @@ SWAP_TEST = QuantumFunctionDeclaration.parse_raw(
938
2257
  "state1": {
939
2258
  "name": "state1",
940
2259
  "quantum_type": {
941
- "length": null,
942
- "kind": "qvec"
2260
+ "kind": "qvec",
2261
+ "length": null
943
2262
  },
2263
+ "kind": "PortDeclaration",
944
2264
  "direction": "inout"
945
2265
  },
946
2266
  "state2": {
947
2267
  "name": "state2",
948
2268
  "quantum_type": {
949
- "length": null,
950
- "kind": "qvec"
2269
+ "kind": "qvec",
2270
+ "length": null
951
2271
  },
2272
+ "kind": "PortDeclaration",
952
2273
  "direction": "inout"
953
2274
  },
954
2275
  "test": {
@@ -956,6 +2277,7 @@ SWAP_TEST = QuantumFunctionDeclaration.parse_raw(
956
2277
  "quantum_type": {
957
2278
  "kind": "qbit"
958
2279
  },
2280
+ "kind": "PortDeclaration",
959
2281
  "direction": "output"
960
2282
  }
961
2283
  },
@@ -964,17 +2286,19 @@ SWAP_TEST = QuantumFunctionDeclaration.parse_raw(
964
2286
  {
965
2287
  "name": "state1",
966
2288
  "quantum_type": {
967
- "length": null,
968
- "kind": "qvec"
2289
+ "kind": "qvec",
2290
+ "length": null
969
2291
  },
2292
+ "kind": "PortDeclaration",
970
2293
  "direction": "inout"
971
2294
  },
972
2295
  {
973
2296
  "name": "state2",
974
2297
  "quantum_type": {
975
- "length": null,
976
- "kind": "qvec"
2298
+ "kind": "qvec",
2299
+ "length": null
977
2300
  },
2301
+ "kind": "PortDeclaration",
978
2302
  "direction": "inout"
979
2303
  },
980
2304
  {
@@ -982,6 +2306,7 @@ SWAP_TEST = QuantumFunctionDeclaration.parse_raw(
982
2306
  "quantum_type": {
983
2307
  "kind": "qbit"
984
2308
  },
2309
+ "kind": "PortDeclaration",
985
2310
  "direction": "output"
986
2311
  }
987
2312
  ]
@@ -1001,15 +2326,17 @@ PREPARE_GHZ_STATE = QuantumFunctionDeclaration.parse_raw(
1001
2326
  "q": {
1002
2327
  "name": "q",
1003
2328
  "quantum_type": {
1004
- "length": null,
1005
- "kind": "qvec"
2329
+ "kind": "qvec",
2330
+ "length": null
1006
2331
  },
2332
+ "kind": "PortDeclaration",
1007
2333
  "direction": "output"
1008
2334
  }
1009
2335
  },
1010
2336
  "operand_declarations": {},
1011
2337
  "positional_arg_declarations": [
1012
2338
  {
2339
+ "kind": "ClassicalParameterDeclaration",
1013
2340
  "name": "size",
1014
2341
  "classical_type": {
1015
2342
  "kind": "int"
@@ -1018,9 +2345,10 @@ PREPARE_GHZ_STATE = QuantumFunctionDeclaration.parse_raw(
1018
2345
  {
1019
2346
  "name": "q",
1020
2347
  "quantum_type": {
1021
- "length": null,
1022
- "kind": "qvec"
2348
+ "kind": "qvec",
2349
+ "length": null
1023
2350
  },
2351
+ "kind": "PortDeclaration",
1024
2352
  "direction": "output"
1025
2353
  }
1026
2354
  ]
@@ -1040,15 +2368,17 @@ PREPARE_EXPONENTIAL_STATE = QuantumFunctionDeclaration.parse_raw(
1040
2368
  "q": {
1041
2369
  "name": "q",
1042
2370
  "quantum_type": {
1043
- "length": null,
1044
- "kind": "qvec"
2371
+ "kind": "qvec",
2372
+ "length": null
1045
2373
  },
2374
+ "kind": "PortDeclaration",
1046
2375
  "direction": "inout"
1047
2376
  }
1048
2377
  },
1049
2378
  "operand_declarations": {},
1050
2379
  "positional_arg_declarations": [
1051
2380
  {
2381
+ "kind": "ClassicalParameterDeclaration",
1052
2382
  "name": "rate",
1053
2383
  "classical_type": {
1054
2384
  "kind": "int"
@@ -1057,9 +2387,10 @@ PREPARE_EXPONENTIAL_STATE = QuantumFunctionDeclaration.parse_raw(
1057
2387
  {
1058
2388
  "name": "q",
1059
2389
  "quantum_type": {
1060
- "length": null,
1061
- "kind": "qvec"
2390
+ "kind": "qvec",
2391
+ "length": null
1062
2392
  },
2393
+ "kind": "PortDeclaration",
1063
2394
  "direction": "inout"
1064
2395
  }
1065
2396
  ]
@@ -1079,17 +2410,19 @@ PREPARE_BELL_STATE = QuantumFunctionDeclaration.parse_raw(
1079
2410
  "q": {
1080
2411
  "name": "q",
1081
2412
  "quantum_type": {
2413
+ "kind": "qvec",
1082
2414
  "length": {
1083
2415
  "expr": "2"
1084
- },
1085
- "kind": "qvec"
2416
+ }
1086
2417
  },
2418
+ "kind": "PortDeclaration",
1087
2419
  "direction": "output"
1088
2420
  }
1089
2421
  },
1090
2422
  "operand_declarations": {},
1091
2423
  "positional_arg_declarations": [
1092
2424
  {
2425
+ "kind": "ClassicalParameterDeclaration",
1093
2426
  "name": "state_num",
1094
2427
  "classical_type": {
1095
2428
  "kind": "int"
@@ -1098,11 +2431,12 @@ PREPARE_BELL_STATE = QuantumFunctionDeclaration.parse_raw(
1098
2431
  {
1099
2432
  "name": "q",
1100
2433
  "quantum_type": {
2434
+ "kind": "qvec",
1101
2435
  "length": {
1102
2436
  "expr": "2"
1103
- },
1104
- "kind": "qvec"
2437
+ }
1105
2438
  },
2439
+ "kind": "PortDeclaration",
1106
2440
  "direction": "output"
1107
2441
  }
1108
2442
  ]
@@ -1122,15 +2456,17 @@ INPLACE_PREPARE_INT = QuantumFunctionDeclaration.parse_raw(
1122
2456
  "target": {
1123
2457
  "name": "target",
1124
2458
  "quantum_type": {
1125
- "length": null,
1126
- "kind": "qvec"
2459
+ "kind": "qvec",
2460
+ "length": null
1127
2461
  },
2462
+ "kind": "PortDeclaration",
1128
2463
  "direction": "inout"
1129
2464
  }
1130
2465
  },
1131
2466
  "operand_declarations": {},
1132
2467
  "positional_arg_declarations": [
1133
2468
  {
2469
+ "kind": "ClassicalParameterDeclaration",
1134
2470
  "name": "value",
1135
2471
  "classical_type": {
1136
2472
  "kind": "int"
@@ -1139,9 +2475,10 @@ INPLACE_PREPARE_INT = QuantumFunctionDeclaration.parse_raw(
1139
2475
  {
1140
2476
  "name": "target",
1141
2477
  "quantum_type": {
1142
- "length": null,
1143
- "kind": "qvec"
2478
+ "kind": "qvec",
2479
+ "length": null
1144
2480
  },
2481
+ "kind": "PortDeclaration",
1145
2482
  "direction": "inout"
1146
2483
  }
1147
2484
  ]
@@ -1163,12 +2500,14 @@ PREPARE_INT = QuantumFunctionDeclaration.parse_raw(
1163
2500
  "quantum_type": {
1164
2501
  "kind": "qnum"
1165
2502
  },
2503
+ "kind": "PortDeclaration",
1166
2504
  "direction": "output"
1167
2505
  }
1168
2506
  },
1169
2507
  "operand_declarations": {},
1170
2508
  "positional_arg_declarations": [
1171
2509
  {
2510
+ "kind": "ClassicalParameterDeclaration",
1172
2511
  "name": "value",
1173
2512
  "classical_type": {
1174
2513
  "kind": "int"
@@ -1179,6 +2518,7 @@ PREPARE_INT = QuantumFunctionDeclaration.parse_raw(
1179
2518
  "quantum_type": {
1180
2519
  "kind": "qnum"
1181
2520
  },
2521
+ "kind": "PortDeclaration",
1182
2522
  "direction": "output"
1183
2523
  }
1184
2524
  ]
@@ -1199,11 +2539,13 @@ SWITCH = QuantumFunctionDeclaration.parse_raw(
1199
2539
  "cases": {
1200
2540
  "name": "cases",
1201
2541
  "positional_arg_declarations": [],
2542
+ "kind": "QuantumOperandDeclaration",
1202
2543
  "is_list": true
1203
2544
  }
1204
2545
  },
1205
2546
  "positional_arg_declarations": [
1206
2547
  {
2548
+ "kind": "ClassicalParameterDeclaration",
1207
2549
  "name": "selector",
1208
2550
  "classical_type": {
1209
2551
  "kind": "int"
@@ -1212,6 +2554,7 @@ SWITCH = QuantumFunctionDeclaration.parse_raw(
1212
2554
  {
1213
2555
  "name": "cases",
1214
2556
  "positional_arg_declarations": [],
2557
+ "kind": "QuantumOperandDeclaration",
1215
2558
  "is_list": true
1216
2559
  }
1217
2560
  ]
@@ -1237,6 +2580,19 @@ __all__ = [
1237
2580
  "GROVER_SEARCH",
1238
2581
  "HADAMARD_TRANSFORM",
1239
2582
  "APPLY_TO_ALL",
2583
+ "QFT_NO_SWAP",
2584
+ "_CHECK_MSB",
2585
+ "_CTRL_X",
2586
+ "QFT_SPACE_ADD_CONST",
2587
+ "CC_MODULAR_ADD",
2588
+ "C_MODULAR_MULTIPLY",
2589
+ "MULTISWAP",
2590
+ "INPLACE_C_MODULAR_MULTIPLY",
2591
+ "MODULAR_EXP",
2592
+ "QSVT_STEP",
2593
+ "QSVT",
2594
+ "PROJECTOR_CONTROLLED_PHASE",
2595
+ "QSVT_INVERSION",
1240
2596
  "ALLOCATE_NUM",
1241
2597
  "QAOA_MIXER_LAYER",
1242
2598
  "QAOA_COST_LAYER",