classiq 0.61.0__py3-none-any.whl → 0.62.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/applications/combinatorial_helpers/optimization_model.py +9 -2
- classiq/applications/combinatorial_helpers/pyomo_utils.py +60 -9
- classiq/applications/combinatorial_optimization/combinatorial_problem.py +54 -21
- classiq/execution/jobs.py +9 -1
- classiq/interface/_version.py +1 -1
- classiq/interface/backend/backend_preferences.py +21 -3
- classiq/interface/backend/quantum_backend_providers.py +3 -1
- classiq/interface/generator/copy.py +47 -0
- classiq/interface/generator/function_param_list_without_self_reference.py +2 -0
- classiq/interface/generator/model/preferences/preferences.py +1 -1
- classiq/interface/generator/types/compilation_metadata.py +2 -1
- classiq/model_expansions/capturing/captured_vars.py +12 -9
- classiq/model_expansions/closure.py +6 -9
- classiq/model_expansions/function_builder.py +6 -1
- classiq/model_expansions/generative_functions.py +1 -1
- classiq/model_expansions/interpreter.py +17 -35
- classiq/model_expansions/quantum_operations/call_emitter.py +23 -19
- classiq/model_expansions/quantum_operations/emitter.py +2 -3
- classiq/model_expansions/quantum_operations/quantum_function_call.py +1 -1
- classiq/model_expansions/quantum_operations/shallow_emitter.py +9 -3
- classiq/model_expansions/scope.py +2 -12
- classiq/qmod/builtins/operations.py +19 -80
- classiq/qmod/python_classical_type.py +1 -5
- classiq/qmod/quantum_expandable.py +2 -1
- classiq/qmod/quantum_function.py +4 -4
- {classiq-0.61.0.dist-info → classiq-0.62.0.dist-info}/METADATA +2 -1
- {classiq-0.61.0.dist-info → classiq-0.62.0.dist-info}/RECORD +28 -27
- {classiq-0.61.0.dist-info → classiq-0.62.0.dist-info}/WHEEL +0 -0
@@ -23,7 +23,10 @@ from classiq.applications.combinatorial_helpers import (
|
|
23
23
|
)
|
24
24
|
from classiq.applications.combinatorial_helpers.encoding_mapping import EncodingMapping
|
25
25
|
from classiq.applications.combinatorial_helpers.memory import InternalQuantumReg
|
26
|
-
from classiq.applications.combinatorial_helpers.pyomo_utils import
|
26
|
+
from classiq.applications.combinatorial_helpers.pyomo_utils import (
|
27
|
+
get_field_name,
|
28
|
+
is_index_var,
|
29
|
+
)
|
27
30
|
from classiq.applications.combinatorial_helpers.transformations import (
|
28
31
|
encoding,
|
29
32
|
ising_converter,
|
@@ -176,7 +179,11 @@ class OptimizationModel:
|
|
176
179
|
for key, value in penalty_map.pyomo2sympy.items():
|
177
180
|
objective_map.pyomo2sympy[key] = value
|
178
181
|
sympy_mapping = {
|
179
|
-
sympy_var:
|
182
|
+
sympy_var: (
|
183
|
+
get_field_name(pyomo_var)
|
184
|
+
if not is_index_var(pyomo_var)
|
185
|
+
else (get_field_name(pyomo_var.parent_component()), pyomo_var.index())
|
186
|
+
)
|
180
187
|
for pyomo_var, sympy_var in objective_map.pyomo2sympy.items()
|
181
188
|
}
|
182
189
|
self.objective_not_encoded_sympy = sympy_mapping, objective_expr
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import math
|
2
2
|
import re
|
3
|
+
from collections import defaultdict
|
3
4
|
from enum import Enum
|
4
5
|
from typing import Any, Optional, TypeVar, Union
|
5
6
|
|
@@ -24,7 +25,7 @@ from classiq.interface.generator.expressions.expression import Expression
|
|
24
25
|
from classiq.interface.generator.functions.classical_type import Integer
|
25
26
|
from classiq.interface.generator.types.struct_declaration import StructDeclaration
|
26
27
|
|
27
|
-
from classiq.qmod.qmod_variable import QBit, QNum, QStruct, QVar
|
28
|
+
from classiq.qmod.qmod_variable import QArray, QBit, QNum, QStruct, QVar
|
28
29
|
from classiq.qmod.symbolic_expr import SymbolicExpr
|
29
30
|
|
30
31
|
ListVars = list[_GeneralVarData]
|
@@ -262,14 +263,51 @@ def pyomo_to_qmod_qstruct(
|
|
262
263
|
struct_name: str, vars: list[_GeneralVarData]
|
263
264
|
) -> type[QStruct]:
|
264
265
|
qmod_struct = type(struct_name, (QStruct,), {})
|
265
|
-
|
266
|
-
qmod_struct.__annotations__ = {
|
267
|
-
var_name: _get_qmod_field_type(var_name, var_data)
|
268
|
-
for var_name, var_data in var_names.items()
|
269
|
-
}
|
266
|
+
qmod_struct.__annotations__ = _get_qstruct_fields(vars)
|
270
267
|
return qmod_struct
|
271
268
|
|
272
269
|
|
270
|
+
def _get_qstruct_fields(vars: list[_GeneralVarData]) -> dict[str, type[QVar]]:
|
271
|
+
array_types = _get_array_types(vars)
|
272
|
+
array_type_sizes = _get_array_sizes(array_types)
|
273
|
+
fields: dict[str, type[QVar]] = {}
|
274
|
+
for var in vars:
|
275
|
+
_add_qmod_field(var, array_type_sizes, fields)
|
276
|
+
return fields
|
277
|
+
|
278
|
+
|
279
|
+
def _get_array_types(vars: list[_GeneralVarData]) -> dict[str, set[int]]:
|
280
|
+
array_types: dict[str, set[int]] = defaultdict(set)
|
281
|
+
for var in vars:
|
282
|
+
if is_index_var(var):
|
283
|
+
array_types[var.parent_component().name].add(var.index())
|
284
|
+
return array_types
|
285
|
+
|
286
|
+
|
287
|
+
def _get_array_sizes(array_types: dict[str, set[int]]) -> dict[str, int]:
|
288
|
+
return {
|
289
|
+
name: array_size
|
290
|
+
for name, indices in array_types.items()
|
291
|
+
if indices == set(range(array_size := len(indices)))
|
292
|
+
}
|
293
|
+
|
294
|
+
|
295
|
+
def _add_qmod_field(
|
296
|
+
var: _GeneralVarData,
|
297
|
+
array_type_sizes: dict[str, int],
|
298
|
+
fields: dict[str, type[QVar]],
|
299
|
+
) -> None:
|
300
|
+
parent_name = var.parent_component().name
|
301
|
+
if parent_name not in array_type_sizes:
|
302
|
+
var_name = get_field_name(var)
|
303
|
+
fields[var_name] = _get_qmod_field_type(var_name, var)
|
304
|
+
elif var.index() == 0:
|
305
|
+
fields[parent_name] = QArray[ # type:ignore[misc]
|
306
|
+
_get_qmod_field_type(parent_name, var),
|
307
|
+
array_type_sizes[parent_name],
|
308
|
+
]
|
309
|
+
|
310
|
+
|
273
311
|
def _get_qmod_field_type(var_name: str, var_data: _GeneralVarData) -> type[QVar]:
|
274
312
|
if var_data.domain not in SUPPORTED_TYPES:
|
275
313
|
raise ClassiqValueError(
|
@@ -294,11 +332,17 @@ def _get_qmod_field_type(var_name: str, var_data: _GeneralVarData) -> type[QVar]
|
|
294
332
|
|
295
333
|
|
296
334
|
def evaluate_objective(
|
297
|
-
var_mapping: dict,
|
335
|
+
var_mapping: dict[Any, Union[str, tuple[str, int]]],
|
336
|
+
sympy_expr: sympy.Expr,
|
337
|
+
struct_obj: Any,
|
298
338
|
) -> Any:
|
299
339
|
sympy_assignment = {
|
300
|
-
sympy_var:
|
301
|
-
|
340
|
+
sympy_var: (
|
341
|
+
getattr(struct_obj, field_accessor)
|
342
|
+
if isinstance(field_accessor, str)
|
343
|
+
else getattr(struct_obj, field_accessor[0])[field_accessor[1]]
|
344
|
+
)
|
345
|
+
for sympy_var, field_accessor in var_mapping.items()
|
302
346
|
}
|
303
347
|
|
304
348
|
# classical objective evaluation
|
@@ -315,3 +359,10 @@ def evaluate_objective(
|
|
315
359
|
|
316
360
|
def get_field_name(var: _GeneralVarData) -> str:
|
317
361
|
return var.local_name.replace("[", "_").replace("]", "")
|
362
|
+
|
363
|
+
|
364
|
+
def is_index_var(var: _GeneralVarData) -> bool:
|
365
|
+
return (
|
366
|
+
isinstance(var.index(), int)
|
367
|
+
and "[" not in var.parent_component().name # nested arrays not supported
|
368
|
+
)
|
@@ -6,11 +6,13 @@ import numpy as np
|
|
6
6
|
import pandas as pd
|
7
7
|
import pyomo.core as pyo
|
8
8
|
import scipy
|
9
|
+
from tqdm import tqdm
|
9
10
|
|
10
11
|
from classiq.interface.executor.execution_preferences import ExecutionPreferences
|
11
12
|
from classiq.interface.executor.result import ExecutionDetails
|
12
13
|
from classiq.interface.model.model import SerializedModel
|
13
14
|
|
15
|
+
from classiq import Constraints, Preferences
|
14
16
|
from classiq.applications.combinatorial_helpers.combinatorial_problem_utils import (
|
15
17
|
pyo_model_to_qmod_problem,
|
16
18
|
)
|
@@ -37,7 +39,7 @@ class CombinatorialProblem:
|
|
37
39
|
num_layers: int,
|
38
40
|
penalty_factor: int = 1,
|
39
41
|
):
|
40
|
-
self.problem_vars_, self.
|
42
|
+
self.problem_vars_, self.cost_func = pyo_model_to_qmod_problem(
|
41
43
|
pyo_model, penalty_factor
|
42
44
|
)
|
43
45
|
self.num_layers_ = num_layers
|
@@ -45,8 +47,26 @@ class CombinatorialProblem:
|
|
45
47
|
self.qprog_ = None
|
46
48
|
self.es_ = None
|
47
49
|
self.optimized_params_ = None
|
50
|
+
self.params_trace_: list[np.ndarray] = []
|
51
|
+
self.cost_trace_: list = []
|
48
52
|
|
49
|
-
|
53
|
+
@property
|
54
|
+
def cost_trace(self) -> list:
|
55
|
+
return self.cost_trace_
|
56
|
+
|
57
|
+
@property
|
58
|
+
def params_trace(self) -> list[np.ndarray]:
|
59
|
+
return self.params_trace_
|
60
|
+
|
61
|
+
@property
|
62
|
+
def optimized_params(self) -> list:
|
63
|
+
return self.optimized_params_ # type:ignore[return-value]
|
64
|
+
|
65
|
+
def get_model(
|
66
|
+
self,
|
67
|
+
constraints: Optional[Constraints] = None,
|
68
|
+
preferences: Optional[Preferences] = None,
|
69
|
+
) -> SerializedModel:
|
50
70
|
@qfunc
|
51
71
|
def main(
|
52
72
|
params: CArray[CReal, self.num_layers_ * 2], # type:ignore[valid-type]
|
@@ -58,13 +78,15 @@ class CombinatorialProblem:
|
|
58
78
|
self.num_layers_,
|
59
79
|
lambda i: [ # type:ignore[arg-type]
|
60
80
|
phase(
|
61
|
-
-self.
|
81
|
+
-self.cost_func(v), params[i]
|
62
82
|
), # type:ignore[func-returns-value]
|
63
83
|
apply_to_all(lambda q: RX(params[self.num_layers_ + i], q), v),
|
64
84
|
],
|
65
85
|
)
|
66
86
|
|
67
|
-
self.model_ = create_model(
|
87
|
+
self.model_ = create_model(
|
88
|
+
main, constraints=constraints, preferences=preferences
|
89
|
+
) # type:ignore[assignment]
|
68
90
|
return self.model_ # type:ignore[return-value]
|
69
91
|
|
70
92
|
def get_qprog(self) -> SerializedQuantumProgram:
|
@@ -77,7 +99,6 @@ class CombinatorialProblem:
|
|
77
99
|
self,
|
78
100
|
execution_preferences: Optional[ExecutionPreferences] = None,
|
79
101
|
maxiter: int = 20,
|
80
|
-
cost_trace: Optional[list[float]] = None,
|
81
102
|
quantile: float = 1.0,
|
82
103
|
) -> list[float]:
|
83
104
|
if self.qprog_ is None:
|
@@ -85,40 +106,52 @@ class CombinatorialProblem:
|
|
85
106
|
self.es_ = ExecutionSession(
|
86
107
|
self.qprog_, execution_preferences # type:ignore[assignment,arg-type]
|
87
108
|
)
|
109
|
+
self.params_trace_ = []
|
110
|
+
self.cost_trace_ = []
|
88
111
|
|
89
112
|
def estimate_cost_wrapper(params: np.ndarray) -> float:
|
90
113
|
cost = self.es_.estimate_cost( # type:ignore[attr-defined]
|
91
|
-
lambda state: self.
|
114
|
+
lambda state: self.cost_func(state["v"]),
|
92
115
|
{"params": params.tolist()},
|
93
116
|
quantile=quantile,
|
94
117
|
)
|
95
|
-
|
96
|
-
|
118
|
+
self.cost_trace_.append(cost)
|
119
|
+
self.params_trace_.append(params)
|
97
120
|
return cost
|
98
121
|
|
99
122
|
initial_params = (
|
100
123
|
np.concatenate(
|
101
124
|
(
|
102
|
-
np.linspace(
|
103
|
-
np.linspace(1,
|
125
|
+
np.linspace(1 / self.num_layers_, 1, self.num_layers_),
|
126
|
+
np.linspace(1, 1 / self.num_layers_, self.num_layers_),
|
104
127
|
)
|
105
128
|
)
|
106
129
|
* math.pi
|
107
130
|
)
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
131
|
+
|
132
|
+
with tqdm(total=maxiter, desc="Optimization Progress", leave=True) as pbar:
|
133
|
+
|
134
|
+
def _minimze_callback(xk: np.ndarray) -> None:
|
135
|
+
pbar.update(1) # increment progress bar
|
136
|
+
self.optimized_params_ = xk.tolist() # save recent optimized value
|
137
|
+
|
138
|
+
self.optimized_params_ = scipy.optimize.minimize(
|
139
|
+
estimate_cost_wrapper,
|
140
|
+
callback=_minimze_callback,
|
141
|
+
x0=initial_params,
|
142
|
+
method="COBYLA",
|
143
|
+
options={"maxiter": maxiter},
|
144
|
+
).x.tolist()
|
145
|
+
|
114
146
|
return self.optimized_params_ # type:ignore[return-value]
|
115
147
|
|
116
|
-
def
|
117
|
-
|
118
|
-
|
148
|
+
def sample_uniform(self) -> pd.DataFrame:
|
149
|
+
return self.sample([0] * self.num_layers_ * 2)
|
150
|
+
|
151
|
+
def sample(self, params: list) -> pd.DataFrame:
|
119
152
|
assert self.es_ is not None
|
120
153
|
res = self.es_.sample( # type:ignore[unreachable]
|
121
|
-
{"params":
|
154
|
+
{"params": params}
|
122
155
|
)
|
123
156
|
parsed_result = [
|
124
157
|
{
|
@@ -128,7 +161,7 @@ class CombinatorialProblem:
|
|
128
161
|
if not re.match(".*_slack_var_.*", key)
|
129
162
|
},
|
130
163
|
"probability": sampled.shots / res.num_shots,
|
131
|
-
"cost": self.
|
164
|
+
"cost": self.cost_func(sampled.state["v"]),
|
132
165
|
}
|
133
166
|
for sampled in res.parsed_counts
|
134
167
|
]
|
classiq/execution/jobs.py
CHANGED
@@ -112,7 +112,15 @@ class ExecutionJob:
|
|
112
112
|
)
|
113
113
|
return cls(details)
|
114
114
|
|
115
|
-
|
115
|
+
# `syncify_function` doesn't work well for class methods, so I wrote `from_id`
|
116
|
+
# explicitly
|
117
|
+
@classmethod
|
118
|
+
def from_id(
|
119
|
+
cls,
|
120
|
+
id: str,
|
121
|
+
_http_client: Optional[httpx.AsyncClient] = None,
|
122
|
+
) -> "ExecutionJob":
|
123
|
+
return syncify_function(cls.from_id_async)(id, _http_client=_http_client)
|
116
124
|
|
117
125
|
@property
|
118
126
|
def _job_id(self) -> JobID:
|
classiq/interface/_version.py
CHANGED
@@ -161,6 +161,20 @@ class ClassiqBackendPreferences(BackendPreferences):
|
|
161
161
|
def is_nvidia_backend(self) -> bool:
|
162
162
|
return self.backend_name in list(ClassiqNvidiaBackendNames)
|
163
163
|
|
164
|
+
# CAD-25390
|
165
|
+
@pydantic.field_validator("backend_name")
|
166
|
+
@classmethod
|
167
|
+
def _validate_nvidia_name_backwards_compatibility(cls, backend_name: str) -> str:
|
168
|
+
if backend_name == "nvidia_state_vector_simulator":
|
169
|
+
warnings.warn(
|
170
|
+
"The name 'nvidia_state_vector_simulator' is deprecated and "
|
171
|
+
"will be removed soon, no earlier than January 12th 2025. "
|
172
|
+
"Please use ClassiqNvidiaBackendNames.SIMULATOR instead",
|
173
|
+
ClassiqDeprecationWarning,
|
174
|
+
stacklevel=2,
|
175
|
+
)
|
176
|
+
return backend_name
|
177
|
+
|
164
178
|
|
165
179
|
class AwsBackendPreferences(BackendPreferences):
|
166
180
|
"""
|
@@ -196,13 +210,17 @@ class AwsBackendPreferences(BackendPreferences):
|
|
196
210
|
backend_service_provider: ProviderTypeVendor.AMAZON_BRAKET = pydantic.Field(
|
197
211
|
default=ProviderVendor.AMAZON_BRAKET
|
198
212
|
)
|
199
|
-
aws_role_arn: pydantic_backend.PydanticAwsRoleArn = pydantic.Field(
|
213
|
+
aws_role_arn: Optional[pydantic_backend.PydanticAwsRoleArn] = pydantic.Field(
|
200
214
|
description="ARN of the role to be assumed for execution on your Braket account."
|
201
215
|
)
|
202
|
-
s3_bucket_name: str = pydantic.Field(description="S3 Bucket Name")
|
203
|
-
s3_folder: pydantic_backend.PydanticS3BucketKey = pydantic.Field(
|
216
|
+
s3_bucket_name: Optional[str] = pydantic.Field(description="S3 Bucket Name")
|
217
|
+
s3_folder: Optional[pydantic_backend.PydanticS3BucketKey] = pydantic.Field(
|
204
218
|
description="S3 Folder Path Within The S3 Bucket"
|
205
219
|
)
|
220
|
+
run_through_classiq: bool = pydantic.Field(
|
221
|
+
default=False,
|
222
|
+
description="Run through Classiq's credentials while using user's allocated budget.",
|
223
|
+
)
|
206
224
|
|
207
225
|
@pydantic.field_validator("s3_bucket_name", mode="before")
|
208
226
|
@classmethod
|
@@ -170,7 +170,8 @@ class ClassiqNvidiaBackendNames(StrEnum):
|
|
170
170
|
Classiq's Nvidia simulator backend names.
|
171
171
|
"""
|
172
172
|
|
173
|
-
SIMULATOR = "
|
173
|
+
SIMULATOR = "nvidia_simulator"
|
174
|
+
SIMULATOR_STATEVECTOR = "nvidia_simulator_statevector"
|
174
175
|
|
175
176
|
|
176
177
|
class IntelBackendNames(StrEnum):
|
@@ -186,6 +187,7 @@ class GoogleNvidiaBackendNames(StrEnum):
|
|
186
187
|
"""
|
187
188
|
|
188
189
|
CUQUANTUM = "cuquantum"
|
190
|
+
CUQUANTUM_STATEVECTOR = "cuquantum_statevector"
|
189
191
|
|
190
192
|
|
191
193
|
class AliceBobBackendNames(StrEnum):
|
@@ -0,0 +1,47 @@
|
|
1
|
+
from typing import Optional
|
2
|
+
|
3
|
+
import pydantic
|
4
|
+
|
5
|
+
from classiq.interface.generator.arith import argument_utils
|
6
|
+
from classiq.interface.generator.arith.register_user_input import RegisterArithmeticInfo
|
7
|
+
from classiq.interface.generator.function_params import FunctionParams
|
8
|
+
|
9
|
+
|
10
|
+
class Copy(FunctionParams):
|
11
|
+
source: argument_utils.RegisterOrConst
|
12
|
+
target: RegisterArithmeticInfo
|
13
|
+
output_size: Optional[pydantic.PositiveInt] = pydantic.Field(default=None)
|
14
|
+
|
15
|
+
@property
|
16
|
+
def source_size(self) -> int:
|
17
|
+
return argument_utils.size(self.source)
|
18
|
+
|
19
|
+
@property
|
20
|
+
def source_reg_size(self) -> int:
|
21
|
+
return (
|
22
|
+
self.source.size if isinstance(self.source, RegisterArithmeticInfo) else 0
|
23
|
+
)
|
24
|
+
|
25
|
+
@property
|
26
|
+
def source_fraction_places(self) -> int:
|
27
|
+
return argument_utils.fraction_places(self.source)
|
28
|
+
|
29
|
+
@property
|
30
|
+
def offset(self) -> int:
|
31
|
+
return self.target.fraction_places - self.source_fraction_places
|
32
|
+
|
33
|
+
@property
|
34
|
+
def source_name(self) -> str:
|
35
|
+
return "source"
|
36
|
+
|
37
|
+
@property
|
38
|
+
def target_name(self) -> str:
|
39
|
+
return "target"
|
40
|
+
|
41
|
+
def _create_ios(self) -> None:
|
42
|
+
self._inputs = {
|
43
|
+
self.target_name: self.target,
|
44
|
+
}
|
45
|
+
if isinstance(self.source, RegisterArithmeticInfo):
|
46
|
+
self._inputs[self.source_name] = self.source
|
47
|
+
self._outputs = {**self._inputs}
|
@@ -28,6 +28,7 @@ from classiq.interface.generator.arith.unary_ops import BitwiseInvert, Negation,
|
|
28
28
|
from classiq.interface.generator.commuting_pauli_exponentiation import (
|
29
29
|
CommutingPauliExponentiation,
|
30
30
|
)
|
31
|
+
from classiq.interface.generator.copy import Copy
|
31
32
|
from classiq.interface.generator.entangler_params import (
|
32
33
|
GridEntangler,
|
33
34
|
HypercubeEntangler,
|
@@ -148,6 +149,7 @@ function_param_library_without_self_reference: FunctionParamLibrary = (
|
|
148
149
|
PiecewiseLinearAmplitudeLoading,
|
149
150
|
PiecewiseLinearRotationAmplitudeLoading,
|
150
151
|
HadamardTransform,
|
152
|
+
Copy,
|
151
153
|
},
|
152
154
|
standard_gate_function_param_library.param_list,
|
153
155
|
oracle_function_param_library.param_list,
|
@@ -156,7 +156,7 @@ class Preferences(pydantic.BaseModel, extra="forbid"):
|
|
156
156
|
)
|
157
157
|
synthesize_all_separately: bool = pydantic.Field(
|
158
158
|
default=False,
|
159
|
-
description="If true,
|
159
|
+
description="If true, a heuristic is used to determine if a function should be synthesized separately",
|
160
160
|
)
|
161
161
|
output_format: PydanticConstrainedQuantumFormatList = pydantic.Field(
|
162
162
|
default=[QuantumFormat.QASM],
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import dataclasses
|
2
|
-
from collections.abc import
|
3
|
-
from contextlib import contextmanager
|
2
|
+
from collections.abc import Sequence
|
4
3
|
from dataclasses import dataclass, field
|
5
4
|
from typing import TYPE_CHECKING, Optional
|
6
5
|
|
@@ -277,11 +276,8 @@ class CapturedVars:
|
|
277
276
|
if not captured_handle.is_propagated
|
278
277
|
}
|
279
278
|
|
280
|
-
|
281
|
-
|
282
|
-
previous = self._captured_handles
|
283
|
-
yield
|
284
|
-
self._captured_handles = previous
|
279
|
+
def clone(self) -> "CapturedVars":
|
280
|
+
return CapturedVars(_captured_handles=list(self._captured_handles))
|
285
281
|
|
286
282
|
|
287
283
|
def _same_closure(closure_1: "FunctionClosure", closure_2: "FunctionClosure") -> bool:
|
@@ -311,7 +307,9 @@ def validate_args_are_not_propagated(
|
|
311
307
|
)
|
312
308
|
|
313
309
|
|
314
|
-
def validate_captured_directions(
|
310
|
+
def validate_captured_directions(
|
311
|
+
captured_vars: CapturedVars, report_outin: bool = True
|
312
|
+
) -> None:
|
315
313
|
captured_inputs = [
|
316
314
|
captured_handle.handle.name
|
317
315
|
for captured_handle in captured_vars._captured_handles
|
@@ -320,7 +318,12 @@ def validate_captured_directions(captured_vars: CapturedVars) -> None:
|
|
320
318
|
captured_outputs = [
|
321
319
|
captured_handle.handle.name
|
322
320
|
for captured_handle in captured_vars._captured_handles
|
323
|
-
if captured_handle.direction
|
321
|
+
if captured_handle.direction
|
322
|
+
in (
|
323
|
+
(PortDirection.Output, PortDirection.Outin)
|
324
|
+
if report_outin
|
325
|
+
else (PortDirection.Output,)
|
326
|
+
)
|
324
327
|
]
|
325
328
|
if len(captured_inputs) > 0:
|
326
329
|
raise ClassiqExpansionError(
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import dataclasses
|
2
2
|
import json
|
3
3
|
import uuid
|
4
|
-
from collections.abc import Collection,
|
5
|
-
from contextlib import contextmanager
|
4
|
+
from collections.abc import Collection, Sequence
|
6
5
|
from dataclasses import dataclass, field
|
7
6
|
from functools import singledispatch
|
8
7
|
from symtable import Symbol
|
@@ -51,11 +50,6 @@ class Closure:
|
|
51
50
|
if isinstance(param, PortDeclaration)
|
52
51
|
}
|
53
52
|
|
54
|
-
@contextmanager
|
55
|
-
def freeze(self) -> Iterator[None]:
|
56
|
-
with self.scope.freeze(), self.captured_vars.freeze():
|
57
|
-
yield
|
58
|
-
|
59
53
|
|
60
54
|
@dataclass(frozen=True)
|
61
55
|
class GenerativeClosure(Closure):
|
@@ -142,9 +136,12 @@ class FunctionClosure(Closure):
|
|
142
136
|
def set_depth(self, depth: int) -> Self:
|
143
137
|
return dataclasses.replace(self, _depth=depth)
|
144
138
|
|
145
|
-
def
|
139
|
+
def clone(self) -> Self:
|
146
140
|
return dataclasses.replace(
|
147
|
-
self,
|
141
|
+
self,
|
142
|
+
scope=self.scope.clone(),
|
143
|
+
signature_scope=self.signature_scope.clone(),
|
144
|
+
captured_vars=self.captured_vars.clone(),
|
148
145
|
)
|
149
146
|
|
150
147
|
|
@@ -92,6 +92,10 @@ class OperationBuilder:
|
|
92
92
|
def current_operation(self) -> Closure:
|
93
93
|
return self._operations[-1].closure
|
94
94
|
|
95
|
+
@property
|
96
|
+
def current_scope(self) -> Scope:
|
97
|
+
return self.current_operation.scope
|
98
|
+
|
95
99
|
@property
|
96
100
|
def current_function(self) -> FunctionClosure:
|
97
101
|
return self._get_last_function(self._operations)
|
@@ -137,7 +141,8 @@ class OperationBuilder:
|
|
137
141
|
validate_captured_directions(
|
138
142
|
captured_vars.filter_vars(
|
139
143
|
self.current_function, self.current_block.variable_declarations
|
140
|
-
)
|
144
|
+
),
|
145
|
+
report_outin=False,
|
141
146
|
)
|
142
147
|
self.current_operation.captured_vars.update(
|
143
148
|
captured_vars.filter_vars(self.current_function)
|
@@ -116,7 +116,7 @@ class _InterpreterExpandable(QFunc):
|
|
116
116
|
name=name,
|
117
117
|
positional_arg_declarations=evaluated.value.positional_arg_declarations,
|
118
118
|
)
|
119
|
-
for name, evaluated in self._interpreter.
|
119
|
+
for name, evaluated in self._interpreter._builder.current_scope.items()
|
120
120
|
if isinstance(evaluated, Evaluated)
|
121
121
|
and isinstance(evaluated.value, FunctionClosure)
|
122
122
|
} | nameables_to_dict(self._interpreter._get_function_declarations())
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import
|
2
|
-
from collections.abc import
|
3
|
-
from contextlib import
|
1
|
+
from collections import defaultdict
|
2
|
+
from collections.abc import Sequence
|
3
|
+
from contextlib import nullcontext
|
4
4
|
from functools import singledispatchmethod
|
5
5
|
from typing import Any, Optional, cast
|
6
6
|
|
@@ -111,8 +111,7 @@ class Interpreter:
|
|
111
111
|
) -> None:
|
112
112
|
self._is_frontend = is_frontend
|
113
113
|
self._model = model
|
114
|
-
self.
|
115
|
-
self._top_level_scope = self._current_scope
|
114
|
+
self._top_level_scope = Scope()
|
116
115
|
self._builder = OperationBuilder(self._top_level_scope)
|
117
116
|
self._expanded_functions: dict[str, NativeFunctionDefinition] = {}
|
118
117
|
|
@@ -123,33 +122,19 @@ class Interpreter:
|
|
123
122
|
if generative_functions is None:
|
124
123
|
generative_functions = []
|
125
124
|
self._generative_functions = generative_functions
|
126
|
-
init_top_level_scope(model, generative_functions, self.
|
125
|
+
init_top_level_scope(model, generative_functions, self._top_level_scope)
|
127
126
|
self._expanded_functions_compilation_metadata: dict[
|
128
127
|
str, CompilationMetadata
|
129
|
-
] =
|
128
|
+
] = defaultdict(CompilationMetadata)
|
130
129
|
self._counted_name_allocator = CountedNameAllocator()
|
131
130
|
self._error_manager: ErrorManager = ErrorManager()
|
132
131
|
|
133
|
-
@contextmanager
|
134
|
-
def _scope_guard(self, scope: Scope) -> Iterator[None]:
|
135
|
-
"""This manager restores both `scope` and `self._current_scope` to their previous values."""
|
136
|
-
scope_data = copy.copy(scope.data)
|
137
|
-
prev_context_scope_data = copy.copy(self._current_scope.data)
|
138
|
-
|
139
|
-
prev_context_scope = self._current_scope
|
140
|
-
self._current_scope = scope
|
141
|
-
yield
|
142
|
-
prev_context_scope.data = prev_context_scope_data
|
143
|
-
self._current_scope = prev_context_scope
|
144
|
-
|
145
|
-
scope.data = scope_data
|
146
|
-
|
147
132
|
def _expand_main_func(self) -> None:
|
148
133
|
main_closure = FunctionClosure.create(
|
149
134
|
name=self._model.main_func.name,
|
150
135
|
positional_arg_declarations=self._model.main_func.positional_arg_declarations,
|
151
136
|
body=self._model.main_func.body,
|
152
|
-
scope=Scope(parent=self.
|
137
|
+
scope=Scope(parent=self._top_level_scope),
|
153
138
|
expr_renamer=self._main_renamer,
|
154
139
|
_depth=0,
|
155
140
|
)
|
@@ -198,11 +183,11 @@ class Interpreter:
|
|
198
183
|
|
199
184
|
@evaluate.register
|
200
185
|
def evaluate_classical_expression(self, expression: Expression) -> Evaluated:
|
201
|
-
return evaluate_classical_expression(expression, self.
|
186
|
+
return evaluate_classical_expression(expression, self._builder.current_scope)
|
202
187
|
|
203
188
|
@evaluate.register
|
204
189
|
def evaluate_identifier(self, identifier: str) -> Evaluated:
|
205
|
-
return self.
|
190
|
+
return self._builder.current_scope[identifier]
|
206
191
|
|
207
192
|
@evaluate.register
|
208
193
|
def evaluate_lambda(self, function: QuantumLambdaFunction) -> Evaluated:
|
@@ -233,7 +218,7 @@ class Interpreter:
|
|
233
218
|
name=func_decl.name,
|
234
219
|
positional_arg_declarations=func_decl.positional_arg_declarations,
|
235
220
|
body=function.body,
|
236
|
-
scope=Scope(parent=self.
|
221
|
+
scope=Scope(parent=self._builder.current_scope),
|
237
222
|
is_lambda=True,
|
238
223
|
**extra_args,
|
239
224
|
),
|
@@ -390,19 +375,16 @@ class Interpreter:
|
|
390
375
|
pass
|
391
376
|
elif isinstance(operation, FunctionClosure) and operation.name == "permute":
|
392
377
|
# special expansion since permute is generative
|
393
|
-
|
394
|
-
self._expand_permute()
|
378
|
+
self._expand_permute()
|
395
379
|
elif isinstance(operation, GenerativeClosure):
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
emit_generative_statements(self, operation, args)
|
380
|
+
args = [
|
381
|
+
self.evaluate(param.name)
|
382
|
+
for param in operation.positional_arg_declarations
|
383
|
+
]
|
384
|
+
emit_generative_statements(self, operation, args)
|
402
385
|
else:
|
403
386
|
for block, block_body in operation.blocks.items():
|
404
|
-
|
405
|
-
self._expand_block(block_body, block)
|
387
|
+
self._expand_block(block_body, block)
|
406
388
|
|
407
389
|
return context
|
408
390
|
|
@@ -53,7 +53,7 @@ if TYPE_CHECKING:
|
|
53
53
|
class CallEmitter(Generic[QuantumStatementT], Emitter[QuantumStatementT], VarSplitter):
|
54
54
|
def __init__(self, interpreter: "Interpreter") -> None:
|
55
55
|
Emitter.__init__(self, interpreter)
|
56
|
-
VarSplitter.__init__(self, interpreter.
|
56
|
+
VarSplitter.__init__(self, interpreter._builder.current_scope)
|
57
57
|
|
58
58
|
@staticmethod
|
59
59
|
def _should_wrap(body: Sequence[QuantumStatement]) -> bool:
|
@@ -90,8 +90,8 @@ class CallEmitter(Generic[QuantumStatementT], Emitter[QuantumStatementT], VarSpl
|
|
90
90
|
args: list[ArgValue],
|
91
91
|
propagated_debug_info: Optional[FunctionDebugInfo] = None,
|
92
92
|
) -> QuantumFunctionCall:
|
93
|
+
function = function.clone()
|
93
94
|
function = function.set_depth(self._builder.current_function.depth + 1)
|
94
|
-
function = function.copy_scope()
|
95
95
|
evaluated_args = [self._interpreter.evaluate(arg) for arg in args]
|
96
96
|
new_declaration = self._prepare_fully_typed_declaration(
|
97
97
|
function, evaluated_args
|
@@ -115,15 +115,20 @@ class CallEmitter(Generic[QuantumStatementT], Emitter[QuantumStatementT], VarSpl
|
|
115
115
|
self._top_level_scope[function_def.name] = Evaluated(
|
116
116
|
value=function_context.closure.with_new_declaration(function_def)
|
117
117
|
)
|
118
|
+
compilation_metadata = self._functions_compilation_metadata.get(
|
119
|
+
function.name
|
120
|
+
)
|
121
|
+
if compilation_metadata is not None:
|
122
|
+
self._expanded_functions_compilation_metadata[function_def.name] = (
|
123
|
+
compilation_metadata
|
124
|
+
)
|
125
|
+
else:
|
126
|
+
self._expanded_functions_compilation_metadata[
|
127
|
+
function_def.name
|
128
|
+
].occurrences_number += 1
|
129
|
+
|
118
130
|
new_declaration = function_def
|
119
131
|
new_function_name = function_def.name
|
120
|
-
compilation_metadata = self._functions_compilation_metadata.get(
|
121
|
-
function.name
|
122
|
-
)
|
123
|
-
if compilation_metadata is not None:
|
124
|
-
self._expanded_functions_compilation_metadata[new_function_name] = (
|
125
|
-
compilation_metadata
|
126
|
-
)
|
127
132
|
|
128
133
|
new_positional_args = self._get_new_positional_args(
|
129
134
|
evaluated_args, is_atomic, new_positional_arg_decls
|
@@ -239,13 +244,12 @@ class CallEmitter(Generic[QuantumStatementT], Emitter[QuantumStatementT], VarSpl
|
|
239
244
|
different from the call scope. For example, the former uses r,s and the latter
|
240
245
|
uses p, q.
|
241
246
|
"""
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
)
|
247
|
+
# The signature scope is passed as a separate argument to avoid contaminating the statement execution scope
|
248
|
+
return NamedParamsQuantumFunctionDeclaration(
|
249
|
+
name=function.name,
|
250
|
+
positional_arg_declarations=evaluate_parameter_types_from_args(
|
251
|
+
function,
|
252
|
+
function.signature_scope,
|
253
|
+
evaluated_args,
|
254
|
+
),
|
255
|
+
)
|
@@ -49,7 +49,6 @@ class Emitter(Generic[QuantumStatementT]):
|
|
49
49
|
def __init__(self, interpreter: "Interpreter") -> None:
|
50
50
|
self._interpreter = interpreter
|
51
51
|
|
52
|
-
self._scope_guard = self._interpreter._scope_guard
|
53
52
|
self._machine_precision = self._interpreter._model.preferences.machine_precision
|
54
53
|
self._expanded_functions_compilation_metadata = (
|
55
54
|
self._interpreter._expanded_functions_compilation_metadata
|
@@ -71,7 +70,7 @@ class Emitter(Generic[QuantumStatementT]):
|
|
71
70
|
|
72
71
|
@property
|
73
72
|
def _current_scope(self) -> Scope:
|
74
|
-
return self.
|
73
|
+
return self._builder.current_scope
|
75
74
|
|
76
75
|
@property
|
77
76
|
def _top_level_scope(self) -> Scope:
|
@@ -104,7 +103,7 @@ class Emitter(Generic[QuantumStatementT]):
|
|
104
103
|
)
|
105
104
|
gen_closure = GenerativeClosure(
|
106
105
|
name=func_decl.name,
|
107
|
-
scope=Scope(parent=self._interpreter.
|
106
|
+
scope=Scope(parent=self._interpreter._builder.current_scope),
|
108
107
|
blocks={},
|
109
108
|
generative_blocks={
|
110
109
|
block_name: GenerativeQFunc(
|
@@ -18,7 +18,7 @@ class QuantumFunctionCallEmitter(CallEmitter[QuantumFunctionCall]):
|
|
18
18
|
def emit(self, call: QuantumFunctionCall, /) -> None:
|
19
19
|
function = self._interpreter.evaluate(call.function).as_type(FunctionClosure)
|
20
20
|
args = call.positional_args
|
21
|
-
with ErrorManager().call(function.name)
|
21
|
+
with ErrorManager().call(function.name):
|
22
22
|
self._emit_quantum_function_call(
|
23
23
|
function, args, self._debug_info.get(call.uuid)
|
24
24
|
)
|
@@ -11,6 +11,9 @@ from classiq.interface.model.quantum_expressions.arithmetic_operation import (
|
|
11
11
|
ArithmeticOperation,
|
12
12
|
ArithmeticOperationKind,
|
13
13
|
)
|
14
|
+
from classiq.interface.model.quantum_expressions.quantum_expression import (
|
15
|
+
QuantumAssignmentOperation,
|
16
|
+
)
|
14
17
|
from classiq.interface.model.quantum_statement import QuantumOperation, QuantumStatement
|
15
18
|
|
16
19
|
from classiq.model_expansions.closure import Closure
|
@@ -68,12 +71,15 @@ class ShallowEmitter(Emitter[QuantumOperation]):
|
|
68
71
|
).value.handle
|
69
72
|
|
70
73
|
op = op.model_copy(update=expanded_components)
|
71
|
-
if isinstance(op,
|
74
|
+
if isinstance(op, QuantumAssignmentOperation):
|
72
75
|
self._post_process_assignment(op)
|
73
76
|
self._builder.emit_statement(op)
|
74
77
|
|
75
|
-
def _post_process_assignment(self, op:
|
76
|
-
if
|
78
|
+
def _post_process_assignment(self, op: QuantumAssignmentOperation) -> None:
|
79
|
+
if (
|
80
|
+
isinstance(op, ArithmeticOperation)
|
81
|
+
and op.operation_kind == ArithmeticOperationKind.Assignment
|
82
|
+
):
|
77
83
|
direction = PortDeclarationDirection.Output
|
78
84
|
self._update_result_type(op)
|
79
85
|
else:
|
@@ -2,7 +2,6 @@ import itertools
|
|
2
2
|
import re
|
3
3
|
from collections import UserDict
|
4
4
|
from collections.abc import Iterator
|
5
|
-
from contextlib import contextmanager
|
6
5
|
from dataclasses import dataclass
|
7
6
|
from functools import singledispatch
|
8
7
|
from typing import TYPE_CHECKING, Any, Optional, TypeVar, Union
|
@@ -231,14 +230,5 @@ class Scope(EvaluatedUserDict):
|
|
231
230
|
parent=parent,
|
232
231
|
)
|
233
232
|
|
234
|
-
def
|
235
|
-
return Scope(
|
236
|
-
self.data, parent=None if self._parent is None else self._parent.copy()
|
237
|
-
)
|
238
|
-
|
239
|
-
@contextmanager
|
240
|
-
def freeze(self) -> Iterator[None]:
|
241
|
-
previous = self._copy()
|
242
|
-
yield
|
243
|
-
self.data = previous.data
|
244
|
-
self._parent = previous._parent
|
233
|
+
def clone(self) -> "Scope":
|
234
|
+
return Scope(self.data, parent=self._parent)
|
@@ -1,16 +1,12 @@
|
|
1
1
|
import inspect
|
2
2
|
import sys
|
3
|
-
import warnings
|
4
3
|
from collections.abc import Mapping
|
5
4
|
from types import FrameType
|
6
5
|
from typing import (
|
7
|
-
TYPE_CHECKING,
|
8
6
|
Any,
|
9
7
|
Callable,
|
10
8
|
Final,
|
11
|
-
Optional,
|
12
9
|
Union,
|
13
|
-
overload,
|
14
10
|
)
|
15
11
|
|
16
12
|
from classiq.interface.exceptions import ClassiqValueError
|
@@ -44,7 +40,8 @@ from classiq.interface.model.repeat import Repeat
|
|
44
40
|
from classiq.interface.model.statement_block import StatementBlock
|
45
41
|
from classiq.interface.model.within_apply_operation import WithinApply
|
46
42
|
|
47
|
-
from classiq.qmod.
|
43
|
+
from classiq.qmod.generative import is_generative_mode
|
44
|
+
from classiq.qmod.qmod_variable import Input, Output, QArray, QBit, QScalar, QVar
|
48
45
|
from classiq.qmod.quantum_callable import QCallable
|
49
46
|
from classiq.qmod.quantum_expandable import prepare_arg
|
50
47
|
from classiq.qmod.symbolic_expr import SymbolicExpr
|
@@ -89,9 +86,10 @@ def if_(
|
|
89
86
|
else_=_operand_to_body(else_, "else") if else_ != _MISSING_VALUE else [], # type: ignore[arg-type]
|
90
87
|
source_ref=source_ref,
|
91
88
|
)
|
92
|
-
|
93
|
-
|
94
|
-
|
89
|
+
if is_generative_mode():
|
90
|
+
if_stmt.set_generative_block("then", then)
|
91
|
+
if callable(else_):
|
92
|
+
if_stmt.set_generative_block("else", else_)
|
95
93
|
QCallable.CURRENT_EXPANDABLE.append_statement_to_body(if_stmt)
|
96
94
|
|
97
95
|
|
@@ -109,9 +107,10 @@ def control(
|
|
109
107
|
else_block=_operand_to_body(else_block, "else_block") if else_block else None,
|
110
108
|
source_ref=source_ref,
|
111
109
|
)
|
112
|
-
|
113
|
-
|
114
|
-
|
110
|
+
if is_generative_mode():
|
111
|
+
control_stmt.set_generative_block("body", stmt_block)
|
112
|
+
if else_block is not None:
|
113
|
+
control_stmt.set_generative_block("else_block", else_block)
|
115
114
|
QCallable.CURRENT_EXPANDABLE.append_statement_to_body(control_stmt)
|
116
115
|
|
117
116
|
|
@@ -161,22 +160,7 @@ def assign_amplitude(expression: SymbolicExpr, target_var: QScalar) -> None:
|
|
161
160
|
)
|
162
161
|
|
163
162
|
|
164
|
-
@overload
|
165
163
|
def inplace_add(expression: SymbolicExpr, target_var: QScalar) -> None:
|
166
|
-
pass
|
167
|
-
|
168
|
-
|
169
|
-
@overload
|
170
|
-
def inplace_add(*, value: QNum, target: QNum) -> None:
|
171
|
-
pass
|
172
|
-
|
173
|
-
|
174
|
-
def inplace_add(
|
175
|
-
expression: Optional[SymbolicExpr] = None,
|
176
|
-
target_var: Optional[QScalar] = None,
|
177
|
-
value: Optional[QNum] = None,
|
178
|
-
target: Optional[QNum] = None,
|
179
|
-
) -> None:
|
180
164
|
"""
|
181
165
|
Add an arithmetic expression to a quantum variable.
|
182
166
|
|
@@ -187,23 +171,6 @@ def inplace_add(
|
|
187
171
|
target_var: A scalar quantum variable
|
188
172
|
"""
|
189
173
|
assert QCallable.CURRENT_EXPANDABLE is not None
|
190
|
-
if value is not None or target is not None:
|
191
|
-
warnings.warn(
|
192
|
-
"Parameters 'value' and 'target of function 'inplace_add' have "
|
193
|
-
"been renamed to 'expression' and 'target_var' respectively. Parameters "
|
194
|
-
"'value' and 'target' will no longer be supported starting on 02/12/24 at "
|
195
|
-
"the earliest.\nHint: Change `inplace_add(value=..., target=...)` to "
|
196
|
-
"`inplace_add(expression=..., target_var=...)` or `inplace_add(..., ...)`.",
|
197
|
-
category=DeprecationWarning,
|
198
|
-
stacklevel=2,
|
199
|
-
)
|
200
|
-
if value is not None:
|
201
|
-
expression = value
|
202
|
-
if target is not None:
|
203
|
-
target_var = target
|
204
|
-
if TYPE_CHECKING:
|
205
|
-
assert expression is not None
|
206
|
-
assert target_var is not None
|
207
174
|
source_ref = get_source_ref(sys._getframe(1))
|
208
175
|
QCallable.CURRENT_EXPANDABLE.append_statement_to_body(
|
209
176
|
ArithmeticOperation(
|
@@ -215,22 +182,7 @@ def inplace_add(
|
|
215
182
|
)
|
216
183
|
|
217
184
|
|
218
|
-
@overload
|
219
185
|
def inplace_xor(expression: SymbolicExpr, target_var: QScalar) -> None:
|
220
|
-
pass
|
221
|
-
|
222
|
-
|
223
|
-
@overload
|
224
|
-
def inplace_xor(*, value: QNum, target: QNum) -> None:
|
225
|
-
pass
|
226
|
-
|
227
|
-
|
228
|
-
def inplace_xor(
|
229
|
-
expression: Optional[SymbolicExpr] = None,
|
230
|
-
target_var: Optional[QScalar] = None,
|
231
|
-
value: Optional[QNum] = None,
|
232
|
-
target: Optional[QNum] = None,
|
233
|
-
) -> None:
|
234
186
|
"""
|
235
187
|
Bitwise-XOR a quantum variable with an arithmetic expression.
|
236
188
|
|
@@ -241,23 +193,6 @@ def inplace_xor(
|
|
241
193
|
target_var: A scalar quantum variable
|
242
194
|
"""
|
243
195
|
assert QCallable.CURRENT_EXPANDABLE is not None
|
244
|
-
if value is not None or target is not None:
|
245
|
-
warnings.warn(
|
246
|
-
"Parameters 'value' and 'target of function 'inplace_xor' have "
|
247
|
-
"been renamed to 'expression' and 'target_var' respectively. Parameters "
|
248
|
-
"'value' and 'target' will no longer be supported starting on 02/12/24 at "
|
249
|
-
"the earliest.\nHint: Change `inplace_xor(value=..., target=...)` to "
|
250
|
-
"`inplace_xor(expression=..., target_var=...)` or `inplace_xor(..., ...)`.",
|
251
|
-
category=DeprecationWarning,
|
252
|
-
stacklevel=2,
|
253
|
-
)
|
254
|
-
if value is not None:
|
255
|
-
expression = value
|
256
|
-
if target is not None:
|
257
|
-
target_var = target
|
258
|
-
if TYPE_CHECKING:
|
259
|
-
assert expression is not None
|
260
|
-
assert target_var is not None
|
261
196
|
source_ref = get_source_ref(sys._getframe(1))
|
262
197
|
QCallable.CURRENT_EXPANDABLE.append_statement_to_body(
|
263
198
|
ArithmeticOperation(
|
@@ -282,8 +217,9 @@ def within_apply(
|
|
282
217
|
action=_operand_to_body(apply, "apply"),
|
283
218
|
source_ref=source_ref,
|
284
219
|
)
|
285
|
-
|
286
|
-
|
220
|
+
if is_generative_mode():
|
221
|
+
within_apply_stmt.set_generative_block("within", within)
|
222
|
+
within_apply_stmt.set_generative_block("apply", apply)
|
287
223
|
QCallable.CURRENT_EXPANDABLE.append_statement_to_body(within_apply_stmt)
|
288
224
|
|
289
225
|
|
@@ -313,7 +249,8 @@ def repeat(count: Union[SymbolicExpr, int], iteration: Callable[[int], None]) ->
|
|
313
249
|
body=iteration_operand.body,
|
314
250
|
source_ref=source_ref,
|
315
251
|
)
|
316
|
-
|
252
|
+
if is_generative_mode():
|
253
|
+
repeat_stmt.set_generative_block("body", iteration)
|
317
254
|
QCallable.CURRENT_EXPANDABLE.append_statement_to_body(repeat_stmt)
|
318
255
|
|
319
256
|
|
@@ -329,7 +266,8 @@ def power(
|
|
329
266
|
body=_operand_to_body(stmt_block, "stmt_block"),
|
330
267
|
source_ref=source_ref,
|
331
268
|
)
|
332
|
-
|
269
|
+
if is_generative_mode():
|
270
|
+
power_stmt.set_generative_block("body", stmt_block)
|
333
271
|
QCallable.CURRENT_EXPANDABLE.append_statement_to_body(power_stmt)
|
334
272
|
|
335
273
|
|
@@ -340,7 +278,8 @@ def invert(stmt_block: Union[QCallable, Callable[[], None]]) -> None:
|
|
340
278
|
invert_stmt = Invert(
|
341
279
|
body=_operand_to_body(stmt_block, "stmt_block"), source_ref=source_ref
|
342
280
|
)
|
343
|
-
|
281
|
+
if is_generative_mode():
|
282
|
+
invert_stmt.set_generative_block("body", stmt_block)
|
344
283
|
QCallable.CURRENT_EXPANDABLE.append_statement_to_body(invert_stmt)
|
345
284
|
|
346
285
|
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import dataclasses
|
2
2
|
import inspect
|
3
|
-
import sys
|
4
3
|
from enum import EnumMeta
|
5
4
|
from typing import (
|
6
5
|
Optional,
|
@@ -16,16 +15,13 @@ from classiq.interface.generator.functions.classical_type import (
|
|
16
15
|
Integer,
|
17
16
|
Real,
|
18
17
|
)
|
18
|
+
from classiq.interface.generator.functions.concrete_types import ConcreteClassicalType
|
19
19
|
from classiq.interface.generator.functions.type_name import Enum, Struct
|
20
20
|
|
21
21
|
from classiq.qmod.cparam import CArray, CBool, CInt, CReal
|
22
22
|
from classiq.qmod.qmod_variable import get_type_hint_expr
|
23
23
|
from classiq.qmod.utilities import version_portable_get_args
|
24
24
|
|
25
|
-
if sys.version_info[0:2] >= (3, 9):
|
26
|
-
pass
|
27
|
-
from classiq.interface.generator.functions.concrete_types import ConcreteClassicalType
|
28
|
-
|
29
25
|
CARRAY_ERROR_MESSAGE = (
|
30
26
|
"CArray accepts one or two generic parameters in the form "
|
31
27
|
"`CArray[<element-type>]` or `CArray[<element-type>, <size>]`"
|
@@ -336,7 +336,8 @@ def prepare_arg(
|
|
336
336
|
pos_rename_params=val.infer_rename_params(),
|
337
337
|
body=val.body,
|
338
338
|
)
|
339
|
-
|
339
|
+
if is_generative_mode():
|
340
|
+
qlambda.set_py_callable(val._py_callable)
|
340
341
|
return qlambda
|
341
342
|
|
342
343
|
if isinstance(val, QExpandable):
|
classiq/qmod/quantum_function.py
CHANGED
@@ -90,10 +90,10 @@ class QFunc(BaseQFunc):
|
|
90
90
|
|
91
91
|
@property
|
92
92
|
def func_decl(self) -> NamedParamsQuantumFunctionDeclaration:
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
)
|
93
|
+
name = self._py_callable.__name__
|
94
|
+
if hasattr(self._qmodule, "native_defs") and name in self._qmodule.native_defs:
|
95
|
+
return self._qmodule.native_defs[name]
|
96
|
+
return infer_func_decl(self._py_callable, qmodule=self._qmodule)
|
97
97
|
|
98
98
|
def __call__(self, *args: Any, **kwargs: Any) -> None:
|
99
99
|
super().__call__(*args, **kwargs)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: classiq
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.62.0
|
4
4
|
Summary: Classiq's Python SDK for quantum computing
|
5
5
|
Home-page: https://classiq.io
|
6
6
|
License: Proprietary
|
@@ -53,6 +53,7 @@ Requires-Dist: sympy (>=1.13.0,<2.0.0)
|
|
53
53
|
Requires-Dist: tabulate (>=0.8.9,<1)
|
54
54
|
Requires-Dist: torch (>=2.0,<3.0) ; extra == "qml"
|
55
55
|
Requires-Dist: torchvision (>=0.15,<1.0) ; extra == "qml"
|
56
|
+
Requires-Dist: tqdm (>=4.67.1,<5.0.0)
|
56
57
|
Project-URL: Documentation, https://docs.classiq.io/
|
57
58
|
Description-Content-Type: text/markdown
|
58
59
|
|
@@ -39,12 +39,12 @@ classiq/applications/combinatorial_helpers/combinatorial_problem_utils.py,sha256
|
|
39
39
|
classiq/applications/combinatorial_helpers/encoding_mapping.py,sha256=ULt_ZGzhiu2QMVv5L9Eo7VzsgPYmfUAiE1wG2_CnqQ8,3652
|
40
40
|
classiq/applications/combinatorial_helpers/encoding_utils.py,sha256=Y75F2IHwjlwGshtqsfBG1U_S3cOl2eWu4zNZcCJ5nGE,3835
|
41
41
|
classiq/applications/combinatorial_helpers/memory.py,sha256=b-VKPf8UiMxjQR5DICLoeV58noDgVTZz1iK218wvdNo,2283
|
42
|
-
classiq/applications/combinatorial_helpers/optimization_model.py,sha256=
|
42
|
+
classiq/applications/combinatorial_helpers/optimization_model.py,sha256=5B805lVSVPtoNVg0yRWCLQ0hAWNOD7g2H3dTW8WxWcs,7225
|
43
43
|
classiq/applications/combinatorial_helpers/pauli_helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
44
44
|
classiq/applications/combinatorial_helpers/pauli_helpers/pauli_sparsing.py,sha256=-vsJgA4Th3wrIxjNrG7Vv6ME8iZbw8rLuFZ99-tRpEc,1263
|
45
45
|
classiq/applications/combinatorial_helpers/pauli_helpers/pauli_utils.py,sha256=kNDQicBmZzofaMsOWaOWptngmBAu-LE2wwSy2S9PGtE,1644
|
46
46
|
classiq/applications/combinatorial_helpers/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
47
|
-
classiq/applications/combinatorial_helpers/pyomo_utils.py,sha256=
|
47
|
+
classiq/applications/combinatorial_helpers/pyomo_utils.py,sha256=rEBmu-E3nhoD9l4hKP7cLGSt9uUfgqTdQAj57k0zhdI,12202
|
48
48
|
classiq/applications/combinatorial_helpers/solvers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
49
49
|
classiq/applications/combinatorial_helpers/sympy_utils.py,sha256=vz85CdjuM-EJmEH0kCTIy5RmPqj_S1g2lb417gMzsks,673
|
50
50
|
classiq/applications/combinatorial_helpers/transformations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -58,7 +58,7 @@ classiq/applications/combinatorial_helpers/transformations/slack_variables.py,sh
|
|
58
58
|
classiq/applications/combinatorial_optimization/__init__.py,sha256=FQv7Kga4aciJzuRuv9SiFLP2uTJdsYpzYZEaH3_cjsE,1050
|
59
59
|
classiq/applications/combinatorial_optimization/combinatorial_optimization_config.py,sha256=jCN7iQJfEVIZE8sx60XzBrPBcBEOHVFXHhOZbq4auRw,618
|
60
60
|
classiq/applications/combinatorial_optimization/combinatorial_optimization_model_constructor.py,sha256=Z22Xw9vhc-q03cm-WFnEgt0ML2_JrjHv5ow5kCjn50U,5314
|
61
|
-
classiq/applications/combinatorial_optimization/combinatorial_problem.py,sha256=
|
61
|
+
classiq/applications/combinatorial_optimization/combinatorial_problem.py,sha256=APwtVlymPCKyEd1Tpe1tWELWj0xV8JMJZ_JWBS3MPPg,7963
|
62
62
|
classiq/applications/combinatorial_optimization/examples/__init__.py,sha256=A0-j2W4dT6eyvRvIoUzK3trntkda3IBpX-tch8evi1M,1725
|
63
63
|
classiq/applications/finance/__init__.py,sha256=1ntNgF5XLrAWhjvgncAdVIG0w80J8dmADySCK_xz2Tk,355
|
64
64
|
classiq/applications/finance/finance_model_constructor.py,sha256=MQdrYHOYeWG0pMSflM23EskmIIPqZWJ1u-_HKEjrhGQ,6535
|
@@ -91,11 +91,11 @@ classiq/execution/__init__.py,sha256=91aJlyrskj_FLmT-2atwIucYKAKsg4o8ZOR15axBFPM
|
|
91
91
|
classiq/execution/all_hardware_devices.py,sha256=KpLefEISE03FDdgFPGggXeG7NAxBW4090gN4272Dl-E,368
|
92
92
|
classiq/execution/execution_session.py,sha256=j63Ty3Qsbmn1dxV9XfJfKizosUSfj0cwzOwgrCsJ2lE,17905
|
93
93
|
classiq/execution/iqcc.py,sha256=0wy1tgQFcwqf9wFYyi6_OYRtx4s0AEViIAIvUkyKBmk,2429
|
94
|
-
classiq/execution/jobs.py,sha256=
|
94
|
+
classiq/execution/jobs.py,sha256=cdZsnyedslwT_B3-g6NmlpBoW0ZV00gqdMPBdSjAork,11263
|
95
95
|
classiq/execution/qnn.py,sha256=WGPvncz5uS2WxSY3-yBWt2LFiCk6Ug8WKWF-Kp-f7TM,2403
|
96
96
|
classiq/executor.py,sha256=JukmHbvH43cXWBzr1-LPk5gDz4LItJncEUaghZwmldY,2686
|
97
97
|
classiq/interface/__init__.py,sha256=cg7hD_XVu1_jJ1fgwmT0rMIoZHopNVeB8xtlmMx-E_A,83
|
98
|
-
classiq/interface/_version.py,sha256=
|
98
|
+
classiq/interface/_version.py,sha256=YgEZsFgTMHuaV7Cc1BAcjtBbx6-7_5r2f2UqhVB6NxE,197
|
99
99
|
classiq/interface/analyzer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
100
100
|
classiq/interface/analyzer/analysis_params.py,sha256=dM5rwSks798cxk4FWe4_X5ToRYtgZQh34F1u0XrFkK8,3881
|
101
101
|
classiq/interface/analyzer/cytoscape_graph.py,sha256=MpeRBIYS1TfwYwiFpgTO51IE0KoxhY510pmEM3S0rbw,2361
|
@@ -104,11 +104,11 @@ classiq/interface/applications/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5
|
|
104
104
|
classiq/interface/applications/qsvm.py,sha256=4dHVSZH--sv58SvxmpDHPh9JDr4qQUZbbGCeaEv6b1I,3408
|
105
105
|
classiq/interface/ast_node.py,sha256=EE06R8KwRA-QkK44Ou9TmMxiaa8J60G9Z9qf9T76k_k,398
|
106
106
|
classiq/interface/backend/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
107
|
-
classiq/interface/backend/backend_preferences.py,sha256=
|
107
|
+
classiq/interface/backend/backend_preferences.py,sha256=DuDfcUsN-5KOPKpjWr_zvM0UEBnrVX7NtdWY5OKXDVo,21743
|
108
108
|
classiq/interface/backend/ionq/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
109
109
|
classiq/interface/backend/ionq/ionq_quantum_program.py,sha256=f8w1XvgIggaM_w9TF0_wkQHB3wamXg5kHMNsgtCsH3k,1235
|
110
110
|
classiq/interface/backend/pydantic_backend.py,sha256=6Lv71R6k-_kl2NfO86BcCCHmnMNs9VNbOB56pNVVJyY,1596
|
111
|
-
classiq/interface/backend/quantum_backend_providers.py,sha256=
|
111
|
+
classiq/interface/backend/quantum_backend_providers.py,sha256=zMWV_-Y0lA8iGe2q4uHT5ODgfrEWDOu-XwMpXwdamuA,6673
|
112
112
|
classiq/interface/chemistry/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
113
113
|
classiq/interface/chemistry/ansatz_library.py,sha256=3ki3uaV77cUxUxUzDbn3mVhjvMoKejJ5bIR1kXpBT1k,360
|
114
114
|
classiq/interface/chemistry/elements.py,sha256=Yy8L80SBVgmuKQyW-GlZKzwTqnP1O9po-FGFmKMJLRA,1181
|
@@ -212,6 +212,7 @@ classiq/interface/generator/compiler_keywords.py,sha256=2qH3291K2eaY6dZggXUr3nTG
|
|
212
212
|
classiq/interface/generator/complex_type.py,sha256=tQ-2vUkXhpWz7dOMmcRTfd3tMJfXDvFkdy-KkQwe2FA,480
|
213
213
|
classiq/interface/generator/constant.py,sha256=cLhRil6sof0UyYRU4lKdm_aBRcmmz7dtvX5bbNpb7N8,309
|
214
214
|
classiq/interface/generator/control_state.py,sha256=eioObKxQt-g69NF3_-2QhLwO2mA5BIkFJnvqolwGFxk,2745
|
215
|
+
classiq/interface/generator/copy.py,sha256=Gb_3JlVg-pXuMaGhLAzerHo2pEh7TUX6Dnxf7-Fa-CI,1372
|
215
216
|
classiq/interface/generator/custom_ansatz.py,sha256=V_ezOlHUQDn5N6r-jE-W-xLeJHzV_cFUGZfN_BDPoP8,879
|
216
217
|
classiq/interface/generator/distance.py,sha256=6u__ZB9VQvBrxePYm7yPKb_HtmITViPzF-F_I-qTgkE,1210
|
217
218
|
classiq/interface/generator/entangler_params.py,sha256=wU5fzmTQ-sinEwsswdjsnX9_IupLp6Jn-2SXpqUcYRY,3108
|
@@ -237,7 +238,7 @@ classiq/interface/generator/expressions/type_proxy.py,sha256=2TSxdmmhnz78jxzPTqG
|
|
237
238
|
classiq/interface/generator/finance.py,sha256=qlaBNQomMaxkbHjxXKZ2O9w9LK3im4_hyGPsigcbXT8,3968
|
238
239
|
classiq/interface/generator/function_param_library.py,sha256=MzxtngUMoyRxxTZ3CRH_OR23Q5S-cxuxDsH0qwY-ZiM,630
|
239
240
|
classiq/interface/generator/function_param_list.py,sha256=C__iX_ETyhm6B-ecfzFUQY7Tyz6aMVWx8_6ZUQuPg3M,503
|
240
|
-
classiq/interface/generator/function_param_list_without_self_reference.py,sha256=
|
241
|
+
classiq/interface/generator/function_param_list_without_self_reference.py,sha256=wICu6BQ3iqV4Yvg19vInr6lklyeeISJ_NtDoFYMP9ZE,5592
|
241
242
|
classiq/interface/generator/function_params.py,sha256=qo0JrN5nbNmh3nB2WUMftMS-c4o-oCh6KnljLBe7bLg,9677
|
242
243
|
classiq/interface/generator/functions/__init__.py,sha256=HXHq8Fw2zHG3AYuRXrDEQdJ-CEFX7ibsNCp8czuCmmM,73
|
243
244
|
classiq/interface/generator/functions/builtins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -272,7 +273,7 @@ classiq/interface/generator/model/__init__.py,sha256=iSabzwl3eN2iTRvdkRBmybAsy0o
|
|
272
273
|
classiq/interface/generator/model/constraints.py,sha256=8LM-2NT8jARIzehBLmR2Z1hHwpQT-TwezWvnt82tTBE,2575
|
273
274
|
classiq/interface/generator/model/model.py,sha256=VoAHk_wnL0GHd9BV2yjqGQR_fyDaCp5vlZOe7QJXtaE,2466
|
274
275
|
classiq/interface/generator/model/preferences/__init__.py,sha256=KTNkU8hK3cpqzXvw_C1maxhBRTm1H53WUen1jJwZ0fQ,256
|
275
|
-
classiq/interface/generator/model/preferences/preferences.py,sha256=
|
276
|
+
classiq/interface/generator/model/preferences/preferences.py,sha256=lwbnvqKUPVGOzUZxj0-4DzahvyH8GckTKgTGqL5kf8g,11171
|
276
277
|
classiq/interface/generator/model/preferences/randomness.py,sha256=nAI8Fu9NQ0uJxuwIQCUDspJKMCQVHBbvPNqCTtrBEos,248
|
277
278
|
classiq/interface/generator/model/quantum_register.py,sha256=_q5ASP_a5PrnpxN4aN2Yw00C1bh_KgIwiW1nTCRnuSw,8026
|
278
279
|
classiq/interface/generator/noise_properties.py,sha256=onvXd_FeBznwu1AcOpAkL7-fo9Dc6tPcAIiL5Qxs2Ok,425
|
@@ -320,7 +321,7 @@ classiq/interface/generator/synthesis_metadata/synthesis_execution_data.py,sha25
|
|
320
321
|
classiq/interface/generator/transpiler_basis_gates.py,sha256=4MHl6uI3Fa8bl1w_kGQC_2y_CQGxnKXbWSp5ezaw-w0,2397
|
321
322
|
classiq/interface/generator/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
322
323
|
classiq/interface/generator/types/builtin_enum_declarations.py,sha256=kzrmQhyvIAO0FG1b4eHNVM7v0YYg5weXtLYYalejARE,2316
|
323
|
-
classiq/interface/generator/types/compilation_metadata.py,sha256=
|
324
|
+
classiq/interface/generator/types/compilation_metadata.py,sha256=TumieFiKwpt7tuje_CipXRJeg87YSr4hOg1uRr6cIU8,214
|
324
325
|
classiq/interface/generator/types/enum_declaration.py,sha256=NLSkIANe33qubSDGmxROhNFZNuIDcJjRA-ZRuKhiZ5g,1712
|
325
326
|
classiq/interface/generator/types/qstruct_declaration.py,sha256=Qw6cHW_elZmrs4UO0z7lgS7TWb0hEUEJ5Ur-Ko0bCR4,485
|
326
327
|
classiq/interface/generator/types/struct_declaration.py,sha256=2qKVV-pdqeUGiwKh2-5W2Ci4z0aQG4TG91MuQ82fa_A,959
|
@@ -390,9 +391,9 @@ classiq/interface/source_reference.py,sha256=a-4Vdc511ux-0lDPDTRGAzouRWWtu4A3MPA
|
|
390
391
|
classiq/model_expansions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
391
392
|
classiq/model_expansions/atomic_expression_functions_defs.py,sha256=cmue5ocNkPDo2KrryYxdzngow3BS7N1X0xOiu17roP4,8547
|
392
393
|
classiq/model_expansions/capturing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
393
|
-
classiq/model_expansions/capturing/captured_vars.py,sha256=
|
394
|
+
classiq/model_expansions/capturing/captured_vars.py,sha256=q_-5WBk33LKKrizAkJRHejIXPny5RuZ1vRxTiNy6Kgc,12527
|
394
395
|
classiq/model_expansions/capturing/mangling_utils.py,sha256=wfCsjP0pScZv9YP6JXq3oVhkS-lCFyUoZ9IROBHS3Ek,1858
|
395
|
-
classiq/model_expansions/closure.py,sha256=
|
396
|
+
classiq/model_expansions/closure.py,sha256=Va5xPaDEyzHmhBQYP5vp8vyY_6YMhQhLVVAGLzIcmEc,6709
|
396
397
|
classiq/model_expansions/debug_flag.py,sha256=JWzl9FFq2CLcvTg_sh-K8Dp_xXvewsTuFKhPjTCrsrs,107
|
397
398
|
classiq/model_expansions/evaluators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
398
399
|
classiq/model_expansions/evaluators/arg_type_match.py,sha256=nMRYHy2eMaG29NhlOdZWMg_qJHLWnKdW-FYrGxmRgjo,6155
|
@@ -404,28 +405,28 @@ classiq/model_expansions/evaluators/quantum_type_utils.py,sha256=5H5ri5RW6TLdXhn
|
|
404
405
|
classiq/model_expansions/evaluators/type_type_match.py,sha256=3akZR86TAFKUyM5c5knCPSlraI3LQeWZXxXMTtmu0BI,3220
|
405
406
|
classiq/model_expansions/expression_evaluator.py,sha256=WO6m6kkD1VHaqzEnt4PMQIAkDSal1wA-4VbbpjLj690,4382
|
406
407
|
classiq/model_expansions/expression_renamer.py,sha256=rtAf-vvJhlwh-KCs2WgxdW4lP3UjA0vUtZeHcIoTwUM,2692
|
407
|
-
classiq/model_expansions/function_builder.py,sha256=
|
408
|
-
classiq/model_expansions/generative_functions.py,sha256=
|
409
|
-
classiq/model_expansions/interpreter.py,sha256=
|
408
|
+
classiq/model_expansions/function_builder.py,sha256=TNUIYtZ9w8ELXc8a-4QWzXC_hL7EWMIhcg9-5o2JsiE,7575
|
409
|
+
classiq/model_expansions/generative_functions.py,sha256=b-R7VS3miFWFQEXTiCf65CvwvoZGZyrzG87I0h8YfnQ,5630
|
410
|
+
classiq/model_expansions/interpreter.py,sha256=0CV1QbxR_g5u88Pw4nLiw413b0KY0H-DdbYimdAGhGw,16093
|
410
411
|
classiq/model_expansions/model_tables.py,sha256=C0ZhCF1GAmgCqkm6iTNO9-cj_YdwGpE8etKvVxWx1w8,3585
|
411
412
|
classiq/model_expansions/quantum_operations/__init__.py,sha256=BMruLYFsir2nU9Du9PZBcQzQsgIc-4Zpkx8CJmvbL14,1040
|
412
413
|
classiq/model_expansions/quantum_operations/bind.py,sha256=A1XPXnoexaKUlgUZSAn88SYXmXjo1G9-fCAJS67gM-c,2515
|
413
|
-
classiq/model_expansions/quantum_operations/call_emitter.py,sha256=
|
414
|
+
classiq/model_expansions/quantum_operations/call_emitter.py,sha256=jGSJN0ZDMOHHJlNho4sNgpLamputh86hBXYXoQY78Hc,10324
|
414
415
|
classiq/model_expansions/quantum_operations/classicalif.py,sha256=egWgO_xx8ohiA71KAo6glNxoQqEgH1MQQ9EbT-JQRV4,2027
|
415
416
|
classiq/model_expansions/quantum_operations/control.py,sha256=cgNLu38Dez_cfDCzfintcjiYvyeXk3DZK0V6THqk5QA,12186
|
416
|
-
classiq/model_expansions/quantum_operations/emitter.py,sha256
|
417
|
+
classiq/model_expansions/quantum_operations/emitter.py,sha256=uhi7OWy_Jan7lQGzaLFp4MnXu8BWb1kqweRij06s2ZA,6630
|
417
418
|
classiq/model_expansions/quantum_operations/expression_operation.py,sha256=aW-0VmmWF5_0v4yWFNQdXoN9HiJQWJmWyIS3uDvjLWI,3962
|
418
419
|
classiq/model_expansions/quantum_operations/inplace_binary_operation.py,sha256=BGBXV-NKFaL86qpdQZBKieLfrFajdtUipQ4AnyKIs9I,18213
|
419
420
|
classiq/model_expansions/quantum_operations/invert.py,sha256=zsxUkakWgpoF07MHst03ahGXWQaulTDE0n_Zf9OV7Xs,1287
|
420
421
|
classiq/model_expansions/quantum_operations/phase.py,sha256=PXbGRUHBVEXGzzDpeTjA1iAZSPuc66KMgw8De3tNFbE,7061
|
421
422
|
classiq/model_expansions/quantum_operations/power.py,sha256=uSMMsA4n6FDhdFZY_S1d1Uo6tx5yGUotvcClsBCTFXg,2468
|
422
423
|
classiq/model_expansions/quantum_operations/quantum_assignment_operation.py,sha256=7g-IOndlnRRC-Dk06l9YWAwBfHQiDN6DOs4jkR-lFc4,9141
|
423
|
-
classiq/model_expansions/quantum_operations/quantum_function_call.py,sha256=
|
424
|
+
classiq/model_expansions/quantum_operations/quantum_function_call.py,sha256=9pATOFHUz2Co9fVBXqgaWoWPPgR-h_C0HfWC57e5-C8,970
|
424
425
|
classiq/model_expansions/quantum_operations/repeat.py,sha256=2gvc6OwU6Tz6qwRFhGJ11Rjju4Xw1CaRoV0hnH4KB5c,2205
|
425
|
-
classiq/model_expansions/quantum_operations/shallow_emitter.py,sha256
|
426
|
+
classiq/model_expansions/quantum_operations/shallow_emitter.py,sha256=hTAtlIND2Nw7Dwzw6y52pgNdEFItYTbTy5yjupzaVZY,6361
|
426
427
|
classiq/model_expansions/quantum_operations/variable_decleration.py,sha256=OG_uWndzpPX4rJ3ij_7iOtcS779ubS-Uo2RT1GHdR60,1199
|
427
428
|
classiq/model_expansions/quantum_operations/within_apply.py,sha256=IbQ9sLWGzn-B_W-oHgdynyrnh2Sl4ZTksEETzeKQ508,982
|
428
|
-
classiq/model_expansions/scope.py,sha256=
|
429
|
+
classiq/model_expansions/scope.py,sha256=D0EPsmIuIYfVVslb47L7JkoWle4iv47uRrq6V2r3GJQ,7594
|
429
430
|
classiq/model_expansions/scope_initialization.py,sha256=JbDKMGm7p-wNJjUBIR1Fy9LAs_w2bViyJHr2xivNYRI,5245
|
430
431
|
classiq/model_expansions/sympy_conversion/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
431
432
|
classiq/model_expansions/sympy_conversion/arithmetics.py,sha256=7ZKg1C92wUdxtFhrT4VuI9mNvH2a1z1R8lbWYFhYczc,1116
|
@@ -470,7 +471,7 @@ classiq/qmod/builtins/functions/state_preparation.py,sha256=7fUA2J6tz2nx4Xrac-WL
|
|
470
471
|
classiq/qmod/builtins/functions/swap_test.py,sha256=7-QLxSJhBjkxp7Kvdf0kaxOa2GwLJ_eQNYo4NgGdjcE,1112
|
471
472
|
classiq/qmod/builtins/functions/utility_functions.py,sha256=PjIe1gfyoh1rp1nWHt_gz7YL4c6JgPZy0Y3ZEnnz4sE,1150
|
472
473
|
classiq/qmod/builtins/functions/variational.py,sha256=wQDkQ3lv2BxWhCJUJd4XioCCAkB-GoeH1mZDiFVa5A4,1776
|
473
|
-
classiq/qmod/builtins/operations.py,sha256=
|
474
|
+
classiq/qmod/builtins/operations.py,sha256=ubmd_Nw7IVYorGooQ8ZwRx8OagE2pMVk6bsJO40SuDY,13712
|
474
475
|
classiq/qmod/builtins/structs.py,sha256=OpPDFcnZkIo1N9EQVXjqDkEk46vtzA8FmcCv2KarJFg,2913
|
475
476
|
classiq/qmod/cfunc.py,sha256=e3zWNEloBBPy-wJaGI1K5cdNFbd3oq0o4TUY2YDr6ks,1087
|
476
477
|
classiq/qmod/classical_function.py,sha256=iHm6T719PUZQPwuNSkouaMA8J9yHrrHUpP-2AQjsA5g,1088
|
@@ -486,14 +487,14 @@ classiq/qmod/native/pretty_printer.py,sha256=BMqoY5TlAWR3cxhbpJbZWX3D2Tc5cal_yqm
|
|
486
487
|
classiq/qmod/pretty_print/__init__.py,sha256=jhR0cpXumOJnyb-zWnvMLpEuUOYPnnJ7DJmV-Zxpy1I,132
|
487
488
|
classiq/qmod/pretty_print/expression_to_python.py,sha256=QoRP817CFEp3Ad3Q3hxWW-hbVzWQbHQIGUHjZkpZDm8,7480
|
488
489
|
classiq/qmod/pretty_print/pretty_printer.py,sha256=NIKcJmleFz3FIe7MvfaL_xxx0Bo1kf4w0N4BrCzkHGo,23213
|
489
|
-
classiq/qmod/python_classical_type.py,sha256=
|
490
|
+
classiq/qmod/python_classical_type.py,sha256=aU7QYrz7_ZRjmgjjS1DPq3tPm3SzuqZoxlJ4ZuKX0XI,2456
|
490
491
|
classiq/qmod/qfunc.py,sha256=pDyGqHhITayNFvcns-IknAG_KHTqlqHaQfHRF25Yc44,1949
|
491
492
|
classiq/qmod/qmod_constant.py,sha256=YawkwhhOLqFyFUyhE13Q_zCnex_Ki46hePRwGJmr5oU,4853
|
492
493
|
classiq/qmod/qmod_parameter.py,sha256=PpK4rzY0Hszgbzr_lclROcZ7JPqnhDJBYsSQkUjkcs8,4294
|
493
494
|
classiq/qmod/qmod_variable.py,sha256=xOYCvvLx0OOC1axFE3_tyQb1c68LumpCp0--cGDb8hE,24059
|
494
495
|
classiq/qmod/quantum_callable.py,sha256=sthlH5UJyJsdOxpCW3_EW3JFIYd0r1K3Zec1CDbC2-0,2451
|
495
|
-
classiq/qmod/quantum_expandable.py,sha256=
|
496
|
-
classiq/qmod/quantum_function.py,sha256=
|
496
|
+
classiq/qmod/quantum_expandable.py,sha256=3dTRcm3LZ0YnUc1NRUkOEsRTuiGJcrCMK5qzcCMR9mg,16162
|
497
|
+
classiq/qmod/quantum_function.py,sha256=qoo_UYMAs11sD17hlkmOlmJmJqEwA5AJr6wq7F0jSNs,10162
|
497
498
|
classiq/qmod/semantics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
498
499
|
classiq/qmod/semantics/annotation.py,sha256=0IeRymMK20sPHzbs7EzGoqhZICQmR6-gXR3SS9sr9OE,1255
|
499
500
|
classiq/qmod/semantics/error_manager.py,sha256=KAnNaQE0YarkXTQ0du3mvCqGCbbH-d81sv2Ti-NpkL4,2783
|
@@ -513,6 +514,6 @@ classiq/qmod/type_attribute_remover.py,sha256=NZmTXAsngWqthXjE8n-n6yE72fiWTFM12-
|
|
513
514
|
classiq/qmod/utilities.py,sha256=z_VnIRmOYTWjJp2UlOcWK0rQRtMqysmP_Gr6WYY_nak,2734
|
514
515
|
classiq/qmod/write_qmod.py,sha256=Oo-j_rSfcmzC5MOn0Vq334vv_OTvdD4P7K9pv-gbo8c,1833
|
515
516
|
classiq/synthesis.py,sha256=WLk3wpX_xPiAMstF9PGMO5SWVb_qqa1sN2Nj3MekX34,8113
|
516
|
-
classiq-0.
|
517
|
-
classiq-0.
|
518
|
-
classiq-0.
|
517
|
+
classiq-0.62.0.dist-info/METADATA,sha256=065h6fe5pa0am7JB8789apehdM0qBfQcUtL55KXEzKY,3497
|
518
|
+
classiq-0.62.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
519
|
+
classiq-0.62.0.dist-info/RECORD,,
|
File without changes
|