classiq 0.72.1__py3-none-any.whl → 0.74.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/client.py +9 -10
- classiq/interface/_version.py +1 -1
- classiq/interface/ast_node.py +5 -2
- classiq/interface/compression_utils.py +31 -0
- classiq/interface/generator/generated_circuit_data.py +42 -11
- classiq/interface/generator/quantum_program.py +14 -0
- classiq/interface/ide/visual_model.py +4 -2
- classiq/interface/model/quantum_function_declaration.py +13 -1
- classiq/interface/model/quantum_lambda_function.py +14 -0
- classiq/model_expansions/atomic_expression_functions_defs.py +10 -1
- classiq/model_expansions/capturing/captured_vars.py +49 -21
- classiq/model_expansions/evaluators/type_type_match.py +2 -1
- classiq/model_expansions/generative_functions.py +31 -54
- classiq/model_expansions/interpreters/generative_interpreter.py +1 -5
- classiq/model_expansions/quantum_operations/call_emitter.py +11 -6
- classiq/model_expansions/utils/text_utils.py +16 -0
- classiq/open_library/functions/__init__.py +2 -0
- classiq/open_library/functions/amplitude_amplification.py +5 -3
- classiq/open_library/functions/state_preparation.py +95 -2
- classiq/qmod/declaration_inferrer.py +4 -0
- classiq/qmod/model_state_container.py +11 -8
- classiq/qmod/quantum_function.py +2 -10
- classiq/qmod/symbolic.py +16 -3
- {classiq-0.72.1.dist-info → classiq-0.74.0.dist-info}/METADATA +2 -1
- {classiq-0.72.1.dist-info → classiq-0.74.0.dist-info}/RECORD +26 -24
- {classiq-0.72.1.dist-info → classiq-0.74.0.dist-info}/WHEEL +0 -0
classiq/_internals/client.py
CHANGED
@@ -75,25 +75,23 @@ def _get_user_agent_header() -> Headers:
|
|
75
75
|
python_version = (
|
76
76
|
f"python({_get_python_execution_environment()})/{platform.python_version()}"
|
77
77
|
)
|
78
|
-
|
79
|
-
sdk_env_value = os.getenv("SDK_ENV", "Default")
|
80
78
|
os_platform = f"{os.name}/{platform.platform()}"
|
81
79
|
frontend_version = f"{_FRONTEND_VARIANT}/{_VERSION}"
|
82
80
|
interface_version = f"{_INTERFACE_VARIANT}/{_VERSION}"
|
83
|
-
|
81
|
+
|
84
82
|
return {
|
85
83
|
"User-Agent": _USERAGENT_SEPARATOR.join(
|
86
|
-
(
|
87
|
-
python_version,
|
88
|
-
os_platform,
|
89
|
-
frontend_version,
|
90
|
-
interface_version,
|
91
|
-
sdk_env,
|
92
|
-
)
|
84
|
+
(python_version, os_platform, frontend_version, interface_version)
|
93
85
|
)
|
94
86
|
}
|
95
87
|
|
96
88
|
|
89
|
+
@functools.lru_cache
|
90
|
+
def _get_sdk_env_header() -> Headers:
|
91
|
+
sdk_env_value = os.getenv("SDK_ENV", "Default")
|
92
|
+
return {_SDK_ENV: sdk_env_value}
|
93
|
+
|
94
|
+
|
97
95
|
Ret = TypeVar("Ret")
|
98
96
|
P = ParamSpec("P")
|
99
97
|
|
@@ -327,6 +325,7 @@ class Client:
|
|
327
325
|
if self._session_id is not None:
|
328
326
|
headers[self._SESSION_HEADER] = self._session_id
|
329
327
|
headers.update(_get_user_agent_header())
|
328
|
+
headers.update(_get_sdk_env_header())
|
330
329
|
return headers
|
331
330
|
|
332
331
|
async def update_expired_access_token(self) -> None:
|
classiq/interface/_version.py
CHANGED
classiq/interface/ast_node.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import Optional, TypeVar
|
1
|
+
from typing import Any, Optional, TypeVar
|
2
2
|
from uuid import UUID
|
3
3
|
|
4
4
|
import pydantic
|
@@ -23,7 +23,10 @@ class ASTNode(HashablePydanticBaseModel):
|
|
23
23
|
def reset_lists(
|
24
24
|
ast_node: ASTNodeType, statement_block_fields: list[str]
|
25
25
|
) -> ASTNodeType:
|
26
|
-
|
26
|
+
update: dict[str, Any] = {field: [] for field in statement_block_fields}
|
27
|
+
if hasattr(ast_node, "uuid"):
|
28
|
+
update["uuid"] = ast_node.uuid
|
29
|
+
return ast_node.model_copy(update=update)
|
27
30
|
|
28
31
|
|
29
32
|
class HashableASTNode(ASTNode, HashablePydanticBaseModel):
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import base64
|
2
|
+
from collections.abc import Sequence
|
3
|
+
from typing import Union
|
4
|
+
|
5
|
+
import zstandard as zstd
|
6
|
+
from pydantic import BaseModel
|
7
|
+
from pydantic_core import from_json, to_json
|
8
|
+
|
9
|
+
|
10
|
+
def compress_pydantic(obj: Union[BaseModel, Sequence[BaseModel]]) -> bytes:
|
11
|
+
json_data = to_json(obj)
|
12
|
+
compressed_data = _compress(json_data, level=22) # max compression level
|
13
|
+
return compressed_data
|
14
|
+
|
15
|
+
|
16
|
+
def decompress(compressed_data: bytes) -> Union[dict, list[dict]]:
|
17
|
+
decompressed_data = _decompress(compressed_data)
|
18
|
+
return from_json(decompressed_data)
|
19
|
+
|
20
|
+
|
21
|
+
def _compress(data: bytes, level: int) -> bytes:
|
22
|
+
compressor = zstd.ZstdCompressor(level=level)
|
23
|
+
compressed_data = compressor.compress(data)
|
24
|
+
b64_compressed_data = base64.b64encode(compressed_data)
|
25
|
+
return b64_compressed_data
|
26
|
+
|
27
|
+
|
28
|
+
def _decompress(data: bytes) -> bytes:
|
29
|
+
compressed_data = base64.b64decode(data)
|
30
|
+
decompressor = zstd.ZstdDecompressor()
|
31
|
+
return decompressor.decompress(compressed_data)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import logging
|
2
2
|
import re
|
3
3
|
from typing import Literal, Optional, Union
|
4
|
+
from uuid import UUID
|
4
5
|
|
5
6
|
import pydantic
|
6
7
|
from pydantic import ConfigDict, Field
|
@@ -16,10 +17,11 @@ from classiq.interface.generator.register_role import RegisterRole
|
|
16
17
|
from classiq.interface.generator.synthesis_metadata.synthesis_execution_data import (
|
17
18
|
ExecutionData,
|
18
19
|
)
|
19
|
-
from classiq.interface.model.quantum_expressions.
|
20
|
-
|
20
|
+
from classiq.interface.model.quantum_expressions.arithmetic_operation import (
|
21
|
+
ArithmeticOperationKind,
|
21
22
|
)
|
22
23
|
from classiq.interface.model.statement_block import (
|
24
|
+
ArithmeticOperation,
|
23
25
|
ConcreteQuantumStatement,
|
24
26
|
QuantumFunctionCall,
|
25
27
|
StatementBlock,
|
@@ -141,11 +143,33 @@ class StatementType(StrEnum):
|
|
141
143
|
CONTROL = "control"
|
142
144
|
POWER = "power"
|
143
145
|
INVERT = "invert"
|
144
|
-
WITHIN_APPLY = "
|
145
|
-
|
146
|
+
WITHIN_APPLY = "within apply"
|
147
|
+
ASSIGN = "assign"
|
148
|
+
ASSIGN_AMPLITUDE = "assign amplitude"
|
149
|
+
PHASE = "phase"
|
150
|
+
INPLACE_XOR = "inplace xor"
|
151
|
+
INPLACE_ADD = "inplace add"
|
146
152
|
REPEAT = "repeat"
|
147
153
|
|
148
154
|
|
155
|
+
# Mapping between statement kind (or sub-kind) and statement type (visualization name)
|
156
|
+
# Keys (statement kind) are taken from the `kind` field of the statement models,
|
157
|
+
# which cannot be used directly because they're instance fields of `Literal` type.
|
158
|
+
STATEMENTS_NAME: dict[str, StatementType] = {
|
159
|
+
"Control": StatementType.CONTROL,
|
160
|
+
"Power": StatementType.POWER,
|
161
|
+
"Invert": StatementType.INVERT,
|
162
|
+
"WithinApply": StatementType.WITHIN_APPLY,
|
163
|
+
ArithmeticOperationKind.Assignment.value: StatementType.ASSIGN,
|
164
|
+
"InplaceBinaryOperation": StatementType.ASSIGN,
|
165
|
+
"AmplitudeLoadingOperation": StatementType.ASSIGN_AMPLITUDE,
|
166
|
+
"PhaseOperation": StatementType.PHASE,
|
167
|
+
ArithmeticOperationKind.InplaceXor.value: StatementType.INPLACE_XOR,
|
168
|
+
ArithmeticOperationKind.InplaceAdd.value: StatementType.INPLACE_ADD,
|
169
|
+
"Repeat": StatementType.REPEAT,
|
170
|
+
}
|
171
|
+
|
172
|
+
|
149
173
|
class FunctionDebugInfoInterface(pydantic.BaseModel):
|
150
174
|
generated_function: Optional[GeneratedFunction] = Field(default=None)
|
151
175
|
children: list["FunctionDebugInfoInterface"]
|
@@ -154,6 +178,8 @@ class FunctionDebugInfoInterface(pydantic.BaseModel):
|
|
154
178
|
is_basis_gate: Optional[bool] = Field(default=None)
|
155
179
|
is_inverse: bool = Field(default=False)
|
156
180
|
is_allocate_or_free: bool = Field(default=False)
|
181
|
+
is_unitary: bool = Field(default=True, exclude=True)
|
182
|
+
uuid: Optional[UUID] = Field(default=None, exclude=True)
|
157
183
|
level: OperationLevel = Field(default=OperationLevel.UNKNOWN)
|
158
184
|
port_to_passed_variable_map: dict[str, str] = Field(default={})
|
159
185
|
release_by_inverse: bool = Field(default=False)
|
@@ -181,14 +207,23 @@ class FunctionDebugInfoInterface(pydantic.BaseModel):
|
|
181
207
|
# Temp fix for currently "supported" statements (same as for level_ property)
|
182
208
|
if generated_name in {StatementType.CONTROL, StatementType.POWER}:
|
183
209
|
return generated_name
|
184
|
-
|
185
|
-
|
210
|
+
|
211
|
+
back_ref = self.first_back_ref
|
212
|
+
if back_ref is None:
|
213
|
+
return generated_name
|
214
|
+
|
215
|
+
if isinstance(back_ref, QuantumFunctionCall):
|
216
|
+
name = generate_original_function_name(back_ref.func_name)
|
186
217
|
if part_match := PART_SUFFIX_REGEX.match(generated_name):
|
187
218
|
suffix = f" [{part_match.group(1)}]"
|
188
219
|
else:
|
189
220
|
suffix = ""
|
190
221
|
return f"{name}{suffix}"
|
191
|
-
|
222
|
+
|
223
|
+
statement_kind: str = back_ref.kind
|
224
|
+
if isinstance(back_ref, ArithmeticOperation):
|
225
|
+
statement_kind = back_ref.operation_kind.value
|
226
|
+
return STATEMENTS_NAME[statement_kind]
|
192
227
|
|
193
228
|
@property
|
194
229
|
def first_back_ref(self) -> Optional[ConcreteQuantumStatement]:
|
@@ -209,10 +244,6 @@ class FunctionDebugInfoInterface(pydantic.BaseModel):
|
|
209
244
|
return self.level
|
210
245
|
if isinstance(back_ref, QuantumFunctionCall):
|
211
246
|
return OperationLevel.QMOD_FUNCTION_CALL
|
212
|
-
# Temp "fix" for assignment statements until we have a way to fully
|
213
|
-
# distinguish them and to properly display them
|
214
|
-
if isinstance(back_ref, QuantumExpressionOperation):
|
215
|
-
return OperationLevel.ENGINE_FUNCTION_CALL
|
216
247
|
return OperationLevel.QMOD_STATEMENT
|
217
248
|
|
218
249
|
@property
|
@@ -8,6 +8,7 @@ from pydantic import model_validator
|
|
8
8
|
from pydantic_core.core_schema import ValidationInfo
|
9
9
|
from typing_extensions import TypeAlias
|
10
10
|
|
11
|
+
from classiq.interface.compression_utils import decompress
|
11
12
|
from classiq.interface.exceptions import (
|
12
13
|
ClassiqMissingOutputFormatError,
|
13
14
|
ClassiqStateInitializationError,
|
@@ -72,6 +73,7 @@ class QuantumProgram(VersionedModel, CircuitCodeInterface):
|
|
72
73
|
debug_info: Optional[list[FunctionDebugInfoInterface]] = pydantic.Field(
|
73
74
|
default=None
|
74
75
|
)
|
76
|
+
compressed_debug_info: Optional[bytes] = pydantic.Field(default=None)
|
75
77
|
program_id: str = pydantic.Field(default_factory=get_uuid_as_str)
|
76
78
|
execution_primitives_input: Optional[PrimitivesInput] = pydantic.Field(default=None)
|
77
79
|
|
@@ -198,3 +200,15 @@ class QuantumProgram(VersionedModel, CircuitCodeInterface):
|
|
198
200
|
if self.transpiled_circuit and self._can_use_transpiled_code
|
199
201
|
else self
|
200
202
|
)
|
203
|
+
|
204
|
+
def get_debug_info(self) -> Optional[list[FunctionDebugInfoInterface]]:
|
205
|
+
# Support legacy uncompressed debug info
|
206
|
+
if self.debug_info is not None:
|
207
|
+
return self.debug_info
|
208
|
+
if self.compressed_debug_info is None:
|
209
|
+
return None
|
210
|
+
decompressed_debug_info_dict_list = decompress(self.compressed_debug_info)
|
211
|
+
return [
|
212
|
+
FunctionDebugInfoInterface.model_validate(debug_info_dict)
|
213
|
+
for debug_info_dict in decompressed_debug_info_dict_list
|
214
|
+
]
|
@@ -1,4 +1,5 @@
|
|
1
1
|
from collections import Counter
|
2
|
+
from functools import cached_property
|
2
3
|
from typing import Any, Optional
|
3
4
|
|
4
5
|
import pydantic
|
@@ -58,11 +59,11 @@ class OperationLinks(pydantic.BaseModel):
|
|
58
59
|
inputs: list[OperationLink]
|
59
60
|
outputs: list[OperationLink]
|
60
61
|
|
61
|
-
@
|
62
|
+
@cached_property
|
62
63
|
def input_width(self) -> int:
|
63
64
|
return sum(len(link.qubits) for link in self.inputs)
|
64
65
|
|
65
|
-
@
|
66
|
+
@cached_property
|
66
67
|
def output_width(self) -> int:
|
67
68
|
return sum(len(link.qubits) for link in self.outputs)
|
68
69
|
|
@@ -122,6 +123,7 @@ class Operation(pydantic.BaseModel):
|
|
122
123
|
default=AtomicGate.UNKNOWN, description="Gate type"
|
123
124
|
)
|
124
125
|
is_daggered: bool = pydantic.Field(default=False)
|
126
|
+
expanded: bool = pydantic.Field(default=False)
|
125
127
|
|
126
128
|
|
127
129
|
class ProgramVisualModel(VersionedModel):
|
@@ -158,6 +158,7 @@ class AnonQuantumOperandDeclaration(AnonQuantumFunctionDeclaration):
|
|
158
158
|
description="Indicate whether the operand expects an unnamed list of lambdas",
|
159
159
|
default=False,
|
160
160
|
)
|
161
|
+
_is_generative: bool = pydantic.PrivateAttr(default=False)
|
161
162
|
|
162
163
|
@pydantic.model_validator(mode="before")
|
163
164
|
@classmethod
|
@@ -170,7 +171,10 @@ class AnonQuantumOperandDeclaration(AnonQuantumFunctionDeclaration):
|
|
170
171
|
new_instance_data = self.__dict__.copy()
|
171
172
|
new_instance_data["name"] = new_name
|
172
173
|
new_instance_data["kind"] = "QuantumOperandDeclaration"
|
173
|
-
|
174
|
+
new_decl = QuantumOperandDeclaration(**new_instance_data)
|
175
|
+
if self._is_generative:
|
176
|
+
new_decl.set_generative()
|
177
|
+
return new_decl
|
174
178
|
|
175
179
|
@property
|
176
180
|
def element_declaration(self) -> Self:
|
@@ -178,6 +182,14 @@ class AnonQuantumOperandDeclaration(AnonQuantumFunctionDeclaration):
|
|
178
182
|
raise ClassiqInternalError
|
179
183
|
return self.model_copy(update={"is_list": False})
|
180
184
|
|
185
|
+
def set_generative(self) -> Self:
|
186
|
+
self._is_generative = True
|
187
|
+
return self
|
188
|
+
|
189
|
+
@property
|
190
|
+
def is_generative(self) -> bool:
|
191
|
+
return self._is_generative
|
192
|
+
|
181
193
|
|
182
194
|
AnonQuantumFunctionDeclaration.model_rebuild()
|
183
195
|
|
@@ -52,6 +52,20 @@ class QuantumLambdaFunction(ASTNode):
|
|
52
52
|
def set_op_decl(self, fd: AnonQuantumOperandDeclaration) -> None:
|
53
53
|
self._func_decl = fd
|
54
54
|
|
55
|
+
@property
|
56
|
+
def named_func_decl(self) -> AnonQuantumOperandDeclaration:
|
57
|
+
named_params = [
|
58
|
+
param.rename(rename)
|
59
|
+
for param, rename in zip(
|
60
|
+
self.func_decl.positional_arg_declarations,
|
61
|
+
self.pos_rename_params,
|
62
|
+
strict=False, # strict=False enables lambda keyword args
|
63
|
+
)
|
64
|
+
]
|
65
|
+
return self.func_decl.model_copy(
|
66
|
+
update={"positional_arg_declarations": named_params}
|
67
|
+
)
|
68
|
+
|
55
69
|
|
56
70
|
class OperandIdentifier(ASTNode):
|
57
71
|
name: str
|
@@ -15,6 +15,9 @@ from classiq.interface.generator.expressions.expression_types import (
|
|
15
15
|
from classiq.interface.generator.expressions.proxies.classical.any_classical_value import (
|
16
16
|
AnyClassicalValue,
|
17
17
|
)
|
18
|
+
from classiq.interface.generator.expressions.proxies.classical.classical_proxy import (
|
19
|
+
ClassicalProxy,
|
20
|
+
)
|
18
21
|
from classiq.interface.generator.expressions.proxies.quantum.qmod_qscalar_proxy import (
|
19
22
|
QmodQNumProxy,
|
20
23
|
)
|
@@ -159,7 +162,7 @@ def struct_literal(struct_type_symbol: Symbol, **kwargs: Any) -> QmodStructInsta
|
|
159
162
|
|
160
163
|
def get_field(
|
161
164
|
proxy: Union[
|
162
|
-
QmodSizedProxy, QmodStructInstance,
|
165
|
+
QmodSizedProxy, QmodStructInstance, list, ClassicalProxy, AnyClassicalValue
|
163
166
|
],
|
164
167
|
field: str,
|
165
168
|
) -> ExpressionValue:
|
@@ -179,6 +182,12 @@ def get_field(
|
|
179
182
|
f"Available attributes: len"
|
180
183
|
)
|
181
184
|
return len(proxy)
|
185
|
+
if not isinstance(
|
186
|
+
proxy, (QmodSizedProxy, QmodStructInstance, ClassicalProxy, AnyClassicalValue)
|
187
|
+
):
|
188
|
+
raise ClassiqExpansionError(
|
189
|
+
f"Object {str(proxy)!r} has not attribute {field!r}"
|
190
|
+
)
|
182
191
|
if field not in proxy.fields:
|
183
192
|
if isinstance(proxy, (QmodStructInstance, QmodQStructProxy)):
|
184
193
|
property_name = "field"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import dataclasses
|
2
2
|
from collections.abc import Sequence
|
3
3
|
from dataclasses import dataclass, field
|
4
|
-
from typing import TYPE_CHECKING
|
4
|
+
from typing import TYPE_CHECKING, Callable
|
5
5
|
|
6
6
|
from typing_extensions import Self
|
7
7
|
|
@@ -40,6 +40,7 @@ from classiq.model_expansions.transformers.model_renamer import (
|
|
40
40
|
SymbolRenaming,
|
41
41
|
)
|
42
42
|
from classiq.model_expansions.transformers.var_splitter import SymbolPart
|
43
|
+
from classiq.model_expansions.utils.text_utils import are, readable_list, s, they
|
43
44
|
|
44
45
|
if TYPE_CHECKING:
|
45
46
|
from classiq.model_expansions.closure import FunctionClosure
|
@@ -115,6 +116,16 @@ class _CapturedHandle(_Captured):
|
|
115
116
|
self.defining_function.depth,
|
116
117
|
)
|
117
118
|
|
119
|
+
@property
|
120
|
+
def mangled_handle(self) -> HandleBinding:
|
121
|
+
return self.handle.rename(
|
122
|
+
mangle_captured_var_name(
|
123
|
+
self.handle.name,
|
124
|
+
self.defining_function.name,
|
125
|
+
self.defining_function.depth,
|
126
|
+
)
|
127
|
+
)
|
128
|
+
|
118
129
|
@property
|
119
130
|
def port(self) -> PortDeclaration:
|
120
131
|
return PortDeclaration(
|
@@ -484,15 +495,14 @@ class CapturedVars:
|
|
484
495
|
(
|
485
496
|
captured_handle.handle
|
486
497
|
if _same_closure(current_function, captured_handle.defining_function)
|
487
|
-
else
|
498
|
+
else captured_handle.mangled_handle
|
488
499
|
)
|
489
500
|
for captured_handle in self._captured_handles
|
490
501
|
]
|
491
502
|
return args
|
492
503
|
|
493
|
-
def
|
494
|
-
|
495
|
-
mapping = {
|
504
|
+
def get_immediate_captured_mapping(self) -> SymbolRenaming:
|
505
|
+
return {
|
496
506
|
captured_handle.handle: [
|
497
507
|
SymbolPart(
|
498
508
|
source_handle=captured_handle.handle,
|
@@ -503,7 +513,21 @@ class CapturedVars:
|
|
503
513
|
for captured_handle in self._captured_handles
|
504
514
|
if not captured_handle.is_propagated
|
505
515
|
}
|
506
|
-
|
516
|
+
|
517
|
+
def get_propagated_captured_mapping(self) -> SymbolRenaming:
|
518
|
+
return {
|
519
|
+
captured_handle.mangled_handle: [
|
520
|
+
SymbolPart(
|
521
|
+
source_handle=captured_handle.mangled_handle,
|
522
|
+
target_var_name=captured_handle.mangled_name,
|
523
|
+
target_var_type=captured_handle.quantum_type,
|
524
|
+
)
|
525
|
+
]
|
526
|
+
for captured_handle in self._captured_handles
|
527
|
+
}
|
528
|
+
|
529
|
+
def get_classical_captured_mapping(self) -> SymbolRenaming:
|
530
|
+
return {
|
507
531
|
(handle := HandleBinding(name=captured_classical_var.name)): [
|
508
532
|
HandleRenaming(
|
509
533
|
source_handle=handle,
|
@@ -513,7 +537,6 @@ class CapturedVars:
|
|
513
537
|
for captured_classical_var in self._captured_classical_vars
|
514
538
|
if not captured_classical_var.is_propagated
|
515
539
|
}
|
516
|
-
return mapping
|
517
540
|
|
518
541
|
def init_var(self, var_name: str, defining_function: "FunctionClosure") -> None:
|
519
542
|
self._handle_states.append((var_name, defining_function, False))
|
@@ -617,7 +640,9 @@ def _same_closure(closure_1: "FunctionClosure", closure_2: "FunctionClosure") ->
|
|
617
640
|
|
618
641
|
|
619
642
|
def validate_args_are_not_propagated(
|
620
|
-
args: Sequence[ArgValue],
|
643
|
+
args: Sequence[ArgValue],
|
644
|
+
captured_vars: Sequence[ArgValue],
|
645
|
+
error_message: Callable[[list[str]], str],
|
621
646
|
) -> None:
|
622
647
|
if not captured_vars:
|
623
648
|
return
|
@@ -629,17 +654,16 @@ def validate_args_are_not_propagated(
|
|
629
654
|
arg_handles = {
|
630
655
|
demangle_handle(arg) for arg in args if isinstance(arg, HandleBinding)
|
631
656
|
}
|
632
|
-
|
633
|
-
arg_handle
|
657
|
+
violating_handles = [
|
658
|
+
f"{str(arg_handle)!r}"
|
634
659
|
for arg_handle in arg_handles
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
660
|
+
if any(
|
661
|
+
arg_handle.overlaps(captured_handle) for captured_handle in captured_handles
|
662
|
+
)
|
663
|
+
]
|
664
|
+
if len(violating_handles) > 0:
|
640
665
|
raise ClassiqExpansionError(
|
641
|
-
f"
|
642
|
-
f"{vars_msg}"
|
666
|
+
f"Quantum cloning violation: {error_message(violating_handles)}"
|
643
667
|
)
|
644
668
|
|
645
669
|
|
@@ -647,12 +671,12 @@ def validate_captured_directions(
|
|
647
671
|
captured_vars: CapturedVars, report_outin: bool = True
|
648
672
|
) -> None:
|
649
673
|
captured_inputs = [
|
650
|
-
captured_handle.handle.name
|
674
|
+
f"{captured_handle.handle.name!r}"
|
651
675
|
for captured_handle in captured_vars._captured_handles
|
652
676
|
if captured_handle.direction == PortDirection.Input
|
653
677
|
]
|
654
678
|
captured_outputs = [
|
655
|
-
captured_handle.handle.name
|
679
|
+
f"{captured_handle.handle.name!r}"
|
656
680
|
for captured_handle in captured_vars._captured_handles
|
657
681
|
if captured_handle.direction
|
658
682
|
in (
|
@@ -663,11 +687,15 @@ def validate_captured_directions(
|
|
663
687
|
]
|
664
688
|
if len(captured_inputs) > 0:
|
665
689
|
raise ClassiqExpansionError(
|
666
|
-
f"
|
690
|
+
f"Variable{s(captured_inputs)} {readable_list(captured_inputs)} "
|
691
|
+
f"{are(captured_inputs)} defined in an outer block, so "
|
692
|
+
f"{they(captured_inputs)} cannot be freed here"
|
667
693
|
)
|
668
694
|
if len(captured_outputs) > 0:
|
669
695
|
raise ClassiqExpansionError(
|
670
|
-
f"
|
696
|
+
f"Variable{s(captured_outputs)} {readable_list(captured_outputs)} "
|
697
|
+
f"{are(captured_outputs)} defined in an outer block, so "
|
698
|
+
f"{they(captured_outputs)} cannot be initialized here"
|
671
699
|
)
|
672
700
|
|
673
701
|
|
@@ -85,6 +85,7 @@ def _check_classical_type_match(
|
|
85
85
|
) -> None:
|
86
86
|
if (
|
87
87
|
not isinstance(op_param, AnonClassicalParameterDeclaration)
|
88
|
-
or decl_param.classical_type
|
88
|
+
or decl_param.classical_type.set_generative()
|
89
|
+
!= op_param.classical_type.set_generative()
|
89
90
|
):
|
90
91
|
raise ClassiqExpansionError(error_message)
|
@@ -16,6 +16,7 @@ from classiq.interface.generator.expressions.proxies.classical.utils import (
|
|
16
16
|
get_proxy_type,
|
17
17
|
)
|
18
18
|
from classiq.interface.generator.functions.type_name import Struct
|
19
|
+
from classiq.interface.helpers.datastructures import get_sdk_compatible_python_object
|
19
20
|
from classiq.interface.helpers.pydantic_model_helpers import nameables_to_dict
|
20
21
|
from classiq.interface.model.native_function_definition import NativeFunctionDefinition
|
21
22
|
from classiq.interface.model.port_declaration import PortDeclaration
|
@@ -34,13 +35,12 @@ from classiq.model_expansions.scope import Evaluated, QuantumSymbol
|
|
34
35
|
from classiq.qmod.generative import generative_mode_context, set_frontend_interpreter
|
35
36
|
from classiq.qmod.model_state_container import QMODULE
|
36
37
|
from classiq.qmod.qmod_parameter import CParamStruct, create_param
|
37
|
-
from classiq.qmod.qmod_variable import
|
38
|
+
from classiq.qmod.qmod_variable import _create_qvar_for_qtype
|
38
39
|
from classiq.qmod.quantum_expandable import (
|
39
40
|
QTerminalCallable,
|
40
41
|
)
|
41
42
|
from classiq.qmod.quantum_function import QFunc
|
42
43
|
from classiq.qmod.semantics.annotation.call_annotation import resolve_function_calls
|
43
|
-
from classiq.qmod.symbolic_expr import SymbolicExpr
|
44
44
|
|
45
45
|
if TYPE_CHECKING:
|
46
46
|
from classiq.model_expansions.interpreters.generative_interpreter import (
|
@@ -65,26 +65,6 @@ def _unwrap_traceback_frame(e: Exception) -> Exception:
|
|
65
65
|
return e.with_traceback(back_tb)
|
66
66
|
|
67
67
|
|
68
|
-
class LenList(list):
|
69
|
-
@property
|
70
|
-
def len(self) -> int:
|
71
|
-
return len(self)
|
72
|
-
|
73
|
-
def __getitem__(self, item: Any) -> Any:
|
74
|
-
if isinstance(item, QNum):
|
75
|
-
return SymbolicExpr(f"{self}[{item}]", True)
|
76
|
-
try:
|
77
|
-
return super().__getitem__(item)
|
78
|
-
except (IndexError, TypeError) as e:
|
79
|
-
raise _unwrap_traceback_frame(e) from None
|
80
|
-
|
81
|
-
@classmethod
|
82
|
-
def wrap(cls, obj: Any) -> Any:
|
83
|
-
if not isinstance(obj, list):
|
84
|
-
return obj
|
85
|
-
return LenList([cls.wrap(item) for item in obj])
|
86
|
-
|
87
|
-
|
88
68
|
def translate_ast_arg_to_python_qmod(param: PositionalArg, evaluated: Evaluated) -> Any:
|
89
69
|
if isinstance(param, PortDeclaration):
|
90
70
|
quantum_symbol = evaluated.as_type(QuantumSymbol)
|
@@ -92,28 +72,13 @@ def translate_ast_arg_to_python_qmod(param: PositionalArg, evaluated: Evaluated)
|
|
92
72
|
quantum_symbol.quantum_type, quantum_symbol.handle
|
93
73
|
)
|
94
74
|
if isinstance(param, QuantumOperandDeclaration):
|
95
|
-
if param.is_list:
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
positional_arg_declarations=param.positional_arg_declarations,
|
103
|
-
),
|
104
|
-
index_=idx,
|
105
|
-
)
|
106
|
-
for idx in range(len(func_list))
|
107
|
-
]
|
108
|
-
)
|
109
|
-
else:
|
110
|
-
func = evaluated.as_type(FunctionClosure)
|
111
|
-
return QTerminalCallable(
|
112
|
-
QuantumFunctionDeclaration(
|
113
|
-
name=param.name if func.is_lambda else func.name,
|
114
|
-
positional_arg_declarations=func.positional_arg_declarations,
|
115
|
-
),
|
116
|
-
)
|
75
|
+
if not param.is_list or not param.is_generative:
|
76
|
+
return QTerminalCallable(param)
|
77
|
+
inner_decl = param.model_copy(update={"is_list": False})
|
78
|
+
func_list: list[FunctionClosure] = evaluated.as_type(list)
|
79
|
+
return [
|
80
|
+
QTerminalCallable(inner_decl, index_=idx) for idx in range(len(func_list))
|
81
|
+
]
|
117
82
|
classical_value = evaluated.value
|
118
83
|
if isinstance(classical_value, QmodStructInstance):
|
119
84
|
return CParamStruct(
|
@@ -126,7 +91,7 @@ def translate_ast_arg_to_python_qmod(param: PositionalArg, evaluated: Evaluated)
|
|
126
91
|
str(classical_value.handle), get_proxy_type(classical_value), QMODULE
|
127
92
|
)
|
128
93
|
|
129
|
-
return
|
94
|
+
return get_sdk_compatible_python_object(classical_value)
|
130
95
|
|
131
96
|
|
132
97
|
class _InterpreterExpandable(QFunc):
|
@@ -161,15 +126,27 @@ class _InterpreterExpandable(QFunc):
|
|
161
126
|
self._interpreter.emit_statement(stmt)
|
162
127
|
|
163
128
|
def _get_function_declarations(self) -> Mapping[str, QuantumFunctionDeclaration]:
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
129
|
+
scope_func_decls: dict[str, QuantumFunctionDeclaration] = {}
|
130
|
+
for name, evaluated in self._interpreter._builder.current_scope.items():
|
131
|
+
value = evaluated.value
|
132
|
+
if isinstance(value, FunctionClosure):
|
133
|
+
scope_func_decls[name] = QuantumFunctionDeclaration(
|
134
|
+
name=name,
|
135
|
+
positional_arg_declarations=value.positional_arg_declarations,
|
136
|
+
)
|
137
|
+
elif (
|
138
|
+
isinstance(value, list)
|
139
|
+
and len(value) > 0
|
140
|
+
and isinstance(value[0], FunctionClosure)
|
141
|
+
):
|
142
|
+
scope_func_decls[name] = QuantumFunctionDeclaration(
|
143
|
+
name=name,
|
144
|
+
positional_arg_declarations=value[0].positional_arg_declarations,
|
145
|
+
)
|
146
|
+
return (
|
147
|
+
nameables_to_dict(self._interpreter._get_function_declarations())
|
148
|
+
| scope_func_decls
|
149
|
+
)
|
173
150
|
|
174
151
|
|
175
152
|
def emit_generative_statements(
|
@@ -95,15 +95,11 @@ class GenerativeInterpreter(BaseInterpreter):
|
|
95
95
|
)
|
96
96
|
|
97
97
|
def evaluate_lambda(self, function: QuantumLambdaFunction) -> Evaluated:
|
98
|
-
renamed_params = [
|
99
|
-
param.rename(function.pos_rename_params[idx])
|
100
|
-
for idx, param in enumerate(function.func_decl.positional_arg_declarations)
|
101
|
-
]
|
102
98
|
func_decl = NamedParamsQuantumFunctionDeclaration(
|
103
99
|
name=self._counted_name_allocator.allocate(
|
104
100
|
function.func_decl.name or "<lambda>"
|
105
101
|
),
|
106
|
-
positional_arg_declarations=
|
102
|
+
positional_arg_declarations=function.named_func_decl.positional_arg_declarations,
|
107
103
|
)
|
108
104
|
|
109
105
|
closure_class: type[FunctionClosure]
|
@@ -62,6 +62,7 @@ from classiq.model_expansions.quantum_operations.emitter import (
|
|
62
62
|
)
|
63
63
|
from classiq.model_expansions.scope import Evaluated, QuantumSymbol, Scope
|
64
64
|
from classiq.model_expansions.transformers.var_splitter import VarSplitter
|
65
|
+
from classiq.model_expansions.utils.text_utils import are, readable_list, s
|
65
66
|
from classiq.qmod.builtins.functions import free
|
66
67
|
from classiq.qmod.semantics.validation.signature_validation import (
|
67
68
|
validate_function_signature,
|
@@ -176,7 +177,11 @@ class CallEmitter(Generic[QuantumStatementT], Emitter[QuantumStatementT], VarSpl
|
|
176
177
|
captured_args = function.captured_vars.filter_vars(function).get_captured_args(
|
177
178
|
self._builder.current_function
|
178
179
|
)
|
179
|
-
validate_args_are_not_propagated(
|
180
|
+
validate_args_are_not_propagated(
|
181
|
+
new_positional_args,
|
182
|
+
captured_args,
|
183
|
+
lambda vars: f"Argument{s(vars)} {readable_list(vars)} {are(vars)} used in adjacent lambda functions",
|
184
|
+
)
|
180
185
|
new_positional_args.extend(captured_args)
|
181
186
|
new_call = QuantumFunctionCall(
|
182
187
|
function=new_declaration.name,
|
@@ -258,11 +263,11 @@ class CallEmitter(Generic[QuantumStatementT], Emitter[QuantumStatementT], VarSpl
|
|
258
263
|
chain.from_iterable((func_def.positional_arg_declarations, captured_ports))
|
259
264
|
)
|
260
265
|
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
)
|
266
|
+
rewrite_mapping = dict(captured_vars.get_propagated_captured_mapping())
|
267
|
+
if function_context.is_lambda:
|
268
|
+
rewrite_mapping |= captured_vars.get_immediate_captured_mapping()
|
269
|
+
rewrite_mapping |= captured_vars.get_classical_captured_mapping()
|
270
|
+
func_def.body = self.rewrite(func_def.body, rewrite_mapping)
|
266
271
|
|
267
272
|
return func_def
|
268
273
|
|
@@ -0,0 +1,16 @@
|
|
1
|
+
def s(items: list) -> str:
|
2
|
+
return "" if len(items) == 1 else "s"
|
3
|
+
|
4
|
+
|
5
|
+
def are(items: list) -> str:
|
6
|
+
return "is" if len(items) == 1 else "are"
|
7
|
+
|
8
|
+
|
9
|
+
def they(items: list) -> str:
|
10
|
+
return "it" if len(items) == 1 else "they"
|
11
|
+
|
12
|
+
|
13
|
+
def readable_list(items: list) -> str:
|
14
|
+
if len(items) == 1:
|
15
|
+
return str(items[0])
|
16
|
+
return f"{', '.join(items[:-1])} and {items[-1]}"
|
@@ -98,6 +98,7 @@ __all__ = [
|
|
98
98
|
"grover_search",
|
99
99
|
"hadamard_transform",
|
100
100
|
"inplace_c_modular_multiply",
|
101
|
+
"inplace_prepare_complex_amplitudes",
|
101
102
|
"inplace_prepare_int",
|
102
103
|
"linear_pauli_rotations",
|
103
104
|
"modular_exp",
|
@@ -105,6 +106,7 @@ __all__ = [
|
|
105
106
|
"multiswap",
|
106
107
|
"phase_oracle",
|
107
108
|
"prepare_bell_state",
|
109
|
+
"prepare_complex_amplitudes",
|
108
110
|
"prepare_exponential_state",
|
109
111
|
"prepare_ghz_state",
|
110
112
|
"prepare_int",
|
@@ -1,3 +1,5 @@
|
|
1
|
+
import numpy as np
|
2
|
+
|
1
3
|
from classiq.open_library.functions.grover import grover_operator
|
2
4
|
from classiq.qmod.builtins.functions.standard_gates import RY
|
3
5
|
from classiq.qmod.builtins.operations import (
|
@@ -11,7 +13,7 @@ from classiq.qmod.cparam import CInt, CReal
|
|
11
13
|
from classiq.qmod.qfunc import qfunc
|
12
14
|
from classiq.qmod.qmod_variable import QArray, QBit
|
13
15
|
from classiq.qmod.quantum_callable import QCallable
|
14
|
-
from classiq.qmod.symbolic import acos, asin, ceiling,
|
16
|
+
from classiq.qmod.symbolic import acos, asin, ceiling, sin
|
15
17
|
|
16
18
|
|
17
19
|
@qfunc
|
@@ -67,8 +69,8 @@ def exact_amplitude_amplification(
|
|
67
69
|
packed_vars: The variable that holds the state to be amplified. Assumed to be in the zero state at the beginning of the algorithm.
|
68
70
|
"""
|
69
71
|
aux = QBit()
|
70
|
-
k = ceiling((pi / (4 * asin(amplitude))) - 0.5)
|
71
|
-
theta = pi / (4 * k + 2)
|
72
|
+
k = ceiling((np.pi / (4 * asin(amplitude))) - 0.5)
|
73
|
+
theta = np.pi / (4 * k + 2)
|
72
74
|
rot_phase = 2 * acos(sin(theta) / amplitude)
|
73
75
|
|
74
76
|
extended_qvars: QArray = QArray()
|
@@ -1,12 +1,23 @@
|
|
1
1
|
import warnings
|
2
2
|
from typing import Literal
|
3
3
|
|
4
|
+
import numpy as np
|
5
|
+
import sympy
|
6
|
+
|
4
7
|
from classiq.interface.exceptions import ClassiqDeprecationWarning
|
5
8
|
|
6
9
|
from classiq.open_library.functions.utility_functions import hadamard_transform
|
7
|
-
from classiq.qmod.builtins.functions
|
10
|
+
from classiq.qmod.builtins.functions import (
|
11
|
+
CX,
|
12
|
+
IDENTITY,
|
13
|
+
RY,
|
14
|
+
RZ,
|
15
|
+
H,
|
16
|
+
X,
|
17
|
+
inplace_prepare_amplitudes,
|
18
|
+
)
|
8
19
|
from classiq.qmod.builtins.operations import allocate, control, if_, inplace_add, repeat
|
9
|
-
from classiq.qmod.cparam import CBool, CInt
|
20
|
+
from classiq.qmod.cparam import CArray, CBool, CInt, CReal
|
10
21
|
from classiq.qmod.qfunc import qfunc
|
11
22
|
from classiq.qmod.qmod_variable import Output, QArray, QBit, QNum
|
12
23
|
from classiq.qmod.symbolic import (
|
@@ -298,3 +309,85 @@ def prepare_int(
|
|
298
309
|
stacklevel=1,
|
299
310
|
)
|
300
311
|
out |= value
|
312
|
+
|
313
|
+
|
314
|
+
def _control_qubit(i: int) -> int:
|
315
|
+
if _msb(_graycode(i)) < _msb(_graycode(i + 1)):
|
316
|
+
return (_graycode(i) & _graycode(i + 1)).bit_length() - 1
|
317
|
+
return (_graycode(i) ^ _graycode(i + 1)).bit_length() - 1
|
318
|
+
|
319
|
+
|
320
|
+
def _graycode(i: int) -> int:
|
321
|
+
return i ^ (i >> 1)
|
322
|
+
|
323
|
+
|
324
|
+
def _msb(x: int) -> int:
|
325
|
+
"""
|
326
|
+
largest non zero bit
|
327
|
+
"""
|
328
|
+
if x == 0:
|
329
|
+
return 0
|
330
|
+
return x.bit_length() - 1
|
331
|
+
|
332
|
+
|
333
|
+
def _classical_hadamard_transform(arr: list[float]) -> np.ndarray:
|
334
|
+
return 1 / np.sqrt(len(arr)) * np.array(sympy.fwht(np.array(arr)))
|
335
|
+
|
336
|
+
|
337
|
+
@qfunc(generative=True)
|
338
|
+
def _load_phases(
|
339
|
+
phases: list[float],
|
340
|
+
target: QArray[QBit, Literal["log(get_field(phases, 'len'), 2)"]],
|
341
|
+
) -> None:
|
342
|
+
alphas = -2 * _classical_hadamard_transform(phases) / np.sqrt(len(phases))
|
343
|
+
|
344
|
+
for i in range(1, len(alphas) - 1):
|
345
|
+
gray = _graycode(i)
|
346
|
+
next_gray = _graycode(i + 1)
|
347
|
+
RZ(alphas[gray], target[_msb(gray)])
|
348
|
+
CX(target[_control_qubit(i)], target[_msb(next_gray)])
|
349
|
+
|
350
|
+
RZ(alphas[_graycode(len(phases) - 1)], target[target.len - 1])
|
351
|
+
|
352
|
+
|
353
|
+
@qfunc
|
354
|
+
def inplace_prepare_complex_amplitudes(
|
355
|
+
magnitudes: CArray[CReal],
|
356
|
+
phases: CArray[CReal],
|
357
|
+
target: QArray[QBit, Literal["log(get_field(magnitudes, 'len'), 2)"]],
|
358
|
+
) -> None:
|
359
|
+
"""
|
360
|
+
|
361
|
+
[Qmod Classiq-library function]
|
362
|
+
|
363
|
+
Prepares a quantum state with amplitudes and phases for each state according to the given parameters, in polar representation.
|
364
|
+
Expects to act on an initialized zero state $|0\\rangle$.
|
365
|
+
|
366
|
+
Args:
|
367
|
+
magnitudes: Absolute values of the state amplitudes.
|
368
|
+
phases: phases of the state amplitudes. should be of the same size as `amplitudes`.
|
369
|
+
target: The quantum variable to act upon.
|
370
|
+
"""
|
371
|
+
inplace_prepare_amplitudes(magnitudes, 0, target)
|
372
|
+
_load_phases(phases, target)
|
373
|
+
|
374
|
+
|
375
|
+
@qfunc
|
376
|
+
def prepare_complex_amplitudes(
|
377
|
+
magnitudes: CArray[CReal],
|
378
|
+
phases: CArray[CReal],
|
379
|
+
out: Output[QArray[QBit, Literal["log(get_field(magnitudes, 'len'), 2)"]]],
|
380
|
+
) -> None:
|
381
|
+
"""
|
382
|
+
|
383
|
+
[Qmod Classiq-library function]
|
384
|
+
|
385
|
+
Initializes and prepares a quantum state with amplitudes and phases for each state according to the given parameters, in polar representation.
|
386
|
+
|
387
|
+
Args:
|
388
|
+
magnitudes: Absolute values of the state amplitudes.
|
389
|
+
phases: phases of the state amplitudes. should be of the same size as `amplitudes`.
|
390
|
+
out: The allocated quantum variable. Must be uninitialized.
|
391
|
+
"""
|
392
|
+
allocate(out)
|
393
|
+
inplace_prepare_complex_amplitudes(magnitudes, phases, out)
|
@@ -102,8 +102,10 @@ def _extract_operand_decl(
|
|
102
102
|
name: Optional[str], py_type: Any, qmodule: Optional[ModelStateContainer]
|
103
103
|
) -> AnonQuantumOperandDeclaration:
|
104
104
|
is_list = (get_origin(py_type) or py_type) is QCallableList
|
105
|
+
is_generative = False
|
105
106
|
if get_origin(py_type) is list:
|
106
107
|
is_list = True
|
108
|
+
is_generative = True
|
107
109
|
py_type = version_portable_get_args(py_type)[0]
|
108
110
|
type_args = version_portable_get_args(py_type)
|
109
111
|
if len(type_args) > 0 and isinstance(type_args[0], list): # Callable support
|
@@ -116,6 +118,8 @@ def _extract_operand_decl(
|
|
116
118
|
),
|
117
119
|
is_list=is_list,
|
118
120
|
)
|
121
|
+
if is_generative:
|
122
|
+
param = param.set_generative()
|
119
123
|
if name is not None:
|
120
124
|
param = param.rename(name)
|
121
125
|
return param
|
@@ -24,13 +24,16 @@ class ModelStateContainer:
|
|
24
24
|
generative_functions: dict[str, "GenerativeQFunc"]
|
25
25
|
function_dependencies: dict[str, list[str]]
|
26
26
|
|
27
|
+
def reset(self) -> None:
|
28
|
+
self.enum_decls = {}
|
29
|
+
self.type_decls = {}
|
30
|
+
self.qstruct_decls = {}
|
31
|
+
self.native_defs = {}
|
32
|
+
self.constants = {}
|
33
|
+
self.functions_compilation_metadata = {}
|
34
|
+
self.generative_functions = {}
|
35
|
+
self.function_dependencies = defaultdict(list)
|
36
|
+
|
27
37
|
|
28
38
|
QMODULE = ModelStateContainer()
|
29
|
-
QMODULE.
|
30
|
-
QMODULE.type_decls = {}
|
31
|
-
QMODULE.qstruct_decls = {}
|
32
|
-
QMODULE.native_defs = {}
|
33
|
-
QMODULE.constants = {}
|
34
|
-
QMODULE.functions_compilation_metadata = {}
|
35
|
-
QMODULE.generative_functions = {}
|
36
|
-
QMODULE.function_dependencies = defaultdict(list)
|
39
|
+
QMODULE.reset()
|
classiq/qmod/quantum_function.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
import ast
|
2
2
|
import functools
|
3
3
|
from abc import abstractmethod
|
4
|
-
from collections import defaultdict
|
5
4
|
from dataclasses import is_dataclass
|
6
5
|
from enum import EnumMeta
|
7
6
|
from inspect import isclass
|
@@ -42,6 +41,7 @@ class BaseQFunc(QExpandable):
|
|
42
41
|
compilation_metadata: Optional[CompilationMetadata] = None,
|
43
42
|
) -> None:
|
44
43
|
super().__init__(py_callable)
|
44
|
+
functools.update_wrapper(self, py_callable)
|
45
45
|
self.compilation_metadata = compilation_metadata
|
46
46
|
|
47
47
|
@property
|
@@ -87,7 +87,6 @@ class QFunc(BaseQFunc):
|
|
87
87
|
) -> None:
|
88
88
|
_validate_no_gen_params(py_callable.__annotations__)
|
89
89
|
super().__init__(py_callable, compilation_metadata)
|
90
|
-
functools.update_wrapper(self, py_callable)
|
91
90
|
self.compilation_metadata: Optional[CompilationMetadata] = None
|
92
91
|
|
93
92
|
@property
|
@@ -120,14 +119,7 @@ class QFunc(BaseQFunc):
|
|
120
119
|
preferences: Optional[Preferences] = None,
|
121
120
|
classical_execution_function: Optional[CFunc] = None,
|
122
121
|
) -> Model:
|
123
|
-
self._qmodule.
|
124
|
-
self._qmodule.type_decls = dict()
|
125
|
-
self._qmodule.qstruct_decls = dict()
|
126
|
-
self._qmodule.native_defs = dict()
|
127
|
-
self._qmodule.constants = dict()
|
128
|
-
self._qmodule.functions_compilation_metadata = dict()
|
129
|
-
self._qmodule.generative_functions = dict()
|
130
|
-
self._qmodule.function_dependencies = defaultdict(list)
|
122
|
+
self._qmodule.reset()
|
131
123
|
QConstant.set_current_model(self._qmodule)
|
132
124
|
self.expand()
|
133
125
|
model_extra_settings: list[tuple[str, Any]] = [
|
classiq/qmod/symbolic.py
CHANGED
@@ -9,6 +9,8 @@ from typing import (
|
|
9
9
|
overload,
|
10
10
|
)
|
11
11
|
|
12
|
+
import numpy as np
|
13
|
+
|
12
14
|
from classiq.interface.exceptions import ClassiqValueError
|
13
15
|
|
14
16
|
from classiq.qmod import model_state_container
|
@@ -30,6 +32,15 @@ GoldenRatio = SymbolicExpr("GoldenRatio", False)
|
|
30
32
|
EulerGamma = SymbolicExpr("EulerGamma", False)
|
31
33
|
Catalan = SymbolicExpr("Catalan", False)
|
32
34
|
|
35
|
+
|
36
|
+
def _unwrap_numpy(x: Any) -> Any:
|
37
|
+
if isinstance(x, np.ndarray):
|
38
|
+
return x.tolist()
|
39
|
+
if isinstance(x, list):
|
40
|
+
return list(map(_unwrap_numpy, x))
|
41
|
+
return x
|
42
|
+
|
43
|
+
|
33
44
|
T = TypeVar("T", bound=CParam)
|
34
45
|
|
35
46
|
|
@@ -45,7 +56,7 @@ def symbolic_function(*args: Any, return_type: Optional[type[T]] = None) -> CPar
|
|
45
56
|
qmodule = (
|
46
57
|
model_state_container.QMODULE
|
47
58
|
) # FIXME: https://classiq.atlassian.net/browse/CAD-15126
|
48
|
-
str_args = [str(x) for x in args]
|
59
|
+
str_args = [str(_unwrap_numpy(x)) for x in args]
|
49
60
|
expr = f"{sys._getframe(1).f_code.co_name}({','.join(str_args)})"
|
50
61
|
|
51
62
|
if return_type is None:
|
@@ -310,10 +321,12 @@ def _subscript_to_str(index: Any) -> str:
|
|
310
321
|
|
311
322
|
|
312
323
|
def subscript(
|
313
|
-
|
324
|
+
array: Union[
|
325
|
+
Sequence[Union[float, CReal, CParamScalar]], CArray[CReal], np.ndarray
|
326
|
+
],
|
314
327
|
index: Any,
|
315
328
|
) -> CParamScalar:
|
316
|
-
return CParamScalar(expr=f"{
|
329
|
+
return CParamScalar(expr=f"{_unwrap_numpy(array)}[{_subscript_to_str(index)}]")
|
317
330
|
|
318
331
|
|
319
332
|
__all__ = [
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: classiq
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.74.0
|
4
4
|
Summary: Classiq's Python SDK for quantum computing
|
5
5
|
License: Proprietary
|
6
6
|
Keywords: quantum computing,quantum circuits,quantum algorithms,QAD,QDL
|
@@ -53,6 +53,7 @@ Requires-Dist: tabulate (>=0.8.9,<1)
|
|
53
53
|
Requires-Dist: torch ; extra == "qml"
|
54
54
|
Requires-Dist: torchvision ; extra == "qml"
|
55
55
|
Requires-Dist: tqdm (>=4.67.1,<5.0.0)
|
56
|
+
Requires-Dist: zstandard (>=0.23.0,<0.24.0)
|
56
57
|
Description-Content-Type: text/markdown
|
57
58
|
|
58
59
|
<p align="center">
|
@@ -11,7 +11,7 @@ classiq/_internals/authentication/authentication.py,sha256=58Xv1QtynXwEfBqIV5E3L
|
|
11
11
|
classiq/_internals/authentication/device.py,sha256=dUii1-Z26j0NY4R6J4p0gjYSq5Goj-gwMxXPSnVANuE,4024
|
12
12
|
classiq/_internals/authentication/password_manager.py,sha256=nhJyr8IGrsq3oaGtD0UXZ_rCN4GPI-4LrTYHc1R--sQ,4464
|
13
13
|
classiq/_internals/authentication/token_manager.py,sha256=XStkqCPUQEqc3uj6tt_XzfUIcUlyT-94tBZ8tpQIy_s,5280
|
14
|
-
classiq/_internals/client.py,sha256=
|
14
|
+
classiq/_internals/client.py,sha256=gHnkpKedytRAXaRasU2CkICttbQd2IsT1tAPPGd8oTU,12634
|
15
15
|
classiq/_internals/config.py,sha256=-UKKvPp_61sxXY-URqU1feLqlfh9ww4wCDH4yl14EiA,3534
|
16
16
|
classiq/_internals/help.py,sha256=9gl64Y8nKW-f-8pYt7lMozOP6uERcIIf8dotgn_WKA0,460
|
17
17
|
classiq/_internals/host_checker.py,sha256=D0rgnoZrHo62rYS32yCuYZSyMrMChZG5ITsJxwj0R5g,3969
|
@@ -89,14 +89,14 @@ classiq/execution/jobs.py,sha256=h_aki-Q7RDbG7fyMYdc-kTRNgtq1gX9W5LDub_7J2UM,108
|
|
89
89
|
classiq/execution/qnn.py,sha256=WGPvncz5uS2WxSY3-yBWt2LFiCk6Ug8WKWF-Kp-f7TM,2403
|
90
90
|
classiq/executor.py,sha256=9mae_QMGZYT8CJ5QlS4XH7063OYrrDUnt8gAFV-OhRc,2773
|
91
91
|
classiq/interface/__init__.py,sha256=cg7hD_XVu1_jJ1fgwmT0rMIoZHopNVeB8xtlmMx-E_A,83
|
92
|
-
classiq/interface/_version.py,sha256=
|
92
|
+
classiq/interface/_version.py,sha256=BI-nVueUF-_bvqJGZ-QZZhNBUCxdF-1lsoJ82-C2X4M,197
|
93
93
|
classiq/interface/analyzer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
94
94
|
classiq/interface/analyzer/analysis_params.py,sha256=dM5rwSks798cxk4FWe4_X5ToRYtgZQh34F1u0XrFkK8,3881
|
95
95
|
classiq/interface/analyzer/cytoscape_graph.py,sha256=MpeRBIYS1TfwYwiFpgTO51IE0KoxhY510pmEM3S0rbw,2361
|
96
96
|
classiq/interface/analyzer/result.py,sha256=CJhZ7Q_VUCyKS1ivtyD9l9534efjEUY6C6Wwrb3kXak,5872
|
97
97
|
classiq/interface/applications/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
98
98
|
classiq/interface/applications/qsvm.py,sha256=4dHVSZH--sv58SvxmpDHPh9JDr4qQUZbbGCeaEv6b1I,3408
|
99
|
-
classiq/interface/ast_node.py,sha256
|
99
|
+
classiq/interface/ast_node.py,sha256=-X3lke3c2Wm0fGDupj0g4cGfuRmLv4hA4EjLsJ1dHqE,941
|
100
100
|
classiq/interface/backend/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
101
101
|
classiq/interface/backend/backend_preferences.py,sha256=apW0rA9nQSrU8NUa9piFPfoKiMQWQJnUILewn73DVqc,21539
|
102
102
|
classiq/interface/backend/ionq/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -134,6 +134,7 @@ classiq/interface/combinatorial_optimization/optimization_problem.py,sha256=iiC1
|
|
134
134
|
classiq/interface/combinatorial_optimization/result.py,sha256=kDGShpwzhp8KOibngo3SFnfZGBjT0ClmS86a3Yrlgj8,198
|
135
135
|
classiq/interface/combinatorial_optimization/sense.py,sha256=P8_kJRf3aUKbCkIqOP3tOc81Vpz9yW4Z74RGaYbd9TA,262
|
136
136
|
classiq/interface/combinatorial_optimization/solver_types.py,sha256=kcLt80fQucq_DWmJXmmVljwCGV4gtDnqOMlJdemhPQc,135
|
137
|
+
classiq/interface/compression_utils.py,sha256=rX4sD4_8C-liWqBICuE6VaT38yjUK_FneSA5GUmPF2A,973
|
137
138
|
classiq/interface/debug_info/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
138
139
|
classiq/interface/debug_info/back_ref_util.py,sha256=plWBiBMfFIY6aYAR3NVYComsY394ysLVdk_yFy1qcC4,791
|
139
140
|
classiq/interface/debug_info/debug_info.py,sha256=XZ3zNzJb1whiHKLpKZpDITXEeV3tbhwEAhHa5cSzABE,4263
|
@@ -254,7 +255,7 @@ classiq/interface/generator/functions/port_declaration.py,sha256=ESJE_19jOg_zS1r
|
|
254
255
|
classiq/interface/generator/functions/qmod_python_interface.py,sha256=x8GA4Cr6YyfC6prGXv0A0I9G9GSnLHNito2nfN1GZDI,93
|
255
256
|
classiq/interface/generator/functions/type_name.py,sha256=2HiPejk-WZJy8PkWyYXcpuhGgecVZCUf9mpPWFuYty8,4443
|
256
257
|
classiq/interface/generator/functions/type_qualifier.py,sha256=PGiNm_3bczA3TB7ulSemry8zXDB5s4HUIuxdFaVdU_Y,145
|
257
|
-
classiq/interface/generator/generated_circuit_data.py,sha256=
|
258
|
+
classiq/interface/generator/generated_circuit_data.py,sha256=S3V2KwGeEG-JaQW0ySUxEDKXEgidfHbeh9WuXZrJFFU,13792
|
258
259
|
classiq/interface/generator/grover_diffuser.py,sha256=c52p2_hpjBO0qUDsqFMQ_xffBIDPJlrfz3kIy2Mh2Gk,3750
|
259
260
|
classiq/interface/generator/grover_operator.py,sha256=_VzBJ3qO0O0MJzsHf8LF7_ooXnsz1p_I5rjQQFf1Ptg,4119
|
260
261
|
classiq/interface/generator/hadamard_transform.py,sha256=NI4oZBpDCGfaw2OTb5SL3iSGI_nDtyUgElTCO4pEKnk,673
|
@@ -295,7 +296,7 @@ classiq/interface/generator/qft.py,sha256=SDLcPWYxshDfPl-tAfhpRFb30NpPRRFpje5Jrr
|
|
295
296
|
classiq/interface/generator/qpe.py,sha256=C6CddpuD196TUVpUEvvlA9uaRLmFlTkwrHheaWbGojY,6526
|
296
297
|
classiq/interface/generator/qsvm.py,sha256=Ry2iTC2NIoh0u9BsuwVaO-ICUBbRIF7Of9scJG4sGFs,3056
|
297
298
|
classiq/interface/generator/quantum_function_call.py,sha256=BlqclMwh_Qj6_yXUTIBM23eLdQ_X3x_KTQ4WWwBN4JY,24123
|
298
|
-
classiq/interface/generator/quantum_program.py,sha256=
|
299
|
+
classiq/interface/generator/quantum_program.py,sha256=k4NU1up8UCofrPNZMTYurCAJfiVwBJ1oH0-e3ER8vGA,8131
|
299
300
|
classiq/interface/generator/randomized_benchmarking.py,sha256=D6KI_1fMF5oBydaal2WLmTSit6xSMtz0yDAIZMMO89Q,635
|
300
301
|
classiq/interface/generator/range_types.py,sha256=X6CtSyimlpISz9QNbCdqqQkRg1pOGHEQCXy4aEeSwA4,2044
|
301
302
|
classiq/interface/generator/register_role.py,sha256=moerPIO9gQUuG5pe43TemmScSVjTK7_gi-qbrhIgLOA,1147
|
@@ -352,7 +353,7 @@ classiq/interface/helpers/validation_helpers.py,sha256=Jt0xs5EZeEQZOBEZPRmKctHmA
|
|
352
353
|
classiq/interface/helpers/versioned_model.py,sha256=kBgEghNdSidohb0-p_EjRFZLs7LAmLZ_uKIHZFSZ8cQ,159
|
353
354
|
classiq/interface/ide/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
354
355
|
classiq/interface/ide/ide_data.py,sha256=TtFsBttR7L34DeRx4NaswpdyMqEyAuguEWSvGXfZtZs,2504
|
355
|
-
classiq/interface/ide/visual_model.py,sha256=
|
356
|
+
classiq/interface/ide/visual_model.py,sha256=nnauOxOCJrWmc_W0Qtn7RoXlXYY3dPxr_ZPNCtHDaaE,3274
|
356
357
|
classiq/interface/interface_version.py,sha256=w1gZSbPPwcEizEoNhHnkmxXxmkHXCNsHFARLKnhrUbk,24
|
357
358
|
classiq/interface/jobs.py,sha256=i8hrBR2qtptCbxNI-PVYZedH_EDehOe2i09JbJUlD1g,2339
|
358
359
|
classiq/interface/model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -377,8 +378,8 @@ classiq/interface/model/quantum_expressions/amplitude_loading_operation.py,sha25
|
|
377
378
|
classiq/interface/model/quantum_expressions/arithmetic_operation.py,sha256=kqABvyr-niat293lHqBmPhV0Ks3WUgHJ3mevmyD1zD8,2732
|
378
379
|
classiq/interface/model/quantum_expressions/quantum_expression.py,sha256=hSWdSJmsEYaZZ62dWI8ueIl_-lqn7FBnwadsqozzZOI,2228
|
379
380
|
classiq/interface/model/quantum_function_call.py,sha256=fKDQwYBg8v_WvDsl9QDAA-RBVsW4GOn-zOnpqlhamPg,7384
|
380
|
-
classiq/interface/model/quantum_function_declaration.py,sha256=
|
381
|
-
classiq/interface/model/quantum_lambda_function.py,sha256=
|
381
|
+
classiq/interface/model/quantum_function_declaration.py,sha256=Er0RfxfpcVO5-ufMkBqSFxKz0BHtu7zCMKnTWOwU_ZM,8675
|
382
|
+
classiq/interface/model/quantum_lambda_function.py,sha256=Jvw8N_GYSwqlAg5RchBSJ3LwYO2U5ImmELaHpvRTWOg,2420
|
382
383
|
classiq/interface/model/quantum_statement.py,sha256=XthtcTISbdRIv4NW-fckV4jB-dkvYotAZnphMIiK-Ww,3359
|
383
384
|
classiq/interface/model/quantum_type.py,sha256=KcwykkbjctiQsMc7XaM3EugKYNE2wVmyPYcclH8K3Lc,10311
|
384
385
|
classiq/interface/model/quantum_variable_declaration.py,sha256=Vmx-aHnss8E_ghqX_wi4Njp-dEtYK-WwYHtHAwmGZxk,229
|
@@ -397,9 +398,9 @@ classiq/interface/server/global_versions.py,sha256=EyUtBCoGHjgS4jybiHI8wOZq3WOqv
|
|
397
398
|
classiq/interface/server/routes.py,sha256=9UKBb5c_DWzqM1QBzU1v2I_W0Y__6NnYfjqRFa1FI3g,3400
|
398
399
|
classiq/interface/source_reference.py,sha256=a-4Vdc511ux-0lDPDTRGAzouRWWtu4A3MPAfiZe_YPE,1764
|
399
400
|
classiq/model_expansions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
400
|
-
classiq/model_expansions/atomic_expression_functions_defs.py,sha256=
|
401
|
+
classiq/model_expansions/atomic_expression_functions_defs.py,sha256=68iOZfdN_WHPbrdChoMgdElokBqp97mLscMNwmUE82U,9841
|
401
402
|
classiq/model_expansions/capturing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
402
|
-
classiq/model_expansions/capturing/captured_vars.py,sha256=
|
403
|
+
classiq/model_expansions/capturing/captured_vars.py,sha256=l1niB6GGOayu6PkfY4ImyjkQbRnORp93S60wHRBOpjs,27002
|
403
404
|
classiq/model_expansions/capturing/mangling_utils.py,sha256=wfCsjP0pScZv9YP6JXq3oVhkS-lCFyUoZ9IROBHS3Ek,1858
|
404
405
|
classiq/model_expansions/closure.py,sha256=vCNdYyn_pzoyNGIs4w-ZEm_Vj9925mfu64TDnTdHkys,4975
|
405
406
|
classiq/model_expansions/debug_flag.py,sha256=JWzl9FFq2CLcvTg_sh-K8Dp_xXvewsTuFKhPjTCrsrs,107
|
@@ -411,14 +412,14 @@ classiq/model_expansions/evaluators/classical_type_inference.py,sha256=Ex2A8uhiU
|
|
411
412
|
classiq/model_expansions/evaluators/control.py,sha256=rFSP5kuQZfh0OPMuf0OmiDVlX_c0stl2mKX4tnIhAHA,4110
|
412
413
|
classiq/model_expansions/evaluators/parameter_types.py,sha256=OjGQspqVkHJfSft7InuwH6SCvB9Pfc6ktNjDCL8pBDY,9261
|
413
414
|
classiq/model_expansions/evaluators/quantum_type_utils.py,sha256=s2kqPenO3qaJsiVa1bo5t4cpJ-MZeRqlVvM9TXPtyBI,7729
|
414
|
-
classiq/model_expansions/evaluators/type_type_match.py,sha256=
|
415
|
+
classiq/model_expansions/evaluators/type_type_match.py,sha256=iNDLigrBiSuAQE0zReJFuvtlYyWjk86Gv7ytz3h0LHI,3262
|
415
416
|
classiq/model_expansions/expression_evaluator.py,sha256=Yn_bzK-qtO99XPC3GgbRyn3bMGHy1WoqxYovVjUEOgk,4780
|
416
417
|
classiq/model_expansions/function_builder.py,sha256=oVmXhyEu6wr8Ru8LSxIqxwn9gdDoQ26SAPlNnYWCGMI,8697
|
417
|
-
classiq/model_expansions/generative_functions.py,sha256=
|
418
|
+
classiq/model_expansions/generative_functions.py,sha256=pBOE9gBXDK8CDRwJdTHFOJo0nvBiCMYqUmWyrvYebJY,6714
|
418
419
|
classiq/model_expansions/interpreters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
419
420
|
classiq/model_expansions/interpreters/base_interpreter.py,sha256=tvs7Q0LEfzZEUOhcn0gcYXf8obeGbFgyDO7BeN-OxUs,11411
|
420
421
|
classiq/model_expansions/interpreters/frontend_generative_interpreter.py,sha256=db1BKh-MDWqLTK8WCXpbNYxxQM4mjqWIhwFtDil7Vd0,3768
|
421
|
-
classiq/model_expansions/interpreters/generative_interpreter.py,sha256=
|
422
|
+
classiq/model_expansions/interpreters/generative_interpreter.py,sha256=HYh782nXN9_0xFTF6PwQsU8m79wbmiwP1aHIWqFvZF8,11967
|
422
423
|
classiq/model_expansions/model_tables.py,sha256=dlrOGRS2x4Fd_dzClIcV7V8edmbbQzePv9eqxtJQrpo,620
|
423
424
|
classiq/model_expansions/quantum_operations/__init__.py,sha256=iLROXHuWaYKWPYJHUM_6uRNKa9-I7oDPYn1yqYFpYgM,309
|
424
425
|
classiq/model_expansions/quantum_operations/allocate.py,sha256=Y00O9rVbXHt_yShLv63UJHO4gju0L-ft4I-xIvSNlFE,3037
|
@@ -427,7 +428,7 @@ classiq/model_expansions/quantum_operations/arithmetic/explicit_boolean_expressi
|
|
427
428
|
classiq/model_expansions/quantum_operations/assignment_result_processor.py,sha256=OtiqKU6-KxrMBNigSyX4jqohUPzg9qOFa2I-d0DZDK0,2671
|
428
429
|
classiq/model_expansions/quantum_operations/bind.py,sha256=KCX_J94-m3taogRGQN7d9sphJyM0XTYaGW_ssBlwIe4,4557
|
429
430
|
classiq/model_expansions/quantum_operations/block_evaluator.py,sha256=bESmqOLibwosu4KUh7UdAluwX3ICwO2hbLB7l4x2GYo,3083
|
430
|
-
classiq/model_expansions/quantum_operations/call_emitter.py,sha256=
|
431
|
+
classiq/model_expansions/quantum_operations/call_emitter.py,sha256=Bt8nVgJxQWZHMFIirHc0V0eZ_7nfmIAyKlUKlGZga-4,15003
|
431
432
|
classiq/model_expansions/quantum_operations/composite_emitter.py,sha256=B09YGldhWcqdNiyhNzQQU-85mJ_9cRrtNgruDvuyEUE,824
|
432
433
|
classiq/model_expansions/quantum_operations/declarative_call_emitter.py,sha256=BlcjV0AG05qpKyWFD2-GJQKqTDWcFfRl7y1z3yIpllc,3209
|
433
434
|
classiq/model_expansions/quantum_operations/emitter.py,sha256=jArt-eMikrGbR9fOzY9mP1Vc11Zmkn1UkGcHQWy5sIQ,9700
|
@@ -450,12 +451,13 @@ classiq/model_expansions/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5
|
|
450
451
|
classiq/model_expansions/utils/counted_name_allocator.py,sha256=9LPLBm-4ZrpC_0r1rbogyF11FnLaGCUyzwWpcBJoSmA,297
|
451
452
|
classiq/model_expansions/utils/handles_collector.py,sha256=4RfPsiKjVZkTq2tuS-nvo5OG5gGT_HEALf52SuzJ4Dg,1164
|
452
453
|
classiq/model_expansions/utils/sympy_utils.py,sha256=nfmAj2r5NawLlANA5M2IkN3PmQoxNAYYPdaxz79uoEE,682
|
454
|
+
classiq/model_expansions/utils/text_utils.py,sha256=rVYVPHLmnmEhsDXwn-90AEaznDyuYRf1kBhD0TMHuls,373
|
453
455
|
classiq/model_expansions/visitors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
454
456
|
classiq/model_expansions/visitors/boolean_expression_transformers.py,sha256=a8ITXY48uROZFd9MF8tXdXs14Uxh8XbBpuvRXvRehjY,8067
|
455
457
|
classiq/model_expansions/visitors/variable_references.py,sha256=HBgzONJujH8hbtRoqBkT8kBGgE2wDErtfAF_BJXcZC8,5299
|
456
458
|
classiq/open_library/__init__.py,sha256=bmg_qqXCXo85hcU7_QCce-qYGrpAVSFNwTKCClsclrg,114
|
457
|
-
classiq/open_library/functions/__init__.py,sha256=
|
458
|
-
classiq/open_library/functions/amplitude_amplification.py,sha256=
|
459
|
+
classiq/open_library/functions/__init__.py,sha256=Xf4XbgHLZphUO5Qw6v5kIi3_fW77jidivjmoHDa3qe8,3358
|
460
|
+
classiq/open_library/functions/amplitude_amplification.py,sha256=4lmK7-26VhZmWhBmhYCNrA44A8uo2Njycg8lFcVLc_U,4198
|
459
461
|
classiq/open_library/functions/amplitude_estimation.py,sha256=iCkca5SQN_HQoJWk1_tLT56fHT72hu5QIt2pxSZQRko,1766
|
460
462
|
classiq/open_library/functions/discrete_sine_cosine_transform.py,sha256=mutvfffkrEEFrFJp1bUliJBnOEnkv4rUQ7q1Pka9V8E,4439
|
461
463
|
classiq/open_library/functions/grover.py,sha256=yoMnx4jAF0b2hQqwaKMpPgdbqe9ZCsx2u95Yr029q_I,4367
|
@@ -467,7 +469,7 @@ classiq/open_library/functions/qaoa_penalty.py,sha256=Uz_ZSn7fRwynP5w2eSOEcft2z4
|
|
467
469
|
classiq/open_library/functions/qft_functions.py,sha256=7pdPBq48QvyQkxHrF3rEKTf0J50qUu_2bN17lfSc7I0,1382
|
468
470
|
classiq/open_library/functions/qpe.py,sha256=e7MBpOthBn73BdqhWpNGT0lkd6Jw3ZG7tE6n--IM0jc,2140
|
469
471
|
classiq/open_library/functions/qsvt.py,sha256=wpLq0P-pmhdTaRQJJWRHwbTZqRnE1M58MfQ2y1C0YUI,14271
|
470
|
-
classiq/open_library/functions/state_preparation.py,sha256=
|
472
|
+
classiq/open_library/functions/state_preparation.py,sha256=g5UHPYNpP8mvRFM61jk_6c1KhWmmzqi9k0AR_GKnNLg,13202
|
471
473
|
classiq/open_library/functions/swap_test.py,sha256=hAjiJjZGeJP2qzEkVYmBVlEK44VcNibWZ-KqJwPEcFY,1048
|
472
474
|
classiq/open_library/functions/utility_functions.py,sha256=MFxuk49vdjNIqLPxdloigACfXmuxmqrP_oSJbO49Rbc,2541
|
473
475
|
classiq/open_library/functions/variational.py,sha256=KYoqPKYRjgUXk_10RvogV0YiCG5kl7GZBHBJeeX82II,1715
|
@@ -495,10 +497,10 @@ classiq/qmod/cfunc.py,sha256=e3zWNEloBBPy-wJaGI1K5cdNFbd3oq0o4TUY2YDr6ks,1087
|
|
495
497
|
classiq/qmod/classical_function.py,sha256=iHm6T719PUZQPwuNSkouaMA8J9yHrrHUpP-2AQjsA5g,1088
|
496
498
|
classiq/qmod/cparam.py,sha256=WqWG_XLYU4SVYDHHXsZNFu0QcE4dfaEM-0C_Q1OOFs0,2007
|
497
499
|
classiq/qmod/create_model_function.py,sha256=JhPFmI-_K4Yv-RFcKwWLLhFMpcs35K651ItojXwHolk,2245
|
498
|
-
classiq/qmod/declaration_inferrer.py,sha256=
|
500
|
+
classiq/qmod/declaration_inferrer.py,sha256=mcqUrrMfolphtNeCn7B0uT4TVAYdx481v6jebmmiRcc,7749
|
499
501
|
classiq/qmod/expression_query.py,sha256=24gsE5hJ1o9ZuqPILH7aaoOzKRQY2RZtvIK35xuubGA,1629
|
500
502
|
classiq/qmod/generative.py,sha256=MSy-LUsmxteVm3sQSTSWPiYgAskBfYcRHm5EJCYBVZo,1255
|
501
|
-
classiq/qmod/model_state_container.py,sha256=
|
503
|
+
classiq/qmod/model_state_container.py,sha256=eeE5sCo7dbMI6A_opNo0rGEtB7uSIQfv6szBcbamANI,1435
|
502
504
|
classiq/qmod/native/__init__.py,sha256=gm0L3ew0KAy0eSqaMQrvpnKWx85HoA1p9ADaAlyejdA,126
|
503
505
|
classiq/qmod/native/expression_to_qmod.py,sha256=a33dDr7BGWl7YhsFjpfAuI9Ys7amJjMo4DImSrD4NZg,7143
|
504
506
|
classiq/qmod/native/pretty_printer.py,sha256=hcvv2PJLeZbJfh7jsWA_ZhpA3kpo9E_cWkW6iVJ7jwE,17421
|
@@ -512,7 +514,7 @@ classiq/qmod/qmod_parameter.py,sha256=3WYO11-F8dmbZKqTokmKxzehLdb-aEPYwyiDcAFbbQ
|
|
512
514
|
classiq/qmod/qmod_variable.py,sha256=_Wbg7FyrpBYSLnySJhHt96hWkH0EOwDaHoQJhq1x2ow,24806
|
513
515
|
classiq/qmod/quantum_callable.py,sha256=RifbkZEmZ4COOHfluPD2jfd-qYSda2ytW173diR3tI4,2501
|
514
516
|
classiq/qmod/quantum_expandable.py,sha256=3GjFdIP7rDv5SMG9scE3_niu04tWELS6u7it2zpRZUg,17640
|
515
|
-
classiq/qmod/quantum_function.py,sha256=
|
517
|
+
classiq/qmod/quantum_function.py,sha256=vXytpoxeeOao08AkLc_yZ1em4xujqFf4dMeASUJBPi0,12422
|
516
518
|
classiq/qmod/semantics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
517
519
|
classiq/qmod/semantics/annotation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
518
520
|
classiq/qmod/semantics/annotation/call_annotation.py,sha256=I94YDffDP-PDx3-r8XRFtg7D8B07OyuwnWOGwJVOOOA,3804
|
@@ -529,13 +531,13 @@ classiq/qmod/semantics/validation/model_validation.py,sha256=BMeleBpQ7WkEi2LNh4j
|
|
529
531
|
classiq/qmod/semantics/validation/signature_validation.py,sha256=WZerCfEwgbCPmXD34iHhXGVATMhJ86sg-dfdOHFZNGg,922
|
530
532
|
classiq/qmod/semantics/validation/type_hints.py,sha256=xXhneZhzxXYq40LvZPc4jqNabQGxItKraN91-GWkCDU,1354
|
531
533
|
classiq/qmod/semantics/validation/types_validation.py,sha256=uVyW1WlDvUQU7emzHT75QTS0huIlFZr9DgUXLQ7s7vQ,4856
|
532
|
-
classiq/qmod/symbolic.py,sha256=
|
534
|
+
classiq/qmod/symbolic.py,sha256=z5aMUf66pSobTozJif6STWDRJ4YlZv1bxHubbJqecAQ,8209
|
533
535
|
classiq/qmod/symbolic_expr.py,sha256=LJoa9c6puMvUu4d5oU0SNzc7VXzSFBUNLf19ADzktLs,6133
|
534
536
|
classiq/qmod/symbolic_type.py,sha256=ded7bVfWmHFw8MoyivVDJsG5vZZVRQontOZYb1kCrTQ,162
|
535
537
|
classiq/qmod/type_attribute_remover.py,sha256=NZmTXAsngWqthXjE8n-n6yE72fiWTFM12-TXXJ1kJ-Q,1242
|
536
538
|
classiq/qmod/utilities.py,sha256=XoB9JU6Vn4p8ZirrUUaP-UpOInm3jwuuYjB6R_V3XLo,5467
|
537
539
|
classiq/qmod/write_qmod.py,sha256=Q3TWQU9p_Uy42STmX5GA_4Ts2TTOgYjt7I8LTRxTbb0,2047
|
538
540
|
classiq/synthesis.py,sha256=_1W-_shxXEmlhNFKuYz3npiv6P3pWonVn55B0qKRYSo,9052
|
539
|
-
classiq-0.
|
540
|
-
classiq-0.
|
541
|
-
classiq-0.
|
541
|
+
classiq-0.74.0.dist-info/METADATA,sha256=M6xZoSaXkyGLUXsariLsJ16P9l858Zo5ELuwYcYcOnI,3382
|
542
|
+
classiq-0.74.0.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
543
|
+
classiq-0.74.0.dist-info/RECORD,,
|
File without changes
|