classiq 0.37.1__py3-none-any.whl → 0.38.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- classiq/__init__.py +2 -2
- classiq/_analyzer_extras/_ipywidgets_async_extension.py +1 -1
- classiq/_analyzer_extras/interactive_hardware.py +3 -3
- classiq/_internals/api_wrapper.py +24 -16
- classiq/_internals/async_utils.py +1 -74
- classiq/_internals/authentication/device.py +9 -4
- classiq/_internals/authentication/password_manager.py +25 -10
- classiq/_internals/authentication/token_manager.py +2 -2
- classiq/_internals/client.py +13 -5
- classiq/_internals/jobs.py +10 -7
- classiq/analyzer/analyzer.py +26 -28
- classiq/analyzer/analyzer_utilities.py +5 -5
- classiq/analyzer/rb.py +4 -5
- classiq/analyzer/show_interactive_hack.py +6 -6
- classiq/applications/benchmarking/mirror_benchmarking.py +9 -6
- classiq/applications/combinatorial_optimization/__init__.py +5 -0
- classiq/applications/qnn/circuit_utils.py +2 -2
- classiq/applications/qnn/gradients/quantum_gradient.py +2 -2
- classiq/applications/qnn/types.py +2 -2
- classiq/applications/qsvm/qsvm.py +4 -7
- classiq/applications/qsvm/qsvm_data_generation.py +2 -5
- classiq/applications_model_constructors/__init__.py +9 -1
- classiq/applications_model_constructors/chemistry_model_constructor.py +9 -16
- classiq/applications_model_constructors/combinatorial_helpers/__init__.py +0 -0
- classiq/applications_model_constructors/combinatorial_helpers/allowed_constraints.py +20 -0
- classiq/applications_model_constructors/combinatorial_helpers/arithmetic/__init__.py +0 -0
- classiq/applications_model_constructors/combinatorial_helpers/arithmetic/arithmetic_expression.py +35 -0
- classiq/applications_model_constructors/combinatorial_helpers/arithmetic/isolation.py +42 -0
- classiq/applications_model_constructors/combinatorial_helpers/combinatorial_problem_utils.py +130 -0
- classiq/applications_model_constructors/combinatorial_helpers/encoding_mapping.py +107 -0
- classiq/applications_model_constructors/combinatorial_helpers/encoding_utils.py +122 -0
- classiq/applications_model_constructors/combinatorial_helpers/memory.py +79 -0
- classiq/applications_model_constructors/combinatorial_helpers/multiple_comp_basis_sp.py +34 -0
- classiq/applications_model_constructors/combinatorial_helpers/optimization_model.py +166 -0
- classiq/applications_model_constructors/combinatorial_helpers/pauli_helpers/__init__.py +0 -0
- classiq/applications_model_constructors/combinatorial_helpers/pauli_helpers/pauli_sparsing.py +31 -0
- classiq/applications_model_constructors/combinatorial_helpers/pauli_helpers/pauli_utils.py +65 -0
- classiq/applications_model_constructors/combinatorial_helpers/py.typed +0 -0
- classiq/applications_model_constructors/combinatorial_helpers/pyomo_utils.py +243 -0
- classiq/applications_model_constructors/combinatorial_helpers/sympy_utils.py +22 -0
- classiq/applications_model_constructors/combinatorial_helpers/transformations/__init__.py +0 -0
- classiq/applications_model_constructors/combinatorial_helpers/transformations/encoding.py +194 -0
- classiq/applications_model_constructors/combinatorial_helpers/transformations/fixed_variables.py +144 -0
- classiq/applications_model_constructors/combinatorial_helpers/transformations/ising_converter.py +124 -0
- classiq/applications_model_constructors/combinatorial_helpers/transformations/penalty.py +32 -0
- classiq/applications_model_constructors/combinatorial_helpers/transformations/penalty_support.py +41 -0
- classiq/applications_model_constructors/combinatorial_helpers/transformations/sign_seperation.py +75 -0
- classiq/applications_model_constructors/combinatorial_helpers/transformations/slack_variables.py +90 -0
- classiq/applications_model_constructors/combinatorial_optimization_model_constructor.py +48 -91
- classiq/applications_model_constructors/finance_model_constructor.py +4 -17
- classiq/applications_model_constructors/grover_model_constructor.py +20 -91
- classiq/applications_model_constructors/libraries/qmci_library.py +17 -19
- classiq/builtin_functions/standard_gates.py +1 -1
- classiq/exceptions.py +43 -1
- classiq/executor.py +10 -9
- classiq/interface/_version.py +1 -1
- classiq/interface/analyzer/analysis_params.py +6 -3
- classiq/interface/analyzer/result.py +12 -4
- classiq/interface/applications/qsvm.py +13 -1
- classiq/interface/backend/backend_preferences.py +4 -2
- classiq/interface/backend/pydantic_backend.py +3 -1
- classiq/interface/backend/quantum_backend_providers.py +1 -0
- classiq/interface/chemistry/fermionic_operator.py +15 -13
- classiq/interface/chemistry/ground_state_problem.py +18 -3
- classiq/interface/chemistry/molecule.py +8 -6
- classiq/interface/chemistry/operator.py +20 -14
- classiq/interface/combinatorial_optimization/examples/ascending_sequence.py +1 -1
- classiq/interface/combinatorial_optimization/examples/greater_than_ilp.py +1 -1
- classiq/interface/combinatorial_optimization/examples/ilp.py +2 -1
- classiq/interface/combinatorial_optimization/examples/integer_portfolio_optimization.py +2 -2
- classiq/interface/combinatorial_optimization/examples/mds.py +2 -1
- classiq/interface/combinatorial_optimization/examples/mht.py +3 -3
- classiq/interface/combinatorial_optimization/examples/mis.py +4 -1
- classiq/interface/combinatorial_optimization/examples/mvc.py +2 -1
- classiq/interface/combinatorial_optimization/examples/set_cover.py +2 -1
- classiq/interface/combinatorial_optimization/examples/tsp.py +4 -3
- classiq/interface/combinatorial_optimization/examples/tsp_digraph.py +6 -2
- classiq/interface/combinatorial_optimization/mht_qaoa_input.py +9 -3
- classiq/interface/executor/aws_execution_cost.py +4 -3
- classiq/interface/executor/estimation.py +2 -2
- classiq/interface/executor/execution_preferences.py +5 -34
- classiq/interface/executor/execution_request.py +19 -17
- classiq/interface/executor/optimizer_preferences.py +22 -13
- classiq/interface/executor/{quantum_program.py → quantum_code.py} +21 -15
- classiq/interface/executor/quantum_instruction_set.py +2 -1
- classiq/interface/executor/register_initialization.py +1 -3
- classiq/interface/executor/result.py +41 -10
- classiq/interface/executor/vqe_result.py +1 -1
- classiq/interface/finance/function_input.py +17 -4
- classiq/interface/finance/gaussian_model_input.py +3 -1
- classiq/interface/finance/log_normal_model_input.py +3 -1
- classiq/interface/finance/model_input.py +2 -0
- classiq/interface/generator/amplitude_loading.py +6 -3
- classiq/interface/generator/application_apis/__init__.py +1 -0
- classiq/interface/generator/application_apis/arithmetic_declarations.py +14 -0
- classiq/interface/generator/arith/argument_utils.py +14 -4
- classiq/interface/generator/arith/arithmetic.py +3 -1
- classiq/interface/generator/arith/arithmetic_arg_type_validator.py +12 -13
- classiq/interface/generator/arith/arithmetic_expression_abc.py +4 -1
- classiq/interface/generator/arith/arithmetic_expression_parser.py +8 -2
- classiq/interface/generator/arith/arithmetic_expression_validator.py +16 -2
- classiq/interface/generator/arith/arithmetic_operations.py +5 -10
- classiq/interface/generator/arith/ast_node_rewrite.py +1 -1
- classiq/interface/generator/arith/binary_ops.py +202 -54
- classiq/interface/generator/arith/extremum_operations.py +5 -3
- classiq/interface/generator/arith/logical_ops.py +4 -2
- classiq/interface/generator/arith/machine_precision.py +3 -0
- classiq/interface/generator/arith/number_utils.py +34 -44
- classiq/interface/generator/arith/register_user_input.py +21 -1
- classiq/interface/generator/arith/unary_ops.py +16 -25
- classiq/interface/generator/chemistry_function_params.py +4 -4
- classiq/interface/generator/commuting_pauli_exponentiation.py +3 -1
- classiq/interface/generator/compiler_keywords.py +4 -0
- classiq/interface/generator/complex_type.py +3 -10
- classiq/interface/generator/control_state.py +5 -3
- classiq/interface/generator/credit_risk_example/linear_gci.py +10 -3
- classiq/interface/generator/credit_risk_example/weighted_adder.py +14 -4
- classiq/interface/generator/expressions/atomic_expression_functions.py +5 -3
- classiq/interface/generator/expressions/evaluated_expression.py +18 -4
- classiq/interface/generator/expressions/expression.py +1 -1
- classiq/interface/generator/expressions/qmod_qscalar_proxy.py +33 -0
- classiq/interface/generator/expressions/sympy_supported_expressions.py +2 -1
- classiq/interface/generator/finance.py +1 -1
- classiq/interface/generator/function_params.py +7 -6
- classiq/interface/generator/functions/__init__.py +1 -1
- classiq/interface/generator/functions/core_lib_declarations/quantum_functions/std_lib_functions.py +505 -138
- classiq/interface/generator/functions/core_lib_declarations/quantum_operators.py +25 -99
- classiq/interface/generator/functions/foreign_function_definition.py +12 -4
- classiq/interface/generator/functions/function_implementation.py +8 -4
- classiq/interface/generator/functions/native_function_definition.py +4 -2
- classiq/interface/generator/functions/register.py +4 -2
- classiq/interface/generator/functions/register_mapping_data.py +14 -10
- classiq/interface/generator/generated_circuit_data.py +2 -2
- classiq/interface/generator/grover_operator.py +5 -3
- classiq/interface/generator/hamiltonian_evolution/suzuki_trotter.py +5 -1
- classiq/interface/generator/hardware/hardware_data.py +6 -4
- classiq/interface/generator/hardware_efficient_ansatz.py +25 -8
- classiq/interface/generator/hartree_fock.py +3 -1
- classiq/interface/generator/linear_pauli_rotations.py +3 -1
- classiq/interface/generator/mcu.py +5 -3
- classiq/interface/generator/mcx.py +7 -5
- classiq/interface/generator/model/constraints.py +2 -1
- classiq/interface/generator/model/model.py +11 -19
- classiq/interface/generator/model/preferences/preferences.py +4 -3
- classiq/interface/generator/oracles/custom_oracle.py +4 -2
- classiq/interface/generator/oracles/oracle_abc.py +2 -2
- classiq/interface/generator/qpe.py +6 -4
- classiq/interface/generator/qsvm.py +5 -8
- classiq/interface/generator/quantum_function_call.py +21 -16
- classiq/interface/generator/{generated_circuit.py → quantum_program.py} +10 -14
- classiq/interface/generator/range_types.py +3 -1
- classiq/interface/generator/slice_parsing_utils.py +8 -3
- classiq/interface/generator/standard_gates/controlled_standard_gates.py +4 -2
- classiq/interface/generator/state_preparation/metrics.py +2 -1
- classiq/interface/generator/state_preparation/state_preparation.py +7 -5
- classiq/interface/generator/state_propagator.py +16 -5
- classiq/interface/generator/types/builtin_struct_declarations/__init__.py +0 -1
- classiq/interface/generator/types/struct_declaration.py +8 -3
- classiq/interface/generator/ucc.py +6 -4
- classiq/interface/generator/unitary_gate.py +7 -3
- classiq/interface/generator/validations/flow_graph.py +6 -4
- classiq/interface/generator/validations/validator_functions.py +6 -4
- classiq/interface/hardware.py +2 -2
- classiq/interface/helpers/custom_encoders.py +3 -0
- classiq/interface/helpers/pydantic_model_helpers.py +0 -6
- classiq/interface/helpers/validation_helpers.py +1 -1
- classiq/interface/helpers/versioned_model.py +4 -1
- classiq/interface/ide/show.py +2 -2
- classiq/interface/jobs.py +72 -3
- classiq/interface/model/bind_operation.py +18 -11
- classiq/interface/model/call_synthesis_data.py +68 -0
- classiq/interface/model/inplace_binary_operation.py +2 -2
- classiq/interface/model/model.py +27 -21
- classiq/interface/model/native_function_definition.py +3 -5
- classiq/interface/model/quantum_expressions/amplitude_loading_operation.py +9 -4
- classiq/interface/model/quantum_expressions/control_state.py +2 -2
- classiq/interface/model/quantum_function_call.py +25 -139
- classiq/interface/model/quantum_function_declaration.py +8 -0
- classiq/interface/model/quantum_if_operation.py +2 -3
- classiq/interface/model/quantum_lambda_function.py +64 -0
- classiq/interface/model/quantum_type.py +57 -56
- classiq/interface/model/quantum_variable_declaration.py +1 -1
- classiq/interface/model/statement_block.py +32 -0
- classiq/interface/model/validations/handles_validator.py +14 -12
- classiq/interface/model/within_apply_operation.py +11 -0
- classiq/interface/pyomo_extension/pyomo_sympy_bimap.py +4 -1
- classiq/interface/server/routes.py +5 -0
- classiq/model/function_handler.py +5 -9
- classiq/model/model.py +2 -19
- classiq/qmod/__init__.py +13 -6
- classiq/qmod/builtins/classical_execution_primitives.py +27 -36
- classiq/qmod/builtins/classical_functions.py +24 -14
- classiq/qmod/builtins/functions.py +162 -145
- classiq/qmod/builtins/operations.py +24 -35
- classiq/qmod/builtins/structs.py +15 -15
- classiq/qmod/cfunc.py +42 -0
- classiq/qmod/classical_function.py +6 -14
- classiq/qmod/declaration_inferrer.py +12 -21
- classiq/qmod/expression_query.py +23 -0
- classiq/qmod/model_state_container.py +2 -0
- classiq/qmod/native/__init__.py +0 -0
- classiq/qmod/native/expression_to_qmod.py +189 -0
- classiq/qmod/native/pretty_printer.py +311 -0
- classiq/qmod/qfunc.py +27 -0
- classiq/qmod/qmod_constant.py +76 -0
- classiq/qmod/qmod_parameter.py +34 -12
- classiq/qmod/qmod_struct.py +3 -3
- classiq/qmod/qmod_variable.py +102 -18
- classiq/qmod/quantum_expandable.py +16 -16
- classiq/qmod/quantum_function.py +37 -8
- classiq/qmod/symbolic.py +47 -4
- classiq/qmod/symbolic_expr.py +9 -0
- classiq/qmod/utilities.py +13 -0
- classiq/qmod/write_qmod.py +39 -0
- classiq/quantum_functions/__init__.py +2 -2
- classiq/quantum_functions/annotation_parser.py +9 -11
- classiq/quantum_functions/function_parser.py +1 -1
- classiq/quantum_functions/quantum_function.py +3 -3
- classiq/quantum_register.py +17 -9
- {classiq-0.37.1.dist-info → classiq-0.38.0.dist-info}/METADATA +2 -1
- {classiq-0.37.1.dist-info → classiq-0.38.0.dist-info}/RECORD +222 -186
- {classiq-0.37.1.dist-info → classiq-0.38.0.dist-info}/WHEEL +1 -1
- classiq/interface/generator/expressions/qmod_qnum_proxy.py +0 -22
- classiq/interface/generator/types/builtin_struct_declarations/qaoa_declarations.py +0 -23
- classiq/interface/generator/types/combinatorial_problem.py +0 -26
- classiq/interface/model/numeric_reinterpretation.py +0 -25
- classiq/interface/model/operator_synthesis_data.py +0 -48
- classiq/model/function_handler.pyi +0 -152
classiq/interface/generator/functions/core_lib_declarations/quantum_functions/std_lib_functions.py
CHANGED
@@ -42,7 +42,6 @@ QPE_FLEXIBLE = QuantumFunctionDeclaration.parse_raw(
|
|
42
42
|
"phase": {
|
43
43
|
"name": "phase",
|
44
44
|
"quantum_type": {
|
45
|
-
"size": null,
|
46
45
|
"kind": "qnum"
|
47
46
|
},
|
48
47
|
"direction": "inout"
|
@@ -78,7 +77,6 @@ QPE_FLEXIBLE = QuantumFunctionDeclaration.parse_raw(
|
|
78
77
|
{
|
79
78
|
"name": "phase",
|
80
79
|
"quantum_type": {
|
81
|
-
"size": null,
|
82
80
|
"kind": "qnum"
|
83
81
|
},
|
84
82
|
"direction": "inout"
|
@@ -95,7 +93,6 @@ QPE = QuantumFunctionDeclaration.parse_raw(
|
|
95
93
|
"phase": {
|
96
94
|
"name": "phase",
|
97
95
|
"quantum_type": {
|
98
|
-
"size": null,
|
99
96
|
"kind": "qnum"
|
100
97
|
},
|
101
98
|
"direction": "inout"
|
@@ -117,7 +114,6 @@ QPE = QuantumFunctionDeclaration.parse_raw(
|
|
117
114
|
{
|
118
115
|
"name": "phase",
|
119
116
|
"quantum_type": {
|
120
|
-
"size": null,
|
121
117
|
"kind": "qnum"
|
122
118
|
},
|
123
119
|
"direction": "inout"
|
@@ -251,6 +247,18 @@ AMPLITUDE_ESTIMATION = QuantumFunctionDeclaration.parse_raw(
|
|
251
247
|
"port_declarations": {
|
252
248
|
"phase_port": {
|
253
249
|
"name": "phase_port",
|
250
|
+
"quantum_type": {
|
251
|
+
"kind": "qnum",
|
252
|
+
"size": {
|
253
|
+
"expr": "num_phase_qubits"
|
254
|
+
},
|
255
|
+
"is_signed": {
|
256
|
+
"expr": "False"
|
257
|
+
},
|
258
|
+
"fraction_digits": {
|
259
|
+
"expr": "num_phase_qubits"
|
260
|
+
}
|
261
|
+
},
|
254
262
|
"size": {
|
255
263
|
"expr": "num_phase_qubits"
|
256
264
|
},
|
@@ -304,117 +312,311 @@ AMPLITUDE_ESTIMATION = QuantumFunctionDeclaration.parse_raw(
|
|
304
312
|
}"""
|
305
313
|
)
|
306
314
|
|
307
|
-
|
315
|
+
PHASE_ORACLE = QuantumFunctionDeclaration.parse_raw(
|
308
316
|
"""{
|
309
|
-
"name": "
|
317
|
+
"name": "phase_oracle",
|
310
318
|
"param_decls": {},
|
311
319
|
"port_declarations": {
|
312
320
|
"target": {
|
313
321
|
"name": "target",
|
322
|
+
"quantum_type": {
|
323
|
+
"length": null,
|
324
|
+
"kind": "qvec"
|
325
|
+
},
|
314
326
|
"direction": "inout"
|
315
327
|
}
|
316
328
|
},
|
317
329
|
"operand_declarations": {
|
318
330
|
"predicate": {
|
319
331
|
"name": "predicate",
|
320
|
-
"
|
321
|
-
|
322
|
-
"name": "
|
323
|
-
"
|
324
|
-
"
|
332
|
+
"positional_arg_declarations": [
|
333
|
+
{
|
334
|
+
"name": "arg0",
|
335
|
+
"quantum_type": {
|
336
|
+
"length": null,
|
337
|
+
"kind": "qvec"
|
325
338
|
},
|
326
339
|
"direction": "inout"
|
327
340
|
},
|
328
|
-
|
329
|
-
"name": "
|
330
|
-
"
|
331
|
-
"
|
341
|
+
{
|
342
|
+
"name": "arg1",
|
343
|
+
"quantum_type": {
|
344
|
+
"kind": "qbit"
|
332
345
|
},
|
333
346
|
"direction": "inout"
|
334
347
|
}
|
335
|
-
|
348
|
+
],
|
349
|
+
"is_list": false
|
336
350
|
}
|
337
351
|
},
|
338
|
-
"positional_arg_declarations": [
|
352
|
+
"positional_arg_declarations": [
|
353
|
+
{
|
354
|
+
"name": "predicate",
|
355
|
+
"positional_arg_declarations": [
|
356
|
+
{
|
357
|
+
"name": "arg0",
|
358
|
+
"quantum_type": {
|
359
|
+
"length": null,
|
360
|
+
"kind": "qvec"
|
361
|
+
},
|
362
|
+
"direction": "inout"
|
363
|
+
},
|
364
|
+
{
|
365
|
+
"name": "arg1",
|
366
|
+
"quantum_type": {
|
367
|
+
"kind": "qbit"
|
368
|
+
},
|
369
|
+
"direction": "inout"
|
370
|
+
}
|
371
|
+
],
|
372
|
+
"is_list": false
|
373
|
+
},
|
374
|
+
{
|
375
|
+
"name": "target",
|
376
|
+
"quantum_type": {
|
377
|
+
"length": null,
|
378
|
+
"kind": "qvec"
|
379
|
+
},
|
380
|
+
"direction": "inout"
|
381
|
+
}
|
382
|
+
]
|
339
383
|
}"""
|
340
384
|
)
|
341
385
|
|
342
|
-
|
386
|
+
REFLECT_ABOUT_ZERO = QuantumFunctionDeclaration.parse_raw(
|
343
387
|
"""{
|
344
|
-
"name": "
|
345
|
-
"param_decls": {
|
346
|
-
|
347
|
-
|
388
|
+
"name": "reflect_about_zero",
|
389
|
+
"param_decls": {},
|
390
|
+
"port_declarations": {
|
391
|
+
"packed_vars": {
|
392
|
+
"name": "packed_vars",
|
393
|
+
"quantum_type": {
|
394
|
+
"length": null,
|
395
|
+
"kind": "qvec"
|
396
|
+
},
|
397
|
+
"direction": "inout"
|
348
398
|
}
|
349
399
|
},
|
400
|
+
"operand_declarations": {},
|
401
|
+
"positional_arg_declarations": [
|
402
|
+
{
|
403
|
+
"name": "packed_vars",
|
404
|
+
"quantum_type": {
|
405
|
+
"length": null,
|
406
|
+
"kind": "qvec"
|
407
|
+
},
|
408
|
+
"direction": "inout"
|
409
|
+
}
|
410
|
+
]
|
411
|
+
}"""
|
412
|
+
)
|
413
|
+
|
414
|
+
GROVER_DIFFUSER = QuantumFunctionDeclaration.parse_raw(
|
415
|
+
"""{
|
416
|
+
"name": "grover_diffuser",
|
417
|
+
"param_decls": {},
|
350
418
|
"port_declarations": {
|
351
|
-
"
|
352
|
-
"name": "
|
353
|
-
"
|
354
|
-
"
|
419
|
+
"packed_vars": {
|
420
|
+
"name": "packed_vars",
|
421
|
+
"quantum_type": {
|
422
|
+
"length": null,
|
423
|
+
"kind": "qvec"
|
355
424
|
},
|
356
425
|
"direction": "inout"
|
357
426
|
}
|
358
427
|
},
|
359
|
-
"operand_declarations": {
|
360
|
-
|
428
|
+
"operand_declarations": {
|
429
|
+
"space_transform": {
|
430
|
+
"name": "space_transform",
|
431
|
+
"positional_arg_declarations": [
|
432
|
+
{
|
433
|
+
"name": "arg0",
|
434
|
+
"quantum_type": {
|
435
|
+
"length": null,
|
436
|
+
"kind": "qvec"
|
437
|
+
},
|
438
|
+
"direction": "inout"
|
439
|
+
}
|
440
|
+
],
|
441
|
+
"is_list": false
|
442
|
+
}
|
443
|
+
},
|
444
|
+
"positional_arg_declarations": [
|
445
|
+
{
|
446
|
+
"name": "space_transform",
|
447
|
+
"positional_arg_declarations": [
|
448
|
+
{
|
449
|
+
"name": "arg0",
|
450
|
+
"quantum_type": {
|
451
|
+
"length": null,
|
452
|
+
"kind": "qvec"
|
453
|
+
},
|
454
|
+
"direction": "inout"
|
455
|
+
}
|
456
|
+
],
|
457
|
+
"is_list": false
|
458
|
+
},
|
459
|
+
{
|
460
|
+
"name": "packed_vars",
|
461
|
+
"quantum_type": {
|
462
|
+
"length": null,
|
463
|
+
"kind": "qvec"
|
464
|
+
},
|
465
|
+
"direction": "inout"
|
466
|
+
}
|
467
|
+
]
|
361
468
|
}"""
|
362
469
|
)
|
363
470
|
|
364
471
|
GROVER_OPERATOR = QuantumFunctionDeclaration.parse_raw(
|
365
472
|
"""{
|
366
473
|
"name": "grover_operator",
|
474
|
+
"param_decls": {},
|
475
|
+
"port_declarations": {
|
476
|
+
"packed_vars": {
|
477
|
+
"name": "packed_vars",
|
478
|
+
"quantum_type": {
|
479
|
+
"length": null,
|
480
|
+
"kind": "qvec"
|
481
|
+
},
|
482
|
+
"direction": "inout"
|
483
|
+
}
|
484
|
+
},
|
485
|
+
"operand_declarations": {
|
486
|
+
"oracle": {
|
487
|
+
"name": "oracle",
|
488
|
+
"positional_arg_declarations": [
|
489
|
+
{
|
490
|
+
"name": "arg0",
|
491
|
+
"quantum_type": {
|
492
|
+
"length": null,
|
493
|
+
"kind": "qvec"
|
494
|
+
},
|
495
|
+
"direction": "inout"
|
496
|
+
}
|
497
|
+
],
|
498
|
+
"is_list": false
|
499
|
+
},
|
500
|
+
"space_transform": {
|
501
|
+
"name": "space_transform",
|
502
|
+
"positional_arg_declarations": [
|
503
|
+
{
|
504
|
+
"name": "arg0",
|
505
|
+
"quantum_type": {
|
506
|
+
"length": null,
|
507
|
+
"kind": "qvec"
|
508
|
+
},
|
509
|
+
"direction": "inout"
|
510
|
+
}
|
511
|
+
],
|
512
|
+
"is_list": false
|
513
|
+
}
|
514
|
+
},
|
515
|
+
"positional_arg_declarations": [
|
516
|
+
{
|
517
|
+
"name": "oracle",
|
518
|
+
"positional_arg_declarations": [
|
519
|
+
{
|
520
|
+
"name": "arg0",
|
521
|
+
"quantum_type": {
|
522
|
+
"length": null,
|
523
|
+
"kind": "qvec"
|
524
|
+
},
|
525
|
+
"direction": "inout"
|
526
|
+
}
|
527
|
+
],
|
528
|
+
"is_list": false
|
529
|
+
},
|
530
|
+
{
|
531
|
+
"name": "space_transform",
|
532
|
+
"positional_arg_declarations": [
|
533
|
+
{
|
534
|
+
"name": "arg0",
|
535
|
+
"quantum_type": {
|
536
|
+
"length": null,
|
537
|
+
"kind": "qvec"
|
538
|
+
},
|
539
|
+
"direction": "inout"
|
540
|
+
}
|
541
|
+
],
|
542
|
+
"is_list": false
|
543
|
+
},
|
544
|
+
{
|
545
|
+
"name": "packed_vars",
|
546
|
+
"quantum_type": {
|
547
|
+
"length": null,
|
548
|
+
"kind": "qvec"
|
549
|
+
},
|
550
|
+
"direction": "inout"
|
551
|
+
}
|
552
|
+
]
|
553
|
+
}"""
|
554
|
+
)
|
555
|
+
|
556
|
+
GROVER_SEARCH = QuantumFunctionDeclaration.parse_raw(
|
557
|
+
"""{
|
558
|
+
"name": "grover_search",
|
367
559
|
"param_decls": {
|
368
|
-
"
|
560
|
+
"reps": {
|
369
561
|
"kind": "int"
|
370
562
|
}
|
371
563
|
},
|
372
564
|
"port_declarations": {
|
373
|
-
"
|
374
|
-
"name": "
|
375
|
-
"
|
376
|
-
"
|
565
|
+
"packed_vars": {
|
566
|
+
"name": "packed_vars",
|
567
|
+
"quantum_type": {
|
568
|
+
"length": null,
|
569
|
+
"kind": "qvec"
|
377
570
|
},
|
378
571
|
"direction": "inout"
|
379
572
|
}
|
380
573
|
},
|
381
574
|
"operand_declarations": {
|
382
|
-
"
|
383
|
-
"name": "
|
384
|
-
"
|
385
|
-
|
386
|
-
"
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
"spq": {
|
391
|
-
"name": "spq",
|
392
|
-
"size": {
|
393
|
-
"expr": "num_qubits"
|
575
|
+
"oracle": {
|
576
|
+
"name": "oracle",
|
577
|
+
"positional_arg_declarations": [
|
578
|
+
{
|
579
|
+
"name": "arg0",
|
580
|
+
"quantum_type": {
|
581
|
+
"length": null,
|
582
|
+
"kind": "qvec"
|
394
583
|
},
|
395
584
|
"direction": "inout"
|
396
585
|
}
|
586
|
+
],
|
587
|
+
"is_list": false
|
588
|
+
}
|
589
|
+
},
|
590
|
+
"positional_arg_declarations": [
|
591
|
+
{
|
592
|
+
"name": "reps",
|
593
|
+
"classical_type": {
|
594
|
+
"kind": "int"
|
397
595
|
}
|
398
596
|
},
|
399
|
-
|
400
|
-
"name": "
|
401
|
-
"
|
402
|
-
|
403
|
-
"
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
"oq": {
|
408
|
-
"name": "oq",
|
409
|
-
"size": {
|
410
|
-
"expr": "num_qubits"
|
597
|
+
{
|
598
|
+
"name": "oracle",
|
599
|
+
"positional_arg_declarations": [
|
600
|
+
{
|
601
|
+
"name": "arg0",
|
602
|
+
"quantum_type": {
|
603
|
+
"length": null,
|
604
|
+
"kind": "qvec"
|
411
605
|
},
|
412
606
|
"direction": "inout"
|
413
607
|
}
|
414
|
-
|
608
|
+
],
|
609
|
+
"is_list": false
|
610
|
+
},
|
611
|
+
{
|
612
|
+
"name": "packed_vars",
|
613
|
+
"quantum_type": {
|
614
|
+
"length": null,
|
615
|
+
"kind": "qvec"
|
616
|
+
},
|
617
|
+
"direction": "inout"
|
415
618
|
}
|
416
|
-
|
417
|
-
"positional_arg_declarations": []
|
619
|
+
]
|
418
620
|
}"""
|
419
621
|
)
|
420
622
|
|
@@ -461,71 +663,6 @@ APPLY_TO_ALL = QuantumFunctionDeclaration.parse_raw(
|
|
461
663
|
}"""
|
462
664
|
)
|
463
665
|
|
464
|
-
GROVER_SEARCH = QuantumFunctionDeclaration.parse_raw(
|
465
|
-
"""{
|
466
|
-
"name": "grover_search",
|
467
|
-
"param_decls": {
|
468
|
-
"num_qubits": {
|
469
|
-
"kind": "int"
|
470
|
-
},
|
471
|
-
"reps": {
|
472
|
-
"kind": "int"
|
473
|
-
}
|
474
|
-
},
|
475
|
-
"port_declarations": {
|
476
|
-
"gsq": {
|
477
|
-
"name": "gsq",
|
478
|
-
"size": {
|
479
|
-
"expr": "num_qubits"
|
480
|
-
},
|
481
|
-
"direction": "inout"
|
482
|
-
}
|
483
|
-
},
|
484
|
-
"operand_declarations": {
|
485
|
-
"oracle_op": {
|
486
|
-
"name": "oracle_op",
|
487
|
-
"param_decls": {
|
488
|
-
"num_qubits": {
|
489
|
-
"kind": "int"
|
490
|
-
}
|
491
|
-
},
|
492
|
-
"port_declarations": {
|
493
|
-
"oq": {
|
494
|
-
"name": "oq",
|
495
|
-
"size": {
|
496
|
-
"expr": "num_qubits"
|
497
|
-
},
|
498
|
-
"direction": "inout"
|
499
|
-
}
|
500
|
-
}
|
501
|
-
}
|
502
|
-
},
|
503
|
-
"positional_arg_declarations": []
|
504
|
-
}"""
|
505
|
-
)
|
506
|
-
|
507
|
-
PREPARE_INT = QuantumFunctionDeclaration.parse_raw(
|
508
|
-
"""{
|
509
|
-
"name": "prepare_int",
|
510
|
-
"param_decls": {
|
511
|
-
"val": {
|
512
|
-
"kind": "int"
|
513
|
-
}
|
514
|
-
},
|
515
|
-
"port_declarations": {
|
516
|
-
"out": {
|
517
|
-
"name": "out",
|
518
|
-
"quantum_type": {
|
519
|
-
"kind": "qnum"
|
520
|
-
},
|
521
|
-
"direction": "output"
|
522
|
-
}
|
523
|
-
},
|
524
|
-
"operand_declarations": {},
|
525
|
-
"positional_arg_declarations": []
|
526
|
-
}"""
|
527
|
-
)
|
528
|
-
|
529
666
|
ALLOCATE_NUM = QuantumFunctionDeclaration.parse_raw(
|
530
667
|
"""{
|
531
668
|
"name": "allocate_num",
|
@@ -544,7 +681,16 @@ ALLOCATE_NUM = QuantumFunctionDeclaration.parse_raw(
|
|
544
681
|
"out": {
|
545
682
|
"name": "out",
|
546
683
|
"quantum_type": {
|
547
|
-
"kind": "qnum"
|
684
|
+
"kind": "qnum",
|
685
|
+
"size": {
|
686
|
+
"expr": "num_qubits"
|
687
|
+
},
|
688
|
+
"is_signed": {
|
689
|
+
"expr": "is_signed"
|
690
|
+
},
|
691
|
+
"fraction_digits": {
|
692
|
+
"expr": "fraction_digits"
|
693
|
+
}
|
548
694
|
},
|
549
695
|
"direction": "output"
|
550
696
|
}
|
@@ -586,9 +732,6 @@ QAOA_COST_LAYER = QuantumFunctionDeclaration.parse_raw(
|
|
586
732
|
"kind": "struct_instance",
|
587
733
|
"name": "PauliTerm"
|
588
734
|
}
|
589
|
-
},
|
590
|
-
"is_st": {
|
591
|
-
"kind": "bool"
|
592
735
|
}
|
593
736
|
},
|
594
737
|
"port_declarations": {
|
@@ -618,9 +761,6 @@ QAOA_LAYER = QuantumFunctionDeclaration.parse_raw(
|
|
618
761
|
"kind": "struct_instance",
|
619
762
|
"name": "PauliTerm"
|
620
763
|
}
|
621
|
-
},
|
622
|
-
"is_st": {
|
623
|
-
"kind": "bool"
|
624
764
|
}
|
625
765
|
},
|
626
766
|
"port_declarations": {
|
@@ -668,9 +808,6 @@ QAOA_PENALTY = QuantumFunctionDeclaration.parse_raw(
|
|
668
808
|
"kind": "struct_instance",
|
669
809
|
"name": "PauliTerm"
|
670
810
|
}
|
671
|
-
},
|
672
|
-
"is_st": {
|
673
|
-
"kind": "bool"
|
674
811
|
}
|
675
812
|
},
|
676
813
|
"port_declarations": {
|
@@ -835,6 +972,230 @@ SWAP_TEST = QuantumFunctionDeclaration.parse_raw(
|
|
835
972
|
}"""
|
836
973
|
)
|
837
974
|
|
975
|
+
PREPARE_GHZ_STATE = QuantumFunctionDeclaration.parse_raw(
|
976
|
+
"""{
|
977
|
+
"name": "prepare_ghz_state",
|
978
|
+
"param_decls": {
|
979
|
+
"size": {
|
980
|
+
"kind": "int"
|
981
|
+
}
|
982
|
+
},
|
983
|
+
"port_declarations": {
|
984
|
+
"q": {
|
985
|
+
"name": "q",
|
986
|
+
"quantum_type": {
|
987
|
+
"length": null,
|
988
|
+
"kind": "qvec"
|
989
|
+
},
|
990
|
+
"direction": "output"
|
991
|
+
}
|
992
|
+
},
|
993
|
+
"operand_declarations": {},
|
994
|
+
"positional_arg_declarations": [
|
995
|
+
{
|
996
|
+
"name": "size",
|
997
|
+
"classical_type": {
|
998
|
+
"kind": "int"
|
999
|
+
}
|
1000
|
+
},
|
1001
|
+
{
|
1002
|
+
"name": "q",
|
1003
|
+
"quantum_type": {
|
1004
|
+
"length": null,
|
1005
|
+
"kind": "qvec"
|
1006
|
+
},
|
1007
|
+
"direction": "output"
|
1008
|
+
}
|
1009
|
+
]
|
1010
|
+
}"""
|
1011
|
+
)
|
1012
|
+
|
1013
|
+
PREPARE_EXPONENTIAL_STATE = QuantumFunctionDeclaration.parse_raw(
|
1014
|
+
"""{
|
1015
|
+
"name": "prepare_exponential_state",
|
1016
|
+
"param_decls": {
|
1017
|
+
"rate": {
|
1018
|
+
"kind": "int"
|
1019
|
+
}
|
1020
|
+
},
|
1021
|
+
"port_declarations": {
|
1022
|
+
"q": {
|
1023
|
+
"name": "q",
|
1024
|
+
"quantum_type": {
|
1025
|
+
"length": null,
|
1026
|
+
"kind": "qvec"
|
1027
|
+
},
|
1028
|
+
"direction": "inout"
|
1029
|
+
}
|
1030
|
+
},
|
1031
|
+
"operand_declarations": {},
|
1032
|
+
"positional_arg_declarations": [
|
1033
|
+
{
|
1034
|
+
"name": "rate",
|
1035
|
+
"classical_type": {
|
1036
|
+
"kind": "int"
|
1037
|
+
}
|
1038
|
+
},
|
1039
|
+
{
|
1040
|
+
"name": "q",
|
1041
|
+
"quantum_type": {
|
1042
|
+
"length": null,
|
1043
|
+
"kind": "qvec"
|
1044
|
+
},
|
1045
|
+
"direction": "inout"
|
1046
|
+
}
|
1047
|
+
]
|
1048
|
+
}"""
|
1049
|
+
)
|
1050
|
+
|
1051
|
+
PREPARE_BELL_STATE = QuantumFunctionDeclaration.parse_raw(
|
1052
|
+
"""{
|
1053
|
+
"name": "prepare_bell_state",
|
1054
|
+
"param_decls": {
|
1055
|
+
"state_num": {
|
1056
|
+
"kind": "int"
|
1057
|
+
}
|
1058
|
+
},
|
1059
|
+
"port_declarations": {
|
1060
|
+
"q": {
|
1061
|
+
"name": "q",
|
1062
|
+
"quantum_type": {
|
1063
|
+
"length": {
|
1064
|
+
"expr": "2"
|
1065
|
+
},
|
1066
|
+
"kind": "qvec"
|
1067
|
+
},
|
1068
|
+
"direction": "output"
|
1069
|
+
}
|
1070
|
+
},
|
1071
|
+
"operand_declarations": {},
|
1072
|
+
"positional_arg_declarations": [
|
1073
|
+
{
|
1074
|
+
"name": "state_num",
|
1075
|
+
"classical_type": {
|
1076
|
+
"kind": "int"
|
1077
|
+
}
|
1078
|
+
},
|
1079
|
+
{
|
1080
|
+
"name": "q",
|
1081
|
+
"quantum_type": {
|
1082
|
+
"length": {
|
1083
|
+
"expr": "2"
|
1084
|
+
},
|
1085
|
+
"kind": "qvec"
|
1086
|
+
},
|
1087
|
+
"direction": "output"
|
1088
|
+
}
|
1089
|
+
]
|
1090
|
+
}"""
|
1091
|
+
)
|
1092
|
+
|
1093
|
+
INPLACE_PREPARE_INT = QuantumFunctionDeclaration.parse_raw(
|
1094
|
+
"""{
|
1095
|
+
"name": "inplace_prepare_int",
|
1096
|
+
"param_decls": {
|
1097
|
+
"value": {
|
1098
|
+
"kind": "int"
|
1099
|
+
}
|
1100
|
+
},
|
1101
|
+
"port_declarations": {
|
1102
|
+
"target": {
|
1103
|
+
"name": "target",
|
1104
|
+
"quantum_type": {
|
1105
|
+
"length": null,
|
1106
|
+
"kind": "qvec"
|
1107
|
+
},
|
1108
|
+
"direction": "inout"
|
1109
|
+
}
|
1110
|
+
},
|
1111
|
+
"operand_declarations": {},
|
1112
|
+
"positional_arg_declarations": [
|
1113
|
+
{
|
1114
|
+
"name": "value",
|
1115
|
+
"classical_type": {
|
1116
|
+
"kind": "int"
|
1117
|
+
}
|
1118
|
+
},
|
1119
|
+
{
|
1120
|
+
"name": "target",
|
1121
|
+
"quantum_type": {
|
1122
|
+
"length": null,
|
1123
|
+
"kind": "qvec"
|
1124
|
+
},
|
1125
|
+
"direction": "inout"
|
1126
|
+
}
|
1127
|
+
]
|
1128
|
+
}"""
|
1129
|
+
)
|
1130
|
+
|
1131
|
+
PREPARE_INT = QuantumFunctionDeclaration.parse_raw(
|
1132
|
+
"""{
|
1133
|
+
"name": "prepare_int",
|
1134
|
+
"param_decls": {
|
1135
|
+
"value": {
|
1136
|
+
"kind": "int"
|
1137
|
+
}
|
1138
|
+
},
|
1139
|
+
"port_declarations": {
|
1140
|
+
"out": {
|
1141
|
+
"name": "out",
|
1142
|
+
"quantum_type": {
|
1143
|
+
"kind": "qnum"
|
1144
|
+
},
|
1145
|
+
"direction": "output"
|
1146
|
+
}
|
1147
|
+
},
|
1148
|
+
"operand_declarations": {},
|
1149
|
+
"positional_arg_declarations": [
|
1150
|
+
{
|
1151
|
+
"name": "value",
|
1152
|
+
"classical_type": {
|
1153
|
+
"kind": "int"
|
1154
|
+
}
|
1155
|
+
},
|
1156
|
+
{
|
1157
|
+
"name": "out",
|
1158
|
+
"quantum_type": {
|
1159
|
+
"kind": "qnum"
|
1160
|
+
},
|
1161
|
+
"direction": "output"
|
1162
|
+
}
|
1163
|
+
]
|
1164
|
+
}"""
|
1165
|
+
)
|
1166
|
+
|
1167
|
+
SWITCH = QuantumFunctionDeclaration.parse_raw(
|
1168
|
+
"""{
|
1169
|
+
"name": "switch",
|
1170
|
+
"param_decls": {
|
1171
|
+
"selector": {
|
1172
|
+
"kind": "int"
|
1173
|
+
}
|
1174
|
+
},
|
1175
|
+
"port_declarations": {},
|
1176
|
+
"operand_declarations": {
|
1177
|
+
"cases": {
|
1178
|
+
"name": "cases",
|
1179
|
+
"positional_arg_declarations": [],
|
1180
|
+
"is_list": true
|
1181
|
+
}
|
1182
|
+
},
|
1183
|
+
"positional_arg_declarations": [
|
1184
|
+
{
|
1185
|
+
"name": "selector",
|
1186
|
+
"classical_type": {
|
1187
|
+
"kind": "int"
|
1188
|
+
}
|
1189
|
+
},
|
1190
|
+
{
|
1191
|
+
"name": "cases",
|
1192
|
+
"positional_arg_declarations": [],
|
1193
|
+
"is_list": true
|
1194
|
+
}
|
1195
|
+
]
|
1196
|
+
}"""
|
1197
|
+
)
|
1198
|
+
|
838
1199
|
__all__ = [
|
839
1200
|
"QFT_STEP",
|
840
1201
|
"QFT",
|
@@ -844,13 +1205,13 @@ __all__ = [
|
|
844
1205
|
"SINGLE_PAULI",
|
845
1206
|
"LINEAR_PAULI_ROTATIONS",
|
846
1207
|
"AMPLITUDE_ESTIMATION",
|
847
|
-
"
|
1208
|
+
"PHASE_ORACLE",
|
1209
|
+
"REFLECT_ABOUT_ZERO",
|
848
1210
|
"GROVER_DIFFUSER",
|
849
1211
|
"GROVER_OPERATOR",
|
1212
|
+
"GROVER_SEARCH",
|
850
1213
|
"HADAMARD_TRANSFORM",
|
851
1214
|
"APPLY_TO_ALL",
|
852
|
-
"GROVER_SEARCH",
|
853
|
-
"PREPARE_INT",
|
854
1215
|
"ALLOCATE_NUM",
|
855
1216
|
"QAOA_MIXER_LAYER",
|
856
1217
|
"QAOA_COST_LAYER",
|
@@ -859,4 +1220,10 @@ __all__ = [
|
|
859
1220
|
"QAOA_PENALTY",
|
860
1221
|
"FULL_HEA",
|
861
1222
|
"SWAP_TEST",
|
1223
|
+
"PREPARE_GHZ_STATE",
|
1224
|
+
"PREPARE_EXPONENTIAL_STATE",
|
1225
|
+
"PREPARE_BELL_STATE",
|
1226
|
+
"INPLACE_PREPARE_INT",
|
1227
|
+
"PREPARE_INT",
|
1228
|
+
"SWITCH",
|
862
1229
|
]
|