classiq 0.34.0__py3-none-any.whl → 0.35.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/_internals/api_wrapper.py +52 -3
- classiq/_internals/client.py +4 -1
- classiq/applications_model_constructors/grover_model_constructor.py +1 -1
- classiq/execution/__init__.py +9 -2
- classiq/execution/jobs.py +84 -11
- classiq/interface/_version.py +1 -1
- classiq/interface/backend/quantum_backend_providers.py +2 -0
- classiq/interface/execution/__init__.py +0 -0
- classiq/interface/execution/jobs.py +28 -0
- classiq/interface/generator/arith/arithmetic_expression_validator.py +1 -0
- classiq/interface/generator/arith/arithmetic_param_getters.py +12 -0
- classiq/interface/generator/arith/binary_ops.py +34 -0
- classiq/interface/generator/expressions/expression.py +3 -0
- classiq/interface/generator/expressions/qmod_sized_proxy.py +12 -2
- classiq/interface/generator/function_param_list_without_self_reference.py +2 -0
- classiq/interface/generator/function_params.py +4 -0
- classiq/interface/generator/functions/core_lib_declarations/quantum_functions/std_lib_functions.py +27 -0
- classiq/interface/generator/model/preferences/preferences.py +2 -0
- classiq/interface/hardware.py +1 -0
- classiq/interface/model/bind_operation.py +10 -0
- classiq/interface/model/handle_binding.py +18 -0
- classiq/interface/model/model.py +12 -3
- classiq/interface/model/quantum_expressions/amplitude_loading_operation.py +2 -1
- classiq/interface/model/quantum_expressions/arithmetic_operation.py +3 -1
- classiq/interface/model/quantum_expressions/quantum_expression.py +9 -6
- classiq/interface/server/routes.py +3 -0
- classiq/model/function_handler.pyi +85 -84
- classiq/qmod/__init__.py +2 -2
- classiq/qmod/builtins/__init__.py +8 -0
- classiq/qmod/{qmod_builtins.py → builtins/functions.py} +30 -136
- classiq/qmod/builtins/operations.py +19 -0
- classiq/qmod/builtins/structs.py +128 -0
- classiq/qmod/qmod_variable.py +4 -4
- classiq/qmod/quantum_callable.py +2 -2
- classiq/qmod/quantum_expandable.py +1 -1
- {classiq-0.34.0.dist-info → classiq-0.35.0.dist-info}/METADATA +1 -1
- {classiq-0.34.0.dist-info → classiq-0.35.0.dist-info}/RECORD +38 -33
- {classiq-0.34.0.dist-info → classiq-0.35.0.dist-info}/WHEEL +0 -0
@@ -4,6 +4,7 @@ from typing import Dict, List, Mapping, Optional, Set, Union
|
|
4
4
|
|
5
5
|
import pydantic
|
6
6
|
|
7
|
+
from classiq.interface.generator.expressions.expression import Expression
|
7
8
|
from classiq.interface.generator.expressions.sympy_supported_expressions import (
|
8
9
|
SYMPY_SUPPORTED_EXPRESSIONS,
|
9
10
|
)
|
@@ -30,12 +31,13 @@ class VarRefCollector(ast.NodeVisitor):
|
|
30
31
|
|
31
32
|
|
32
33
|
class QuantumExpressionOperation(QuantumOperation):
|
33
|
-
|
34
|
-
description="The expression in terms of quantum variables"
|
35
|
-
)
|
34
|
+
expression: Expression = pydantic.Field()
|
36
35
|
result_var: HandleBinding = pydantic.Field(
|
37
36
|
description="The variable storing the expression result"
|
38
37
|
)
|
38
|
+
_var_handles: List[HandleBinding] = pydantic.PrivateAttr(
|
39
|
+
default_factory=list,
|
40
|
+
)
|
39
41
|
_var_types: Dict[str, QuantumType] = pydantic.PrivateAttr(
|
40
42
|
default_factory=dict,
|
41
43
|
)
|
@@ -45,9 +47,10 @@ class QuantumExpressionOperation(QuantumOperation):
|
|
45
47
|
|
46
48
|
@property
|
47
49
|
def var_handles(self) -> List[HandleBinding]:
|
48
|
-
|
49
|
-
|
50
|
-
|
50
|
+
return self._var_handles
|
51
|
+
|
52
|
+
def set_var_handles(self, var_handles: List[HandleBinding]) -> None:
|
53
|
+
self._var_handles = var_handles
|
51
54
|
|
52
55
|
@property
|
53
56
|
def var_types(self) -> Dict[str, QuantumType]:
|
@@ -5,6 +5,8 @@ EXECUTION_PREFIX = "/execution"
|
|
5
5
|
|
6
6
|
SYNTHESIS_SERVICE_PREFIX = "/synthesis/v1"
|
7
7
|
|
8
|
+
EXECUTION_SERVICE_PREFIX = "/execution/v1"
|
9
|
+
|
8
10
|
ANALYZER_CIRCUIT_PAGE = "circuit"
|
9
11
|
DEFAULT_IDE_FE_APP = "https://platform.classiq.io/"
|
10
12
|
|
@@ -53,6 +55,7 @@ TASKS_UCC_OPERATORS_SUFFIX = "/tasks/ucc_operators"
|
|
53
55
|
|
54
56
|
EXECUTION_JOBS_SUFFIX = "/jobs"
|
55
57
|
EXECUTION_JOBS_FULL_PATH = EXECUTION_PREFIX + EXECUTION_JOBS_SUFFIX
|
58
|
+
EXECUTION_SERVICE_JOBS_FULL_PATH = EXECUTION_SERVICE_PREFIX + EXECUTION_JOBS_SUFFIX
|
56
59
|
EXECUTE_QUANTUM_PROGRAM_FULL_PATH = LEGACY_EXECUTE_PREFIX + QUANTUM_PROGRAM_SUFFIX
|
57
60
|
EXECUTE_ESTIMATE_FULL_PATH = LEGACY_EXECUTE_PREFIX + ESTIMATE_SUFFIX
|
58
61
|
|
@@ -47,107 +47,108 @@ class FunctionHandler(abc.ABC, metaclass=abc.ABCMeta):
|
|
47
47
|
def include_library(self, library: FunctionLibrary) -> None: ...
|
48
48
|
@abc.abstractmethod
|
49
49
|
def create_library(self) -> None: ...
|
50
|
-
def
|
51
|
-
def RShift(self, params: RShift, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
52
|
-
def RGate(self, params: RGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
53
|
-
def LogicalAnd(self, params: LogicalAnd, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
54
|
-
def HardwareEfficientAnsatz(self, params: HardwareEfficientAnsatz, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
55
|
-
def NotEqual(self, params: NotEqual, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
56
|
-
def LinearGCI(self, params: LinearGCI, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
57
|
-
def GreaterThan(self, params: GreaterThan, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
58
|
-
def GreaterEqual(self, params: GreaterEqual, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
59
|
-
def LessThan(self, params: LessThan, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
60
|
-
def LessEqual(self, params: LessEqual, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
61
|
-
def CRZGate(self, params: CRZGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
62
|
-
def CPhaseGate(self, params: CPhaseGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
63
|
-
def ExponentialStatePreparation(self, params: ExponentialStatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
64
|
-
def HVA(self, params: HVA, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
65
|
-
def RZGate(self, params: RZGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
66
|
-
def FinancePayoff(self, params: FinancePayoff, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
67
|
-
def Exponentiation(self, params: Exponentiation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
68
|
-
def UnitaryGate(self, params: UnitaryGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
69
|
-
def QSVMFeatureMap(self, params: QSVMFeatureMap, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
50
|
+
def BellStatePreparation(self, params: BellStatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
70
51
|
def CyclicShift(self, params: CyclicShift, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
71
|
-
def StatePreparation(self, params: StatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
72
|
-
def LShift(self, params: LShift, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
73
|
-
def BitwiseAnd(self, params: BitwiseAnd, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
74
|
-
def UniformDistributionStatePreparation(self, params: UniformDistributionStatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
75
|
-
def XGate(self, params: XGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
76
|
-
def RYGate(self, params: RYGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
77
|
-
def Negation(self, params: Negation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
78
|
-
def MCPhaseGate(self, params: MCPhaseGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
79
|
-
def Subtractor(self, params: Subtractor, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
80
|
-
def HartreeFock(self, params: HartreeFock, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
81
|
-
def Finance(self, params: Finance, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
82
|
-
def Identity(self, params: Identity, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
83
|
-
def Mcu(self, params: Mcu, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
84
|
-
def HypercubeEntangler(self, params: HypercubeEntangler, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
85
|
-
def C3XGate(self, params: C3XGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
86
|
-
def CYGate(self, params: CYGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
87
|
-
def CZGate(self, params: CZGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
88
|
-
def UGate(self, params: UGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
89
|
-
def RandomizedBenchmarking(self, params: RandomizedBenchmarking, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
90
|
-
def PhaseEstimation(self, params: PhaseEstimation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
91
|
-
def InequalityMixer(self, params: InequalityMixer, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
92
|
-
def Sign(self, params: Sign, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
93
52
|
def CommutingPauliExponentiation(self, params: CommutingPauliExponentiation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
94
|
-
def
|
95
|
-
def
|
96
|
-
def
|
97
|
-
def
|
98
|
-
def
|
99
|
-
def
|
100
|
-
def
|
53
|
+
def UnitaryGate(self, params: UnitaryGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
54
|
+
def RYGate(self, params: RYGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
55
|
+
def RZZGate(self, params: RZZGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
56
|
+
def CHGate(self, params: CHGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
57
|
+
def CSXGate(self, params: CSXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
58
|
+
def LogicalAnd(self, params: LogicalAnd, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
59
|
+
def Exponentiation(self, params: Exponentiation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
60
|
+
def BitwiseXor(self, params: BitwiseXor, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
61
|
+
def LinearPauliRotations(self, params: LinearPauliRotations, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
101
62
|
def RYYGate(self, params: RYYGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
102
|
-
def SwapGate(self, params: SwapGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
103
|
-
def BellStatePreparation(self, params: BellStatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
104
63
|
def GroverOperator(self, params: GroverOperator, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
64
|
+
def FinanceModels(self, params: FinanceModels, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
105
65
|
def AmplitudeEstimation(self, params: AmplitudeEstimation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
106
|
-
def
|
66
|
+
def HadamardTransform(self, params: HadamardTransform, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
67
|
+
def RXGate(self, params: RXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
68
|
+
def Subtractor(self, params: Subtractor, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
69
|
+
def QSVMFeatureMap(self, params: QSVMFeatureMap, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
70
|
+
def HypercubeEntangler(self, params: HypercubeEntangler, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
107
71
|
def QFT(self, params: QFT, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
72
|
+
def CRYGate(self, params: CRYGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
73
|
+
def AmplitudeLoading(self, params: AmplitudeLoading, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
74
|
+
def CCXGate(self, params: CCXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
75
|
+
def CRXGate(self, params: CRXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
108
76
|
def YGate(self, params: YGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
109
|
-
def
|
77
|
+
def GHZStatePreparation(self, params: GHZStatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
110
78
|
def ZGate(self, params: ZGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
111
79
|
def HGate(self, params: HGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
112
|
-
def
|
113
|
-
def
|
114
|
-
def
|
115
|
-
def
|
80
|
+
def iSwapGate(self, params: iSwapGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
81
|
+
def C4XGate(self, params: C4XGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
82
|
+
def UGate(self, params: UGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
83
|
+
def Arithmetic(self, params: Arithmetic, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
84
|
+
def TwoDimensionalEntangler(self, params: TwoDimensionalEntangler, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
85
|
+
def ComputationalBasisStatePreparation(self, params: ComputationalBasisStatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
86
|
+
def LShift(self, params: LShift, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
87
|
+
def StatePreparation(self, params: StatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
88
|
+
def BitwiseOr(self, params: BitwiseOr, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
89
|
+
def SwapGate(self, params: SwapGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
90
|
+
def RandomizedBenchmarking(self, params: RandomizedBenchmarking, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
91
|
+
def FinancePayoff(self, params: FinancePayoff, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
92
|
+
def ArithmeticOracle(self, params: ArithmeticOracle, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
93
|
+
def RXXGate(self, params: RXXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
116
94
|
def IGate(self, params: IGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
117
|
-
def
|
118
|
-
def SuzukiTrotter(self, params: SuzukiTrotter, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
119
|
-
def SXGate(self, params: SXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
95
|
+
def SGate(self, params: SGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
120
96
|
def SdgGate(self, params: SdgGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
97
|
+
def CPhaseGate(self, params: CPhaseGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
98
|
+
def SXGate(self, params: SXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
121
99
|
def SXdgGate(self, params: SXdgGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
122
|
-
def
|
100
|
+
def GridEntangler(self, params: GridEntangler, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
101
|
+
def NotEqual(self, params: NotEqual, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
102
|
+
def CRZGate(self, params: CRZGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
123
103
|
def TGate(self, params: TGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
104
|
+
def CustomFunction(self, params: CustomFunction, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
124
105
|
def TdgGate(self, params: TdgGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
125
|
-
def
|
126
|
-
def
|
127
|
-
def
|
128
|
-
def BitwiseXor(self, params: BitwiseXor, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
106
|
+
def HVA(self, params: HVA, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
107
|
+
def PhaseGate(self, params: PhaseGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
108
|
+
def WeightedAdder(self, params: WeightedAdder, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
129
109
|
def Modulo(self, params: Modulo, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
130
|
-
def
|
110
|
+
def Mcu(self, params: Mcu, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
111
|
+
def BitwiseInvert(self, params: BitwiseInvert, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
112
|
+
def MCPhaseGate(self, params: MCPhaseGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
113
|
+
def Adder(self, params: Adder, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
114
|
+
def Negation(self, params: Negation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
115
|
+
def UniformDistributionStatePreparation(self, params: UniformDistributionStatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
116
|
+
def InequalityMixer(self, params: InequalityMixer, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
117
|
+
def HardwareEfficientAnsatz(self, params: HardwareEfficientAnsatz, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
131
118
|
def Multiplier(self, params: Multiplier, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
119
|
+
def RGate(self, params: RGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
120
|
+
def PhaseEstimation(self, params: PhaseEstimation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
121
|
+
def Equal(self, params: Equal, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
122
|
+
def CXGate(self, params: CXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
123
|
+
def SuzukiTrotter(self, params: SuzukiTrotter, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
124
|
+
def Identity(self, params: Identity, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
125
|
+
def GroverDiffuser(self, params: GroverDiffuser, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
126
|
+
def UCC(self, params: UCC, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
127
|
+
def ExponentialStatePreparation(self, params: ExponentialStatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
128
|
+
def GreaterThan(self, params: GreaterThan, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
129
|
+
def GreaterEqual(self, params: GreaterEqual, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
130
|
+
def LessThan(self, params: LessThan, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
131
|
+
def LessEqual(self, params: LessEqual, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
132
|
+
def BitwiseAnd(self, params: BitwiseAnd, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
133
|
+
def CustomOracle(self, params: CustomOracle, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
134
|
+
def LogicalOr(self, params: LogicalOr, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
135
|
+
def Mcx(self, params: Mcx, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
136
|
+
def Power(self, params: Power, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
137
|
+
def Sign(self, params: Sign, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
132
138
|
def Min(self, params: Min, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
133
|
-
def
|
139
|
+
def LinearGCI(self, params: LinearGCI, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
140
|
+
def CZGate(self, params: CZGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
141
|
+
def CYGate(self, params: CYGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
142
|
+
def WStatePreparation(self, params: WStatePreparation, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
143
|
+
def C3XGate(self, params: C3XGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
134
144
|
def Max(self, params: Max, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
135
|
-
def
|
136
|
-
def
|
137
|
-
def
|
138
|
-
def
|
139
|
-
def
|
140
|
-
def RXXGate(self, params: RXXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
145
|
+
def RZGate(self, params: RZGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
146
|
+
def PiecewiseLinearRotationAmplitudeLoading(self, params: PiecewiseLinearRotationAmplitudeLoading, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
147
|
+
def Finance(self, params: Finance, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
148
|
+
def QDrift(self, params: QDrift, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
149
|
+
def XGate(self, params: XGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
141
150
|
def PiecewiseLinearAmplitudeLoading(self, params: PiecewiseLinearAmplitudeLoading, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
142
|
-
def CCXGate(self, params: CCXGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
143
|
-
def CRYGate(self, params: CRYGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
144
151
|
def StatePropagator(self, params: StatePropagator, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
145
|
-
def
|
146
|
-
def
|
147
|
-
def
|
148
|
-
def ArithmeticOracle(self, params: ArithmeticOracle, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
149
|
-
def WeightedAdder(self, params: WeightedAdder, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
150
|
-
def UCC(self, params: UCC, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
151
|
-
def C4XGate(self, params: C4XGate, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
152
|
-
def Adder(self, params: Adder, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
153
|
-
def BitwiseOr(self, params: BitwiseOr, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
152
|
+
def RShift(self, params: RShift, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
153
|
+
def RangeMixer(self, params: RangeMixer, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
154
|
+
def HartreeFock(self, params: HartreeFock, in_wires: Optional[Dict[str, Wire]] = None) -> Dict[str, Wire]: ...
|
classiq/qmod/__init__.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
from .
|
2
|
-
from .
|
1
|
+
from .builtins import * # noqa: F403
|
2
|
+
from .builtins import __all__ as _builtins_all
|
3
3
|
from .qmod_parameter import Array, QParam
|
4
4
|
from .qmod_struct import QStruct
|
5
5
|
from .qmod_variable import Input, Output, QArray, QBit, QFixed, QInt
|
@@ -0,0 +1,8 @@
|
|
1
|
+
from .functions import * # noqa: F403
|
2
|
+
from .functions import __all__ as _builtin_functions
|
3
|
+
from .operations import * # noqa: F403
|
4
|
+
from .operations import __all__ as _builtin_operations
|
5
|
+
from .structs import * # noqa: F403
|
6
|
+
from .structs import __all__ as _builtin_structs
|
7
|
+
|
8
|
+
__all__ = _builtin_structs + _builtin_functions + _builtin_operations
|
@@ -1,115 +1,13 @@
|
|
1
|
+
# This file was generated automatically - do not edit manually
|
2
|
+
|
1
3
|
from typing import List, Literal
|
2
4
|
|
3
5
|
from classiq.qmod.qmod_parameter import QParam
|
4
|
-
from classiq.qmod.qmod_struct import QStruct
|
5
6
|
from classiq.qmod.qmod_variable import Input, Output, QArray, QBit
|
6
7
|
from classiq.qmod.quantum_callable import QCallable
|
7
8
|
from classiq.qmod.quantum_function import ExternalQFunc
|
8
9
|
|
9
|
-
|
10
|
-
@QStruct
|
11
|
-
class PauliTerm:
|
12
|
-
pauli: List[int]
|
13
|
-
coefficient: float
|
14
|
-
|
15
|
-
|
16
|
-
@QStruct
|
17
|
-
class MoleculeProblem:
|
18
|
-
mapping: int
|
19
|
-
z2_symmetries: bool
|
20
|
-
molecule: "Molecule"
|
21
|
-
freeze_core: bool
|
22
|
-
remove_orbitals: List[int]
|
23
|
-
|
24
|
-
|
25
|
-
@QStruct
|
26
|
-
class Molecule:
|
27
|
-
atoms: List["ChemistryAtom"]
|
28
|
-
spin: int
|
29
|
-
charge: int
|
30
|
-
|
31
|
-
|
32
|
-
@QStruct
|
33
|
-
class ChemistryAtom:
|
34
|
-
element: int
|
35
|
-
position: "Position"
|
36
|
-
|
37
|
-
|
38
|
-
@QStruct
|
39
|
-
class Position:
|
40
|
-
x: float
|
41
|
-
y: float
|
42
|
-
z: float
|
43
|
-
|
44
|
-
|
45
|
-
@QStruct
|
46
|
-
class FockHamiltonianProblem:
|
47
|
-
mapping: int
|
48
|
-
z2_symmetries: bool
|
49
|
-
terms: List["LadderTerm"]
|
50
|
-
num_particles: List[int]
|
51
|
-
|
52
|
-
|
53
|
-
@QStruct
|
54
|
-
class LadderTerm:
|
55
|
-
coefficient: float
|
56
|
-
ops: List["LadderOp"]
|
57
|
-
|
58
|
-
|
59
|
-
@QStruct
|
60
|
-
class LadderOp:
|
61
|
-
op: int
|
62
|
-
index: int
|
63
|
-
|
64
|
-
|
65
|
-
@QStruct
|
66
|
-
class CombinatorialOptimizationSolution:
|
67
|
-
probability: float
|
68
|
-
cost: float
|
69
|
-
solution: List[int]
|
70
|
-
count: int
|
71
|
-
|
72
|
-
|
73
|
-
@QStruct
|
74
|
-
class GaussianModel:
|
75
|
-
num_qubits: int
|
76
|
-
normal_max_value: float
|
77
|
-
default_probabilities: List[float]
|
78
|
-
rhos: List[float]
|
79
|
-
loss: List[int]
|
80
|
-
min_loss: int
|
81
|
-
|
82
|
-
|
83
|
-
@QStruct
|
84
|
-
class LogNormalModel:
|
85
|
-
num_qubits: int
|
86
|
-
mu: float
|
87
|
-
sigma: float
|
88
|
-
|
89
|
-
|
90
|
-
@QStruct
|
91
|
-
class FinanceFunction:
|
92
|
-
f: int
|
93
|
-
threshold: float
|
94
|
-
larger: bool
|
95
|
-
polynomial_degree: int
|
96
|
-
use_chebyshev_polynomial_approximation: bool
|
97
|
-
tail_probability: float
|
98
|
-
|
99
|
-
|
100
|
-
@QStruct
|
101
|
-
class QsvmResult:
|
102
|
-
test_score: float
|
103
|
-
predicted_labels: List[float]
|
104
|
-
|
105
|
-
|
106
|
-
@QStruct
|
107
|
-
class QSVMFeatureMapPauli:
|
108
|
-
feature_dimension: int
|
109
|
-
reps: int
|
110
|
-
entanglement: int
|
111
|
-
alpha: float
|
112
|
-
paulis: List[List[int]]
|
10
|
+
from .structs import *
|
113
11
|
|
114
12
|
|
115
13
|
@ExternalQFunc
|
@@ -394,7 +292,7 @@ def single_pauli_exponent(
|
|
394
292
|
|
395
293
|
@ExternalQFunc
|
396
294
|
def suzuki_trotter(
|
397
|
-
pauli_operator: QParam[List[
|
295
|
+
pauli_operator: QParam[List[PauliTerm]],
|
398
296
|
evolution_coefficient: QParam[float],
|
399
297
|
order: QParam[int],
|
400
298
|
repetitions: QParam[int],
|
@@ -405,7 +303,7 @@ def suzuki_trotter(
|
|
405
303
|
|
406
304
|
@ExternalQFunc
|
407
305
|
def qdrift(
|
408
|
-
pauli_operator: QParam[List[
|
306
|
+
pauli_operator: QParam[List[PauliTerm]],
|
409
307
|
evolution_coefficient: QParam[float],
|
410
308
|
num_qdrift: QParam[int],
|
411
309
|
qbv: QArray[QBit, Literal["len(get_field(pauli_operator[0], 'pauli'))"]],
|
@@ -415,7 +313,7 @@ def qdrift(
|
|
415
313
|
|
416
314
|
@ExternalQFunc
|
417
315
|
def exponentiation_with_depth_constraint(
|
418
|
-
pauli_operator: QParam[List[
|
316
|
+
pauli_operator: QParam[List[PauliTerm]],
|
419
317
|
evolution_coefficient: QParam[float],
|
420
318
|
max_depth: QParam[int],
|
421
319
|
qbv: QArray[QBit, Literal["len(get_field(pauli_operator[0], 'pauli'))"]],
|
@@ -437,6 +335,15 @@ def qft(
|
|
437
335
|
pass
|
438
336
|
|
439
337
|
|
338
|
+
@ExternalQFunc
|
339
|
+
def standard_qpe(
|
340
|
+
precision: QParam[int],
|
341
|
+
unitary: QCallable,
|
342
|
+
phase: QArray[QBit, Literal["precision"]],
|
343
|
+
) -> None:
|
344
|
+
pass
|
345
|
+
|
346
|
+
|
440
347
|
@ExternalQFunc
|
441
348
|
def qpe(
|
442
349
|
precision: QParam[int],
|
@@ -550,7 +457,7 @@ def qaoa_mixer_layer(
|
|
550
457
|
@ExternalQFunc
|
551
458
|
def qaoa_cost_layer(
|
552
459
|
g: QParam[float],
|
553
|
-
hamiltonian: QParam[List[
|
460
|
+
hamiltonian: QParam[List[PauliTerm]],
|
554
461
|
is_st: QParam[bool],
|
555
462
|
target: QArray[QBit],
|
556
463
|
) -> None:
|
@@ -561,7 +468,7 @@ def qaoa_cost_layer(
|
|
561
468
|
def qaoa_layer(
|
562
469
|
g: QParam[float],
|
563
470
|
b: QParam[float],
|
564
|
-
hamiltonian: QParam[List[
|
471
|
+
hamiltonian: QParam[List[PauliTerm]],
|
565
472
|
is_st: QParam[bool],
|
566
473
|
target: QArray[QBit],
|
567
474
|
) -> None:
|
@@ -579,7 +486,7 @@ def qaoa_init(
|
|
579
486
|
def qaoa_penalty(
|
580
487
|
num_qubits: QParam[int],
|
581
488
|
params_list: QParam[List[float]],
|
582
|
-
hamiltonian: QParam[List[
|
489
|
+
hamiltonian: QParam[List[PauliTerm]],
|
583
490
|
is_st: QParam[bool],
|
584
491
|
target: QArray[QBit, Literal["num_qubits"]],
|
585
492
|
) -> None:
|
@@ -677,7 +584,7 @@ def power(
|
|
677
584
|
|
678
585
|
@ExternalQFunc
|
679
586
|
def molecule_ucc(
|
680
|
-
molecule_problem: QParam[
|
587
|
+
molecule_problem: QParam[MoleculeProblem],
|
681
588
|
excitations: QParam[List[int]],
|
682
589
|
qbv: QArray[
|
683
590
|
QBit,
|
@@ -691,7 +598,7 @@ def molecule_ucc(
|
|
691
598
|
|
692
599
|
@ExternalQFunc
|
693
600
|
def molecule_hva(
|
694
|
-
molecule_problem: QParam[
|
601
|
+
molecule_problem: QParam[MoleculeProblem],
|
695
602
|
reps: QParam[int],
|
696
603
|
qbv: QArray[
|
697
604
|
QBit,
|
@@ -705,7 +612,7 @@ def molecule_hva(
|
|
705
612
|
|
706
613
|
@ExternalQFunc
|
707
614
|
def molecule_hartree_fock(
|
708
|
-
molecule_problem: QParam[
|
615
|
+
molecule_problem: QParam[MoleculeProblem],
|
709
616
|
qbv: QArray[
|
710
617
|
QBit,
|
711
618
|
Literal[
|
@@ -718,7 +625,7 @@ def molecule_hartree_fock(
|
|
718
625
|
|
719
626
|
@ExternalQFunc
|
720
627
|
def fock_hamiltonian_ucc(
|
721
|
-
fock_hamiltonian_problem: QParam[
|
628
|
+
fock_hamiltonian_problem: QParam[FockHamiltonianProblem],
|
722
629
|
excitations: QParam[List[int]],
|
723
630
|
qbv: QArray[
|
724
631
|
QBit,
|
@@ -732,7 +639,7 @@ def fock_hamiltonian_ucc(
|
|
732
639
|
|
733
640
|
@ExternalQFunc
|
734
641
|
def fock_hamiltonian_hva(
|
735
|
-
fock_hamiltonian_problem: QParam[
|
642
|
+
fock_hamiltonian_problem: QParam[FockHamiltonianProblem],
|
736
643
|
reps: QParam[int],
|
737
644
|
qbv: QArray[
|
738
645
|
QBit,
|
@@ -746,7 +653,7 @@ def fock_hamiltonian_hva(
|
|
746
653
|
|
747
654
|
@ExternalQFunc
|
748
655
|
def fock_hamiltonian_hartree_fock(
|
749
|
-
fock_hamiltonian_problem: QParam[
|
656
|
+
fock_hamiltonian_problem: QParam[FockHamiltonianProblem],
|
750
657
|
qbv: QArray[
|
751
658
|
QBit,
|
752
659
|
Literal[
|
@@ -759,8 +666,8 @@ def fock_hamiltonian_hartree_fock(
|
|
759
666
|
|
760
667
|
@ExternalQFunc
|
761
668
|
def log_normal_finance(
|
762
|
-
finance_model: QParam[
|
763
|
-
finance_function: QParam[
|
669
|
+
finance_model: QParam[LogNormalModel],
|
670
|
+
finance_function: QParam[FinanceFunction],
|
764
671
|
func_port: QArray[QBit, Literal["get_field(finance_model, 'num_qubits')"]],
|
765
672
|
obj_port: QBit,
|
766
673
|
) -> None:
|
@@ -769,8 +676,8 @@ def log_normal_finance(
|
|
769
676
|
|
770
677
|
@ExternalQFunc
|
771
678
|
def gaussian_finance(
|
772
|
-
finance_model: QParam[
|
773
|
-
finance_function: QParam[
|
679
|
+
finance_model: QParam[GaussianModel],
|
680
|
+
finance_function: QParam[FinanceFunction],
|
774
681
|
func_port: QArray[
|
775
682
|
QBit,
|
776
683
|
Literal[
|
@@ -784,7 +691,7 @@ def gaussian_finance(
|
|
784
691
|
|
785
692
|
@ExternalQFunc
|
786
693
|
def pauli_feature_map(
|
787
|
-
feature_map: QParam[
|
694
|
+
feature_map: QParam[QSVMFeatureMapPauli],
|
788
695
|
qbv: QArray[QBit, Literal["get_field(feature_map, 'feature_dimension')"]],
|
789
696
|
) -> None:
|
790
697
|
pass
|
@@ -799,20 +706,6 @@ def bloch_sphere_feature_map(
|
|
799
706
|
|
800
707
|
|
801
708
|
__all__ = [
|
802
|
-
"PauliTerm",
|
803
|
-
"MoleculeProblem",
|
804
|
-
"Molecule",
|
805
|
-
"ChemistryAtom",
|
806
|
-
"Position",
|
807
|
-
"FockHamiltonianProblem",
|
808
|
-
"LadderTerm",
|
809
|
-
"LadderOp",
|
810
|
-
"CombinatorialOptimizationSolution",
|
811
|
-
"GaussianModel",
|
812
|
-
"LogNormalModel",
|
813
|
-
"FinanceFunction",
|
814
|
-
"QsvmResult",
|
815
|
-
"QSVMFeatureMapPauli",
|
816
709
|
"H",
|
817
710
|
"X",
|
818
711
|
"Y",
|
@@ -853,6 +746,7 @@ __all__ = [
|
|
853
746
|
"exponentiation_with_depth_constraint",
|
854
747
|
"qft_step",
|
855
748
|
"qft",
|
749
|
+
"standard_qpe",
|
856
750
|
"qpe",
|
857
751
|
"single_pauli",
|
858
752
|
"linear_pauli_rotations",
|
@@ -0,0 +1,19 @@
|
|
1
|
+
from classiq.interface.model.bind_operation import BindOperation
|
2
|
+
|
3
|
+
from classiq.qmod.qmod_variable import Input, Output, QVar
|
4
|
+
from classiq.qmod.quantum_callable import QCallable
|
5
|
+
|
6
|
+
|
7
|
+
def bind(source: Input[QVar], destination: Output[QVar]) -> None:
|
8
|
+
assert QCallable.CURRENT_EXPANDABLE is not None
|
9
|
+
QCallable.CURRENT_EXPANDABLE.append_statement_to_body(
|
10
|
+
BindOperation(
|
11
|
+
in_handle=source.get_handle_binding(),
|
12
|
+
out_handle=destination.get_handle_binding(),
|
13
|
+
)
|
14
|
+
)
|
15
|
+
|
16
|
+
|
17
|
+
__all__ = [
|
18
|
+
"bind",
|
19
|
+
]
|