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