classiq 0.38.0__py3-none-any.whl → 0.40.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- classiq/__init__.py +22 -22
- classiq/_internals/api_wrapper.py +13 -1
- classiq/_internals/client.py +12 -2
- classiq/analyzer/analyzer.py +3 -1
- classiq/applications/__init__.py +1 -8
- classiq/applications/chemistry/__init__.py +6 -0
- classiq/{applications_model_constructors → applications/chemistry}/chemistry_model_constructor.py +1 -1
- classiq/{applications_model_constructors → applications}/combinatorial_helpers/arithmetic/arithmetic_expression.py +1 -1
- classiq/{applications_model_constructors → applications}/combinatorial_helpers/combinatorial_problem_utils.py +25 -6
- classiq/{applications_model_constructors → applications}/combinatorial_helpers/encoding_mapping.py +1 -1
- classiq/{applications_model_constructors → applications}/combinatorial_helpers/encoding_utils.py +1 -1
- classiq/{applications_model_constructors → applications}/combinatorial_helpers/memory.py +2 -4
- classiq/{applications_model_constructors → applications}/combinatorial_helpers/optimization_model.py +13 -16
- classiq/{applications_model_constructors → applications}/combinatorial_helpers/pyomo_utils.py +4 -2
- classiq/{applications_model_constructors → applications}/combinatorial_helpers/transformations/encoding.py +3 -10
- classiq/{applications_model_constructors → applications}/combinatorial_helpers/transformations/fixed_variables.py +4 -6
- classiq/{applications_model_constructors → applications}/combinatorial_helpers/transformations/ising_converter.py +3 -5
- classiq/{applications_model_constructors → applications}/combinatorial_helpers/transformations/penalty_support.py +3 -7
- classiq/{applications_model_constructors → applications}/combinatorial_helpers/transformations/slack_variables.py +4 -6
- classiq/applications/combinatorial_optimization/__init__.py +11 -3
- classiq/{applications_model_constructors → applications/combinatorial_optimization}/combinatorial_optimization_model_constructor.py +9 -10
- classiq/applications/finance/__init__.py +3 -2
- classiq/{applications_model_constructors → applications/finance}/finance_model_constructor.py +24 -14
- classiq/applications/grover/__init__.py +11 -0
- classiq/applications/libraries/qmci_library.py +35 -0
- classiq/applications/qsvm/__init__.py +5 -1
- classiq/execution/all_hardware_devices.py +13 -0
- classiq/executor.py +2 -1
- classiq/interface/_version.py +1 -1
- classiq/interface/analyzer/result.py +1 -5
- classiq/interface/applications/qsvm.py +4 -2
- classiq/interface/ast_node.py +23 -0
- classiq/interface/backend/backend_preferences.py +5 -5
- classiq/interface/backend/quantum_backend_providers.py +7 -7
- classiq/interface/combinatorial_optimization/examples/mht.py +8 -3
- classiq/interface/executor/execution_preferences.py +4 -9
- classiq/interface/executor/execution_request.py +2 -37
- classiq/interface/executor/vqe_result.py +1 -1
- classiq/interface/generator/application_apis/chemistry_declarations.py +2 -4
- classiq/interface/generator/application_apis/finance_declarations.py +1 -1
- classiq/interface/generator/arith/arithmetic_expression_validator.py +2 -0
- classiq/interface/generator/builtin_api_builder.py +0 -5
- classiq/interface/generator/constant.py +2 -3
- classiq/interface/generator/expressions/expression.py +2 -4
- classiq/interface/generator/expressions/qmod_qarray_proxy.py +82 -0
- classiq/interface/generator/expressions/qmod_qscalar_proxy.py +22 -1
- classiq/interface/generator/expressions/qmod_sized_proxy.py +22 -0
- classiq/interface/generator/functions/__init__.py +2 -2
- classiq/interface/generator/functions/builtins/__init__.py +15 -0
- classiq/interface/generator/functions/builtins/core_library/__init__.py +14 -0
- classiq/interface/generator/functions/{core_lib_declarations/quantum_functions → builtins/core_library}/atomic_quantum_functions.py +8 -6
- classiq/interface/generator/functions/{core_lib_declarations/quantum_functions → builtins/core_library}/exponentiation_functions.py +10 -4
- classiq/interface/generator/functions/builtins/internal_operators.py +62 -0
- classiq/interface/generator/functions/{core_lib_declarations/quantum_functions/std_lib_functions.py → builtins/open_lib_functions.py} +893 -319
- classiq/interface/generator/functions/builtins/quantum_operators.py +37 -0
- classiq/interface/generator/functions/classical_type.py +31 -21
- classiq/interface/generator/functions/function_declaration.py +2 -2
- classiq/interface/generator/hartree_fock.py +10 -2
- classiq/interface/generator/model/classical_main_validator.py +1 -1
- classiq/interface/generator/model/model.py +1 -1
- classiq/interface/generator/model/preferences/preferences.py +4 -2
- classiq/interface/generator/quantum_function_call.py +1 -1
- classiq/interface/generator/types/struct_declaration.py +2 -4
- classiq/interface/model/call_synthesis_data.py +3 -3
- classiq/interface/model/classical_if.py +13 -0
- classiq/interface/model/classical_parameter_declaration.py +2 -3
- classiq/interface/model/{quantum_if_operation.py → control.py} +39 -21
- classiq/interface/model/handle_binding.py +3 -2
- classiq/interface/model/invert.py +10 -0
- classiq/interface/model/model.py +2 -1
- classiq/interface/model/power.py +12 -0
- classiq/interface/model/quantum_function_call.py +9 -4
- classiq/interface/model/quantum_lambda_function.py +3 -9
- classiq/interface/model/quantum_statement.py +3 -2
- classiq/interface/model/quantum_type.py +8 -9
- classiq/interface/model/quantum_variable_declaration.py +2 -2
- classiq/interface/model/repeat.py +13 -0
- classiq/interface/model/resolvers/function_call_resolver.py +21 -0
- classiq/interface/model/statement_block.py +18 -4
- classiq/interface/model/validations/handles_validator.py +8 -12
- classiq/interface/model/within_apply_operation.py +4 -4
- classiq/interface/server/routes.py +0 -4
- classiq/qmod/__init__.py +6 -2
- classiq/qmod/builtins/classical_functions.py +34 -39
- classiq/qmod/builtins/functions.py +287 -300
- classiq/qmod/builtins/operations.py +217 -16
- classiq/qmod/builtins/structs.py +50 -48
- classiq/qmod/declaration_inferrer.py +30 -18
- classiq/qmod/native/expression_to_qmod.py +5 -4
- classiq/qmod/native/pretty_printer.py +48 -26
- classiq/qmod/qmod_constant.py +29 -5
- classiq/qmod/qmod_parameter.py +56 -34
- classiq/qmod/qmod_struct.py +2 -2
- classiq/qmod/qmod_variable.py +87 -43
- classiq/qmod/quantum_callable.py +8 -4
- classiq/qmod/quantum_expandable.py +25 -20
- classiq/qmod/quantum_function.py +29 -2
- classiq/qmod/symbolic.py +79 -69
- classiq/qmod/symbolic_expr.py +1 -1
- classiq/qmod/symbolic_type.py +1 -4
- classiq/qmod/utilities.py +29 -0
- {classiq-0.38.0.dist-info → classiq-0.40.0.dist-info}/METADATA +1 -1
- {classiq-0.38.0.dist-info → classiq-0.40.0.dist-info}/RECORD +122 -141
- classiq/applications/benchmarking/__init__.py +0 -9
- classiq/applications/benchmarking/mirror_benchmarking.py +0 -70
- classiq/applications/numpy_utils.py +0 -37
- classiq/applications_model_constructors/__init__.py +0 -25
- classiq/applications_model_constructors/combinatorial_helpers/multiple_comp_basis_sp.py +0 -34
- classiq/applications_model_constructors/libraries/qmci_library.py +0 -107
- classiq/builtin_functions/__init__.py +0 -43
- classiq/builtin_functions/amplitude_loading.py +0 -3
- classiq/builtin_functions/binary_ops.py +0 -1
- classiq/builtin_functions/exponentiation.py +0 -5
- classiq/builtin_functions/qpe.py +0 -4
- classiq/builtin_functions/qsvm.py +0 -7
- classiq/builtin_functions/range_types.py +0 -5
- classiq/builtin_functions/standard_gates.py +0 -1
- classiq/builtin_functions/state_preparation.py +0 -6
- classiq/builtin_functions/suzuki_trotter.py +0 -3
- classiq/interface/executor/error_mitigation.py +0 -6
- classiq/interface/generator/functions/core_lib_declarations/quantum_functions/__init__.py +0 -18
- classiq/interface/generator/functions/core_lib_declarations/quantum_functions/chemistry_functions.py +0 -0
- classiq/interface/generator/functions/core_lib_declarations/quantum_operators.py +0 -95
- classiq/model/__init__.py +0 -14
- classiq/model/composite_function_generator.py +0 -33
- classiq/model/function_handler.py +0 -462
- classiq/model/logic_flow.py +0 -149
- classiq/model/logic_flow_change_handler.py +0 -71
- classiq/model/model.py +0 -229
- classiq/quantum_functions/__init__.py +0 -17
- classiq/quantum_functions/annotation_parser.py +0 -205
- classiq/quantum_functions/decorators.py +0 -22
- classiq/quantum_functions/function_library.py +0 -181
- classiq/quantum_functions/function_parser.py +0 -74
- classiq/quantum_functions/quantum_function.py +0 -236
- /classiq/{applications_model_constructors → applications}/combinatorial_helpers/__init__.py +0 -0
- /classiq/{applications_model_constructors → applications}/combinatorial_helpers/allowed_constraints.py +0 -0
- /classiq/{applications_model_constructors → applications}/combinatorial_helpers/arithmetic/__init__.py +0 -0
- /classiq/{applications_model_constructors → applications}/combinatorial_helpers/arithmetic/isolation.py +0 -0
- /classiq/{applications_model_constructors → applications}/combinatorial_helpers/pauli_helpers/__init__.py +0 -0
- /classiq/{applications_model_constructors → applications}/combinatorial_helpers/pauli_helpers/pauli_sparsing.py +0 -0
- /classiq/{applications_model_constructors → applications}/combinatorial_helpers/pauli_helpers/pauli_utils.py +0 -0
- /classiq/{applications_model_constructors → applications}/combinatorial_helpers/py.typed +0 -0
- /classiq/{applications_model_constructors/combinatorial_helpers/transformations → applications/combinatorial_helpers/solvers}/__init__.py +0 -0
- /classiq/{applications_model_constructors → applications}/combinatorial_helpers/sympy_utils.py +0 -0
- /classiq/{applications_model_constructors/libraries → applications/combinatorial_helpers/transformations}/__init__.py +0 -0
- /classiq/{applications_model_constructors → applications}/combinatorial_helpers/transformations/penalty.py +0 -0
- /classiq/{applications_model_constructors → applications}/combinatorial_helpers/transformations/sign_seperation.py +0 -0
- /classiq/{applications_model_constructors → applications/grover}/grover_model_constructor.py +0 -0
- /classiq/{interface/generator/functions/core_lib_declarations → applications/libraries}/__init__.py +0 -0
- /classiq/{applications_model_constructors → applications}/libraries/ampltitude_estimation_library.py +0 -0
- /classiq/{applications_model_constructors → applications/qsvm}/qsvm_model_constructor.py +0 -0
- /classiq/{quantum_register.py → interface/model/quantum_register.py} +0 -0
- {classiq-0.38.0.dist-info → classiq-0.40.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,13 @@
|
|
1
|
+
from typing import TYPE_CHECKING
|
2
|
+
|
3
|
+
from classiq.interface.generator.expressions.expression import Expression
|
4
|
+
from classiq.interface.model.quantum_statement import QuantumOperation
|
5
|
+
|
6
|
+
if TYPE_CHECKING:
|
7
|
+
from classiq.interface.model.statement_block import StatementBlock
|
8
|
+
|
9
|
+
|
10
|
+
class Repeat(QuantumOperation):
|
11
|
+
iter_var: str
|
12
|
+
count: Expression
|
13
|
+
body: "StatementBlock"
|
@@ -1,11 +1,16 @@
|
|
1
|
+
import itertools
|
1
2
|
from typing import Any, Mapping
|
2
3
|
|
3
4
|
from classiq.interface.generator.visitor import Visitor
|
5
|
+
from classiq.interface.model.control import Control
|
6
|
+
from classiq.interface.model.invert import Invert
|
4
7
|
from classiq.interface.model.native_function_definition import NativeFunctionDefinition
|
5
8
|
from classiq.interface.model.quantum_function_call import QuantumFunctionCall
|
6
9
|
from classiq.interface.model.quantum_function_declaration import (
|
7
10
|
QuantumFunctionDeclaration,
|
8
11
|
)
|
12
|
+
from classiq.interface.model.repeat import Repeat
|
13
|
+
from classiq.interface.model.within_apply_operation import WithinApply
|
9
14
|
|
10
15
|
|
11
16
|
class FunctionCallResolver(Visitor):
|
@@ -15,6 +20,22 @@ class FunctionCallResolver(Visitor):
|
|
15
20
|
) -> None:
|
16
21
|
self._quantum_function_dict = quantum_function_dict
|
17
22
|
|
23
|
+
def visit_Invert(self, invert: Invert) -> None:
|
24
|
+
for fc in invert.body:
|
25
|
+
self.visit(fc)
|
26
|
+
|
27
|
+
def visit_Repeat(self, repeat: Repeat) -> None:
|
28
|
+
for fc in repeat.body:
|
29
|
+
self.visit(fc)
|
30
|
+
|
31
|
+
def visit_Control(self, control: Control) -> None:
|
32
|
+
for fc in control.body:
|
33
|
+
self.visit(fc)
|
34
|
+
|
35
|
+
def visit_WithinApply(self, within_apply: WithinApply) -> None:
|
36
|
+
for fc in itertools.chain(within_apply.compute, within_apply.action):
|
37
|
+
self.visit(fc)
|
38
|
+
|
18
39
|
def visit_QuantumFunctionCall(self, fc: QuantumFunctionCall) -> None:
|
19
40
|
fc.resolve_function_decl(self._quantum_function_dict, check_operands=True)
|
20
41
|
self.visit_BaseModel(fc)
|
@@ -1,7 +1,11 @@
|
|
1
1
|
from typing import List, Union
|
2
2
|
|
3
3
|
from classiq.interface.model.bind_operation import BindOperation
|
4
|
+
from classiq.interface.model.classical_if import ClassicalIf
|
5
|
+
from classiq.interface.model.control import Control
|
4
6
|
from classiq.interface.model.inplace_binary_operation import InplaceBinaryOperation
|
7
|
+
from classiq.interface.model.invert import Invert
|
8
|
+
from classiq.interface.model.power import Power
|
5
9
|
from classiq.interface.model.quantum_expressions.amplitude_loading_operation import (
|
6
10
|
AmplitudeLoadingOperation,
|
7
11
|
)
|
@@ -9,12 +13,12 @@ from classiq.interface.model.quantum_expressions.arithmetic_operation import (
|
|
9
13
|
ArithmeticOperation,
|
10
14
|
)
|
11
15
|
from classiq.interface.model.quantum_function_call import QuantumFunctionCall
|
12
|
-
from classiq.interface.model.quantum_if_operation import QuantumIfOperation
|
13
16
|
from classiq.interface.model.quantum_lambda_function import QuantumLambdaFunction
|
17
|
+
from classiq.interface.model.repeat import Repeat
|
14
18
|
from classiq.interface.model.variable_declaration_statement import (
|
15
19
|
VariableDeclarationStatement,
|
16
20
|
)
|
17
|
-
from classiq.interface.model.within_apply_operation import
|
21
|
+
from classiq.interface.model.within_apply_operation import WithinApply
|
18
22
|
|
19
23
|
ConcreteQuantumStatement = Union[
|
20
24
|
QuantumFunctionCall,
|
@@ -23,10 +27,20 @@ ConcreteQuantumStatement = Union[
|
|
23
27
|
VariableDeclarationStatement,
|
24
28
|
BindOperation,
|
25
29
|
InplaceBinaryOperation,
|
26
|
-
|
27
|
-
|
30
|
+
Repeat,
|
31
|
+
Power,
|
32
|
+
Invert,
|
33
|
+
ClassicalIf,
|
34
|
+
Control,
|
35
|
+
WithinApply,
|
28
36
|
]
|
29
37
|
|
30
38
|
StatementBlock = List[ConcreteQuantumStatement]
|
31
39
|
|
40
|
+
Control.update_forward_refs(StatementBlock=StatementBlock)
|
32
41
|
QuantumLambdaFunction.update_forward_refs(StatementBlock=StatementBlock)
|
42
|
+
Repeat.update_forward_refs(StatementBlock=StatementBlock)
|
43
|
+
Power.update_forward_refs(StatementBlock=StatementBlock)
|
44
|
+
Invert.update_forward_refs(StatementBlock=StatementBlock)
|
45
|
+
WithinApply.update_forward_refs(StatementBlock=StatementBlock)
|
46
|
+
ClassicalIf.update_forward_refs(StatementBlock=StatementBlock)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
from typing import Dict, Mapping, Set, Union
|
2
2
|
|
3
3
|
from classiq.interface.generator.function_params import PortDirection
|
4
|
-
from classiq.interface.generator.functions.
|
4
|
+
from classiq.interface.generator.functions.builtins.quantum_operators import (
|
5
5
|
APPLY_OPERATOR,
|
6
6
|
)
|
7
7
|
from classiq.interface.model.handle_binding import (
|
@@ -11,11 +11,8 @@ from classiq.interface.model.handle_binding import (
|
|
11
11
|
)
|
12
12
|
from classiq.interface.model.port_declaration import PortDeclaration
|
13
13
|
from classiq.interface.model.quantum_function_call import QuantumFunctionCall
|
14
|
-
from classiq.interface.model.quantum_lambda_function import (
|
15
|
-
QuantumLambdaFunction,
|
16
|
-
QuantumOperand,
|
17
|
-
)
|
18
14
|
from classiq.interface.model.quantum_statement import QuantumOperation
|
15
|
+
from classiq.interface.model.statement_block import StatementBlock
|
19
16
|
from classiq.interface.model.validation_handle import HandleState, ValidationHandle
|
20
17
|
from classiq.interface.model.validations.handle_validation_base import (
|
21
18
|
HandleValidationBase,
|
@@ -23,7 +20,7 @@ from classiq.interface.model.validations.handle_validation_base import (
|
|
23
20
|
from classiq.interface.model.variable_declaration_statement import (
|
24
21
|
VariableDeclarationStatement,
|
25
22
|
)
|
26
|
-
from classiq.interface.model.within_apply_operation import
|
23
|
+
from classiq.interface.model.within_apply_operation import WithinApply
|
27
24
|
|
28
25
|
from classiq.exceptions import ClassiqValueError
|
29
26
|
|
@@ -60,8 +57,9 @@ class HandleValidator(HandleValidationBase):
|
|
60
57
|
|
61
58
|
def handle_operation(self, op: QuantumOperation) -> None:
|
62
59
|
if isinstance(op, QuantumFunctionCall) and op.function == APPLY_OPERATOR.name:
|
63
|
-
|
64
|
-
|
60
|
+
call_name = op.operands[APPLY_OPERATOR.operand_names[0]]
|
61
|
+
self._handle_apply([QuantumFunctionCall(function=call_name)])
|
62
|
+
elif isinstance(op, WithinApply):
|
65
63
|
self._handle_apply(op.action)
|
66
64
|
self._handle_inputs(op.wiring_inputs)
|
67
65
|
self._handle_outputs(op.wiring_outputs)
|
@@ -133,12 +131,10 @@ class HandleValidator(HandleValidationBase):
|
|
133
131
|
f"Invalid use of inout handle {handle!r}, used both in slice or subscript and whole"
|
134
132
|
)
|
135
133
|
|
136
|
-
def _handle_apply(self,
|
137
|
-
if not isinstance(operand, QuantumLambdaFunction):
|
138
|
-
return
|
134
|
+
def _handle_apply(self, body: StatementBlock) -> None:
|
139
135
|
local_variables: Set[str] = set()
|
140
136
|
output_capturing_variables: Set[str] = set()
|
141
|
-
for statement in
|
137
|
+
for statement in body:
|
142
138
|
if isinstance(statement, VariableDeclarationStatement):
|
143
139
|
local_variables.add(statement.name)
|
144
140
|
elif isinstance(statement, QuantumOperation):
|
@@ -3,9 +3,9 @@ from typing import TYPE_CHECKING
|
|
3
3
|
from classiq.interface.model.quantum_statement import QuantumOperation
|
4
4
|
|
5
5
|
if TYPE_CHECKING:
|
6
|
-
from classiq.interface.model.
|
6
|
+
from classiq.interface.model.statement_block import StatementBlock
|
7
7
|
|
8
8
|
|
9
|
-
class
|
10
|
-
compute: "
|
11
|
-
action: "
|
9
|
+
class WithinApply(QuantumOperation):
|
10
|
+
compute: "StatementBlock"
|
11
|
+
action: "StatementBlock"
|
@@ -78,10 +78,6 @@ FINANCE_GENERATE_MODEL_PATH = MODEL_GENERATE_PREFIX + "/finance"
|
|
78
78
|
|
79
79
|
GROVER_GENERATE_MODEL_PATH = MODEL_GENERATE_PREFIX + "/grover"
|
80
80
|
|
81
|
-
QMOD_PREFIX = ANALYZER_PREFIX + "/qmods"
|
82
|
-
QMOD_METADATA_PATH = QMOD_PREFIX + "/metadata"
|
83
|
-
QMOD_FILE_PATH = QMOD_PREFIX + "/file"
|
84
|
-
|
85
81
|
CONVERSION_GENERATED_CIRCUIT_TO_EXECUTION_INPUT_SUFFIX = "/execution_input"
|
86
82
|
CONVERSION_GENERATED_CIRCUIT_TO_EXECUTION_INPUT_FULL = (
|
87
83
|
CONVERSION_PREFIX + CONVERSION_GENERATED_CIRCUIT_TO_EXECUTION_INPUT_SUFFIX
|
classiq/qmod/__init__.py
CHANGED
@@ -5,7 +5,7 @@ from .cfunc import cfunc
|
|
5
5
|
from .expression_query import get_expression_numeric_attributes
|
6
6
|
from .qfunc import qfunc
|
7
7
|
from .qmod_constant import QConstant
|
8
|
-
from .qmod_parameter import Array, QParam
|
8
|
+
from .qmod_parameter import Array, CArray, CBool, CInt, CReal, QParam
|
9
9
|
from .qmod_struct import struct
|
10
10
|
from .qmod_variable import Input, Output, QArray, QBit, QNum
|
11
11
|
from .quantum_callable import QCallable, QCallableList
|
@@ -13,8 +13,11 @@ from .quantum_function import create_model
|
|
13
13
|
from .write_qmod import write_qmod
|
14
14
|
|
15
15
|
__all__ = [
|
16
|
-
"QParam",
|
17
16
|
"Array",
|
17
|
+
"CArray",
|
18
|
+
"CBool",
|
19
|
+
"CInt",
|
20
|
+
"CReal",
|
18
21
|
"Input",
|
19
22
|
"Output",
|
20
23
|
"QArray",
|
@@ -23,6 +26,7 @@ __all__ = [
|
|
23
26
|
"QCallable",
|
24
27
|
"QCallableList",
|
25
28
|
"QConstant",
|
29
|
+
"QParam",
|
26
30
|
"struct",
|
27
31
|
"qfunc",
|
28
32
|
"cfunc",
|
@@ -1,78 +1,73 @@
|
|
1
1
|
# This file was generated automatically - do not edit manually
|
2
2
|
|
3
|
-
from
|
4
|
-
|
5
|
-
from classiq.qmod.qmod_parameter import QParam
|
3
|
+
from classiq.qmod.qmod_parameter import CArray, CBool, CInt, CReal
|
6
4
|
from classiq.qmod.symbolic import symbolic_function
|
7
5
|
|
8
6
|
from .structs import *
|
9
7
|
|
10
8
|
|
9
|
+
def qft_const_adder_phase(
|
10
|
+
bit_index: CInt,
|
11
|
+
value: CInt,
|
12
|
+
reg_len: CInt,
|
13
|
+
) -> CReal:
|
14
|
+
return symbolic_function(bit_index, value, reg_len, return_type=CReal)
|
15
|
+
|
16
|
+
|
11
17
|
def molecule_problem_to_hamiltonian(
|
12
|
-
problem:
|
13
|
-
) ->
|
14
|
-
return symbolic_function(problem, return_type=
|
18
|
+
problem: MoleculeProblem,
|
19
|
+
) -> CArray[PauliTerm]:
|
20
|
+
return symbolic_function(problem, return_type=CArray[PauliTerm])
|
15
21
|
|
16
22
|
|
17
23
|
def fock_hamiltonian_problem_to_hamiltonian(
|
18
|
-
problem:
|
19
|
-
) ->
|
20
|
-
return symbolic_function(problem, return_type=
|
24
|
+
problem: FockHamiltonianProblem,
|
25
|
+
) -> CArray[PauliTerm]:
|
26
|
+
return symbolic_function(problem, return_type=CArray[PauliTerm])
|
21
27
|
|
22
28
|
|
23
29
|
def grid_entangler_graph(
|
24
|
-
num_qubits:
|
25
|
-
schmidt_rank:
|
26
|
-
grid_randomization:
|
27
|
-
) ->
|
30
|
+
num_qubits: CInt,
|
31
|
+
schmidt_rank: CInt,
|
32
|
+
grid_randomization: CBool,
|
33
|
+
) -> CArray[CArray[CInt]]:
|
28
34
|
return symbolic_function(
|
29
|
-
num_qubits,
|
30
|
-
schmidt_rank,
|
31
|
-
grid_randomization,
|
32
|
-
return_type=QParam[List[List[int]]],
|
35
|
+
num_qubits, schmidt_rank, grid_randomization, return_type=CArray[CArray[CInt]]
|
33
36
|
)
|
34
37
|
|
35
38
|
|
36
39
|
def hypercube_entangler_graph(
|
37
|
-
num_qubits:
|
38
|
-
) ->
|
39
|
-
return symbolic_function(num_qubits, return_type=
|
40
|
+
num_qubits: CInt,
|
41
|
+
) -> CArray[CArray[CInt]]:
|
42
|
+
return symbolic_function(num_qubits, return_type=CArray[CArray[CInt]])
|
40
43
|
|
41
44
|
|
42
45
|
def log_normal_finance_post_process(
|
43
|
-
finance_model:
|
44
|
-
estimation_method:
|
45
|
-
probability:
|
46
|
-
) ->
|
46
|
+
finance_model: LogNormalModel,
|
47
|
+
estimation_method: FinanceFunction,
|
48
|
+
probability: CReal,
|
49
|
+
) -> CReal:
|
47
50
|
return symbolic_function(
|
48
|
-
finance_model, estimation_method, probability, return_type=
|
51
|
+
finance_model, estimation_method, probability, return_type=CReal
|
49
52
|
)
|
50
53
|
|
51
54
|
|
52
55
|
def gaussian_finance_post_process(
|
53
|
-
finance_model:
|
54
|
-
estimation_method:
|
55
|
-
probability:
|
56
|
-
) ->
|
56
|
+
finance_model: GaussianModel,
|
57
|
+
estimation_method: FinanceFunction,
|
58
|
+
probability: CReal,
|
59
|
+
) -> CReal:
|
57
60
|
return symbolic_function(
|
58
|
-
finance_model, estimation_method, probability, return_type=
|
61
|
+
finance_model, estimation_method, probability, return_type=CReal
|
59
62
|
)
|
60
63
|
|
61
64
|
|
62
|
-
def qft_const_adder_phase(
|
63
|
-
bit_index: QParam[int],
|
64
|
-
value: QParam[int],
|
65
|
-
reg_len: QParam[int],
|
66
|
-
) -> QParam[float]:
|
67
|
-
return symbolic_function(bit_index, value, reg_len, return_type=QParam[float])
|
68
|
-
|
69
|
-
|
70
65
|
__all__ = [
|
66
|
+
"qft_const_adder_phase",
|
71
67
|
"molecule_problem_to_hamiltonian",
|
72
68
|
"fock_hamiltonian_problem_to_hamiltonian",
|
73
69
|
"grid_entangler_graph",
|
74
70
|
"hypercube_entangler_graph",
|
75
71
|
"log_normal_finance_post_process",
|
76
72
|
"gaussian_finance_post_process",
|
77
|
-
"qft_const_adder_phase",
|
78
73
|
]
|