cirq-core 1.6.0.dev20250519175318__py3-none-any.whl → 1.6.0.dev20250519202416__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.
Potentially problematic release.
This version of cirq-core might be problematic. Click here for more details.
- cirq/_version.py +1 -1
- cirq/_version_test.py +1 -1
- cirq/devices/grid_qubit_test.py +3 -0
- cirq/devices/insertion_noise_model_test.py +2 -0
- cirq/devices/line_qubit_test.py +2 -0
- cirq/devices/named_topologies_test.py +3 -0
- cirq/devices/noise_properties_test.py +2 -0
- cirq/devices/noise_utils_test.py +2 -0
- cirq/devices/superconducting_qubits_noise_properties_test.py +2 -0
- cirq/devices/thermal_noise_model_test.py +2 -0
- cirq/devices/unconstrained_device_test.py +2 -0
- cirq/experiments/benchmarking/parallel_xeb_test.py +2 -0
- cirq/experiments/fidelity_estimation_test.py +3 -0
- cirq/experiments/n_qubit_tomography_test.py +3 -0
- cirq/experiments/purity_estimation.py +2 -0
- cirq/experiments/purity_estimation_test.py +2 -0
- cirq/experiments/qubit_characterizations_test.py +2 -0
- cirq/experiments/readout_confusion_matrix_test.py +2 -0
- cirq/experiments/t1_decay_experiment_test.py +2 -0
- cirq/experiments/t2_decay_experiment_test.py +2 -0
- cirq/experiments/two_qubit_xeb_test.py +4 -0
- cirq/experiments/xeb_sampling_test.py +3 -0
- cirq/experiments/z_phase_calibration_test.py +2 -0
- cirq/interop/quirk/cells/all_cells.py +7 -2
- cirq/interop/quirk/cells/arithmetic_cells_test.py +3 -0
- cirq/interop/quirk/cells/cell_test.py +3 -0
- cirq/interop/quirk/cells/composite_cell_test.py +2 -0
- cirq/interop/quirk/cells/control_cells_test.py +2 -0
- cirq/interop/quirk/cells/frequency_space_cells_test.py +2 -0
- cirq/interop/quirk/cells/ignored_cells.py +3 -0
- cirq/interop/quirk/cells/ignored_cells_test.py +2 -0
- cirq/interop/quirk/cells/input_cells_test.py +2 -0
- cirq/interop/quirk/cells/input_rotation_cells_test.py +2 -0
- cirq/interop/quirk/cells/measurement_cells_test.py +2 -0
- cirq/interop/quirk/cells/parse.py +2 -0
- cirq/interop/quirk/cells/parse_test.py +2 -0
- cirq/interop/quirk/cells/qubit_permutation_cells_test.py +2 -0
- cirq/interop/quirk/cells/scalar_cells_test.py +2 -0
- cirq/interop/quirk/cells/single_qubit_rotation_cells_test.py +2 -0
- cirq/interop/quirk/cells/swap_cell_test.py +2 -0
- cirq/interop/quirk/cells/testing.py +2 -0
- cirq/interop/quirk/cells/testing_test.py +2 -0
- cirq/interop/quirk/cells/unsupported_cells.py +3 -0
- cirq/interop/quirk/cells/unsupported_cells_test.py +2 -0
- cirq/interop/quirk/url_to_circuit_test.py +3 -0
- cirq/linalg/combinators_test.py +3 -0
- cirq/linalg/decompositions_test.py +2 -0
- cirq/linalg/diagonalize.py +2 -0
- cirq/linalg/diagonalize_test.py +2 -0
- cirq/linalg/operator_spaces_test.py +2 -0
- cirq/linalg/predicates_test.py +2 -0
- cirq/linalg/tolerance_test.py +2 -0
- cirq/linalg/transformations.py +4 -1
- cirq/linalg/transformations_test.py +2 -0
- cirq/neutral_atoms/convert_to_neutral_atom_gates_test.py +2 -0
- cirq/neutral_atoms/neutral_atom_devices.py +2 -0
- cirq/ops/arithmetic_operation_test.py +2 -0
- cirq/ops/boolean_hamiltonian_test.py +3 -0
- cirq/ops/classically_controlled_operation_test.py +2 -0
- cirq/ops/common_channels_test.py +2 -0
- cirq/ops/common_gate_families.py +2 -0
- cirq/ops/common_gate_families_test.py +2 -0
- cirq/ops/common_gates_test.py +2 -0
- cirq/ops/control_values_test.py +2 -0
- cirq/ops/controlled_gate_test.py +4 -2
- cirq/ops/controlled_operation_test.py +4 -2
- cirq/ops/dense_pauli_string_test.py +3 -0
- cirq/ops/diagonal_gate_test.py +2 -0
- cirq/ops/eigen_gate_test.py +2 -0
- cirq/ops/fourier_transform_test.py +2 -0
- cirq/ops/fsim_gate_test.py +2 -0
- cirq/ops/gate_features.py +2 -0
- cirq/ops/gate_features_test.py +2 -0
- cirq/ops/gate_operation_test.py +3 -0
- cirq/ops/gateset_test.py +2 -0
- cirq/ops/global_phase_op_test.py +2 -0
- cirq/ops/greedy_qubit_manager_test.py +2 -0
- cirq/ops/identity_test.py +3 -0
- cirq/ops/kraus_channel_test.py +3 -0
- cirq/ops/linear_combinations_test.py +2 -0
- cirq/ops/matrix_gates_test.py +3 -0
- cirq/ops/measure_util_test.py +2 -0
- cirq/ops/measurement_gate_test.py +2 -0
- cirq/ops/mixed_unitary_channel_test.py +3 -0
- cirq/ops/named_qubit_test.py +2 -0
- cirq/ops/op_tree_test.py +3 -0
- cirq/ops/parallel_gate_test.py +2 -0
- cirq/ops/parity_gates_test.py +2 -0
- cirq/ops/pauli_gates_test.py +2 -0
- cirq/ops/pauli_interaction_gate_test.py +2 -0
- cirq/ops/pauli_measurement_gate_test.py +2 -0
- cirq/ops/pauli_string_phasor_test.py +2 -0
- cirq/ops/pauli_string_raw_types_test.py +2 -0
- cirq/ops/pauli_string_test.py +2 -0
- cirq/ops/pauli_sum_exponential_test.py +2 -0
- cirq/ops/permutation_gate_test.py +2 -0
- cirq/ops/phased_iswap_gate_test.py +2 -0
- cirq/ops/phased_x_gate_test.py +2 -0
- cirq/ops/phased_x_z_gate_test.py +3 -0
- cirq/ops/projector_test.py +3 -0
- cirq/ops/qid_util_test.py +2 -0
- cirq/ops/qubit_manager_test.py +2 -0
- cirq/ops/qubit_order.py +11 -13
- cirq/ops/qubit_order_or_list.py +2 -0
- cirq/ops/qubit_order_test.py +2 -0
- cirq/ops/random_gate_channel_test.py +3 -0
- cirq/ops/state_preparation_channel_test.py +2 -0
- cirq/ops/swap_gates_test.py +2 -0
- cirq/ops/tags.py +4 -0
- cirq/ops/tags_test.py +2 -0
- cirq/ops/three_qubit_gates_test.py +2 -0
- cirq/ops/two_qubit_diagonal_gate_test.py +2 -0
- cirq/ops/uniform_superposition_gate_test.py +2 -0
- cirq/ops/wait_gate_test.py +3 -0
- cirq/protocols/apply_channel_protocol.py +6 -4
- cirq/protocols/apply_channel_protocol_test.py +2 -0
- cirq/protocols/apply_mixture_protocol.py +6 -4
- cirq/protocols/apply_mixture_protocol_test.py +3 -0
- cirq/protocols/apply_unitary_protocol_test.py +2 -0
- cirq/protocols/approximate_equality_protocol.py +2 -0
- cirq/protocols/approximate_equality_protocol_test.py +2 -0
- cirq/protocols/circuit_diagram_info_protocol_test.py +3 -0
- cirq/protocols/commutes_protocol.py +3 -0
- cirq/protocols/commutes_protocol_test.py +2 -0
- cirq/protocols/control_key_protocol_test.py +2 -0
- cirq/protocols/equal_up_to_global_phase_protocol.py +2 -0
- cirq/protocols/equal_up_to_global_phase_protocol_test.py +3 -0
- cirq/protocols/has_stabilizer_effect_protocol.py +2 -0
- cirq/protocols/has_stabilizer_effect_protocol_test.py +2 -0
- cirq/protocols/has_unitary_protocol.py +2 -0
- cirq/protocols/has_unitary_protocol_test.py +2 -0
- cirq/protocols/inverse_protocol_test.py +3 -1
- cirq/protocols/json_serialization.py +3 -0
- cirq/protocols/json_serialization_test.py +2 -0
- cirq/protocols/json_test_data/spec.py +2 -0
- cirq/protocols/kraus_protocol.py +2 -0
- cirq/protocols/kraus_protocol_test.py +2 -0
- cirq/protocols/measurement_key_protocol_test.py +4 -1
- cirq/protocols/mixture_protocol.py +2 -0
- cirq/protocols/mixture_protocol_test.py +2 -0
- cirq/protocols/mul_protocol.py +2 -0
- cirq/protocols/mul_protocol_test.py +2 -0
- cirq/protocols/pauli_expansion_protocol.py +3 -0
- cirq/protocols/pauli_expansion_protocol_test.py +2 -0
- cirq/protocols/phase_protocol.py +2 -0
- cirq/protocols/phase_protocol_test.py +2 -0
- cirq/protocols/pow_protocol_test.py +2 -0
- cirq/protocols/qasm_test.py +3 -0
- cirq/protocols/qid_shape_protocol.py +2 -0
- cirq/protocols/qid_shape_protocol_test.py +2 -0
- cirq/protocols/resolve_parameters_test.py +3 -2
- cirq/protocols/trace_distance_bound.py +2 -0
- cirq/protocols/trace_distance_bound_test.py +2 -0
- cirq/protocols/unitary_protocol.py +2 -0
- cirq/protocols/unitary_protocol_test.py +3 -0
- cirq/qis/channels.py +6 -2
- cirq/qis/channels_test.py +4 -0
- cirq/qis/clifford_tableau_test.py +2 -0
- cirq/qis/entropy.py +2 -0
- cirq/qis/entropy_test.py +2 -0
- cirq/qis/measures_test.py +4 -0
- cirq/qis/noise_utils.py +2 -0
- cirq/qis/noise_utils_test.py +2 -0
- cirq/qis/states_test.py +2 -0
- cirq/sim/classical_simulator_test.py +2 -0
- cirq/sim/clifford/clifford_simulator_test.py +3 -0
- cirq/sim/clifford/clifford_tableau_simulation_state_test.py +2 -0
- cirq/sim/clifford/stabilizer_ch_form_simulation_state_test.py +2 -0
- cirq/sim/clifford/stabilizer_sampler_test.py +2 -0
- cirq/sim/clifford/stabilizer_simulation_state_test.py +2 -0
- cirq/sim/clifford/stabilizer_state_ch_form_test.py +2 -0
- cirq/sim/density_matrix_simulation_state_test.py +2 -0
- cirq/sim/density_matrix_simulator_test.py +3 -0
- cirq/sim/density_matrix_utils_test.py +2 -0
- cirq/sim/mux_test.py +3 -0
- cirq/sim/simulation_product_state_test.py +3 -0
- cirq/sim/simulation_state_test.py +2 -0
- cirq/sim/simulation_utils.py +2 -0
- cirq/sim/simulation_utils_test.py +3 -0
- cirq/sim/sparse_simulator_test.py +3 -0
- cirq/sim/state_vector_simulation_state_test.py +2 -0
- cirq/sim/state_vector_simulator_test.py +2 -0
- cirq/sim/state_vector_test.py +3 -0
- cirq/study/flatten_expressions_test.py +2 -0
- cirq/study/resolver_test.py +2 -0
- cirq/study/result_test.py +2 -0
- cirq/study/sweepable.py +5 -3
- cirq/study/sweepable_test.py +3 -0
- cirq/study/sweeps_test.py +3 -0
- cirq/testing/circuit_compare.py +2 -0
- cirq/testing/circuit_compare_test.py +2 -0
- cirq/testing/consistent_act_on.py +9 -3
- cirq/testing/consistent_act_on_test.py +2 -0
- cirq/testing/consistent_channels.py +2 -0
- cirq/testing/consistent_channels_test.py +2 -0
- cirq/testing/consistent_controlled_gate_op.py +2 -0
- cirq/testing/consistent_decomposition.py +2 -0
- cirq/testing/consistent_decomposition_test.py +2 -0
- cirq/testing/consistent_pauli_expansion.py +2 -0
- cirq/testing/consistent_pauli_expansion_test.py +2 -0
- cirq/testing/consistent_phase_by.py +2 -0
- cirq/testing/consistent_phase_by_test.py +2 -0
- {cirq_core-1.6.0.dev20250519175318.dist-info → cirq_core-1.6.0.dev20250519202416.dist-info}/METADATA +1 -1
- {cirq_core-1.6.0.dev20250519175318.dist-info → cirq_core-1.6.0.dev20250519202416.dist-info}/RECORD +207 -207
- {cirq_core-1.6.0.dev20250519175318.dist-info → cirq_core-1.6.0.dev20250519202416.dist-info}/WHEEL +0 -0
- {cirq_core-1.6.0.dev20250519175318.dist-info → cirq_core-1.6.0.dev20250519202416.dist-info}/licenses/LICENSE +0 -0
- {cirq_core-1.6.0.dev20250519175318.dist-info → cirq_core-1.6.0.dev20250519202416.dist-info}/top_level.txt +0 -0
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
|
|
15
15
|
"""A protocol for implementing high performance channel evolutions."""
|
|
16
16
|
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
17
19
|
from types import NotImplementedType
|
|
18
20
|
from typing import Any, Iterable, Optional, Sequence, Tuple, TypeVar, Union
|
|
19
21
|
|
|
@@ -273,7 +275,7 @@ def apply_channel(
|
|
|
273
275
|
)
|
|
274
276
|
|
|
275
277
|
|
|
276
|
-
def _apply_unitary(val: Any, args:
|
|
278
|
+
def _apply_unitary(val: Any, args: ApplyChannelArgs) -> Optional[np.ndarray]:
|
|
277
279
|
"""Attempt to use `apply_unitary` and return the result.
|
|
278
280
|
|
|
279
281
|
If `val` does not support `apply_unitary` returns None.
|
|
@@ -297,7 +299,7 @@ def _apply_unitary(val: Any, args: 'ApplyChannelArgs') -> Optional[np.ndarray]:
|
|
|
297
299
|
|
|
298
300
|
|
|
299
301
|
def _apply_kraus(
|
|
300
|
-
kraus: Union[Tuple[np.ndarray], Sequence[Any]], args:
|
|
302
|
+
kraus: Union[Tuple[np.ndarray], Sequence[Any]], args: ApplyChannelArgs
|
|
301
303
|
) -> np.ndarray:
|
|
302
304
|
"""Directly apply the kraus operators to the target tensor."""
|
|
303
305
|
# Initialize output.
|
|
@@ -313,7 +315,7 @@ def _apply_kraus(
|
|
|
313
315
|
|
|
314
316
|
|
|
315
317
|
def _apply_kraus_single_qubit(
|
|
316
|
-
kraus: Union[Tuple[Any], Sequence[Any]], args:
|
|
318
|
+
kraus: Union[Tuple[Any], Sequence[Any]], args: ApplyChannelArgs
|
|
317
319
|
) -> np.ndarray:
|
|
318
320
|
"""Use slicing to apply single qubit channel. Only for two-level qubits."""
|
|
319
321
|
zero_left = linalg.slice_for_qubits_equal_to(args.left_axes, 0)
|
|
@@ -338,7 +340,7 @@ def _apply_kraus_single_qubit(
|
|
|
338
340
|
|
|
339
341
|
|
|
340
342
|
def _apply_kraus_multi_qubit(
|
|
341
|
-
kraus: Union[Tuple[Any], Sequence[Any]], args:
|
|
343
|
+
kraus: Union[Tuple[Any], Sequence[Any]], args: ApplyChannelArgs
|
|
342
344
|
) -> np.ndarray:
|
|
343
345
|
"""Use numpy's einsum to apply a multi-qubit channel."""
|
|
344
346
|
qid_shape = tuple(args.target_tensor.shape[i] for i in args.left_axes)
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
|
|
15
15
|
"""A protocol for implementing high performance mixture evolutions."""
|
|
16
16
|
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
17
19
|
from types import NotImplementedType
|
|
18
20
|
from typing import Any, cast, Iterable, Optional, Tuple, TypeVar, Union
|
|
19
21
|
|
|
@@ -273,7 +275,7 @@ def apply_mixture(
|
|
|
273
275
|
)
|
|
274
276
|
|
|
275
277
|
|
|
276
|
-
def _validate_input(val: Any, args:
|
|
278
|
+
def _validate_input(val: Any, args: ApplyMixtureArgs) -> Tuple[Any, ApplyMixtureArgs, bool]:
|
|
277
279
|
"""Validate args input and determine if we are operating on a
|
|
278
280
|
density matrix or a state vector.
|
|
279
281
|
"""
|
|
@@ -303,7 +305,7 @@ def _validate_input(val: Any, args: 'ApplyMixtureArgs') -> Tuple[Any, 'ApplyMixt
|
|
|
303
305
|
|
|
304
306
|
|
|
305
307
|
def _apply_unitary_strat(
|
|
306
|
-
val: Any, args:
|
|
308
|
+
val: Any, args: ApplyMixtureArgs, is_density_matrix: bool
|
|
307
309
|
) -> Optional[np.ndarray]:
|
|
308
310
|
"""Attempt to use `apply_unitary` and return the result.
|
|
309
311
|
|
|
@@ -333,7 +335,7 @@ def _apply_unitary_strat(
|
|
|
333
335
|
|
|
334
336
|
|
|
335
337
|
def _apply_unitary_from_matrix_strat(
|
|
336
|
-
val: np.ndarray, args:
|
|
338
|
+
val: np.ndarray, args: ApplyMixtureArgs, is_density_matrix: bool
|
|
337
339
|
) -> Optional[np.ndarray]:
|
|
338
340
|
"""Used to enact mixture tuples that are given as (probability, np.ndarray)
|
|
339
341
|
|
|
@@ -359,7 +361,7 @@ def _apply_unitary_from_matrix_strat(
|
|
|
359
361
|
|
|
360
362
|
|
|
361
363
|
def _apply_mixture_from_mixture_strat(
|
|
362
|
-
val: Any, args:
|
|
364
|
+
val: Any, args: ApplyMixtureArgs, is_density_matrix: bool
|
|
363
365
|
) -> Optional[np.ndarray]:
|
|
364
366
|
"""Attempt to use unitary matrices in _mixture_ and return the result."""
|
|
365
367
|
method = getattr(val, '_mixture_', None)
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
14
17
|
from typing import Any, cast, Iterable, Optional, Tuple
|
|
15
18
|
|
|
16
19
|
import numpy as np
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
14
17
|
import numpy as np
|
|
15
18
|
import pytest
|
|
16
19
|
import sympy
|
|
@@ -11,8 +11,11 @@
|
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
|
+
|
|
14
15
|
"""Protocol for determining commutativity."""
|
|
15
16
|
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
16
19
|
from types import NotImplementedType
|
|
17
20
|
from typing import Any, overload, TypeVar, Union
|
|
18
21
|
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
14
17
|
import numpy as np
|
|
15
18
|
|
|
16
19
|
import cirq
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
15
17
|
import pytest
|
|
16
18
|
|
|
17
19
|
import cirq
|
|
@@ -32,7 +34,7 @@ class ReturnsFive:
|
|
|
32
34
|
|
|
33
35
|
|
|
34
36
|
class SelfInverse:
|
|
35
|
-
def __pow__(self, exponent) ->
|
|
37
|
+
def __pow__(self, exponent) -> SelfInverse:
|
|
36
38
|
return self
|
|
37
39
|
|
|
38
40
|
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
14
17
|
import dataclasses
|
|
15
18
|
import datetime
|
|
16
19
|
import gzip
|
cirq/protocols/kraus_protocol.py
CHANGED
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
15
17
|
import pytest
|
|
16
18
|
|
|
17
19
|
import cirq
|
|
@@ -99,7 +101,8 @@ def test_is_measurement() -> None:
|
|
|
99
101
|
assert not cirq.is_measurement(cirq.bit_flip(1))
|
|
100
102
|
|
|
101
103
|
class NotImplementedOperation(cirq.Operation):
|
|
102
|
-
|
|
104
|
+
# pylint: disable=undefined-variable
|
|
105
|
+
def with_qubits(self, *new_qubits) -> NotImplementedOperation:
|
|
103
106
|
raise NotImplementedError()
|
|
104
107
|
|
|
105
108
|
@property
|
cirq/protocols/mul_protocol.py
CHANGED
|
@@ -11,8 +11,11 @@
|
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
|
+
|
|
14
15
|
"""Protocol for obtaining expansion of linear operators in Pauli basis."""
|
|
15
16
|
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
16
19
|
from typing import Any, TypeVar, Union
|
|
17
20
|
|
|
18
21
|
from typing_extensions import Protocol
|
cirq/protocols/phase_protocol.py
CHANGED
cirq/protocols/qasm_test.py
CHANGED
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
14
17
|
import pytest
|
|
15
18
|
|
|
16
19
|
import cirq
|
|
@@ -12,11 +12,12 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
15
17
|
import pytest
|
|
16
18
|
import sympy
|
|
17
19
|
|
|
18
20
|
import cirq
|
|
19
|
-
from cirq.study import ParamResolver
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
@pytest.mark.parametrize('resolve_fn', [cirq.resolve_parameters, cirq.resolve_parameters_once])
|
|
@@ -38,7 +39,7 @@ def test_resolve_parameters(resolve_fn) -> None:
|
|
|
38
39
|
def _is_parameterized_(self) -> bool:
|
|
39
40
|
return self.parameter != 0
|
|
40
41
|
|
|
41
|
-
def _resolve_parameters_(self, resolver: ParamResolver, recursive: bool):
|
|
42
|
+
def _resolve_parameters_(self, resolver: cirq.ParamResolver, recursive: bool):
|
|
42
43
|
self.parameter = resolver.value_of(self.parameter, recursive)
|
|
43
44
|
return self
|
|
44
45
|
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
14
17
|
from typing import Optional
|
|
15
18
|
|
|
16
19
|
import numpy as np
|
cirq/qis/channels.py
CHANGED
|
@@ -11,7 +11,11 @@
|
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
|
+
|
|
14
15
|
"""Tools for analyzing and manipulating quantum channels."""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
15
19
|
from typing import Sequence
|
|
16
20
|
|
|
17
21
|
import numpy as np
|
|
@@ -280,7 +284,7 @@ def superoperator_to_choi(superoperator: np.ndarray) -> np.ndarray:
|
|
|
280
284
|
return np.reshape(c, (d * d, d * d))
|
|
281
285
|
|
|
282
286
|
|
|
283
|
-
def operation_to_choi(operation:
|
|
287
|
+
def operation_to_choi(operation: protocols.SupportsKraus) -> np.ndarray:
|
|
284
288
|
r"""Returns the unique Choi matrix associated with an operation .
|
|
285
289
|
|
|
286
290
|
Choi matrix J(E) of a linear map E: L(H1) -> L(H2) which takes linear operators
|
|
@@ -302,7 +306,7 @@ def operation_to_choi(operation: 'protocols.SupportsKraus') -> np.ndarray:
|
|
|
302
306
|
return kraus_to_choi(protocols.kraus(operation))
|
|
303
307
|
|
|
304
308
|
|
|
305
|
-
def operation_to_superoperator(operation:
|
|
309
|
+
def operation_to_superoperator(operation: protocols.SupportsKraus) -> np.ndarray:
|
|
306
310
|
"""Returns the matrix representation of an operation in standard basis.
|
|
307
311
|
|
|
308
312
|
Let E: L(H1) -> L(H2) denote a linear map which takes linear operators on Hilbert space H1
|
cirq/qis/channels_test.py
CHANGED
|
@@ -11,7 +11,11 @@
|
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
|
+
|
|
14
15
|
"""Tests for channels."""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
15
19
|
from typing import Iterable, Sequence
|
|
16
20
|
|
|
17
21
|
import numpy as np
|
cirq/qis/entropy.py
CHANGED
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
15
17
|
from collections.abc import Sequence
|
|
16
18
|
from concurrent.futures import ThreadPoolExecutor
|
|
17
19
|
from itertools import product
|
cirq/qis/entropy_test.py
CHANGED
cirq/qis/measures_test.py
CHANGED
|
@@ -11,7 +11,11 @@
|
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
|
+
|
|
14
15
|
"""Tests for measures."""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
15
19
|
import numpy as np
|
|
16
20
|
import pytest
|
|
17
21
|
|
cirq/qis/noise_utils.py
CHANGED
cirq/qis/noise_utils_test.py
CHANGED
cirq/qis/states_test.py
CHANGED