classiq 0.52.0__py3-none-any.whl → 0.53.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- classiq/_internals/api_wrapper.py +15 -9
- classiq/_internals/client.py +1 -1
- classiq/applications/qnn/qlayer.py +23 -4
- classiq/execution/__init__.py +2 -0
- classiq/execution/execution_session.py +41 -0
- classiq/execution/iqcc.py +1 -1
- classiq/execution/qaoa.py +84 -0
- classiq/executor.py +1 -1
- classiq/interface/_version.py +1 -1
- classiq/interface/exceptions.py +3 -1
- classiq/interface/execution/iqcc.py +1 -3
- classiq/interface/executor/result.py +12 -1
- classiq/interface/helpers/dotdict.py +18 -0
- classiq/interface/ide/visual_model.py +13 -0
- classiq/interface/model/native_function_definition.py +10 -0
- classiq/model_expansions/quantum_operations/inplace_binary_operation.py +4 -3
- classiq/qmod/__init__.py +2 -0
- classiq/qmod/builtins/functions/__init__.py +5 -0
- classiq/qmod/builtins/functions/standard_gates.py +14 -14
- classiq/qmod/builtins/functions/variational.py +37 -0
- classiq/qmod/create_model_function.py +12 -2
- classiq/qmod/qmod_parameter.py +3 -1
- classiq/qmod/quantum_expandable.py +21 -1
- classiq/qmod/quantum_function.py +24 -2
- classiq/qmod/synthesize_separately.py +16 -0
- {classiq-0.52.0.dist-info → classiq-0.53.0.dist-info}/METADATA +1 -1
- {classiq-0.52.0.dist-info → classiq-0.53.0.dist-info}/RECORD +28 -24
- {classiq-0.52.0.dist-info → classiq-0.53.0.dist-info}/WHEEL +0 -0
@@ -342,19 +342,25 @@ class ApiWrapper:
|
|
342
342
|
@classmethod
|
343
343
|
async def call_iqcc_init_auth(cls, data: IQCCInitAuthData) -> IQCCInitAuthResponse:
|
344
344
|
response = await cls._call_task_pydantic(
|
345
|
-
http_method=HTTPMethod.
|
345
|
+
http_method=HTTPMethod.PUT,
|
346
346
|
url=f"{routes.IQCC_INIT_AUTH_FULL_PATH}",
|
347
347
|
model=data,
|
348
348
|
)
|
349
|
-
return IQCCInitAuthResponse.
|
349
|
+
return IQCCInitAuthResponse.model_validate(response)
|
350
350
|
|
351
351
|
@classmethod
|
352
352
|
async def call_iqcc_probe_auth(
|
353
353
|
cls, data: IQCCProbeAuthData
|
354
|
-
) -> IQCCProbeAuthResponse:
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
354
|
+
) -> Optional[IQCCProbeAuthResponse]:
|
355
|
+
try:
|
356
|
+
response = await cls._call_task_pydantic(
|
357
|
+
http_method=HTTPMethod.PUT,
|
358
|
+
url=f"{routes.IQCC_PROBE_AUTH_FULL_PATH}",
|
359
|
+
model=data,
|
360
|
+
)
|
361
|
+
except ClassiqAPIError as ex:
|
362
|
+
if ex.status_code == 418:
|
363
|
+
return None
|
364
|
+
raise
|
365
|
+
|
366
|
+
return IQCCProbeAuthResponse.model_validate(response)
|
classiq/_internals/client.py
CHANGED
@@ -15,6 +15,7 @@ from classiq.applications.qnn.circuit_utils import (
|
|
15
15
|
validate_circuit,
|
16
16
|
)
|
17
17
|
from classiq.applications.qnn.gradients.simple_quantum_gradient import (
|
18
|
+
EPSILON,
|
18
19
|
SimpleQuantumGradient,
|
19
20
|
)
|
20
21
|
from classiq.applications.qnn.torch_utils import (
|
@@ -40,6 +41,7 @@ class QLayerFunction(torch.autograd.Function):
|
|
40
41
|
quantum_program: SerializedQuantumProgram,
|
41
42
|
execute: ExecuteFunction,
|
42
43
|
post_process: PostProcessFunction,
|
44
|
+
epsilon: Optional[float] = EPSILON,
|
43
45
|
) -> Tensor:
|
44
46
|
"""
|
45
47
|
This function receives:
|
@@ -52,6 +54,8 @@ class QLayerFunction(torch.autograd.Function):
|
|
52
54
|
and returning a `Tensor`
|
53
55
|
|
54
56
|
"""
|
57
|
+
if epsilon is None:
|
58
|
+
epsilon = EPSILON
|
55
59
|
circuit = Circuit.model_validate_json(quantum_program)
|
56
60
|
validate_circuit(circuit)
|
57
61
|
|
@@ -61,7 +65,7 @@ class QLayerFunction(torch.autograd.Function):
|
|
61
65
|
ctx.execute = execute
|
62
66
|
ctx.post_process = post_process
|
63
67
|
ctx.quantum_gradient = SimpleQuantumGradient(
|
64
|
-
quantum_program, execute, post_process
|
68
|
+
quantum_program, execute, post_process, epsilon
|
65
69
|
)
|
66
70
|
|
67
71
|
ctx.batch_size, ctx.num_in_features = inputs.shape
|
@@ -95,7 +99,7 @@ class QLayerFunction(torch.autograd.Function):
|
|
95
99
|
@staticmethod
|
96
100
|
def backward( # type: ignore[override]
|
97
101
|
ctx: Any, grad_output: Tensor
|
98
|
-
) -> Tuple[Optional[Tensor], Optional[Tensor], None, None, None]:
|
102
|
+
) -> Tuple[Optional[Tensor], Optional[Tensor], None, None, None, None]:
|
99
103
|
"""
|
100
104
|
grad_output: Tensor
|
101
105
|
is of shape (ctx.batch_size, ctx.num_out_features)
|
@@ -104,6 +108,7 @@ class QLayerFunction(torch.autograd.Function):
|
|
104
108
|
|
105
109
|
grad_weights = grad_inputs = None
|
106
110
|
grad_circuit = grad_execute = grad_post_process = None
|
111
|
+
grad_epsilon = None
|
107
112
|
is_single_layer = is_single_layer_circuit(weights)
|
108
113
|
|
109
114
|
if ctx.needs_input_grad[1]:
|
@@ -119,7 +124,14 @@ class QLayerFunction(torch.autograd.Function):
|
|
119
124
|
f"Grad required for unknown type: {ctx.needs_input_grad}"
|
120
125
|
)
|
121
126
|
|
122
|
-
return
|
127
|
+
return (
|
128
|
+
grad_inputs,
|
129
|
+
grad_weights,
|
130
|
+
grad_circuit,
|
131
|
+
grad_execute,
|
132
|
+
grad_post_process,
|
133
|
+
grad_epsilon,
|
134
|
+
)
|
123
135
|
|
124
136
|
|
125
137
|
CalcNumOutFeatures = Callable[[SerializedQuantumProgram], int]
|
@@ -143,6 +155,7 @@ class QLayer(nn.Module):
|
|
143
155
|
head_start: Union[float, Tensor, None] = None,
|
144
156
|
# Experimental parameters:
|
145
157
|
calc_num_out_features: CalcNumOutFeatures = calc_num_out_features_single_output,
|
158
|
+
epsilon: float = EPSILON,
|
146
159
|
) -> None:
|
147
160
|
circuit = Circuit.model_validate_json(quantum_program)
|
148
161
|
validate_circuit(circuit)
|
@@ -152,6 +165,7 @@ class QLayer(nn.Module):
|
|
152
165
|
self._execute = execute
|
153
166
|
self._post_process = post_process
|
154
167
|
self._head_start = head_start
|
168
|
+
self._epsilon = epsilon
|
155
169
|
|
156
170
|
self.quantum_program = quantum_program
|
157
171
|
|
@@ -183,5 +197,10 @@ class QLayer(nn.Module):
|
|
183
197
|
|
184
198
|
def forward(self, x: Tensor) -> Tensor:
|
185
199
|
return QLayerFunction.apply(
|
186
|
-
x,
|
200
|
+
x,
|
201
|
+
self.weight,
|
202
|
+
self.quantum_program,
|
203
|
+
self._execute,
|
204
|
+
self._post_process,
|
205
|
+
self._epsilon,
|
187
206
|
)
|
classiq/execution/__init__.py
CHANGED
@@ -12,6 +12,7 @@ from ..interface.executor.vqe_result import VQESolverResult
|
|
12
12
|
from .execution_session import ExecutionSession
|
13
13
|
from .iqcc import generate_iqcc_token, generate_iqcc_token_async
|
14
14
|
from .jobs import ExecutionJob, get_execution_jobs, get_execution_jobs_async
|
15
|
+
from .qaoa import execute_qaoa
|
15
16
|
from .qnn import execute_qnn
|
16
17
|
|
17
18
|
__all__ = (
|
@@ -26,6 +27,7 @@ __all__ = (
|
|
26
27
|
"get_execution_jobs",
|
27
28
|
"get_execution_jobs_async",
|
28
29
|
"ExecutionSession",
|
30
|
+
"execute_qaoa",
|
29
31
|
"execute_qnn",
|
30
32
|
"generate_iqcc_token",
|
31
33
|
"generate_iqcc_token_async",
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import json
|
2
2
|
from typing import Any, Callable, Dict, List, Optional, Tuple, Union, cast
|
3
3
|
|
4
|
+
import numpy as np
|
5
|
+
|
4
6
|
from classiq.interface.chemistry.operator import PauliOperator, pauli_integers_to_str
|
5
7
|
from classiq.interface.exceptions import ClassiqValueError
|
6
8
|
from classiq.interface.execution.primitives import EstimateInput, PrimitivesInput
|
@@ -8,6 +10,7 @@ from classiq.interface.executor.execution_preferences import ExecutionPreference
|
|
8
10
|
from classiq.interface.executor.result import (
|
9
11
|
EstimationResult,
|
10
12
|
ExecutionDetails,
|
13
|
+
ParsedState,
|
11
14
|
)
|
12
15
|
from classiq.interface.generator.functions.qmod_python_interface import QmodPyStruct
|
13
16
|
from classiq.interface.generator.quantum_program import QuantumProgram
|
@@ -340,3 +343,41 @@ class ExecutionSession:
|
|
340
343
|
)
|
341
344
|
)
|
342
345
|
return execute(SerializedQuantumProgram(self.qprog))
|
346
|
+
|
347
|
+
def estimate_cost(
|
348
|
+
self,
|
349
|
+
cost_func: Callable[[ParsedState], float],
|
350
|
+
parameters: Optional[ExecutionParams] = None,
|
351
|
+
quantile: float = 1.0,
|
352
|
+
) -> float:
|
353
|
+
"""
|
354
|
+
Estimates circuit cost using a classical cost function.
|
355
|
+
|
356
|
+
Args:
|
357
|
+
cost_func: classical circuit sample cost function
|
358
|
+
parameters: execution parameters sent to 'sample'
|
359
|
+
quantile: drop cost values outside the specified quantile
|
360
|
+
|
361
|
+
Returns:
|
362
|
+
cost estimation
|
363
|
+
|
364
|
+
See Also:
|
365
|
+
sample
|
366
|
+
"""
|
367
|
+
if quantile < 0 or quantile > 1:
|
368
|
+
raise ClassiqValueError("'quantile' must be between 0 and 1")
|
369
|
+
res = self.sample(parameters)
|
370
|
+
|
371
|
+
counts = np.array(res.parsed_counts)
|
372
|
+
costs = np.vectorize(lambda sample: cost_func(sample.state))(counts)
|
373
|
+
shots = np.vectorize(lambda sample: sample.shots)(counts)
|
374
|
+
|
375
|
+
if quantile == 1:
|
376
|
+
return float(np.average(costs, weights=shots))
|
377
|
+
costs = np.repeat(costs, shots)
|
378
|
+
sort_idx = costs.argsort()
|
379
|
+
sort_idx = sort_idx[: int(quantile * len(costs))]
|
380
|
+
costs = costs[sort_idx]
|
381
|
+
if costs.size == 0:
|
382
|
+
return np.nan
|
383
|
+
return float(np.average(costs))
|
classiq/execution/iqcc.py
CHANGED
@@ -0,0 +1,84 @@
|
|
1
|
+
import math
|
2
|
+
from typing import Callable, Optional, Tuple, Type
|
3
|
+
|
4
|
+
import numpy as np
|
5
|
+
import scipy
|
6
|
+
|
7
|
+
from classiq.interface.executor.execution_preferences import ExecutionPreferences
|
8
|
+
from classiq.interface.executor.result import ExecutionDetails
|
9
|
+
from classiq.interface.model.model import SerializedModel
|
10
|
+
|
11
|
+
from classiq.execution import ExecutionSession
|
12
|
+
from classiq.qmod.builtins.functions import (
|
13
|
+
RX,
|
14
|
+
allocate,
|
15
|
+
apply_to_all,
|
16
|
+
hadamard_transform,
|
17
|
+
)
|
18
|
+
from classiq.qmod.builtins.operations import phase, repeat
|
19
|
+
from classiq.qmod.cparam import CReal
|
20
|
+
from classiq.qmod.create_model_function import create_model
|
21
|
+
from classiq.qmod.qfunc import qfunc
|
22
|
+
from classiq.qmod.qmod_parameter import CArray
|
23
|
+
from classiq.qmod.qmod_variable import Output, QVar
|
24
|
+
from classiq.synthesis import SerializedQuantumProgram, synthesize
|
25
|
+
|
26
|
+
|
27
|
+
def execute_qaoa(
|
28
|
+
problem_vars: Type[QVar],
|
29
|
+
cost_func: Callable,
|
30
|
+
num_layers: int,
|
31
|
+
maxiter: int,
|
32
|
+
execution_preferences: Optional[ExecutionPreferences] = None,
|
33
|
+
) -> Tuple[SerializedModel, SerializedQuantumProgram, ExecutionDetails]:
|
34
|
+
"""
|
35
|
+
Implements a simple QAOA algorithm, including the creation and synthesis of the QAOA
|
36
|
+
ansatz and the classical optimization loop.
|
37
|
+
|
38
|
+
Args:
|
39
|
+
problem_vars: the quantum type (scalar, array, or struct) of the problem variable(s)
|
40
|
+
cost_func: the arithmetic expression that evaluates the cost given an instance of the problem_vars type
|
41
|
+
num_layers: the number of layers of the QAOA ansatz
|
42
|
+
maxiter: the maximum number of iterations for the classical optimization loop
|
43
|
+
execution_preferences: the execution settings for running the QAOA ansatz
|
44
|
+
|
45
|
+
Returns:
|
46
|
+
a tuple containing the model of the QAOA ansatz, the corresponding synthesized quantum program,
|
47
|
+
and the result of the execution with the optimized parameters
|
48
|
+
"""
|
49
|
+
|
50
|
+
@qfunc
|
51
|
+
def main(
|
52
|
+
params: CArray[CReal, num_layers * 2], # type:ignore[valid-type]
|
53
|
+
v: Output[problem_vars], # type:ignore[valid-type]
|
54
|
+
) -> None:
|
55
|
+
allocate(v.size, v) # type:ignore[attr-defined]
|
56
|
+
hadamard_transform(v)
|
57
|
+
repeat(
|
58
|
+
num_layers,
|
59
|
+
lambda i: [ # type:ignore[arg-type]
|
60
|
+
phase(-cost_func(v), params[i]), # type:ignore[func-returns-value]
|
61
|
+
apply_to_all(lambda q: RX(params[num_layers + i], q), v),
|
62
|
+
],
|
63
|
+
)
|
64
|
+
|
65
|
+
model = create_model(main)
|
66
|
+
qprog = synthesize(model)
|
67
|
+
|
68
|
+
es = ExecutionSession(qprog, execution_preferences)
|
69
|
+
initial_params = (
|
70
|
+
np.concatenate((np.linspace(0, 1, num_layers), np.linspace(1, 0, num_layers)))
|
71
|
+
* math.pi
|
72
|
+
)
|
73
|
+
final_params = scipy.optimize.minimize(
|
74
|
+
lambda params: es.estimate_cost(
|
75
|
+
lambda state: cost_func(state["v"]),
|
76
|
+
{"params": params.tolist()},
|
77
|
+
),
|
78
|
+
x0=initial_params,
|
79
|
+
method="COBYLA",
|
80
|
+
options={"maxiter": maxiter},
|
81
|
+
).x.tolist()
|
82
|
+
result = es.sample({"params": final_params})
|
83
|
+
|
84
|
+
return model, qprog, result
|
classiq/executor.py
CHANGED
@@ -46,7 +46,7 @@ def execute(quantum_program: SerializedQuantumProgram) -> ExecutionJob:
|
|
46
46
|
Returns:
|
47
47
|
ExecutionJob: The result of the execution.
|
48
48
|
|
49
|
-
For examples please see [Execution Documentation](https://docs.classiq.io/latest/
|
49
|
+
For examples please see [Execution Documentation](https://docs.classiq.io/latest/user-guide/executor/)
|
50
50
|
"""
|
51
51
|
return async_utils.run(execute_async(quantum_program))
|
52
52
|
|
classiq/interface/_version.py
CHANGED
classiq/interface/exceptions.py
CHANGED
@@ -51,7 +51,9 @@ class ClassiqAnalyzerVisualizationError(ClassiqError):
|
|
51
51
|
|
52
52
|
|
53
53
|
class ClassiqAPIError(ClassiqError):
|
54
|
-
|
54
|
+
def __init__(self, message: str, status_code: Optional[int] = None) -> None:
|
55
|
+
self.status_code = status_code
|
56
|
+
super().__init__(message)
|
55
57
|
|
56
58
|
|
57
59
|
class ClassiqVersionError(ClassiqError):
|
@@ -1,5 +1,3 @@
|
|
1
|
-
from typing import Optional
|
2
|
-
|
3
1
|
from classiq.interface.helpers.versioned_model import VersionedModel
|
4
2
|
|
5
3
|
|
@@ -18,4 +16,4 @@ class IQCCProbeAuthData(IQCCInitAuthData):
|
|
18
16
|
|
19
17
|
|
20
18
|
class IQCCProbeAuthResponse(VersionedModel):
|
21
|
-
auth_token:
|
19
|
+
auth_token: str
|
@@ -24,6 +24,7 @@ from classiq.interface.generator.arith import number_utils
|
|
24
24
|
from classiq.interface.generator.complex_type import Complex
|
25
25
|
from classiq.interface.generator.functions.classical_type import QmodPyObject
|
26
26
|
from classiq.interface.helpers.custom_pydantic_types import PydanticNonNegIntTuple
|
27
|
+
from classiq.interface.helpers.dotdict import get_recursive_dotdict
|
27
28
|
from classiq.interface.helpers.versioned_model import VersionedModel
|
28
29
|
|
29
30
|
_ILLEGAL_QUBIT_ERROR_MSG: str = "Illegal qubit index requested"
|
@@ -39,14 +40,24 @@ ParsedStates: TypeAlias = Mapping[State, ParsedState]
|
|
39
40
|
Counts: TypeAlias = Dict[State, MeasuredShots]
|
40
41
|
StateVector: TypeAlias = Optional[Dict[str, Complex]]
|
41
42
|
|
43
|
+
if TYPE_CHECKING:
|
44
|
+
DotAccessParsedState = Mapping[Name, Any]
|
45
|
+
else:
|
46
|
+
DotAccessParsedState = ParsedState
|
47
|
+
|
42
48
|
|
43
49
|
class SampledState(BaseModel):
|
44
|
-
state:
|
50
|
+
state: DotAccessParsedState
|
45
51
|
shots: MeasuredShots
|
46
52
|
|
47
53
|
def __repr__(self) -> str:
|
48
54
|
return f"{self.state}: {self.shots}"
|
49
55
|
|
56
|
+
@pydantic.field_validator("state", mode="after")
|
57
|
+
@classmethod
|
58
|
+
def _convert_state_to_dotdict(cls, state: ParsedState) -> DotAccessParsedState:
|
59
|
+
return {name: get_recursive_dotdict(value) for name, value in state.items()}
|
60
|
+
|
50
61
|
|
51
62
|
ParsedCounts: TypeAlias = List[SampledState]
|
52
63
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
from typing import Any
|
2
|
+
|
3
|
+
|
4
|
+
class DotDict(dict):
|
5
|
+
def __getattr__(self, key: str) -> Any:
|
6
|
+
return super().get(key)
|
7
|
+
|
8
|
+
def __setattr__(self, key: str, value: Any) -> None:
|
9
|
+
super().__setitem__(key, value)
|
10
|
+
|
11
|
+
def __delattr__(self, key: str) -> None:
|
12
|
+
super().__delitem__(key)
|
13
|
+
|
14
|
+
|
15
|
+
def get_recursive_dotdict(obj: Any) -> Any:
|
16
|
+
if not isinstance(obj, dict):
|
17
|
+
return obj
|
18
|
+
return DotDict({k: get_recursive_dotdict(v) for k, v in obj.items()})
|
@@ -59,6 +59,14 @@ class OperationLinks(pydantic.BaseModel):
|
|
59
59
|
inputs: List[OperationLink]
|
60
60
|
outputs: List[OperationLink]
|
61
61
|
|
62
|
+
@property
|
63
|
+
def input_width(self) -> int:
|
64
|
+
return sum(len(link.qubits) for link in self.inputs)
|
65
|
+
|
66
|
+
@property
|
67
|
+
def output_width(self) -> int:
|
68
|
+
return sum(len(link.qubits) for link in self.outputs)
|
69
|
+
|
62
70
|
|
63
71
|
class AtomicGate(StrEnum):
|
64
72
|
UNKNOWN = ""
|
@@ -89,6 +97,11 @@ class AtomicGate(StrEnum):
|
|
89
97
|
CPHASE = "CPHASE"
|
90
98
|
SWAP = "SWAP"
|
91
99
|
IDENTITY = "IDENTITY"
|
100
|
+
U = "U"
|
101
|
+
|
102
|
+
@property
|
103
|
+
def is_control_gate(self) -> bool:
|
104
|
+
return self.startswith("C")
|
92
105
|
|
93
106
|
|
94
107
|
class Operation(pydantic.BaseModel):
|
@@ -10,6 +10,13 @@ if TYPE_CHECKING:
|
|
10
10
|
from classiq.interface.model.statement_block import StatementBlock
|
11
11
|
|
12
12
|
|
13
|
+
class FunctionSynthesisData(pydantic.BaseModel):
|
14
|
+
should_synthesize_separately: bool = pydantic.Field(
|
15
|
+
default=False,
|
16
|
+
description="Whether the function should be synthesized separately.",
|
17
|
+
)
|
18
|
+
|
19
|
+
|
13
20
|
class NativeFunctionDefinition(NamedParamsQuantumFunctionDeclaration):
|
14
21
|
"""
|
15
22
|
Facilitates the creation of a user-defined composite function
|
@@ -21,3 +28,6 @@ class NativeFunctionDefinition(NamedParamsQuantumFunctionDeclaration):
|
|
21
28
|
body: "StatementBlock" = pydantic.Field(
|
22
29
|
default_factory=list, description="List of function calls to perform."
|
23
30
|
)
|
31
|
+
synthesis_data: FunctionSynthesisData = pydantic.Field(
|
32
|
+
default_factory=FunctionSynthesisData,
|
33
|
+
)
|
@@ -148,9 +148,6 @@ def _build_inplace_binary_operation(
|
|
148
148
|
value_var.quantum_type.fraction_digits_value
|
149
149
|
- target_var.quantum_type.fraction_digits_value
|
150
150
|
)
|
151
|
-
size_diff = (
|
152
|
-
value_var.quantum_type.size_in_bits - target_var.quantum_type.size_in_bits
|
153
|
-
)
|
154
151
|
|
155
152
|
target_overlap_var, target_var_decls, target_bind_ops = (
|
156
153
|
_trim_superfluous_fraction_digits("target", target_var, -frac_digits_diff)
|
@@ -158,6 +155,10 @@ def _build_inplace_binary_operation(
|
|
158
155
|
value_overlap_var, value_trim_var_decls, value_bind_ops = (
|
159
156
|
_trim_superfluous_fraction_digits("value", value_var, frac_digits_diff)
|
160
157
|
)
|
158
|
+
size_diff = (
|
159
|
+
value_overlap_var.quantum_type.size_in_bits
|
160
|
+
- target_overlap_var.quantum_type.size_in_bits
|
161
|
+
)
|
161
162
|
(
|
162
163
|
value_padded_var,
|
163
164
|
value_pad_var_decls,
|
classiq/qmod/__init__.py
CHANGED
@@ -8,6 +8,7 @@ from .qmod_constant import QConstant
|
|
8
8
|
from .qmod_parameter import Array, CArray, CBool, CInt, CReal
|
9
9
|
from .qmod_variable import Input, Output, QArray, QBit, QNum, QStruct
|
10
10
|
from .quantum_callable import QCallable, QCallableList
|
11
|
+
from .synthesize_separately import synthesize_separately
|
11
12
|
from .write_qmod import write_qmod
|
12
13
|
|
13
14
|
__all__ = [
|
@@ -30,4 +31,5 @@ __all__ = [
|
|
30
31
|
"get_expression_numeric_attributes",
|
31
32
|
"qfunc",
|
32
33
|
"write_qmod",
|
34
|
+
"synthesize_separately",
|
33
35
|
] + _builtins_all
|
@@ -22,6 +22,7 @@ from .standard_gates import *
|
|
22
22
|
from .state_preparation import *
|
23
23
|
from .state_preparation import _prepare_uniform_trimmed_state_step
|
24
24
|
from .swap_test import *
|
25
|
+
from .variational import *
|
25
26
|
|
26
27
|
CORE_LIB_DECLS = [
|
27
28
|
func.func_decl
|
@@ -138,6 +139,8 @@ OPEN_LIB_DECLS = [
|
|
138
139
|
_qct_d_operator,
|
139
140
|
_qct_pi_operator,
|
140
141
|
_check_msb,
|
142
|
+
encode_in_angle,
|
143
|
+
encode_on_bloch,
|
141
144
|
)
|
142
145
|
]
|
143
146
|
|
@@ -252,4 +255,6 @@ __all__ = [
|
|
252
255
|
"qst_type2",
|
253
256
|
"modular_increment",
|
254
257
|
"qft",
|
258
|
+
"encode_in_angle",
|
259
|
+
"encode_on_bloch",
|
255
260
|
]
|
@@ -405,7 +405,7 @@ def RZZ(theta: CReal, target: QArray[QBit, Literal[2]]) -> None:
|
|
405
405
|
|
406
406
|
|
407
407
|
@qfunc(external=True)
|
408
|
-
def CH(
|
408
|
+
def CH(ctrl: QBit, target: QBit) -> None:
|
409
409
|
"""
|
410
410
|
[Qmod core-library function]
|
411
411
|
|
@@ -423,7 +423,7 @@ def CH(control: QBit, target: QBit) -> None:
|
|
423
423
|
$$
|
424
424
|
|
425
425
|
Args:
|
426
|
-
|
426
|
+
ctrl: The control qubit.
|
427
427
|
target: The qubit to apply the Hadamard gate on.
|
428
428
|
|
429
429
|
Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
|
@@ -432,7 +432,7 @@ def CH(control: QBit, target: QBit) -> None:
|
|
432
432
|
|
433
433
|
|
434
434
|
@qfunc(external=True)
|
435
|
-
def CX(
|
435
|
+
def CX(ctrl: QBit, target: QBit) -> None:
|
436
436
|
"""
|
437
437
|
[Qmod core-library function]
|
438
438
|
|
@@ -450,7 +450,7 @@ def CX(control: QBit, target: QBit) -> None:
|
|
450
450
|
$$
|
451
451
|
|
452
452
|
Args:
|
453
|
-
|
453
|
+
ctrl: The control qubit.
|
454
454
|
target: The qubit to apply the Pauli-X gate on.
|
455
455
|
|
456
456
|
Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
|
@@ -459,7 +459,7 @@ def CX(control: QBit, target: QBit) -> None:
|
|
459
459
|
|
460
460
|
|
461
461
|
@qfunc(external=True)
|
462
|
-
def CY(
|
462
|
+
def CY(ctrl: QBit, target: QBit) -> None:
|
463
463
|
"""
|
464
464
|
[Qmod core-library function]
|
465
465
|
|
@@ -477,7 +477,7 @@ def CY(control: QBit, target: QBit) -> None:
|
|
477
477
|
$$
|
478
478
|
|
479
479
|
Args:
|
480
|
-
|
480
|
+
ctrl: The control qubit.
|
481
481
|
target: The qubit to apply the Pauli-Y gate on.
|
482
482
|
|
483
483
|
Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
|
@@ -486,7 +486,7 @@ def CY(control: QBit, target: QBit) -> None:
|
|
486
486
|
|
487
487
|
|
488
488
|
@qfunc(external=True)
|
489
|
-
def CZ(
|
489
|
+
def CZ(ctrl: QBit, target: QBit) -> None:
|
490
490
|
"""
|
491
491
|
[Qmod core-library function]
|
492
492
|
|
@@ -504,7 +504,7 @@ def CZ(control: QBit, target: QBit) -> None:
|
|
504
504
|
$$
|
505
505
|
|
506
506
|
Args:
|
507
|
-
|
507
|
+
ctrl: The control qubit.
|
508
508
|
target: The qubit to apply the Pauli-Z gate on.
|
509
509
|
|
510
510
|
Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
|
@@ -513,7 +513,7 @@ def CZ(control: QBit, target: QBit) -> None:
|
|
513
513
|
|
514
514
|
|
515
515
|
@qfunc(external=True)
|
516
|
-
def CRX(theta: CReal,
|
516
|
+
def CRX(theta: CReal, ctrl: QBit, target: QBit) -> None:
|
517
517
|
"""
|
518
518
|
[Qmod core-library function]
|
519
519
|
|
@@ -532,7 +532,7 @@ def CRX(theta: CReal, control: QBit, target: QBit) -> None:
|
|
532
532
|
|
533
533
|
Args:
|
534
534
|
theta: The rotation angle in radians.
|
535
|
-
|
535
|
+
ctrl: The control qubit.
|
536
536
|
target: The qubit to apply the RX gate on.
|
537
537
|
|
538
538
|
Link: [Reference Manual](https://docs.classiq.io/latest/reference-manual/qmod/library-reference/core-library-functions/standard_gates/standard_gates/)
|
@@ -541,7 +541,7 @@ def CRX(theta: CReal, control: QBit, target: QBit) -> None:
|
|
541
541
|
|
542
542
|
|
543
543
|
@qfunc(external=True)
|
544
|
-
def CRY(theta: CReal,
|
544
|
+
def CRY(theta: CReal, ctrl: QBit, target: QBit) -> None:
|
545
545
|
"""
|
546
546
|
[Qmod core-library function]
|
547
547
|
|
@@ -569,7 +569,7 @@ def CRY(theta: CReal, control: QBit, target: QBit) -> None:
|
|
569
569
|
|
570
570
|
|
571
571
|
@qfunc(external=True)
|
572
|
-
def CRZ(theta: CReal,
|
572
|
+
def CRZ(theta: CReal, ctrl: QBit, target: QBit) -> None:
|
573
573
|
"""
|
574
574
|
[Qmod core-library function]
|
575
575
|
|
@@ -597,7 +597,7 @@ def CRZ(theta: CReal, control: QBit, target: QBit) -> None:
|
|
597
597
|
|
598
598
|
|
599
599
|
@qfunc(external=True)
|
600
|
-
def CPHASE(theta: CReal,
|
600
|
+
def CPHASE(theta: CReal, ctrl: QBit, target: QBit) -> None:
|
601
601
|
"""
|
602
602
|
[Qmod core-library function]
|
603
603
|
|
@@ -707,7 +707,7 @@ def U(theta: CReal, phi: CReal, lam: CReal, gam: CReal, target: QBit) -> None:
|
|
707
707
|
|
708
708
|
|
709
709
|
@qfunc(external=True)
|
710
|
-
def CCX(
|
710
|
+
def CCX(ctrl: QArray[QBit, Literal[2]], target: QBit) -> None:
|
711
711
|
"""
|
712
712
|
[Qmod core-library function]
|
713
713
|
|
@@ -0,0 +1,37 @@
|
|
1
|
+
from classiq.qmod.cparam import CReal
|
2
|
+
from classiq.qmod.qfunc import qfunc
|
3
|
+
from classiq.qmod.qmod_parameter import CArray
|
4
|
+
from classiq.qmod.qmod_variable import Output, QArray, QBit
|
5
|
+
|
6
|
+
|
7
|
+
@qfunc(external=True)
|
8
|
+
def encode_in_angle(data: CArray[CReal], qba: Output[QArray[QBit]]) -> None:
|
9
|
+
"""
|
10
|
+
[Qmod Classiq-library function]
|
11
|
+
|
12
|
+
Creates an angle encoding of n data points on n qubits.
|
13
|
+
|
14
|
+
Applies RY($\\pi$data[i]) on qba[i].
|
15
|
+
|
16
|
+
Args:
|
17
|
+
data: A classical array representing the data to encode.
|
18
|
+
qba: The array of qubits on which the data is encoded.
|
19
|
+
"""
|
20
|
+
pass
|
21
|
+
|
22
|
+
|
23
|
+
@qfunc(external=True)
|
24
|
+
def encode_on_bloch(data: CArray[CReal], qba: Output[QArray]) -> None:
|
25
|
+
"""
|
26
|
+
[Qmod Classiq-library function]
|
27
|
+
|
28
|
+
Creates a dense angle encoding of n data points on n//2 qubits.
|
29
|
+
|
30
|
+
Encodes pairs of data points on a Bloch sphere, via RX($\\pi$data[2*i])RZ($\\pi$data[2*i+1]) on qba[i].
|
31
|
+
If the length of the data is odd then RX($\\pi$data[i]) is applied on the last qubit.
|
32
|
+
|
33
|
+
Args:
|
34
|
+
data: A classical array representing the data to encode.
|
35
|
+
qba: The QArray of QBits on which the data is encoded.
|
36
|
+
"""
|
37
|
+
pass
|
@@ -155,9 +155,9 @@ def _get_wrapper_main(gen_main: QFunc, preferences: Optional[Preferences]) -> Mo
|
|
155
155
|
|
156
156
|
|
157
157
|
def _get_all_model_functions_as_generative_functions() -> List[GenerativeQFunc]:
|
158
|
+
|
158
159
|
gen_functions = list(GEN_QFUNCS) + [
|
159
|
-
|
160
|
-
for dec_func in DEC_QFUNCS
|
160
|
+
_get_gen_from_dec(dec_func) for dec_func in DEC_QFUNCS
|
161
161
|
]
|
162
162
|
return [
|
163
163
|
(
|
@@ -173,6 +173,16 @@ def _get_all_model_functions_as_generative_functions() -> List[GenerativeQFunc]:
|
|
173
173
|
]
|
174
174
|
|
175
175
|
|
176
|
+
def _get_gen_from_dec(dec_func: QFunc) -> GenerativeQFunc:
|
177
|
+
synthesis_data = dec_func.synthesis_data
|
178
|
+
if synthesis_data is not None and synthesis_data.should_synthesize_separately:
|
179
|
+
raise ClassiqError(
|
180
|
+
"""The model contains generative functions,
|
181
|
+
which cannot coexist with functions marked for separate synthesis"""
|
182
|
+
)
|
183
|
+
return GenerativeQFunc(dec_func._py_callable, dec_func.func_decl)
|
184
|
+
|
185
|
+
|
176
186
|
def _interpret_generative_model(
|
177
187
|
gen_model: Model, gen_functions: List[GenerativeQFunc]
|
178
188
|
) -> Dict[str, NativeFunctionDefinition]:
|
classiq/qmod/qmod_parameter.py
CHANGED
@@ -44,7 +44,9 @@ class CParamList(CParam):
|
|
44
44
|
self._list_type = list_type
|
45
45
|
|
46
46
|
def __getitem__(self, key: Any) -> CParam:
|
47
|
+
param_type = self._list_type.element_type
|
47
48
|
if isinstance(key, slice):
|
49
|
+
param_type = self._list_type
|
48
50
|
start = key.start if key.start is not None else ""
|
49
51
|
stop = key.stop if key.stop is not None else ""
|
50
52
|
if key.step is not None:
|
@@ -53,7 +55,7 @@ class CParamList(CParam):
|
|
53
55
|
key = f"{start}:{stop}"
|
54
56
|
return create_param(
|
55
57
|
f"({self})[{key}]",
|
56
|
-
|
58
|
+
param_type,
|
57
59
|
qmodule=self._qmodule,
|
58
60
|
)
|
59
61
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import inspect
|
2
|
+
import warnings
|
2
3
|
from abc import ABC
|
3
4
|
from dataclasses import is_dataclass
|
4
5
|
from enum import Enum as PythonEnum
|
@@ -21,7 +22,7 @@ import pydantic
|
|
21
22
|
from sympy import Basic
|
22
23
|
from typing_extensions import Self
|
23
24
|
|
24
|
-
from classiq.interface.exceptions import ClassiqValueError
|
25
|
+
from classiq.interface.exceptions import ClassiqDeprecationWarning, ClassiqValueError
|
25
26
|
from classiq.interface.generator.expressions.expression import Expression
|
26
27
|
from classiq.interface.generator.functions.concrete_types import (
|
27
28
|
NativePythonClassicalTypes,
|
@@ -392,6 +393,7 @@ def _get_operand_hint(
|
|
392
393
|
def _prepare_args(
|
393
394
|
decl: AnonQuantumFunctionDeclaration, arg_list: List[Any], kwargs: Dict[str, Any]
|
394
395
|
) -> List[ArgValue]:
|
396
|
+
_apply_control_backward_compatibility(decl, kwargs)
|
395
397
|
result = []
|
396
398
|
for idx, arg_decl in enumerate(decl.positional_arg_declarations):
|
397
399
|
arg = None
|
@@ -414,6 +416,24 @@ def _prepare_args(
|
|
414
416
|
return result
|
415
417
|
|
416
418
|
|
419
|
+
def _apply_control_backward_compatibility(
|
420
|
+
decl: AnonQuantumFunctionDeclaration, kwargs: Dict[str, Any]
|
421
|
+
) -> None:
|
422
|
+
from classiq.qmod.builtins.functions import __all__ as builtin_functions
|
423
|
+
|
424
|
+
if decl.name in builtin_functions and "control" in kwargs:
|
425
|
+
warnings.warn(
|
426
|
+
f"Parameter 'control' of function {decl.name!r} has been renamed to "
|
427
|
+
f"'ctrl'. Parameter 'control' will no longer be supported starting on "
|
428
|
+
f"4/11/24 at the earliest.\nHint: Change {decl.name}(control=...) to "
|
429
|
+
f"{decl.name}(ctrl=...).",
|
430
|
+
ClassiqDeprecationWarning,
|
431
|
+
stacklevel=6,
|
432
|
+
)
|
433
|
+
kwargs["ctrl"] = kwargs["control"]
|
434
|
+
kwargs.pop("control")
|
435
|
+
|
436
|
+
|
417
437
|
def _create_quantum_function_call(
|
418
438
|
decl_: QuantumFunctionDeclaration,
|
419
439
|
index_: Optional[Union[CParamScalar, int]] = None,
|
classiq/qmod/quantum_function.py
CHANGED
@@ -10,7 +10,10 @@ from classiq.interface.executor.execution_preferences import ExecutionPreference
|
|
10
10
|
from classiq.interface.generator.model.constraints import Constraints
|
11
11
|
from classiq.interface.generator.model.preferences.preferences import Preferences
|
12
12
|
from classiq.interface.model.model import Model
|
13
|
-
from classiq.interface.model.native_function_definition import
|
13
|
+
from classiq.interface.model.native_function_definition import (
|
14
|
+
FunctionSynthesisData,
|
15
|
+
NativeFunctionDefinition,
|
16
|
+
)
|
14
17
|
from classiq.interface.model.quantum_function_declaration import (
|
15
18
|
NamedParamsQuantumFunctionDeclaration,
|
16
19
|
)
|
@@ -32,6 +35,7 @@ class QFunc(QExpandable):
|
|
32
35
|
_validate_no_gen_params(py_callable.__annotations__)
|
33
36
|
super().__init__(py_callable)
|
34
37
|
functools.update_wrapper(self, py_callable)
|
38
|
+
self._synthesis_data: Optional[FunctionSynthesisData] = None
|
35
39
|
|
36
40
|
@property
|
37
41
|
def func_decl(self) -> NamedParamsQuantumFunctionDeclaration:
|
@@ -40,6 +44,14 @@ class QFunc(QExpandable):
|
|
40
44
|
infer_func_decl(self._py_callable, qmodule=self._qmodule),
|
41
45
|
)
|
42
46
|
|
47
|
+
@property
|
48
|
+
def synthesis_data(self) -> Optional[FunctionSynthesisData]:
|
49
|
+
return self._synthesis_data
|
50
|
+
|
51
|
+
@synthesis_data.setter
|
52
|
+
def synthesis_data(self, value: FunctionSynthesisData) -> None:
|
53
|
+
self._synthesis_data = value
|
54
|
+
|
43
55
|
def __call__(self, *args: Any, **kwargs: Any) -> None:
|
44
56
|
super().__call__(*args, **kwargs)
|
45
57
|
self.expand()
|
@@ -82,7 +94,17 @@ class QFunc(QExpandable):
|
|
82
94
|
return
|
83
95
|
super().expand()
|
84
96
|
self._qmodule.native_defs[self.func_decl.name] = NativeFunctionDefinition(
|
85
|
-
**{
|
97
|
+
**{
|
98
|
+
**self.func_decl.model_dump(),
|
99
|
+
**{
|
100
|
+
"body": self.body,
|
101
|
+
"synthesis_data": (
|
102
|
+
self.synthesis_data
|
103
|
+
if self.synthesis_data is not None
|
104
|
+
else FunctionSynthesisData()
|
105
|
+
),
|
106
|
+
},
|
107
|
+
},
|
86
108
|
)
|
87
109
|
|
88
110
|
def _add_constants_from_classical_code(
|
@@ -0,0 +1,16 @@
|
|
1
|
+
from typing import Union
|
2
|
+
|
3
|
+
from classiq.interface.exceptions import ClassiqError
|
4
|
+
from classiq.interface.model.native_function_definition import FunctionSynthesisData
|
5
|
+
|
6
|
+
from classiq.qmod.quantum_function import ExternalQFunc, GenerativeQFunc, QFunc
|
7
|
+
|
8
|
+
|
9
|
+
def synthesize_separately(qfunc: Union[QFunc, GenerativeQFunc, ExternalQFunc]) -> QFunc:
|
10
|
+
if isinstance(qfunc, QFunc):
|
11
|
+
qfunc.synthesis_data = FunctionSynthesisData(should_synthesize_separately=True)
|
12
|
+
return qfunc
|
13
|
+
if isinstance(qfunc, GenerativeQFunc):
|
14
|
+
raise ClassiqError("Generative functions can not be synthesized separately")
|
15
|
+
if isinstance(qfunc, ExternalQFunc):
|
16
|
+
raise ClassiqError("External functions can not be synthesized separately")
|
@@ -3,7 +3,7 @@ classiq/_analyzer_extras/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
|
|
3
3
|
classiq/_analyzer_extras/_ipywidgets_async_extension.py,sha256=DF-G1Dhp51P6qlxTJT-kxPMJiYy9tyNoCvqbPQOeJd0,2163
|
4
4
|
classiq/_analyzer_extras/interactive_hardware.py,sha256=f7ad2HeFq1f-2dJtPpgOE_w2IFzm49W6P_c-MzqJ5qE,3257
|
5
5
|
classiq/_internals/__init__.py,sha256=OA8BXI1JSGyLXEUuLLxp-u2X_S0zYTEPblmle06pHIo,651
|
6
|
-
classiq/_internals/api_wrapper.py,sha256=
|
6
|
+
classiq/_internals/api_wrapper.py,sha256=XR_R5XmhHw76R3IBRv0LvqVrDg_WYUIyo5QOMvgB3iM,12842
|
7
7
|
classiq/_internals/async_utils.py,sha256=-GmCGCfr7JnIfQmiR_MqEr5R29FxibI7ctJJD9UJQOs,3355
|
8
8
|
classiq/_internals/authentication/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
9
|
classiq/_internals/authentication/auth0.py,sha256=OIIXt0nuA3uP1avprwS35JWafw-LZ7OUDHPQx5MXEOU,3669
|
@@ -11,7 +11,7 @@ classiq/_internals/authentication/authentication.py,sha256=58Xv1QtynXwEfBqIV5E3L
|
|
11
11
|
classiq/_internals/authentication/device.py,sha256=t9LLZwG90r59TC1axQpY4cYw6n1bFziVHgOqsFe4ESg,4003
|
12
12
|
classiq/_internals/authentication/password_manager.py,sha256=0UgNqBSQa0DXvgc0Uuomsq6tT6P5jXgU-neiOKnnaXk,4444
|
13
13
|
classiq/_internals/authentication/token_manager.py,sha256=SdpWQNgETvF0xC8QLIms1Qm_iYV8XGjmf1G6evq7cnE,5259
|
14
|
-
classiq/_internals/client.py,sha256=
|
14
|
+
classiq/_internals/client.py,sha256=s4baK5XGUAHBjG3-xFXIRJ5KRoUgeoz_EMhphnfvD-k,10409
|
15
15
|
classiq/_internals/config.py,sha256=-ZRTNxwGyB5_d1fcrG2BDBd4Tv7aW6qK1U84wbS8CuY,3540
|
16
16
|
classiq/_internals/help.py,sha256=9gl64Y8nKW-f-8pYt7lMozOP6uERcIIf8dotgn_WKA0,460
|
17
17
|
classiq/_internals/host_checker.py,sha256=D0rgnoZrHo62rYS32yCuYZSyMrMChZG5ITsJxwj0R5g,3969
|
@@ -79,22 +79,23 @@ classiq/applications/qnn/datasets/datasets_utils.py,sha256=LgerS3HPe82gVTMg6YLWF
|
|
79
79
|
classiq/applications/qnn/gradients/__init__.py,sha256=md5sLINVaPeZUHJUe1ZtIcqLN_V_I2RKfBe3mO3zZs4,102
|
80
80
|
classiq/applications/qnn/gradients/quantum_gradient.py,sha256=SPEcaZA1Yi86_GVYOs5zfn6JNY6bpmKdoICOgMOsNUY,1287
|
81
81
|
classiq/applications/qnn/gradients/simple_quantum_gradient.py,sha256=tXpbqdz1PMny06vkseBRjQrfXPy1-Bv3_2RJ8YfVaCU,5022
|
82
|
-
classiq/applications/qnn/qlayer.py,sha256=
|
82
|
+
classiq/applications/qnn/qlayer.py,sha256=bHobgZ61c861VQ0nrmFIb1VNltgb07fCWa-dkyDQn88,6662
|
83
83
|
classiq/applications/qnn/torch_utils.py,sha256=FCPCYOq_wW0TDYCuHyRCea_375MRNLdIvxRn4dwr0AY,4436
|
84
84
|
classiq/applications/qnn/types.py,sha256=HAeyKQFTy9JsqGlr-I08K1zJBZJRzA4UHpdYOn5f790,925
|
85
85
|
classiq/applications/qsvm/__init__.py,sha256=FQ5hxBPPxW6uX7Csp9YGh1fA3tzr3fCTru3x6PhENLY,276
|
86
86
|
classiq/applications/qsvm/qsvm.py,sha256=GQh-WpyndAEy35t5YZ2irx-IyY8huOU0VhLkpSz10Po,202
|
87
87
|
classiq/applications/qsvm/qsvm_data_generation.py,sha256=1NJfcEWAwRtjWilXhHJbcDVcPlVZc4qETgof1gedofo,1617
|
88
88
|
classiq/applications/qsvm/qsvm_model_constructor.py,sha256=2AsdS4lXM0kgwevi5lLqbttDQt2B6fPUomRqfbPZgXk,3958
|
89
|
-
classiq/execution/__init__.py,sha256=
|
89
|
+
classiq/execution/__init__.py,sha256=O9Gfnkfch7mH_7HhaUn1NjXx9gA6o5HQ1pUCCuu4xKI,1245
|
90
90
|
classiq/execution/all_hardware_devices.py,sha256=J7LilVskLZFDSqNnIcaqN3_esbs9JgKPrbdApHKU6FI,393
|
91
|
-
classiq/execution/execution_session.py,sha256=
|
92
|
-
classiq/execution/iqcc.py,sha256=
|
91
|
+
classiq/execution/execution_session.py,sha256=yix5xS06W0m6nErWfxG-yquClaEMAgjqGobwn_cYF6Y,15851
|
92
|
+
classiq/execution/iqcc.py,sha256=0wy1tgQFcwqf9wFYyi6_OYRtx4s0AEViIAIvUkyKBmk,2429
|
93
93
|
classiq/execution/jobs.py,sha256=dFV6quaQ4tknqti4dtVtibe_5tPvGseeWdNmCWjVcfQ,9582
|
94
|
+
classiq/execution/qaoa.py,sha256=8bNDAk3URvyRzZQGLwNWfW_VabnaDde0bCpqm0Qv5tI,3020
|
94
95
|
classiq/execution/qnn.py,sha256=qsOA2mD8Ne_4VwvyGPfuHVDTzyxVnDHwE2gfoaOMsf8,2339
|
95
|
-
classiq/executor.py,sha256=
|
96
|
+
classiq/executor.py,sha256=H7tfRtGcV85Dp1rPfNNFsHhN8i0smtCmzIdzYzk8rVk,2609
|
96
97
|
classiq/interface/__init__.py,sha256=cg7hD_XVu1_jJ1fgwmT0rMIoZHopNVeB8xtlmMx-E_A,83
|
97
|
-
classiq/interface/_version.py,sha256=
|
98
|
+
classiq/interface/_version.py,sha256=axDk2zvHsD7aFqIqWo6E2xREykK5nXdXN2D0d7mSbpg,197
|
98
99
|
classiq/interface/analyzer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
99
100
|
classiq/interface/analyzer/analysis_params.py,sha256=Pck4PCcXjhJxCp7k3JOStMPvLZBX28B1SqO_R_RR0eI,3922
|
100
101
|
classiq/interface/analyzer/cytoscape_graph.py,sha256=fDiqbqWHKl-3uk9i0PupSMfsNsC1xhIAO6grigF5peE,2373
|
@@ -142,9 +143,9 @@ classiq/interface/combinatorial_optimization/solver_types.py,sha256=kcLt80fQucq_
|
|
142
143
|
classiq/interface/debug_info/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
143
144
|
classiq/interface/debug_info/debug_info.py,sha256=NERveV8kf6EEB9OPYYhREt7qQsnB7ekQZ7iSIX8h6-I,2984
|
144
145
|
classiq/interface/enum_utils.py,sha256=QxkxLGgON8vdSzLZzHFlPEBJoGOqoIwpESEfLfRqN0w,312
|
145
|
-
classiq/interface/exceptions.py,sha256
|
146
|
+
classiq/interface/exceptions.py,sha256=BRC959zbYlSNRFKX8NkUqGRxRMm1eLWMFYlNiHaZgBs,4266
|
146
147
|
classiq/interface/execution/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
147
|
-
classiq/interface/execution/iqcc.py,sha256=
|
148
|
+
classiq/interface/execution/iqcc.py,sha256=HmqnkUCJT_rXGp4PIjcqJwDw2IfybxfLZ8MBRGgR6Tg,370
|
148
149
|
classiq/interface/execution/jobs.py,sha256=Ito037TOdx-X-D-FB1sgMJ1DxWNtWV9z5bcEjc9j-e8,619
|
149
150
|
classiq/interface/execution/primitives.py,sha256=a_vH8YgdMeEVYx1h9sgNAqbDQmqca3ePvHfsADHJMn4,584
|
150
151
|
classiq/interface/execution/resource_estimator.py,sha256=YJRuk9lAkhpwqegjyOrxvEY1TgHzvPnXCMAd-MQC6GE,144
|
@@ -161,7 +162,7 @@ classiq/interface/executor/optimizer_preferences.py,sha256=pOl2HdYnCeKi5v9aJtiPx
|
|
161
162
|
classiq/interface/executor/quantum_code.py,sha256=5UTkVpCnnpnArJCCuQmMxgOk1sQyzS1FqzABN4VSlTM,4271
|
162
163
|
classiq/interface/executor/quantum_instruction_set.py,sha256=_2owh6shcNSKlCHCXbAO6UzzZqldTu3YmUqUw9Qefvo,565
|
163
164
|
classiq/interface/executor/register_initialization.py,sha256=1DwImV3VCFhrwesd7j3zumulN0A9EWMXgWSdX3c_DZM,1390
|
164
|
-
classiq/interface/executor/result.py,sha256=
|
165
|
+
classiq/interface/executor/result.py,sha256=NFDW77EyRsmVo34H8txVDDMukbOzs6hq4SsvExh48Ok,12316
|
165
166
|
classiq/interface/executor/vqe_result.py,sha256=IyLslBWEJ87AdDWqe3pG22Qy61OazPCCREOHADXGn8I,2343
|
166
167
|
classiq/interface/finance/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
167
168
|
classiq/interface/finance/finance_modelling_params.py,sha256=dmJscMXugQsBRoFd4HFtrTU8gsuZJ6sS51R4crC-PKE,347
|
@@ -337,6 +338,7 @@ classiq/interface/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
|
|
337
338
|
classiq/interface/helpers/classproperty.py,sha256=pt9A39GgEMzj2nbY5gjFp_CId_wom6lOQt_PADidT4Y,279
|
338
339
|
classiq/interface/helpers/custom_encoders.py,sha256=0-9DTHwQr-I_vP1Ie4Z9N4qfzDhFvGT4qsXP-EdDegs,107
|
339
340
|
classiq/interface/helpers/custom_pydantic_types.py,sha256=2BypLUrVPUPjjXGERcx-dyJ1SRH1vUf8TELDPoDTUU8,2955
|
341
|
+
classiq/interface/helpers/dotdict.py,sha256=b6b8Nln4DsU5faCIvzEilt2_rvAs9sYcZjHeZqtKZDw,472
|
340
342
|
classiq/interface/helpers/hashable_mixin.py,sha256=w6aqoVdjqbjTOetwS2lbgiOPUQLcJFY0vPiz_cqNAuk,1079
|
341
343
|
classiq/interface/helpers/hashable_pydantic_base_model.py,sha256=0wLXnkQQDE3obO1qY9RbYh7eTmBsP3cUGt8PvbNjg9g,611
|
342
344
|
classiq/interface/helpers/pydantic_model_helpers.py,sha256=kBQ0jbz1bemmKivRdfwWQtclRsYDr_ArQzF-gX1jy7k,527
|
@@ -344,7 +346,7 @@ classiq/interface/helpers/validation_helpers.py,sha256=oUD1jMdTSoAkV-HjbkvMovb8Z
|
|
344
346
|
classiq/interface/helpers/versioned_model.py,sha256=kBgEghNdSidohb0-p_EjRFZLs7LAmLZ_uKIHZFSZ8cQ,159
|
345
347
|
classiq/interface/ide/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
346
348
|
classiq/interface/ide/ide_data.py,sha256=8T9lt6ihJn_tOcwPQHC8D7lDn__kG2ni8ZKT3KetrOU,2543
|
347
|
-
classiq/interface/ide/visual_model.py,sha256=
|
349
|
+
classiq/interface/ide/visual_model.py,sha256=9jXokftguzOyq8TJFMScbI7otiXXIEBIeE6w-oTqDpw,3098
|
348
350
|
classiq/interface/interface_version.py,sha256=hXglUKVBx98E8bY6pZCVyjOHpoouaIe8o1uvb1RQXyY,24
|
349
351
|
classiq/interface/jobs.py,sha256=ABB-0ASX-ZM8aRtDdD76SWqr9mvqitaoFSim2i9G-u8,2345
|
350
352
|
classiq/interface/model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -356,7 +358,7 @@ classiq/interface/model/handle_binding.py,sha256=jNmS1uDHfB9eYFLDwsCuMx_lzBoVpt4
|
|
356
358
|
classiq/interface/model/inplace_binary_operation.py,sha256=WuragOXVSW-g50rdIre-wQym8YvKiLyOEfw2by-h3Tc,1467
|
357
359
|
classiq/interface/model/invert.py,sha256=9gN0vmy4892_ItwPxKc0lTjjagyKUX6mEer2vINdL5o,294
|
358
360
|
classiq/interface/model/model.py,sha256=HR5Vp1TnNqC2N_9Pl8S55yeKFIZ9wjznNIJeUZfzdfA,6606
|
359
|
-
classiq/interface/model/native_function_definition.py,sha256=
|
361
|
+
classiq/interface/model/native_function_definition.py,sha256=K_hwgBb2io81ycHKP7J3si3B4dpJh_K_9Eb7MGI68UI,986
|
360
362
|
classiq/interface/model/parameter.py,sha256=otI4w5Oc4EPAALfZxDf-QxBlMSXP_CtKaUa7STMdaiw,333
|
361
363
|
classiq/interface/model/phase_operation.py,sha256=sZh00h1wOkZLiwdv_-vqJRtYJxZzmsNqCjGm2z3aXRQ,323
|
362
364
|
classiq/interface/model/port_declaration.py,sha256=Ujk2Cvjay2hN-W1DKhh-g56D_L1DCl5gDukWKTaJPZo,1656
|
@@ -413,7 +415,7 @@ classiq/model_expansions/quantum_operations/classicalif.py,sha256=6SFumWVIWCTNQs
|
|
413
415
|
classiq/model_expansions/quantum_operations/control.py,sha256=2qSLebOCPn8UOQJiiFZVEEGT8pK9UasWx5GXYjFYxH4,9989
|
414
416
|
classiq/model_expansions/quantum_operations/emitter.py,sha256=Y0qGHPcdFYGOUN6cAScA8ff6PmrtGgr-Y_dVHuQQ2bw,11790
|
415
417
|
classiq/model_expansions/quantum_operations/expression_operation.py,sha256=OHenY0a9SNyMGghCdrEXfuhFJHABWZ9v848BxFPlIEc,7479
|
416
|
-
classiq/model_expansions/quantum_operations/inplace_binary_operation.py,sha256=
|
418
|
+
classiq/model_expansions/quantum_operations/inplace_binary_operation.py,sha256=jmX7wrReni1T5mxsD261JMsOCjMaoANg803o6qvjXWU,12674
|
417
419
|
classiq/model_expansions/quantum_operations/invert.py,sha256=2lGBaGR6XuMPkMXSx9_LlVI_Y--XYaEDyofCYUgin14,1667
|
418
420
|
classiq/model_expansions/quantum_operations/phase.py,sha256=vnfl9EbYiej3Oofy3Vc2blJX8XXFcCi-8IisP2dOxAg,7246
|
419
421
|
classiq/model_expansions/quantum_operations/power.py,sha256=7ICUvE4_mXqiCdRNi0fbxsfs_MpNFLUk4d2NF2plZXQ,2667
|
@@ -434,13 +436,13 @@ classiq/model_expansions/visitors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeR
|
|
434
436
|
classiq/model_expansions/visitors/boolean_expression_transformers.py,sha256=a8ITXY48uROZFd9MF8tXdXs14Uxh8XbBpuvRXvRehjY,8067
|
435
437
|
classiq/model_expansions/visitors/variable_references.py,sha256=Og9Ifj9mBqdNfdCN5YKy14oFmxVaY3FDKRtfgWmCVbQ,4096
|
436
438
|
classiq/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
437
|
-
classiq/qmod/__init__.py,sha256=
|
439
|
+
classiq/qmod/__init__.py,sha256=OMMtt4fV3lgk4nszak2VOjvQFhEpf9vZ1JplVYKCcfU,928
|
438
440
|
classiq/qmod/builtins/__init__.py,sha256=pYNdaroGuxuXRPX3oHdwGoF5sCfHSqU9IG3uuenCmT8,1206
|
439
441
|
classiq/qmod/builtins/classical_execution_primitives.py,sha256=VlA4Wam35v2wMppZ5wCI01uQOSQIzT948Dmn3URBZPk,3244
|
440
442
|
classiq/qmod/builtins/classical_functions.py,sha256=sOMYm_vU24mAGgR63qmJ5eMTgpacXCRIhNEXa6pl0Q4,1914
|
441
443
|
classiq/qmod/builtins/constants.py,sha256=FURSVt0dlIAw_xkGMyj89z4eub7vUdvUrPzaLTGUQxk,222
|
442
444
|
classiq/qmod/builtins/enums.py,sha256=JzfANJT4Z1Gy8io4JjCnez4t97mxBjT1K-ij2Cli9kQ,3417
|
443
|
-
classiq/qmod/builtins/functions/__init__.py,sha256=
|
445
|
+
classiq/qmod/builtins/functions/__init__.py,sha256=RnumBn5Y7BoGqLgwAsyysji_mt7NeRMj69TGpakvMx4,5585
|
444
446
|
classiq/qmod/builtins/functions/amplitude_estimation.py,sha256=nO2HlzVgZw3621YUr1-4AflAWDm5xTBaTSjQ6o9yjKA,1562
|
445
447
|
classiq/qmod/builtins/functions/arithmetic.py,sha256=qG6Iq8JS_jF3wXmBEQSasGT1vc9DbiZUg_6UcB9Nv4I,1905
|
446
448
|
classiq/qmod/builtins/functions/benchmarking.py,sha256=TYY1VRd5DHl-mKTKeW5wF1txZgFsb3yPXM_rdgoLWCo,250
|
@@ -458,15 +460,16 @@ classiq/qmod/builtins/functions/qft.py,sha256=N8cyfZ6foBcG4pN2ui8Z3te048qrVCcqjj
|
|
458
460
|
classiq/qmod/builtins/functions/qpe.py,sha256=zemPR03SszqGLbWlwHI8ZrdRuTqcgnXdHGRSy3-4PJ8,1984
|
459
461
|
classiq/qmod/builtins/functions/qsvm.py,sha256=j5UbMWfl2UNtBewjSWgXq-fvHuAznpINw_b5-_XEKdU,586
|
460
462
|
classiq/qmod/builtins/functions/qsvt.py,sha256=aSePhlqVql8IHfmhsGY6vMucJi3htoUNKvLJYOQvIGM,6635
|
461
|
-
classiq/qmod/builtins/functions/standard_gates.py,sha256=
|
463
|
+
classiq/qmod/builtins/functions/standard_gates.py,sha256=r41BEvOyJqWB9ehuiPD9xvInnTyfINgMTAXo-Ctno7U,22307
|
462
464
|
classiq/qmod/builtins/functions/state_preparation.py,sha256=Vv_cM80h--3VAv9F4dW7jqWmEmu7hf9Yan7-9HaDaaU,15628
|
463
465
|
classiq/qmod/builtins/functions/swap_test.py,sha256=DGWCkJNvunUGR5Q_eYxKOMO21elfD8kQkiNlQpcerOU,957
|
466
|
+
classiq/qmod/builtins/functions/variational.py,sha256=fVookQxQxZLpr4S0YGRFHJywcWz4UOq2UCYmfU8DFAU,1149
|
464
467
|
classiq/qmod/builtins/operations.py,sha256=Clbx-sxfdEH4dX8Zrfb7vHVeDXV8-CWjhZfMe8qoDf0,10790
|
465
468
|
classiq/qmod/builtins/structs.py,sha256=pdjNKFAhxLNzVdz4bhONO4PwvfI_W7Z7Skjgqt47mxw,2913
|
466
469
|
classiq/qmod/cfunc.py,sha256=quwJdgYRgqI2C13SRrRunLi-Kuf7nCAk2-O2B46QtoY,1093
|
467
470
|
classiq/qmod/classical_function.py,sha256=DuPzfK--_6pR6JcuvkWoNx3jRHkRVskqyTOi4qbejr8,1221
|
468
471
|
classiq/qmod/cparam.py,sha256=wai8PyfS6QCJ8_WLck2nRZrtuEXYg1cogj4CQ_EZKP4,1182
|
469
|
-
classiq/qmod/create_model_function.py,sha256=
|
472
|
+
classiq/qmod/create_model_function.py,sha256=N8uDkynVtbafaGT31AQEQWB0fcDxoydgWJJV1xWjzOQ,7909
|
470
473
|
classiq/qmod/declaration_inferrer.py,sha256=4GEh_qzwqR2Rj_B-oBAtENCPDSq92PKcahc7I4vghG0,7003
|
471
474
|
classiq/qmod/expression_query.py,sha256=EkZPG-iJGcar2zqAwji0QtPKjapO6RL3nz8YEuhxyGg,1642
|
472
475
|
classiq/qmod/generative.py,sha256=--557jt22gVKJROwcSA7AzQBdgNl9zMXGEfRJVI6W1k,1561
|
@@ -480,11 +483,11 @@ classiq/qmod/pretty_print/pretty_printer.py,sha256=cO0fVbDoWPfMmRr9WwgW8zAKp9rla
|
|
480
483
|
classiq/qmod/python_classical_type.py,sha256=kodOLRAm4UTnrRcHGCrUKJGMJBrPmtLEvE4K5SSKkgw,2404
|
481
484
|
classiq/qmod/qfunc.py,sha256=R9Dif90S-RfOnkFWA53p-ZuG1MFVGJoNuMKPC1oULuM,1304
|
482
485
|
classiq/qmod/qmod_constant.py,sha256=ZGYhlN4sN4opm91LGFxN7eShcj5mTlDH3DJXpazW-Zk,3857
|
483
|
-
classiq/qmod/qmod_parameter.py,sha256=
|
486
|
+
classiq/qmod/qmod_parameter.py,sha256=PpK4rzY0Hszgbzr_lclROcZ7JPqnhDJBYsSQkUjkcs8,4294
|
484
487
|
classiq/qmod/qmod_variable.py,sha256=T2s0lq9T9tUBAjCTbu8SXcMIYWNAM1pLIXViNjw4w6A,24042
|
485
488
|
classiq/qmod/quantum_callable.py,sha256=sthlH5UJyJsdOxpCW3_EW3JFIYd0r1K3Zec1CDbC2-0,2451
|
486
|
-
classiq/qmod/quantum_expandable.py,sha256=
|
487
|
-
classiq/qmod/quantum_function.py,sha256=
|
489
|
+
classiq/qmod/quantum_expandable.py,sha256=zsfcUE6db8FTK9ip4qK5UhVm08Me7GuMshafXvxxDi8,16480
|
490
|
+
classiq/qmod/quantum_function.py,sha256=eF5pJZPgx2gBmQ7g79nmGa-vEz_7_SE1fbR9a0QJEJQ,8044
|
488
491
|
classiq/qmod/semantics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
489
492
|
classiq/qmod/semantics/annotation.py,sha256=vjEsS1IEXkKXMP3UO-Fh4CUomQI7hqWimonZHtwMQek,1246
|
490
493
|
classiq/qmod/semantics/error_manager.py,sha256=GYKC61JdKlFrD2SDo7s4Yrfts6SV18PTk6l8tJte2mw,2768
|
@@ -497,10 +500,11 @@ classiq/qmod/semantics/validation/types_validation.py,sha256=cuefLq7jC6rm-D5nLho
|
|
497
500
|
classiq/qmod/symbolic.py,sha256=Sg5WrQpPYxmzXk3pSx-4zEjqSpShdknIhlgO-yP9Yko,7638
|
498
501
|
classiq/qmod/symbolic_expr.py,sha256=LJoa9c6puMvUu4d5oU0SNzc7VXzSFBUNLf19ADzktLs,6133
|
499
502
|
classiq/qmod/symbolic_type.py,sha256=whMy3Uw4iE2SOVfHeyfTpDJ3BH6Rxlhk492ij-4QRU4,169
|
503
|
+
classiq/qmod/synthesize_separately.py,sha256=ykoQBEUd3TmngcG-g4kbdv04RCyvVLTK2c9qdRu-6lA,731
|
500
504
|
classiq/qmod/type_attribute_remover.py,sha256=NZmTXAsngWqthXjE8n-n6yE72fiWTFM12-TXXJ1kJ-Q,1242
|
501
505
|
classiq/qmod/utilities.py,sha256=z_VnIRmOYTWjJp2UlOcWK0rQRtMqysmP_Gr6WYY_nak,2734
|
502
506
|
classiq/qmod/write_qmod.py,sha256=x4K4N9XPQqGTett1vCZd-D2yVAo_DmXTJ_TyEm0fff8,1800
|
503
507
|
classiq/synthesis.py,sha256=kh2BZECSw1tYWMyVXtSvXvVpZR6rSn0JkG8xQ1uTaJQ,8029
|
504
|
-
classiq-0.
|
505
|
-
classiq-0.
|
506
|
-
classiq-0.
|
508
|
+
classiq-0.53.0.dist-info/METADATA,sha256=MeDd1yHCor4X7ZWS5Y9sYU5vyiXJoyQ7TccHa6n_0aI,3508
|
509
|
+
classiq-0.53.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
510
|
+
classiq-0.53.0.dist-info/RECORD,,
|
File without changes
|