classiq 0.99.0__py3-none-any.whl → 0.100.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/interface/_version.py +1 -1
- classiq/interface/executor/user_budget.py +2 -6
- classiq/interface/generator/generation_request.py +35 -0
- classiq/interface/generator/transpiler_basis_gates.py +1 -3
- classiq/interface/generator/types/compilation_metadata.py +1 -1
- classiq/interface/helpers/text_utils.py +4 -0
- classiq/interface/model/bind_operation.py +3 -0
- classiq/model_expansions/arithmetic_compute_result_attrs.py +10 -1
- classiq/model_expansions/quantum_operations/call_emitter.py +0 -3
- classiq/open_library/functions/__init__.py +13 -0
- classiq/open_library/functions/encodings.py +182 -0
- classiq/open_library/functions/state_preparation.py +7 -4
- classiq/qmod/qmod_variable.py +1 -1
- classiq/qmod/semantics/error_manager.py +11 -1
- {classiq-0.99.0.dist-info → classiq-0.100.0.dist-info}/METADATA +1 -1
- {classiq-0.99.0.dist-info → classiq-0.100.0.dist-info}/RECORD +18 -16
- {classiq-0.99.0.dist-info → classiq-0.100.0.dist-info}/WHEEL +0 -0
- {classiq-0.99.0.dist-info → classiq-0.100.0.dist-info}/licenses/LICENSE.txt +0 -0
classiq/interface/_version.py
CHANGED
|
@@ -28,14 +28,10 @@ class UserBudgets(VersionedModel):
|
|
|
28
28
|
rows = []
|
|
29
29
|
|
|
30
30
|
for budget in self.budgets:
|
|
31
|
-
|
|
31
|
+
provider = reverse_mapper[budget.provider]
|
|
32
32
|
rows.append(
|
|
33
33
|
[
|
|
34
|
-
|
|
35
|
-
provider_key.name
|
|
36
|
-
if hasattr(provider_key, "name")
|
|
37
|
-
else provider_key
|
|
38
|
-
),
|
|
34
|
+
provider.value,
|
|
39
35
|
f"{budget.used_budget:.3f}",
|
|
40
36
|
f"{budget.available_budget:.3f}",
|
|
41
37
|
(
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
from pydantic import Field
|
|
4
|
+
|
|
5
|
+
from classiq.interface.helpers.versioned_model import VersionedModel
|
|
6
|
+
from classiq.interface.jobs import JobStatus
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class SynthesisJobDetails(VersionedModel):
|
|
10
|
+
id: str
|
|
11
|
+
|
|
12
|
+
name: str | None = Field(default=None)
|
|
13
|
+
start_time: datetime
|
|
14
|
+
end_time: datetime | None = Field(default=None)
|
|
15
|
+
|
|
16
|
+
target_backend: str | None = Field(default=None)
|
|
17
|
+
backend_name: str | None = Field(default=None)
|
|
18
|
+
optimization_level: str | None = Field(default=None)
|
|
19
|
+
optimization_parameter: str | None = Field(default=None)
|
|
20
|
+
|
|
21
|
+
status: JobStatus
|
|
22
|
+
|
|
23
|
+
program_id: str | None = Field(default=None)
|
|
24
|
+
|
|
25
|
+
error: str | None = Field(default=None)
|
|
26
|
+
|
|
27
|
+
cost: float | None = Field(default=None)
|
|
28
|
+
|
|
29
|
+
random_seed: int | None = Field(default=None)
|
|
30
|
+
max_width: int | None = Field(default=None)
|
|
31
|
+
max_gate_count: int | None = Field(default=None)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class SynthesisJobsQueryResults(VersionedModel):
|
|
35
|
+
results: list[SynthesisJobDetails]
|
|
@@ -71,9 +71,7 @@ DEFAULT_BASIS_GATES: BasisGates = SINGLE_QUBIT_GATES | BASIC_TWO_QUBIT_GATES
|
|
|
71
71
|
ALL_GATES: BasisGates = (
|
|
72
72
|
SINGLE_QUBIT_GATES | TWO_QUBIT_GATES | THREE_QUBIT_GATES | NON_UNITARY_GATES
|
|
73
73
|
)
|
|
74
|
-
ALL_NON_3_QBIT_GATES: BasisGates =
|
|
75
|
-
SINGLE_QUBIT_GATES | TWO_QUBIT_GATES | NON_UNITARY_GATES
|
|
76
|
-
)
|
|
74
|
+
ALL_NON_3_QBIT_GATES: BasisGates = ALL_GATES - THREE_QUBIT_GATES
|
|
77
75
|
|
|
78
76
|
ROUTING_TWO_QUBIT_BASIS_GATES: BasisGates = frozenset(
|
|
79
77
|
("cx", "ecr", "rzx", "ryy", "rxx", "rzz", "cy", "cz", "cp", "swap")
|
|
@@ -3,7 +3,7 @@ from pydantic import BaseModel, Field, NonNegativeInt, PrivateAttr
|
|
|
3
3
|
|
|
4
4
|
class CompilationMetadata(BaseModel):
|
|
5
5
|
should_synthesize_separately: bool = Field(default=False)
|
|
6
|
-
occurrences_number: NonNegativeInt = Field(default=
|
|
6
|
+
occurrences_number: NonNegativeInt = Field(default=0)
|
|
7
7
|
_occupation_number: NonNegativeInt = PrivateAttr(default=0)
|
|
8
8
|
disable_perm_check: bool = Field(default=False)
|
|
9
9
|
disable_const_checks: list[str] | bool = Field(default=False)
|
|
@@ -12,6 +12,10 @@ def they(items: list) -> str:
|
|
|
12
12
|
return "it" if len(items) == 1 else "they"
|
|
13
13
|
|
|
14
14
|
|
|
15
|
+
def conj(items: list) -> str:
|
|
16
|
+
return "s" if len(items) == 1 else ""
|
|
17
|
+
|
|
18
|
+
|
|
15
19
|
def readable_list(items: list, quote: bool = False) -> str:
|
|
16
20
|
if quote:
|
|
17
21
|
items = [repr(str(item)) for item in items]
|
|
@@ -64,11 +64,20 @@ def compute_result_attrs_bitwise_and(
|
|
|
64
64
|
if left.fraction_digits > 0 or right.fraction_digits > 0:
|
|
65
65
|
raise ClassiqValueError("Bitwise AND is only defined for integers")
|
|
66
66
|
|
|
67
|
+
if left.is_signed and not right.is_signed:
|
|
68
|
+
size = right.size
|
|
69
|
+
elif not left.is_signed and right.is_signed:
|
|
70
|
+
size = left.size
|
|
71
|
+
elif not left.is_signed and not right.is_signed:
|
|
72
|
+
size = min(left.size, right.size)
|
|
73
|
+
else:
|
|
74
|
+
size = max(left.size, right.size)
|
|
75
|
+
|
|
67
76
|
# we comply with python, which uses arbitrary precision, so a positive number can
|
|
68
77
|
# always be represented by "0..." and a negative number by "1...", thus their
|
|
69
78
|
# bitwise AND is always non-negative
|
|
70
79
|
return NumericAttributes(
|
|
71
|
-
size=
|
|
80
|
+
size=size,
|
|
72
81
|
is_signed=left.is_signed and right.is_signed,
|
|
73
82
|
fraction_digits=0,
|
|
74
83
|
)
|
|
@@ -286,9 +286,6 @@ class CallEmitter(Generic[QuantumStatementT], Emitter[QuantumStatementT], ModelR
|
|
|
286
286
|
if cache_key in self._expanded_functions:
|
|
287
287
|
function_def = self._expanded_functions[cache_key]
|
|
288
288
|
self._expand_cached_function(function, function_def)
|
|
289
|
-
self._expanded_functions_compilation_metadata[
|
|
290
|
-
function_def.name
|
|
291
|
-
].occurrences_number += 1
|
|
292
289
|
return function_def
|
|
293
290
|
|
|
294
291
|
context = self._expand_operation(function)
|
|
@@ -8,6 +8,7 @@ from .amplitude_estimation import *
|
|
|
8
8
|
from .amplitude_loading import assign_amplitude_table
|
|
9
9
|
from .discrete_sine_cosine_transform import *
|
|
10
10
|
from .discrete_sine_cosine_transform import _qct_d_operator, _qct_pi_operator
|
|
11
|
+
from .encodings import *
|
|
11
12
|
from .grover import *
|
|
12
13
|
from .grover import _cond_phase_flip
|
|
13
14
|
from .hea import *
|
|
@@ -95,6 +96,9 @@ OPEN_LIBRARY_FUNCTIONS: list[BaseQFunc] = [
|
|
|
95
96
|
inplace_modular_multiply,
|
|
96
97
|
modular_multiply,
|
|
97
98
|
modular_add_qft_space,
|
|
99
|
+
one_hot_to_unary,
|
|
100
|
+
inplace_one_hot_to_unary,
|
|
101
|
+
unary_to_one_hot,
|
|
98
102
|
]
|
|
99
103
|
|
|
100
104
|
__all__ = [
|
|
@@ -103,6 +107,8 @@ __all__ = [
|
|
|
103
107
|
"amplitude_estimation",
|
|
104
108
|
"apply_to_all",
|
|
105
109
|
"assign_amplitude_table",
|
|
110
|
+
"binary_to_one_hot",
|
|
111
|
+
"binary_to_unary",
|
|
106
112
|
"c_modular_multiply",
|
|
107
113
|
"cc_modular_add",
|
|
108
114
|
"encode_in_angle",
|
|
@@ -114,8 +120,10 @@ __all__ = [
|
|
|
114
120
|
"grover_operator",
|
|
115
121
|
"grover_search",
|
|
116
122
|
"hadamard_transform",
|
|
123
|
+
"inplace_binary_to_one_hot",
|
|
117
124
|
"inplace_c_modular_multiply",
|
|
118
125
|
"inplace_modular_multiply",
|
|
126
|
+
"inplace_one_hot_to_unary",
|
|
119
127
|
"inplace_prepare_complex_amplitudes",
|
|
120
128
|
"inplace_prepare_int",
|
|
121
129
|
"inplace_prepare_sparse_amplitudes",
|
|
@@ -127,6 +135,9 @@ __all__ = [
|
|
|
127
135
|
"modular_increment",
|
|
128
136
|
"modular_multiply",
|
|
129
137
|
"multiswap",
|
|
138
|
+
"one_hot_to_binary",
|
|
139
|
+
"one_hot_to_unary",
|
|
140
|
+
"pad_zeros",
|
|
130
141
|
"phase_oracle",
|
|
131
142
|
"prepare_basis_state",
|
|
132
143
|
"prepare_bell_state",
|
|
@@ -166,4 +177,6 @@ __all__ = [
|
|
|
166
177
|
"suzuki_trotter",
|
|
167
178
|
"swap_test",
|
|
168
179
|
"switch",
|
|
180
|
+
"unary_to_binary",
|
|
181
|
+
"unary_to_one_hot",
|
|
169
182
|
]
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
from typing import Literal
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
|
|
5
|
+
from classiq.qmod.builtins.functions.allocation import free
|
|
6
|
+
from classiq.qmod.builtins.functions.standard_gates import CX, SWAP, X
|
|
7
|
+
from classiq.qmod.builtins.operations import allocate, bind, control, invert, repeat
|
|
8
|
+
from classiq.qmod.qfunc import qperm
|
|
9
|
+
from classiq.qmod.qmod_variable import Input, Output, QArray, QBit, QNum
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def get_rewire_list(qvars: list[QBit]) -> list[QBit]:
|
|
13
|
+
rewire_list = qvars[int(np.log2(len(qvars))) :]
|
|
14
|
+
for i, qvar in enumerate(qvars[: int(np.log2(len(qvars)))]):
|
|
15
|
+
rewire_list.insert(2 ** (i + 1) - 1, qvar)
|
|
16
|
+
return rewire_list
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@qperm
|
|
20
|
+
def inplace_binary_to_one_hot(qvar: QArray) -> None:
|
|
21
|
+
"""
|
|
22
|
+
Inplace conversion of binary encoded value to one-hot encoding.
|
|
23
|
+
The implementation is based on https://quantumcomputing.stackexchange.com/questions/5526/garbage-free-reversible-binary-to-unary-decoder-construction.
|
|
24
|
+
The input is assumed to be of size 2^n, where n is the number of bits in the binary representation.
|
|
25
|
+
For example, the state |01000>=|2> will be converted to |00100> (one-hot for 2).
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
qvar: binary input array padded with 0's to be converted to one-hot encoding.
|
|
29
|
+
"""
|
|
30
|
+
temp_qvars = [QBit(f"x{i}") for i in range(qvar.len)]
|
|
31
|
+
bind(qvar, temp_qvars) # type: ignore[arg-type]
|
|
32
|
+
bind(get_rewire_list(temp_qvars), qvar) # type: ignore[arg-type]
|
|
33
|
+
|
|
34
|
+
# logic
|
|
35
|
+
X(qvar[0])
|
|
36
|
+
for i in range(int(np.log2(qvar.len))):
|
|
37
|
+
index = 2 ** (i + 1) - 1
|
|
38
|
+
for j in range(2**i - 1):
|
|
39
|
+
control(qvar[index], lambda i=i, j=j: SWAP(qvar[j], qvar[j + 2**i])) # type: ignore[misc]
|
|
40
|
+
for j in range(2**i - 1):
|
|
41
|
+
CX(qvar[j + 2**i], qvar[index])
|
|
42
|
+
|
|
43
|
+
CX(qvar[index], qvar[index - 2**i])
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@qperm
|
|
47
|
+
def inplace_one_hot_to_unary(qvar: QArray) -> None:
|
|
48
|
+
"""
|
|
49
|
+
Inplace conversion of one-hot encoded value to unary encoding.
|
|
50
|
+
The input is assumed to be of size n, where n is the number of bits in the one-hot representation.
|
|
51
|
+
The remaining unary representation will at the higher n-1 bits, where the lsb is cleared to 0.
|
|
52
|
+
For example, the state |0010> (one-hot for 2) will be converted to |0>|110> (unary for 2).
|
|
53
|
+
|
|
54
|
+
Args:
|
|
55
|
+
qvar: one-hot input array to be converted to unary encoding.
|
|
56
|
+
"""
|
|
57
|
+
# fill with 1s after the leading 1 bit
|
|
58
|
+
repeat(qvar.len - 1, lambda i: CX(qvar[qvar.len - i - 1], qvar[qvar.len - i - 2]))
|
|
59
|
+
# clear the 0 bit, to be excluded from the unary encoding
|
|
60
|
+
X(qvar[0])
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
@qperm
|
|
64
|
+
def one_hot_to_unary(one_hot: Input[QArray], unary: Output[QArray]) -> None:
|
|
65
|
+
"""
|
|
66
|
+
Conversion of one-hot encoded value to unary encoding. The output `unary` variable
|
|
67
|
+
is smaller in 1 qubit than the input `one_hot` variable.
|
|
68
|
+
For example, the state |0010> (one-hot for 2) will be converted to |110> (unary for 2).
|
|
69
|
+
|
|
70
|
+
Args:
|
|
71
|
+
one_hot: one-hot input array to be converted to unary encoding.
|
|
72
|
+
unary: unary output array.
|
|
73
|
+
"""
|
|
74
|
+
inplace_one_hot_to_unary(one_hot)
|
|
75
|
+
lsb: QBit = QBit()
|
|
76
|
+
bind(one_hot, [lsb, unary])
|
|
77
|
+
free(lsb)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
@qperm
|
|
81
|
+
def one_hot_to_binary(
|
|
82
|
+
one_hot: Input[QArray],
|
|
83
|
+
binary: Output[QNum[Literal["ceiling(log(one_hot.len, 2))"]]],
|
|
84
|
+
) -> None:
|
|
85
|
+
"""
|
|
86
|
+
Conversion of one-hot encoded value to binary encoding. The output `binary` variable
|
|
87
|
+
is of size log2(one_hot.size) rounded up.
|
|
88
|
+
For example, the state |0010> (one-hot for 2) will be converted to |01>=|2>.
|
|
89
|
+
|
|
90
|
+
Args:
|
|
91
|
+
one_hot: one-hot input array to be converted to binary encoding.
|
|
92
|
+
binary: binary output variable.
|
|
93
|
+
"""
|
|
94
|
+
extension: QArray = QArray()
|
|
95
|
+
invert(lambda: inplace_binary_to_one_hot(one_hot))
|
|
96
|
+
bind(one_hot, [binary, extension])
|
|
97
|
+
free(extension)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
@qperm
|
|
101
|
+
def unary_to_binary(unary: Input[QArray], binary: Output[QNum]) -> None:
|
|
102
|
+
"""
|
|
103
|
+
Conversion of unary encoded value to binary encoding. The output `binary` variable
|
|
104
|
+
is of size log2(unary.size + 1) rounded up.
|
|
105
|
+
For example, the state |110> (unary for 2) will be converted to |01>=|2>.
|
|
106
|
+
|
|
107
|
+
Args:
|
|
108
|
+
unary: unary input array to be converted to binary encoding.
|
|
109
|
+
binary: binary output variable.
|
|
110
|
+
"""
|
|
111
|
+
one_hot: QArray = QArray()
|
|
112
|
+
unary_to_one_hot(unary, one_hot)
|
|
113
|
+
one_hot_to_binary(one_hot, binary)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
@qperm
|
|
117
|
+
def unary_to_one_hot(unary: Input[QArray], one_hot: Output[QArray]) -> None:
|
|
118
|
+
"""
|
|
119
|
+
Conversion of unary encoded value to one-hot encoding. The output `one_hot` variable
|
|
120
|
+
is larger in 1 qubit than the input `unary` variable.
|
|
121
|
+
For example, the state |110> (unary for 2) will be converted to |0010> (one-hot for 2).
|
|
122
|
+
|
|
123
|
+
Args:
|
|
124
|
+
unary: unary input array to be converted to one-hot encoding.
|
|
125
|
+
one_hot: one-hot output array.
|
|
126
|
+
"""
|
|
127
|
+
lsb: QBit = QBit()
|
|
128
|
+
allocate(lsb)
|
|
129
|
+
bind([lsb, unary], one_hot)
|
|
130
|
+
invert(lambda: inplace_one_hot_to_unary(one_hot))
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
@qperm
|
|
134
|
+
def binary_to_one_hot(binary: Input[QNum], one_hot: Output[QArray]) -> None:
|
|
135
|
+
"""
|
|
136
|
+
Conversion of binary encoded value to one-hot encoding. The output `one_hot` variable
|
|
137
|
+
is of size 2^n, where n is the number of bits in the binary representation.
|
|
138
|
+
For example, the state |01>=|2> will be converted to |0010> (one-hot for 2).
|
|
139
|
+
|
|
140
|
+
Args:
|
|
141
|
+
binary: binary input variable to be converted to one-hot encoding.
|
|
142
|
+
one_hot: one-hot output array.
|
|
143
|
+
"""
|
|
144
|
+
extension: QArray = QArray()
|
|
145
|
+
allocate(2**binary.size - binary.size, extension)
|
|
146
|
+
bind([binary, extension], one_hot)
|
|
147
|
+
|
|
148
|
+
inplace_binary_to_one_hot(one_hot)
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
@qperm
|
|
152
|
+
def binary_to_unary(binary: Input[QNum], unary: Output[QArray]) -> None:
|
|
153
|
+
"""
|
|
154
|
+
Conversion of binary encoded value to unary encoding. The output `unary` variable
|
|
155
|
+
is of size 2^n - 1, where n is the number of bits in the binary representation.
|
|
156
|
+
For example, the state |01>=|2> will be converted to |110> (unary for 2).
|
|
157
|
+
|
|
158
|
+
Args:
|
|
159
|
+
binary: binary input variable to be converted to unary encoding.
|
|
160
|
+
unary: unary output array.
|
|
161
|
+
"""
|
|
162
|
+
one_hot: QArray = QArray()
|
|
163
|
+
binary_to_one_hot(binary, one_hot)
|
|
164
|
+
one_hot_to_unary(one_hot, unary)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
@qperm
|
|
168
|
+
def pad_zeros(total_size: int, qvar: Input[QArray], padded: Output[QArray]) -> None:
|
|
169
|
+
"""
|
|
170
|
+
Pad the input qvar with additional qubits at the end to reach the total_size.
|
|
171
|
+
|
|
172
|
+
Args:
|
|
173
|
+
total_size: The desired total size after padding.
|
|
174
|
+
qvar: The input quantum array to be padded.
|
|
175
|
+
padded: The output quantum array after padding.
|
|
176
|
+
"""
|
|
177
|
+
extension: QArray = QArray()
|
|
178
|
+
allocate(total_size - qvar.len, extension)
|
|
179
|
+
bind([qvar, extension], padded)
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
# TODO: when the functions can have default arguments, add `pad` function with direction and value
|
|
@@ -393,7 +393,7 @@ def _dicke_split_cycle_shift(k: int, qvar: QArray[QBit]) -> None:
|
|
|
393
393
|
internal function, assumes the input is in the form |11..100..0> with up to k ones.
|
|
394
394
|
transforms the state to: sqrt(1/n)*|11..100..0> + sqrt((n-1)/n)*|01..110..0>.
|
|
395
395
|
"""
|
|
396
|
-
for i in range(k):
|
|
396
|
+
for i in range(min(k, qvar.len - 1)):
|
|
397
397
|
within_apply(
|
|
398
398
|
lambda i=i: CX(qvar[i + 1], qvar[0]), # type: ignore[misc]
|
|
399
399
|
lambda i=i: ( # type: ignore[misc]
|
|
@@ -415,7 +415,7 @@ def prepare_dicke_state_unary_input(max_k: int, qvar: QArray[QBit]) -> None:
|
|
|
415
415
|
"""
|
|
416
416
|
[Qmod Classiq-library function]
|
|
417
417
|
|
|
418
|
-
Prepares a Dicke state with a variable number of excitations based on
|
|
418
|
+
Prepares a Dicke state with a variable number of excitations based on a unary-encoded input.
|
|
419
419
|
|
|
420
420
|
The Dicke state is defined to be:
|
|
421
421
|
|
|
@@ -430,9 +430,12 @@ def prepare_dicke_state_unary_input(max_k: int, qvar: QArray[QBit]) -> None:
|
|
|
430
430
|
max_k: The maximum number of allowed excitations (upper bound for k).
|
|
431
431
|
qvar: Unary-encoded quantum input register of length >= max_k. Must be pre-initialized.
|
|
432
432
|
"""
|
|
433
|
-
if qvar.len
|
|
433
|
+
if qvar.len >= max(1, max_k):
|
|
434
434
|
_dicke_split_cycle_shift(max_k, qvar)
|
|
435
|
-
|
|
435
|
+
if qvar.len > 2:
|
|
436
|
+
prepare_dicke_state_unary_input(
|
|
437
|
+
min(max_k, qvar.len - 2), qvar[1 : qvar.len]
|
|
438
|
+
)
|
|
436
439
|
|
|
437
440
|
|
|
438
441
|
@qfunc
|
classiq/qmod/qmod_variable.py
CHANGED
|
@@ -274,7 +274,7 @@ class QScalar(QVar, SymbolicExpr):
|
|
|
274
274
|
|
|
275
275
|
def __iand__(self, other: Any) -> NoReturn:
|
|
276
276
|
raise ClassiqNotImplementedError(
|
|
277
|
-
f"{self.get_qmod_type().raw_qmod_type_name} does not support '
|
|
277
|
+
f"{self.get_qmod_type().raw_qmod_type_name} does not support '&='"
|
|
278
278
|
)
|
|
279
279
|
|
|
280
280
|
def __ifloordiv__(self, other: Any) -> NoReturn:
|
|
@@ -20,6 +20,7 @@ class ErrorManager:
|
|
|
20
20
|
self._current_refs_stack: list[SourceReference | None] = []
|
|
21
21
|
self._call_stack: list[str] = []
|
|
22
22
|
self._ignore_errors: bool = False
|
|
23
|
+
self._treat_warnings_as_errors: bool = False
|
|
23
24
|
|
|
24
25
|
@property
|
|
25
26
|
def _current_source_ref(self) -> SourceReference | None:
|
|
@@ -36,6 +37,15 @@ class ErrorManager:
|
|
|
36
37
|
finally:
|
|
37
38
|
self._ignore_errors = previous
|
|
38
39
|
|
|
40
|
+
@contextmanager
|
|
41
|
+
def treat_warnings_as_errors_context(self, value: bool) -> Iterator[None]:
|
|
42
|
+
previous = self._treat_warnings_as_errors
|
|
43
|
+
self._treat_warnings_as_errors = value
|
|
44
|
+
try:
|
|
45
|
+
yield
|
|
46
|
+
finally:
|
|
47
|
+
self._treat_warnings_as_errors = previous
|
|
48
|
+
|
|
39
49
|
@property
|
|
40
50
|
def annotated_errors(self) -> list[str]:
|
|
41
51
|
return [str(error) for error in self._errors]
|
|
@@ -62,7 +72,7 @@ class ErrorManager:
|
|
|
62
72
|
),
|
|
63
73
|
function=(function if function is not None else self.current_function),
|
|
64
74
|
)
|
|
65
|
-
if warning:
|
|
75
|
+
if warning and not self._treat_warnings_as_errors:
|
|
66
76
|
self._warnings.append(source_ref_error)
|
|
67
77
|
else:
|
|
68
78
|
self._errors.append(source_ref_error)
|
|
@@ -130,7 +130,7 @@ classiq/execution/qnn.py,sha256=zA-I-wvVkjyoigGvcG2W2KVbyKF5Z4X6hIQ3IPI-1xA,2436
|
|
|
130
130
|
classiq/execution/user_budgets.py,sha256=zModhoxmfusRm_AEYD80NAzEE9oemmkkwpE9vMP3ydI,3527
|
|
131
131
|
classiq/executor.py,sha256=5j4bLYP4acxKTenFYnSEGf9tBDCjdpBiaBp86l78U_o,2278
|
|
132
132
|
classiq/interface/__init__.py,sha256=cg7hD_XVu1_jJ1fgwmT0rMIoZHopNVeB8xtlmMx-E_A,83
|
|
133
|
-
classiq/interface/_version.py,sha256=
|
|
133
|
+
classiq/interface/_version.py,sha256=HvVkcTD79dwXbSJYxzB3LsT-gzpzr5JiOfMS4Dixmbk,198
|
|
134
134
|
classiq/interface/analyzer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
135
135
|
classiq/interface/analyzer/analysis_params.py,sha256=34pFb5X5rPeZOe3TNxBq6oT5YJKcJ9ORyZ_7KRP-alA,2991
|
|
136
136
|
classiq/interface/analyzer/cytoscape_graph.py,sha256=Ky2tSKdnCnA26896DPy64HSVudLnE3FzdGDUUf0nkI0,2345
|
|
@@ -201,7 +201,7 @@ classiq/interface/executor/quantum_instruction_set.py,sha256=z6i6jWsXjatmyrTJW6t
|
|
|
201
201
|
classiq/interface/executor/quantum_program_params.py,sha256=yoxZRCa-O_sbzchUXPcIjQ_doT6db_8o9mf040NDWkM,503
|
|
202
202
|
classiq/interface/executor/register_initialization.py,sha256=-dkivVSDkkLGkIdu0L5VaONhPCRp_JE42LiAZuHUK7k,1365
|
|
203
203
|
classiq/interface/executor/result.py,sha256=oyenkuVT2sqLhoYBfcJIsCHzt980ip1wRvps6mX62AU,16954
|
|
204
|
-
classiq/interface/executor/user_budget.py,sha256=
|
|
204
|
+
classiq/interface/executor/user_budget.py,sha256=fcaaB91HdURQrfROlSOaQcDnKUR7gl26TRN_n7PQCMI,1572
|
|
205
205
|
classiq/interface/executor/vqe_result.py,sha256=SaYSgj8JtyDR4b8Ew6zs6fKTfTJKgQd6pIoDv7unHB4,2281
|
|
206
206
|
classiq/interface/generator/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
207
207
|
classiq/interface/generator/adjacency.py,sha256=JCXr1C3Imbs9AVboIBr3OHkW31Z3YrPHeNCE9tniH7U,428
|
|
@@ -275,6 +275,7 @@ classiq/interface/generator/functions/qmod_python_interface.py,sha256=w1Oz3bV6KS
|
|
|
275
275
|
classiq/interface/generator/functions/type_modifier.py,sha256=tcAS3rfgBhNyWW-IDj5v4wA00fOMfDektRD4IBmnvqQ,150
|
|
276
276
|
classiq/interface/generator/functions/type_name.py,sha256=OyFT64_ktSVteTgUFUUjX2lY6923yWJkkssLIOiZKo0,7146
|
|
277
277
|
classiq/interface/generator/generated_circuit_data.py,sha256=eHFqjw510qSj0sYsCokeastwjHMGNcaQld91pBZm2is,12675
|
|
278
|
+
classiq/interface/generator/generation_request.py,sha256=06KiD6cFfhU_7UskJbW4pIUI4B7AAXyyF4Gnd9xt2WI,980
|
|
278
279
|
classiq/interface/generator/hadamard_transform.py,sha256=NI4oZBpDCGfaw2OTb5SL3iSGI_nDtyUgElTCO4pEKnk,673
|
|
279
280
|
classiq/interface/generator/hamiltonian_evolution/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
280
281
|
classiq/interface/generator/hamiltonian_evolution/exponentiation.py,sha256=sBRQAtP5MD3aaF9FmKKXtrF2g8DXn_OI_G_BWLv0jX8,1675
|
|
@@ -318,10 +319,10 @@ classiq/interface/generator/synthesis_execution_parameter.py,sha256=l6aktoNqXVpZ
|
|
|
318
319
|
classiq/interface/generator/synthesis_metadata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
319
320
|
classiq/interface/generator/synthesis_metadata/synthesis_duration.py,sha256=CEQFUYCnkMBmJuPBITS-PVAPqUw0ZnKXN4-fn74zTIM,812
|
|
320
321
|
classiq/interface/generator/synthesis_metadata/synthesis_execution_data.py,sha256=N_vgRIyH7n_sdiOzttmDHkXdajY89PKkggT2o-gAuyo,1911
|
|
321
|
-
classiq/interface/generator/transpiler_basis_gates.py,sha256=
|
|
322
|
+
classiq/interface/generator/transpiler_basis_gates.py,sha256=U66BGe9yhqGQ31OUV8bwL_U29GsupVBAFDYGPKEqiRk,2688
|
|
322
323
|
classiq/interface/generator/types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
323
324
|
classiq/interface/generator/types/builtin_enum_declarations.py,sha256=H9zkpag4t75Gnfocw2WQGTuqLRQYrqpzRsJ9kbtBQaU,334
|
|
324
|
-
classiq/interface/generator/types/compilation_metadata.py,sha256=
|
|
325
|
+
classiq/interface/generator/types/compilation_metadata.py,sha256=uhCibrsTC6rfW6vB8G4oa3txwE8EwrI6MBFVbUw0JS4,1005
|
|
325
326
|
classiq/interface/generator/types/enum_declaration.py,sha256=3_pIY47ZbPN_UIUa-lT8twEsyRbTDEHj0X3Tzmsrm60,3412
|
|
326
327
|
classiq/interface/generator/types/qstruct_declaration.py,sha256=Qw6cHW_elZmrs4UO0z7lgS7TWb0hEUEJ5Ur-Ko0bCR4,485
|
|
327
328
|
classiq/interface/generator/types/struct_declaration.py,sha256=2qKVV-pdqeUGiwKh2-5W2Ci4z0aQG4TG91MuQ82fa_A,959
|
|
@@ -341,7 +342,7 @@ classiq/interface/helpers/hashable_mixin.py,sha256=BmMts3hvzNgTWnbYmjVeDYyNL9uMq
|
|
|
341
342
|
classiq/interface/helpers/hashable_pydantic_base_model.py,sha256=ADkPtodtdNEsLkZl65Vw-H8N6e0pJaLccV3G1l-QPcs,638
|
|
342
343
|
classiq/interface/helpers/model_normalizer.py,sha256=TC3byg70bLCHubzYttLr_jz2AtHmsXUr0mJsJ4AM0FY,1601
|
|
343
344
|
classiq/interface/helpers/pydantic_model_helpers.py,sha256=i4AccZnH4EuxaRF6dbMdNrZ2kwxbbHsjzxP-fGDtyE0,548
|
|
344
|
-
classiq/interface/helpers/text_utils.py,sha256=
|
|
345
|
+
classiq/interface/helpers/text_utils.py,sha256=ZlpNDjVH-DbSHrClkf0saTMjwOMaZ4pTmYglwLMcDrY,625
|
|
345
346
|
classiq/interface/helpers/validation_helpers.py,sha256=Jt0xs5EZeEQZOBEZPRmKctHmAiEfp6cWhLcSycsU_8w,594
|
|
346
347
|
classiq/interface/helpers/versioned_model.py,sha256=XFjk7GPEUKeUeXc4fK0azhUUvze8bNheTDDIE-JZTdw,579
|
|
347
348
|
classiq/interface/ide/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -351,7 +352,7 @@ classiq/interface/interface_version.py,sha256=9-Xz6OauSvAPJfTS_7eJ8ZIgT6EU-VBCIO
|
|
|
351
352
|
classiq/interface/jobs.py,sha256=KuVNoE1sDkdTQA170X3VrJM7H0yGh3hMR3VS3FPyyJI,2323
|
|
352
353
|
classiq/interface/model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
353
354
|
classiq/interface/model/allocate.py,sha256=4ybki0Z5CUnAF2o5ARDKFFaXJgd_ezZ6BZf41cgunPY,974
|
|
354
|
-
classiq/interface/model/bind_operation.py,sha256=
|
|
355
|
+
classiq/interface/model/bind_operation.py,sha256=2ycchvUXezsY83ubwvjgzsHMrhtlqz45g0az-n34dPE,1600
|
|
355
356
|
classiq/interface/model/block.py,sha256=WITUfFlfvLZ4zMBtxdYO8K6KHlT5Dg6QR3J5xzhTHoE,484
|
|
356
357
|
classiq/interface/model/bounds.py,sha256=rWsqQdo09VsawiuCPwtZe-a-0lKXZm2jf6EXlhRur8g,707
|
|
357
358
|
classiq/interface/model/classical_if.py,sha256=xJIdmXAUXOp1htL7hBnvNdc49wWkVvCa-He3Bcksq5g,2211
|
|
@@ -395,7 +396,7 @@ classiq/interface/server/routes.py,sha256=Of0wZl_RBJwW_8t2DZiZBJkZwRqY6BKxoW7eCm
|
|
|
395
396
|
classiq/interface/source_reference.py,sha256=A44UHfPyUeOog8K4G1ftNLiU8WyYvUpkeVyA1PBLhWI,1844
|
|
396
397
|
classiq/model_expansions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
397
398
|
classiq/model_expansions/arithmetic.py,sha256=H37cybFtPrPB4jSyNRDcqSTnd9p4dPLHBqzkEQl4gBc,5072
|
|
398
|
-
classiq/model_expansions/arithmetic_compute_result_attrs.py,sha256=
|
|
399
|
+
classiq/model_expansions/arithmetic_compute_result_attrs.py,sha256=0ucjLAVysbjn11enXeNeFXnFtHy1WPk2afoiWZyz6IU,11161
|
|
399
400
|
classiq/model_expansions/capturing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
400
401
|
classiq/model_expansions/capturing/captured_vars.py,sha256=OwkO_kw9s4r4U5Au3aD4upkXj9A8QFCrtdipSPQygm4,32624
|
|
401
402
|
classiq/model_expansions/capturing/mangling_utils.py,sha256=Vqk6T4s9e9km54oD8P_gDOkjZ4RbvBatPx4oKcA7jvM,1827
|
|
@@ -415,7 +416,7 @@ classiq/model_expansions/quantum_operations/assignment_result_processor.py,sha25
|
|
|
415
416
|
classiq/model_expansions/quantum_operations/bind.py,sha256=6-jIhZEAXi5cb7xuOB4YN1KiDTK_DuXUNnkTqfD2jc4,6760
|
|
416
417
|
classiq/model_expansions/quantum_operations/block_evaluator.py,sha256=06EYOb5CVDUvqYXKk-s-rcoY3rQ2Dr2XWUkqNzT0N0w,4734
|
|
417
418
|
classiq/model_expansions/quantum_operations/bounds.py,sha256=p2qb5MybXCTEQ2zeJRN3P3CDtSyhLSjJ_QZ_-xEWjBM,1394
|
|
418
|
-
classiq/model_expansions/quantum_operations/call_emitter.py,sha256=
|
|
419
|
+
classiq/model_expansions/quantum_operations/call_emitter.py,sha256=QqluEr7TsY8sY3Bxi3eVYH3FBD5Ae2oHkHXSXZ8obQw,18780
|
|
419
420
|
classiq/model_expansions/quantum_operations/classical_var_emitter.py,sha256=LDYdIubNbisJlyDAMuS2qHgfs-2m344SbJrehXhDZwk,1055
|
|
420
421
|
classiq/model_expansions/quantum_operations/composite_emitter.py,sha256=AQp3cYaUUA7eEKNwmZwIq1KEdDlTKRaXiop9pXxSVZg,815
|
|
421
422
|
classiq/model_expansions/quantum_operations/declarative_call_emitter.py,sha256=LIUb0bhBs3G1-f-bYcFq9PxCMvrrpbuLtELNJrWI22w,3628
|
|
@@ -440,11 +441,12 @@ classiq/model_expansions/visitors/symbolic_param_inference.py,sha256=goLFicRmxFu
|
|
|
440
441
|
classiq/model_expansions/visitors/uncomputation_signature_inference.py,sha256=7WokVCaDELa8fNMyblDcIljhvkgKtn-WnRQFwRtEy4Q,12911
|
|
441
442
|
classiq/model_expansions/visitors/variable_references.py,sha256=z6_vcra7sTak5mEhONXs77p7xO34Y8ZeeYCMuSfAui8,6587
|
|
442
443
|
classiq/open_library/__init__.py,sha256=bmg_qqXCXo85hcU7_QCce-qYGrpAVSFNwTKCClsclrg,114
|
|
443
|
-
classiq/open_library/functions/__init__.py,sha256=
|
|
444
|
+
classiq/open_library/functions/__init__.py,sha256=clGNxuY40ap6jWG-Sb9Yuweh7gLQQ2i4jfudTlRTYDY,4514
|
|
444
445
|
classiq/open_library/functions/amplitude_amplification.py,sha256=WH2dqYbmmWHZX7beu7-EipnC6Gzn4En4D2gmB2sXvZI,3997
|
|
445
446
|
classiq/open_library/functions/amplitude_estimation.py,sha256=iCkca5SQN_HQoJWk1_tLT56fHT72hu5QIt2pxSZQRko,1766
|
|
446
447
|
classiq/open_library/functions/amplitude_loading.py,sha256=TN4Hq11RDk8JCXCKa6uZYi0Ch8CU9g9RP_IIZJ8tvX4,2844
|
|
447
448
|
classiq/open_library/functions/discrete_sine_cosine_transform.py,sha256=F-yD4paGBFueWRK_Tr36aIxxBuzvXte1JtvizxKet68,4634
|
|
449
|
+
classiq/open_library/functions/encodings.py,sha256=0cNhkttdigvFhYJ6DQ-9Otkep3D6bd6Sx1e31X4ZIa4,6619
|
|
448
450
|
classiq/open_library/functions/grover.py,sha256=e5LlbHj-nfR_iAhmRei4BuFJOjDFJrb2rBwzdwB-xfg,4688
|
|
449
451
|
classiq/open_library/functions/hea.py,sha256=Nc9pj-4mGLZVQQKCaVRgrcPd4eViuz3Ji5ZeYzaCozg,4889
|
|
450
452
|
classiq/open_library/functions/lcu.py,sha256=MZcxrxWVSngyw888RpH4Yum9eaQC0vwAKwq5K5_kygU,5268
|
|
@@ -455,7 +457,7 @@ classiq/open_library/functions/qft_functions.py,sha256=7pdPBq48QvyQkxHrF3rEKTf0J
|
|
|
455
457
|
classiq/open_library/functions/qpe.py,sha256=e7MBpOthBn73BdqhWpNGT0lkd6Jw3ZG7tE6n--IM0jc,2140
|
|
456
458
|
classiq/open_library/functions/qsvt.py,sha256=5Y7S33XFj9olENmSFG-8pSvF5LwQlwk0LZJY7BTQNEY,14751
|
|
457
459
|
classiq/open_library/functions/qsvt_temp.py,sha256=-t-JtbrEfBMTDG2eq9eGJZ0RopzICrnMUsOHvw1fCDI,25150
|
|
458
|
-
classiq/open_library/functions/state_preparation.py,sha256=
|
|
460
|
+
classiq/open_library/functions/state_preparation.py,sha256=Jea9I5PE_vvw9R_MDOwHskTpQbi35h18U2kr6ZseLTo,26020
|
|
459
461
|
classiq/open_library/functions/swap_test.py,sha256=hAjiJjZGeJP2qzEkVYmBVlEK44VcNibWZ-KqJwPEcFY,1048
|
|
460
462
|
classiq/open_library/functions/utility_functions.py,sha256=-0r7dUdh1KJa93QORRlmPFM8ZDObyreB5Q5Jx4d9RBM,2539
|
|
461
463
|
classiq/open_library/functions/variational.py,sha256=KYoqPKYRjgUXk_10RvogV0YiCG5kl7GZBHBJeeX82II,1715
|
|
@@ -496,7 +498,7 @@ classiq/qmod/python_classical_type.py,sha256=E-uJUKm0Ip5wWIhad5YHUZmIPpdFcy6ccuN
|
|
|
496
498
|
classiq/qmod/qfunc.py,sha256=vlDrjqnNpj3N7itAHZvI0JKoJ2c8YhWHOwtFnn0uyTA,5465
|
|
497
499
|
classiq/qmod/qmod_constant.py,sha256=aAP7o3ZYa_kwlQOiW0kFWfU5SyqEUVqeITBm6Njt6Js,5130
|
|
498
500
|
classiq/qmod/qmod_parameter.py,sha256=UtVLkHNxJWftpHsYc-AjHP8oYzXtFgSaxUnxFuefhJQ,6570
|
|
499
|
-
classiq/qmod/qmod_variable.py,sha256=
|
|
501
|
+
classiq/qmod/qmod_variable.py,sha256=EVuKQExplTf9zKJIsTJ4PAg2ScwMZyKp5j_cg2NQxhg,32502
|
|
500
502
|
classiq/qmod/quantum_callable.py,sha256=XODQnSr2gI_N46LPpSAqenXfZVsT1jxoue84RgyJMoA,2497
|
|
501
503
|
classiq/qmod/quantum_expandable.py,sha256=WJ72ci-fL-3VQtVHg8Wp80aSphgb6n-e3zzv4ALhwPs,19473
|
|
502
504
|
classiq/qmod/quantum_function.py,sha256=M8DLOxBejr2mInIqSLl0TIQoOW4_jTHmm_k9KTtDYFA,17453
|
|
@@ -505,7 +507,7 @@ classiq/qmod/semantics/annotation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeR
|
|
|
505
507
|
classiq/qmod/semantics/annotation/call_annotation.py,sha256=kieFypj0PSLam6jbxs9fOwr4rRZ_sI5FXBNnfQmPfYw,3887
|
|
506
508
|
classiq/qmod/semantics/annotation/model_annotation.py,sha256=gzsX3RrcaTPYBxxplbXaE3pBlQQvVkLGrK-xewzdVMA,329
|
|
507
509
|
classiq/qmod/semantics/annotation/qstruct_annotator.py,sha256=z4W_-i806XCU-58R-Er_oX7EZo5QwusFsC0eIbGtJTU,2599
|
|
508
|
-
classiq/qmod/semantics/error_manager.py,sha256=
|
|
510
|
+
classiq/qmod/semantics/error_manager.py,sha256=TYqkSD34SMy-hJAjf01dV6Om5RPo1L4gvX90h_YONNc,4048
|
|
509
511
|
classiq/qmod/semantics/lambdas.py,sha256=TfB6zD1cX11wbQt8s1B0bUl-D6JIfl9PMzQ0IMX-i7I,1187
|
|
510
512
|
classiq/qmod/semantics/static_semantics_visitor.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
511
513
|
classiq/qmod/semantics/validation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -525,7 +527,7 @@ classiq/qmod/write_qmod.py,sha256=8xiZKCpy0y5c246DRow22-2YQm7F_eSTXY2KJRFAeds,34
|
|
|
525
527
|
classiq/quantum_program.py,sha256=9r1AvhPHDZb4lBEem5T5-mMqbojjyRWHysbJhAoNx80,2056
|
|
526
528
|
classiq/synthesis.py,sha256=RedYU2XVovqd1nmZU4Nb3b705gBlDarXDqQ1A7ug6C0,9852
|
|
527
529
|
classiq/visualization.py,sha256=SvLkPNN-RFd74wnH83eBNANjX11phBTo0wedTazr7VQ,975
|
|
528
|
-
classiq-0.
|
|
529
|
-
classiq-0.
|
|
530
|
-
classiq-0.
|
|
531
|
-
classiq-0.
|
|
530
|
+
classiq-0.100.0.dist-info/licenses/LICENSE.txt,sha256=pIUwTWPybNElw1us8qbLyUuGDCH1_YioM4ol5tg0Zzw,13367
|
|
531
|
+
classiq-0.100.0.dist-info/WHEEL,sha256=X16MKk8bp2DRsAuyteHJ-9qOjzmnY0x1aj0P1ftqqWA,78
|
|
532
|
+
classiq-0.100.0.dist-info/METADATA,sha256=ttCuRNPYSIMgmHRLX4yKfLRA5E2SKCLsfHYqwXpfrSQ,3745
|
|
533
|
+
classiq-0.100.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|