classiq 0.36.1__py3-none-any.whl → 0.37.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 +1 -0
- classiq/_internals/api_wrapper.py +24 -6
- classiq/_internals/authentication/device.py +6 -3
- classiq/_internals/authentication/token_manager.py +21 -5
- classiq/_internals/client.py +7 -2
- classiq/_internals/config.py +12 -0
- classiq/_internals/host_checker.py +1 -1
- classiq/_internals/jobs.py +3 -1
- classiq/_internals/type_validation.py +3 -6
- classiq/analyzer/analyzer.py +1 -0
- classiq/analyzer/rb.py +3 -5
- classiq/applications_model_constructors/chemistry_model_constructor.py +0 -1
- classiq/applications_model_constructors/grover_model_constructor.py +27 -18
- classiq/execution/jobs.py +13 -4
- classiq/executor.py +3 -2
- classiq/interface/_version.py +1 -1
- classiq/interface/analyzer/analysis_params.py +0 -6
- classiq/interface/analyzer/result.py +0 -4
- classiq/interface/backend/backend_preferences.py +2 -2
- classiq/interface/backend/quantum_backend_providers.py +1 -1
- classiq/interface/execution/resource_estimator.py +7 -0
- classiq/interface/execution/result.py +5 -0
- classiq/interface/generator/ansatz_library.py +3 -3
- classiq/interface/generator/arith/binary_ops.py +1 -3
- classiq/interface/generator/expressions/atomic_expression_functions.py +2 -0
- classiq/interface/generator/expressions/qmod_qnum_proxy.py +22 -0
- classiq/interface/generator/expressions/qmod_sized_proxy.py +2 -12
- classiq/interface/generator/functions/core_lib_declarations/quantum_functions/std_lib_functions.py +140 -14
- classiq/interface/generator/functions/core_lib_declarations/quantum_operators.py +3 -20
- classiq/interface/generator/functions/native_function_definition.py +3 -3
- classiq/interface/generator/model/constraints.py +3 -3
- classiq/interface/generator/model/preferences/preferences.py +10 -8
- classiq/interface/generator/noise_properties.py +5 -5
- classiq/interface/generator/qpe.py +5 -5
- classiq/interface/generator/quantum_function_call.py +5 -3
- classiq/interface/generator/visitor.py +1 -2
- classiq/interface/hardware.py +1 -1
- classiq/interface/model/native_function_definition.py +2 -24
- classiq/interface/model/quantum_expressions/amplitude_loading_operation.py +2 -2
- classiq/interface/model/quantum_expressions/arithmetic_operation.py +2 -2
- classiq/interface/model/quantum_expressions/control_state.py +38 -0
- classiq/interface/model/quantum_expressions/quantum_expression.py +12 -9
- classiq/interface/model/quantum_function_call.py +3 -0
- classiq/interface/model/quantum_function_declaration.py +3 -3
- classiq/interface/model/quantum_if_operation.py +95 -0
- classiq/interface/model/validations/handles_validator.py +7 -15
- classiq/interface/server/routes.py +10 -6
- classiq/model/function_handler.pyi +85 -85
- classiq/model/model.py +1 -0
- classiq/qmod/__init__.py +4 -1
- classiq/qmod/builtins/__init__.py +13 -1
- classiq/qmod/builtins/classical_execution_primitives.py +109 -0
- classiq/qmod/builtins/classical_functions.py +68 -0
- classiq/qmod/builtins/functions.py +47 -21
- classiq/qmod/builtins/operations.py +15 -29
- classiq/qmod/classical_function.py +40 -0
- classiq/qmod/declaration_inferrer.py +5 -2
- classiq/qmod/qmod_variable.py +15 -3
- classiq/qmod/quantum_callable.py +24 -3
- classiq/qmod/quantum_expandable.py +99 -17
- classiq/qmod/quantum_function.py +12 -2
- classiq/qmod/symbolic.py +109 -107
- classiq/qmod/symbolic_expr.py +1 -4
- classiq/qmod/symbolic_type.py +8 -0
- classiq/quantum_functions/decorators.py +2 -4
- classiq/quantum_functions/function_library.py +1 -0
- {classiq-0.36.1.dist-info → classiq-0.37.0.dist-info}/METADATA +1 -1
- {classiq-0.36.1.dist-info → classiq-0.37.0.dist-info}/RECORD +69 -61
- classiq/interface/model/local_variable_declaration.py +0 -7
- {classiq-0.36.1.dist-info → classiq-0.37.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,95 @@
|
|
1
|
+
from typing import TYPE_CHECKING, Optional
|
2
|
+
|
3
|
+
import pydantic
|
4
|
+
from sympy import Equality
|
5
|
+
from sympy.core.numbers import Integer
|
6
|
+
|
7
|
+
from classiq.interface.generator.expressions.expression import Expression
|
8
|
+
from classiq.interface.generator.expressions.qmod_qnum_proxy import QmodQNumProxy
|
9
|
+
from classiq.interface.model.quantum_expressions.control_state import (
|
10
|
+
min_bit_length,
|
11
|
+
to_twos_complement,
|
12
|
+
)
|
13
|
+
from classiq.interface.model.quantum_expressions.quantum_expression import (
|
14
|
+
QuantumExpressionOperation,
|
15
|
+
)
|
16
|
+
|
17
|
+
from classiq.exceptions import ClassiqValueError
|
18
|
+
|
19
|
+
if TYPE_CHECKING:
|
20
|
+
from classiq.interface.model.quantum_function_call import QuantumOperand
|
21
|
+
|
22
|
+
|
23
|
+
QUANTUM_IF_INOUT_NAME = "ctrl"
|
24
|
+
QUANTUM_IF_CONDITION_ARG_ERROR_MESSAGE_FORMAT = (
|
25
|
+
"quantum_if condition must be of the form '<quantum-variable> == "
|
26
|
+
"<classical-integer-expression>', but condition's {}-hand side was {!r}"
|
27
|
+
)
|
28
|
+
|
29
|
+
|
30
|
+
class QuantumIfOperation(QuantumExpressionOperation):
|
31
|
+
then: "QuantumOperand"
|
32
|
+
_ctrl: Optional[QmodQNumProxy] = pydantic.PrivateAttr(
|
33
|
+
default=None,
|
34
|
+
)
|
35
|
+
_ctrl_val: Optional[int] = pydantic.PrivateAttr(
|
36
|
+
default=None,
|
37
|
+
)
|
38
|
+
|
39
|
+
@property
|
40
|
+
def condition(self) -> Expression:
|
41
|
+
return self.expression
|
42
|
+
|
43
|
+
@property
|
44
|
+
def ctrl(self) -> QmodQNumProxy:
|
45
|
+
assert self._ctrl is not None
|
46
|
+
return self._ctrl
|
47
|
+
|
48
|
+
@property
|
49
|
+
def ctrl_val(self) -> int:
|
50
|
+
assert self._ctrl_val is not None
|
51
|
+
return self._ctrl_val
|
52
|
+
|
53
|
+
def resolve_condition(self) -> None:
|
54
|
+
condition = self.condition.value.value
|
55
|
+
if not isinstance(condition, Equality):
|
56
|
+
raise ClassiqValueError(
|
57
|
+
f"quantum_if condition must be an equality, was {str(condition)!r}"
|
58
|
+
)
|
59
|
+
ctrl, ctrl_val = condition.args
|
60
|
+
if isinstance(ctrl, Integer) and isinstance(ctrl_val, QmodQNumProxy):
|
61
|
+
ctrl, ctrl_val = ctrl_val, ctrl
|
62
|
+
if not isinstance(ctrl, QmodQNumProxy):
|
63
|
+
raise ClassiqValueError(
|
64
|
+
QUANTUM_IF_CONDITION_ARG_ERROR_MESSAGE_FORMAT.format("left", str(ctrl))
|
65
|
+
)
|
66
|
+
if not isinstance(ctrl_val, Integer):
|
67
|
+
raise ClassiqValueError(
|
68
|
+
QUANTUM_IF_CONDITION_ARG_ERROR_MESSAGE_FORMAT.format(
|
69
|
+
"right", str(ctrl_val)
|
70
|
+
)
|
71
|
+
)
|
72
|
+
self._ctrl, self._ctrl_val = ctrl, int(ctrl_val)
|
73
|
+
|
74
|
+
@property
|
75
|
+
def ctrl_state(self) -> str:
|
76
|
+
is_signed = self.ctrl.is_signed
|
77
|
+
fraction_places = self.ctrl.fraction_digits
|
78
|
+
ctrl_size = len(self.ctrl)
|
79
|
+
if not is_signed and self.ctrl_val < 0:
|
80
|
+
raise ClassiqValueError(
|
81
|
+
f"Variable {str(self.ctrl)!r} is not signed but control value "
|
82
|
+
f"{self.ctrl_val} is negative"
|
83
|
+
)
|
84
|
+
required_qubits = min_bit_length(self.ctrl_val, is_signed)
|
85
|
+
if ctrl_size < required_qubits:
|
86
|
+
raise ClassiqValueError(
|
87
|
+
f"Variable {str(self.ctrl)!r} has {ctrl_size} qubits but control value "
|
88
|
+
f"{str(self.ctrl_val)!r} requires at least {required_qubits} qubits"
|
89
|
+
)
|
90
|
+
if fraction_places != 0:
|
91
|
+
raise ClassiqValueError(
|
92
|
+
f"quantum-if on a non-integer quantum variable {str(self.ctrl)!r} is "
|
93
|
+
f"not supported at the moment"
|
94
|
+
)
|
95
|
+
return to_twos_complement(self.ctrl_val, ctrl_size, is_signed)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import Dict,
|
1
|
+
from typing import Dict, Mapping, Set, Union
|
2
2
|
|
3
3
|
from classiq.interface.generator.function_params import PortDirection
|
4
4
|
from classiq.interface.generator.functions.core_lib_declarations.quantum_operators import (
|
@@ -10,7 +10,6 @@ from classiq.interface.model.handle_binding import (
|
|
10
10
|
SlicedHandleBinding,
|
11
11
|
SubscriptHandleBinding,
|
12
12
|
)
|
13
|
-
from classiq.interface.model.local_variable_declaration import LocalVariableDeclaration
|
14
13
|
from classiq.interface.model.port_declaration import PortDeclaration
|
15
14
|
from classiq.interface.model.quantum_function_call import (
|
16
15
|
QuantumFunctionCall,
|
@@ -30,20 +29,16 @@ from classiq.exceptions import ClassiqValueError
|
|
30
29
|
|
31
30
|
def _initialize_handles_to_state(
|
32
31
|
port_declarations: Mapping[str, PortDeclaration],
|
33
|
-
local_handles: Iterable[LocalVariableDeclaration],
|
34
32
|
) -> Dict[str, ValidationHandle]:
|
35
33
|
handles_to_state: Dict[str, ValidationHandle] = dict()
|
36
34
|
|
37
35
|
for port_decl in port_declarations.values():
|
38
36
|
handles_to_state[port_decl.name] = ValidationHandle(
|
39
|
-
initial_state=
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
for local_handle in local_handles:
|
45
|
-
handles_to_state[local_handle.name] = ValidationHandle(
|
46
|
-
initial_state=HandleState.UNINITIALIZED
|
37
|
+
initial_state=(
|
38
|
+
HandleState.INITIALIZED
|
39
|
+
if port_decl.direction.includes_port_direction(PortDirection.Input)
|
40
|
+
else HandleState.UNINITIALIZED
|
41
|
+
)
|
47
42
|
)
|
48
43
|
|
49
44
|
return handles_to_state
|
@@ -53,13 +48,10 @@ class HandleValidator(HandleValidationBase):
|
|
53
48
|
def __init__(
|
54
49
|
self,
|
55
50
|
port_declarations: Mapping[str, PortDeclaration],
|
56
|
-
local_handles: Iterable[LocalVariableDeclaration],
|
57
51
|
) -> None:
|
58
52
|
super().__init__(port_declarations)
|
59
53
|
self._port_declarations = port_declarations.values()
|
60
|
-
self._handles_to_state = _initialize_handles_to_state(
|
61
|
-
port_declarations, local_handles
|
62
|
-
)
|
54
|
+
self._handles_to_state = _initialize_handles_to_state(port_declarations)
|
63
55
|
|
64
56
|
@property
|
65
57
|
def _validation_handles_state(self) -> Mapping[str, ValidationHandle]:
|
@@ -4,9 +4,8 @@ LEGACY_EXECUTE_PREFIX = "/execute"
|
|
4
4
|
EXECUTION_PREFIX = "/execution"
|
5
5
|
CONVERSION_PREFIX = "/conversion"
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
EXECUTION_SERVICE_PREFIX = "/execution/v1"
|
7
|
+
EXECUTION_NON_VERSIONED_PREFIX = "/execution/v1"
|
8
|
+
SYNTHESIS_NON_VERSIONED_PREFIX = "/synthesis/v1"
|
10
9
|
|
11
10
|
ANALYZER_CIRCUIT_PAGE = "circuit"
|
12
11
|
DEFAULT_IDE_FE_APP = "https://platform.classiq.io/"
|
@@ -51,10 +50,11 @@ TASK_PREDICT_SUFFIX = TASKS_SUFFIX + "/predict"
|
|
51
50
|
TASK_RB_SUFFIX = TASKS_SUFFIX + RB
|
52
51
|
TASKS_GENERATE_FULL_PATH = TASKS_GENERATE_SUFFIX
|
53
52
|
|
54
|
-
|
55
53
|
EXECUTION_JOBS_SUFFIX = "/jobs"
|
56
54
|
EXECUTION_JOBS_FULL_PATH = EXECUTION_PREFIX + EXECUTION_JOBS_SUFFIX
|
57
|
-
|
55
|
+
EXECUTION_JOBS_NON_VERSIONED_FULL_PATH = (
|
56
|
+
EXECUTION_NON_VERSIONED_PREFIX + EXECUTION_JOBS_SUFFIX
|
57
|
+
)
|
58
58
|
EXECUTE_QUANTUM_PROGRAM_FULL_PATH = LEGACY_EXECUTE_PREFIX + QUANTUM_PROGRAM_SUFFIX
|
59
59
|
EXECUTE_ESTIMATE_FULL_PATH = LEGACY_EXECUTE_PREFIX + ESTIMATE_SUFFIX
|
60
60
|
|
@@ -62,8 +62,12 @@ ANALYZER_FULL_PATH = ANALYZER_PREFIX + TASKS_SUFFIX
|
|
62
62
|
ANALYZER_RB_FULL_PATH = ANALYZER_PREFIX + TASK_RB_SUFFIX
|
63
63
|
GENERATE_RESOURCE_ESTIMATOR_REPORT = "/resource_estimator_report"
|
64
64
|
|
65
|
+
TASKS_SOLVE_EXACT_SUFFIX = "/tasks/solve_exact"
|
66
|
+
|
65
67
|
GENERATE_HAMILTONIAN_SUFFIX = "/generate_hamiltonian"
|
66
|
-
GENERATE_HAMILTONIAN_FULL_PATH =
|
68
|
+
GENERATE_HAMILTONIAN_FULL_PATH = (
|
69
|
+
SYNTHESIS_NON_VERSIONED_PREFIX + GENERATE_HAMILTONIAN_SUFFIX
|
70
|
+
)
|
67
71
|
|
68
72
|
FINANCE_GENERATE_MODEL_PATH = MODEL_GENERATE_PREFIX + "/finance"
|
69
73
|
|
@@ -45,108 +45,108 @@ class FunctionHandler(abc.ABC, metaclass=abc.ABCMeta):
|
|
45
45
|
def include_library(self, library: FunctionLibrary) -> None: ...
|
46
46
|
@abc.abstractmethod
|
47
47
|
def create_library(self) -> None: ...
|
48
|
-
def
|
49
|
-
def
|
50
|
-
def
|
51
|
-
def
|
52
|
-
def BellStatePreparation(self, params: BellStatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
53
|
-
def UGate(self, params: UGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
54
|
-
def CYGate(self, params: CYGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
55
|
-
def CZGate(self, params: CZGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
56
|
-
def Equal(self, params: Equal, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
57
|
-
def Multiplier(self, params: Multiplier, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
58
|
-
def Modulo(self, params: Modulo, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
59
|
-
def Arithmetic(self, params: Arithmetic, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
60
|
-
def RShift(self, params: RShift, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
61
|
-
def CustomOracle(self, params: CustomOracle, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
62
|
-
def QFT(self, params: QFT, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
63
|
-
def BitwiseOr(self, params: BitwiseOr, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
64
|
-
def LinearGCI(self, params: LinearGCI, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
65
|
-
def GroverDiffuser(self, params: GroverDiffuser, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
48
|
+
def Mcx(self, params: Mcx, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
49
|
+
def CHGate(self, params: CHGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
50
|
+
def Negation(self, params: Negation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
51
|
+
def BitwiseInvert(self, params: BitwiseInvert, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
66
52
|
def RXGate(self, params: RXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
67
|
-
def
|
68
|
-
def GHZStatePreparation(self, params: GHZStatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
69
|
-
def RandomizedBenchmarking(self, params: RandomizedBenchmarking, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
70
|
-
def UnitaryGate(self, params: UnitaryGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
71
|
-
def UniformDistributionStatePreparation(self, params: UniformDistributionStatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
72
|
-
def PiecewiseLinearRotationAmplitudeLoading(self, params: PiecewiseLinearRotationAmplitudeLoading, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
53
|
+
def LessEqual(self, params: LessEqual, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
73
54
|
def HVA(self, params: HVA, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
74
|
-
def
|
55
|
+
def LogicalOr(self, params: LogicalOr, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
75
56
|
def Mcu(self, params: Mcu, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
76
|
-
def
|
77
|
-
def
|
78
|
-
def
|
79
|
-
def
|
80
|
-
def
|
81
|
-
def WeightedAdder(self, params: WeightedAdder, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
82
|
-
def NotEqual(self, params: NotEqual, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
57
|
+
def CustomFunction(self, params: CustomFunction, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
58
|
+
def Multiplier(self, params: Multiplier, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
59
|
+
def RZZGate(self, params: RZZGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
60
|
+
def ExponentialStatePreparation(self, params: ExponentialStatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
61
|
+
def QSVMFeatureMap(self, params: QSVMFeatureMap, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
83
62
|
def YGate(self, params: YGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
84
|
-
def
|
63
|
+
def FinanceModels(self, params: FinanceModels, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
85
64
|
def ZGate(self, params: ZGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
86
65
|
def HGate(self, params: HGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
66
|
+
def QFT(self, params: QFT, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
87
67
|
def IGate(self, params: IGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
88
68
|
def SGate(self, params: SGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
89
|
-
def
|
90
|
-
def
|
91
|
-
def
|
92
|
-
def HardwareEfficientAnsatz(self, params: HardwareEfficientAnsatz, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
93
|
-
def FinancePayoff(self, params: FinancePayoff, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
69
|
+
def StatePropagator(self, params: StatePropagator, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
70
|
+
def LShift(self, params: LShift, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
71
|
+
def PhaseEstimation(self, params: PhaseEstimation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
94
72
|
def SXGate(self, params: SXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
73
|
+
def HardwareEfficientAnsatz(self, params: HardwareEfficientAnsatz, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
74
|
+
def SdgGate(self, params: SdgGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
75
|
+
def SXdgGate(self, params: SXdgGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
76
|
+
def TGate(self, params: TGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
77
|
+
def LinearPauliRotations(self, params: LinearPauliRotations, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
78
|
+
def TwoDimensionalEntangler(self, params: TwoDimensionalEntangler, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
79
|
+
def TdgGate(self, params: TdgGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
95
80
|
def RYYGate(self, params: RYYGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
96
|
-
def
|
81
|
+
def PiecewiseLinearRotationAmplitudeLoading(self, params: PiecewiseLinearRotationAmplitudeLoading, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
97
82
|
def CCXGate(self, params: CCXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
98
|
-
def CRYGate(self, params: CRYGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
99
|
-
def StatePreparation(self, params: StatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
100
|
-
def BitwiseAnd(self, params: BitwiseAnd, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
101
|
-
def ArithmeticOracle(self, params: ArithmeticOracle, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
102
|
-
def GridEntangler(self, params: GridEntangler, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
103
|
-
def PhaseGate(self, params: PhaseGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
104
|
-
def CRXGate(self, params: CRXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
105
|
-
def LessEqual(self, params: LessEqual, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
106
|
-
def RZZGate(self, params: RZZGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
107
|
-
def LShift(self, params: LShift, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
108
|
-
def BitwiseInvert(self, params: BitwiseInvert, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
109
83
|
def QDrift(self, params: QDrift, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
110
|
-
def
|
111
|
-
def Max(self, params: Max, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
112
|
-
def Min(self, params: Min, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
84
|
+
def AmplitudeLoading(self, params: AmplitudeLoading, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
113
85
|
def C4XGate(self, params: C4XGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
86
|
+
def Modulo(self, params: Modulo, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
87
|
+
def LogicalAnd(self, params: LogicalAnd, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
88
|
+
def CommutingPauliExponentiation(self, params: CommutingPauliExponentiation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
89
|
+
def GroverDiffuser(self, params: GroverDiffuser, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
90
|
+
def Arithmetic(self, params: Arithmetic, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
91
|
+
def GreaterEqual(self, params: GreaterEqual, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
92
|
+
def BitwiseAnd(self, params: BitwiseAnd, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
93
|
+
def PhaseGate(self, params: PhaseGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
94
|
+
def SwapGate(self, params: SwapGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
95
|
+
def UCC(self, params: UCC, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
96
|
+
def BitwiseOr(self, params: BitwiseOr, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
97
|
+
def CRYGate(self, params: CRYGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
98
|
+
def iSwapGate(self, params: iSwapGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
114
99
|
def GreaterThan(self, params: GreaterThan, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
115
|
-
def
|
116
|
-
def
|
117
|
-
def
|
118
|
-
def
|
119
|
-
def
|
120
|
-
def RGate(self, params: RGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
121
|
-
def LinearPauliRotations(self, params: LinearPauliRotations, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
122
|
-
def SuzukiTrotter(self, params: SuzukiTrotter, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
100
|
+
def Power(self, params: Power, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
101
|
+
def CRXGate(self, params: CRXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
102
|
+
def Adder(self, params: Adder, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
103
|
+
def NotEqual(self, params: NotEqual, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
104
|
+
def Exponentiation(self, params: Exponentiation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
123
105
|
def HartreeFock(self, params: HartreeFock, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
106
|
+
def PiecewiseLinearAmplitudeLoading(self, params: PiecewiseLinearAmplitudeLoading, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
107
|
+
def CSXGate(self, params: CSXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
108
|
+
def UniformDistributionStatePreparation(self, params: UniformDistributionStatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
109
|
+
def RGate(self, params: RGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
110
|
+
def Min(self, params: Min, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
124
111
|
def RXXGate(self, params: RXXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
125
|
-
def
|
126
|
-
def
|
127
|
-
def
|
128
|
-
def
|
129
|
-
def
|
130
|
-
def
|
131
|
-
def
|
132
|
-
def TdgGate(self, params: TdgGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
133
|
-
def StatePropagator(self, params: StatePropagator, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
134
|
-
def SwapGate(self, params: SwapGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
112
|
+
def CyclicShift(self, params: CyclicShift, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
113
|
+
def CustomOracle(self, params: CustomOracle, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
114
|
+
def Max(self, params: Max, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
115
|
+
def WStatePreparation(self, params: WStatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
116
|
+
def RandomizedBenchmarking(self, params: RandomizedBenchmarking, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
117
|
+
def LessThan(self, params: LessThan, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
118
|
+
def RangeMixer(self, params: RangeMixer, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
135
119
|
def CPhaseGate(self, params: CPhaseGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
136
|
-
def
|
137
|
-
def
|
138
|
-
def
|
139
|
-
def
|
140
|
-
def
|
141
|
-
def LogicalAnd(self, params: LogicalAnd, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
142
|
-
def RYGate(self, params: RYGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
143
|
-
def PiecewiseLinearAmplitudeLoading(self, params: PiecewiseLinearAmplitudeLoading, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
120
|
+
def CRZGate(self, params: CRZGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
121
|
+
def InequalityMixer(self, params: InequalityMixer, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
122
|
+
def UnitaryGate(self, params: UnitaryGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
123
|
+
def WeightedAdder(self, params: WeightedAdder, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
124
|
+
def GHZStatePreparation(self, params: GHZStatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
144
125
|
def CXGate(self, params: CXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
145
|
-
def CommutingPauliExponentiation(self, params: CommutingPauliExponentiation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
146
|
-
def BitwiseXor(self, params: BitwiseXor, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
147
|
-
def MCPhaseGate(self, params: MCPhaseGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
148
|
-
def Power(self, params: Power, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
149
|
-
def UCC(self, params: UCC, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
150
126
|
def Identity(self, params: Identity, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
127
|
+
def FinancePayoff(self, params: FinancePayoff, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
128
|
+
def RZGate(self, params: RZGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
129
|
+
def HadamardTransform(self, params: HadamardTransform, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
130
|
+
def Subtractor(self, params: Subtractor, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
131
|
+
def Equal(self, params: Equal, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
132
|
+
def Sign(self, params: Sign, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
133
|
+
def CYGate(self, params: CYGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
134
|
+
def CZGate(self, params: CZGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
151
135
|
def XGate(self, params: XGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
152
|
-
def
|
136
|
+
def StatePreparation(self, params: StatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
137
|
+
def LinearGCI(self, params: LinearGCI, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
138
|
+
def C3XGate(self, params: C3XGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
139
|
+
def MCPhaseGate(self, params: MCPhaseGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
140
|
+
def UGate(self, params: UGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
141
|
+
def SuzukiTrotter(self, params: SuzukiTrotter, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
142
|
+
def BellStatePreparation(self, params: BellStatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
143
|
+
def BitwiseXor(self, params: BitwiseXor, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
144
|
+
def RYGate(self, params: RYGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
145
|
+
def Finance(self, params: Finance, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
146
|
+
def RShift(self, params: RShift, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
147
|
+
def ComputationalBasisStatePreparation(self, params: ComputationalBasisStatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
148
|
+
def GroverOperator(self, params: GroverOperator, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
149
|
+
def AmplitudeEstimation(self, params: AmplitudeEstimation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
150
|
+
def ArithmeticOracle(self, params: ArithmeticOracle, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
151
|
+
def HypercubeEntangler(self, params: HypercubeEntangler, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
152
|
+
def GridEntangler(self, params: GridEntangler, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
classiq/model/model.py
CHANGED
classiq/qmod/__init__.py
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
from . import symbolic
|
2
2
|
from .builtins import * # noqa: F403
|
3
3
|
from .builtins import __all__ as _builtins_all
|
4
|
+
from .classical_function import CFunc
|
4
5
|
from .qmod_parameter import Array, QParam
|
5
6
|
from .qmod_struct import QStruct
|
6
7
|
from .qmod_variable import Input, Output, QArray, QBit, QNum
|
7
|
-
from .quantum_callable import QCallable
|
8
|
+
from .quantum_callable import QCallable, QCallableList
|
8
9
|
from .quantum_function import QFunc, create_model
|
9
10
|
|
10
11
|
__all__ = [
|
@@ -16,8 +17,10 @@ __all__ = [
|
|
16
17
|
"QBit",
|
17
18
|
"QNum",
|
18
19
|
"QCallable",
|
20
|
+
"QCallableList",
|
19
21
|
"QStruct",
|
20
22
|
"QFunc",
|
23
|
+
"CFunc",
|
21
24
|
"create_model",
|
22
25
|
"symbolic",
|
23
26
|
] + _builtins_all
|
@@ -1,3 +1,9 @@
|
|
1
|
+
from .classical_execution_primitives import * # noqa: F403
|
2
|
+
from .classical_execution_primitives import (
|
3
|
+
__all__ as _builtin_classical_execution_primitives,
|
4
|
+
)
|
5
|
+
from .classical_functions import * # noqa: F403
|
6
|
+
from .classical_functions import __all__ as _builtin_classical_functions
|
1
7
|
from .functions import * # noqa: F403
|
2
8
|
from .functions import __all__ as _builtin_functions
|
3
9
|
from .operations import * # noqa: F403
|
@@ -5,4 +11,10 @@ from .operations import __all__ as _builtin_operations
|
|
5
11
|
from .structs import * # noqa: F403
|
6
12
|
from .structs import __all__ as _builtin_structs
|
7
13
|
|
8
|
-
__all__ =
|
14
|
+
__all__ = (
|
15
|
+
_builtin_structs
|
16
|
+
+ _builtin_functions
|
17
|
+
+ _builtin_operations
|
18
|
+
+ _builtin_classical_execution_primitives
|
19
|
+
+ _builtin_classical_functions
|
20
|
+
)
|
@@ -0,0 +1,109 @@
|
|
1
|
+
from typing import Dict, List, Optional
|
2
|
+
|
3
|
+
from classiq.interface.executor.execution_preferences import QaeWithQpeEstimationMethod
|
4
|
+
from classiq.interface.executor.iqae_result import IQAEResult
|
5
|
+
from classiq.interface.executor.result import EstimationResult, ExecutionDetails
|
6
|
+
from classiq.interface.executor.vqe_result import VQESolverResult
|
7
|
+
from classiq.interface.generator.expressions.enums import Optimizer
|
8
|
+
from classiq.interface.generator.functions.qmod_python_interface import QmodPyStruct
|
9
|
+
from classiq.interface.generator.types.combinatorial_problem import (
|
10
|
+
CombinatorialOptimizationStructDeclaration,
|
11
|
+
)
|
12
|
+
|
13
|
+
from classiq.applications.qsvm.qsvm import Data, Labels
|
14
|
+
|
15
|
+
ExecutionParams = Dict[str, float]
|
16
|
+
|
17
|
+
|
18
|
+
def save(values_to_save: dict) -> None:
|
19
|
+
pass
|
20
|
+
|
21
|
+
|
22
|
+
def sample( # type: ignore
|
23
|
+
execution_params: Optional[ExecutionParams] = None,
|
24
|
+
) -> ExecutionDetails:
|
25
|
+
pass
|
26
|
+
|
27
|
+
|
28
|
+
def estimate( # type: ignore
|
29
|
+
hamiltonian: List[QmodPyStruct], execution_params: Optional[ExecutionParams] = None
|
30
|
+
) -> EstimationResult:
|
31
|
+
pass
|
32
|
+
|
33
|
+
|
34
|
+
def vqe( # type: ignore
|
35
|
+
hamiltonian: List[QmodPyStruct],
|
36
|
+
maximize: bool,
|
37
|
+
initial_point: List[int],
|
38
|
+
optimizer: Optimizer,
|
39
|
+
max_iteration: int,
|
40
|
+
tolerance: float,
|
41
|
+
step_size: float,
|
42
|
+
skip_compute_variance: bool,
|
43
|
+
alpha_cvar: float,
|
44
|
+
) -> VQESolverResult:
|
45
|
+
pass
|
46
|
+
|
47
|
+
|
48
|
+
def qae_with_qpe_result_post_processing( # type: ignore
|
49
|
+
estimation_register_size: int,
|
50
|
+
estimation_method: QaeWithQpeEstimationMethod,
|
51
|
+
result: ExecutionDetails,
|
52
|
+
) -> float:
|
53
|
+
pass
|
54
|
+
|
55
|
+
|
56
|
+
def qsvm_full_run( # type: ignore
|
57
|
+
train_data: Data,
|
58
|
+
train_labels: Labels,
|
59
|
+
test_data: Data,
|
60
|
+
test_labels: Labels,
|
61
|
+
predict_data: Data,
|
62
|
+
) -> QmodPyStruct:
|
63
|
+
pass
|
64
|
+
|
65
|
+
|
66
|
+
def iqae( # type: ignore
|
67
|
+
epsilon: float,
|
68
|
+
alpha: float,
|
69
|
+
execution_params: Optional[ExecutionParams] = None,
|
70
|
+
) -> IQAEResult:
|
71
|
+
pass
|
72
|
+
|
73
|
+
|
74
|
+
def molecule_ground_state_solution_post_process( # type: ignore
|
75
|
+
problem: QmodPyStruct, vqe_result: VQESolverResult
|
76
|
+
) -> QmodPyStruct:
|
77
|
+
pass
|
78
|
+
|
79
|
+
|
80
|
+
def optimization_problem_to_hamiltonian( # type: ignore
|
81
|
+
problem_struct: CombinatorialOptimizationStructDeclaration, penalty_energy: float
|
82
|
+
) -> List[QmodPyStruct]:
|
83
|
+
pass
|
84
|
+
|
85
|
+
|
86
|
+
def get_optimization_solution( # type: ignore
|
87
|
+
problem_struct: CombinatorialOptimizationStructDeclaration,
|
88
|
+
vqe_result: VQESolverResult,
|
89
|
+
penalty_energy: float,
|
90
|
+
) -> List[QmodPyStruct]:
|
91
|
+
pass
|
92
|
+
|
93
|
+
|
94
|
+
__all__ = [
|
95
|
+
"save",
|
96
|
+
"sample",
|
97
|
+
"estimate",
|
98
|
+
"vqe",
|
99
|
+
"qae_with_qpe_result_post_processing",
|
100
|
+
"qsvm_full_run",
|
101
|
+
"iqae",
|
102
|
+
"molecule_ground_state_solution_post_process",
|
103
|
+
"optimization_problem_to_hamiltonian",
|
104
|
+
"get_optimization_solution",
|
105
|
+
]
|
106
|
+
|
107
|
+
|
108
|
+
def __dir__() -> List[str]:
|
109
|
+
return __all__
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# This file was generated automatically - do not edit manually
|
2
|
+
|
3
|
+
from typing import List
|
4
|
+
|
5
|
+
from classiq.qmod.qmod_parameter import QParam
|
6
|
+
from classiq.qmod.symbolic import symbolic_function
|
7
|
+
|
8
|
+
from .structs import *
|
9
|
+
|
10
|
+
|
11
|
+
def compute_qaoa_initial_point(
|
12
|
+
hamiltonian: QParam[List[PauliTerm]],
|
13
|
+
repetitions: QParam[int],
|
14
|
+
) -> QParam[List[float]]:
|
15
|
+
return symbolic_function(hamiltonian, repetitions)
|
16
|
+
|
17
|
+
|
18
|
+
def molecule_problem_to_hamiltonian(
|
19
|
+
problem: QParam[MoleculeProblem],
|
20
|
+
) -> QParam[List[PauliTerm]]:
|
21
|
+
return symbolic_function(problem)
|
22
|
+
|
23
|
+
|
24
|
+
def fock_hamiltonian_problem_to_hamiltonian(
|
25
|
+
problem: QParam[FockHamiltonianProblem],
|
26
|
+
) -> QParam[List[PauliTerm]]:
|
27
|
+
return symbolic_function(problem)
|
28
|
+
|
29
|
+
|
30
|
+
def grid_entangler_graph(
|
31
|
+
num_qubits: QParam[int],
|
32
|
+
schmidt_rank: QParam[int],
|
33
|
+
grid_randomization: QParam[bool],
|
34
|
+
) -> QParam[List[List[int]]]:
|
35
|
+
return symbolic_function(num_qubits, schmidt_rank, grid_randomization)
|
36
|
+
|
37
|
+
|
38
|
+
def hypercube_entangler_graph(
|
39
|
+
num_qubits: QParam[int],
|
40
|
+
) -> QParam[List[List[int]]]:
|
41
|
+
return symbolic_function(num_qubits)
|
42
|
+
|
43
|
+
|
44
|
+
def log_normal_finance_post_process(
|
45
|
+
finance_model: QParam[LogNormalModel],
|
46
|
+
estimation_method: QParam[FinanceFunction],
|
47
|
+
probability: QParam[float],
|
48
|
+
) -> QParam[float]:
|
49
|
+
return symbolic_function(finance_model, estimation_method, probability)
|
50
|
+
|
51
|
+
|
52
|
+
def gaussian_finance_post_process(
|
53
|
+
finance_model: QParam[GaussianModel],
|
54
|
+
estimation_method: QParam[FinanceFunction],
|
55
|
+
probability: QParam[float],
|
56
|
+
) -> QParam[float]:
|
57
|
+
return symbolic_function(finance_model, estimation_method, probability)
|
58
|
+
|
59
|
+
|
60
|
+
__all__ = [
|
61
|
+
"compute_qaoa_initial_point",
|
62
|
+
"molecule_problem_to_hamiltonian",
|
63
|
+
"fock_hamiltonian_problem_to_hamiltonian",
|
64
|
+
"grid_entangler_graph",
|
65
|
+
"hypercube_entangler_graph",
|
66
|
+
"log_normal_finance_post_process",
|
67
|
+
"gaussian_finance_post_process",
|
68
|
+
]
|