cirq-core 1.6.0.dev20250519212157__py3-none-any.whl → 1.6.0.dev20250520001204__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/circuits/frozen_circuit.py +2 -2
- cirq/contrib/acquaintance/topological_sort.py +2 -2
- cirq/contrib/custom_simulators/custom_state_simulator.py +2 -2
- cirq/contrib/paulistring/clifford_target_gateset.py +2 -2
- cirq/contrib/quantum_volume/quantum_volume.py +5 -3
- cirq/contrib/quimb/grid_circuits.py +4 -3
- cirq/contrib/quimb/state_vector.py +4 -2
- cirq/contrib/routing/router.py +2 -2
- cirq/experiments/qubit_characterizations.py +2 -1
- cirq/experiments/random_quantum_circuit_generation.py +2 -1
- cirq/experiments/two_qubit_xeb.py +2 -1
- cirq/linalg/predicates.py +1 -1
- cirq/ops/gate_operation.py +2 -1
- cirq/ops/linear_combinations.py +5 -5
- cirq/ops/pauli_string_phasor.py +2 -2
- cirq/ops/raw_types.py +2 -1
- cirq/sim/clifford/clifford_tableau_simulation_state.py +2 -2
- cirq/sim/clifford/stabilizer_ch_form_simulation_state.py +2 -2
- cirq/sim/clifford/stabilizer_simulation_state.py +2 -1
- cirq/sim/simulation_state_base.py +2 -1
- cirq/testing/consistent_protocols.py +2 -0
- cirq/testing/consistent_protocols_test.py +4 -2
- cirq/testing/consistent_qasm.py +2 -0
- cirq/testing/consistent_qasm_test.py +2 -0
- cirq/testing/consistent_resolve_parameters.py +2 -0
- cirq/testing/consistent_specified_has_unitary.py +2 -0
- cirq/testing/consistent_specified_has_unitary_test.py +2 -0
- cirq/testing/consistent_unitary.py +2 -0
- cirq/testing/consistent_unitary_test.py +2 -0
- cirq/testing/deprecation.py +3 -0
- cirq/testing/deprecation_test.py +3 -0
- cirq/testing/devices.py +4 -0
- cirq/testing/devices_test.py +3 -0
- cirq/testing/equals_tester.py +2 -0
- cirq/testing/equals_tester_test.py +2 -0
- cirq/testing/equivalent_basis_map.py +2 -0
- cirq/testing/equivalent_basis_map_test.py +3 -0
- cirq/testing/equivalent_repr_eval.py +2 -0
- cirq/testing/equivalent_repr_eval_test.py +2 -0
- cirq/testing/gate_features.py +2 -0
- cirq/testing/gate_features_test.py +2 -0
- cirq/testing/json.py +6 -2
- cirq/testing/json_test.py +2 -0
- cirq/testing/lin_alg_utils_test.py +2 -0
- cirq/testing/logs.py +4 -0
- cirq/testing/logs_test.py +2 -0
- cirq/testing/no_identifier_qubit.py +3 -0
- cirq/testing/no_identifier_qubit_test.py +2 -0
- cirq/testing/op_tree.py +2 -0
- cirq/testing/op_tree_test.py +3 -0
- cirq/testing/order_tester.py +2 -0
- cirq/testing/order_tester_test.py +2 -0
- cirq/testing/pytest_utils.py +2 -0
- cirq/testing/pytest_utils_test.py +2 -0
- cirq/testing/random_circuit_test.py +3 -0
- cirq/testing/repr_pretty_tester.py +1 -0
- cirq/testing/repr_pretty_tester_test.py +2 -0
- cirq/testing/routing_devices_test.py +3 -0
- cirq/testing/sample_circuits_test.py +2 -0
- cirq/testing/sample_gates.py +3 -0
- cirq/testing/sample_gates_test.py +3 -0
- cirq/transformers/align_test.py +2 -0
- cirq/transformers/analytical_decompositions/clifford_decomposition_test.py +2 -0
- cirq/transformers/analytical_decompositions/controlled_gate_decomposition_test.py +2 -0
- cirq/transformers/analytical_decompositions/cphase_to_fsim_test.py +2 -0
- cirq/transformers/analytical_decompositions/pauli_string_decomposition.py +2 -0
- cirq/transformers/analytical_decompositions/pauli_string_decomposition_test.py +2 -0
- cirq/transformers/analytical_decompositions/quantum_shannon_decomposition_test.py +2 -0
- cirq/transformers/analytical_decompositions/single_qubit_decompositions.py +2 -0
- cirq/transformers/analytical_decompositions/single_qubit_decompositions_test.py +2 -0
- cirq/transformers/analytical_decompositions/single_to_two_qubit_isometry_test.py +3 -0
- cirq/transformers/analytical_decompositions/three_qubit_decomposition.py +2 -0
- cirq/transformers/analytical_decompositions/three_qubit_decomposition_test.py +2 -0
- cirq/transformers/analytical_decompositions/two_qubit_state_preparation_test.py +2 -0
- cirq/transformers/analytical_decompositions/two_qubit_to_cz_test.py +2 -0
- cirq/transformers/analytical_decompositions/two_qubit_to_fsim_test.py +2 -0
- cirq/transformers/analytical_decompositions/two_qubit_to_ms.py +2 -2
- cirq/transformers/analytical_decompositions/two_qubit_to_ms_test.py +2 -0
- cirq/transformers/analytical_decompositions/two_qubit_to_sqrt_iswap_test.py +2 -0
- cirq/transformers/drop_empty_moments_test.py +2 -0
- cirq/transformers/drop_negligible_operations_test.py +2 -0
- cirq/transformers/eject_phased_paulis_test.py +3 -0
- cirq/transformers/eject_z_test.py +2 -0
- cirq/transformers/expand_composite_test.py +2 -0
- cirq/transformers/gauge_compiling/cphase_gauge_test.py +2 -0
- cirq/transformers/gauge_compiling/cz_gauge.py +2 -0
- cirq/transformers/gauge_compiling/cz_gauge_test.py +1 -0
- cirq/transformers/gauge_compiling/gauge_compiling.py +9 -5
- cirq/transformers/gauge_compiling/gauge_compiling_test.py +2 -0
- cirq/transformers/gauge_compiling/gauge_compiling_test_utils.py +1 -0
- cirq/transformers/gauge_compiling/gauge_compiling_test_utils_test.py +6 -1
- cirq/transformers/gauge_compiling/iswap_gauge.py +2 -0
- cirq/transformers/gauge_compiling/iswap_gauge_test.py +2 -0
- cirq/transformers/gauge_compiling/spin_inversion_gauge.py +2 -0
- cirq/transformers/gauge_compiling/spin_inversion_gauge_test.py +2 -0
- cirq/transformers/gauge_compiling/sqrt_cz_gauge.py +3 -3
- cirq/transformers/gauge_compiling/sqrt_cz_gauge_test.py +2 -0
- cirq/transformers/gauge_compiling/sqrt_iswap_gauge.py +2 -0
- cirq/transformers/gauge_compiling/sqrt_iswap_gauge_test.py +2 -0
- cirq/transformers/heuristic_decompositions/gate_tabulation_math_utils.py +3 -0
- cirq/transformers/heuristic_decompositions/gate_tabulation_math_utils_test.py +3 -0
- cirq/transformers/heuristic_decompositions/two_qubit_gate_tabulation_test.py +2 -0
- cirq/transformers/insertion_sort_test.py +2 -0
- cirq/transformers/measurement_transformers_test.py +2 -0
- cirq/transformers/merge_single_qubit_gates_test.py +2 -0
- cirq/transformers/noise_adding.py +2 -0
- cirq/transformers/noise_adding_test.py +2 -0
- cirq/transformers/qubit_management_transformers_test.py +2 -0
- cirq/transformers/randomized_measurements_test.py +2 -0
- cirq/transformers/routing/initial_mapper_test.py +2 -0
- cirq/transformers/routing/line_initial_mapper_test.py +2 -0
- cirq/transformers/routing/mapping_manager_test.py +2 -0
- cirq/transformers/routing/route_circuit_cqc_test.py +2 -0
- cirq/transformers/routing/visualize_routed_circuit_test.py +2 -0
- cirq/transformers/stratify_test.py +3 -0
- cirq/transformers/synchronize_terminal_measurements_test.py +2 -0
- cirq/transformers/tag_transformers.py +10 -8
- cirq/transformers/tag_transformers_test.py +2 -0
- cirq/transformers/target_gatesets/cz_gateset_test.py +2 -0
- cirq/transformers/target_gatesets/sqrt_iswap_gateset_test.py +2 -0
- cirq/transformers/transformer_api_test.py +2 -0
- cirq/value/abc_alt.py +2 -0
- cirq/value/abc_alt_test.py +2 -0
- cirq/value/angle.py +5 -2
- cirq/value/angle_test.py +2 -0
- cirq/value/classical_data_test.py +3 -0
- cirq/value/condition_test.py +2 -0
- cirq/value/digits.py +2 -0
- cirq/value/digits_test.py +2 -0
- cirq/value/duration_test.py +2 -0
- cirq/value/linear_dict_test.py +2 -0
- cirq/value/measurement_key.py +5 -5
- cirq/value/measurement_key_test.py +2 -0
- cirq/value/periodic_value_test.py +2 -0
- cirq/value/probability_test.py +2 -0
- cirq/value/product_state_test.py +3 -0
- cirq/value/random_state.py +2 -0
- cirq/value/random_state_test.py +2 -0
- cirq/value/timestamp.py +8 -5
- cirq/value/timestamp_test.py +2 -0
- cirq/value/type_alias.py +2 -0
- cirq/value/value_equality_attr.py +3 -0
- cirq/value/value_equality_attr_test.py +3 -0
- cirq/vis/density_matrix.py +2 -0
- cirq/vis/density_matrix_test.py +3 -0
- cirq/vis/heatmap_test.py +3 -0
- cirq/vis/histogram.py +3 -0
- cirq/vis/histogram_test.py +3 -0
- cirq/vis/state_histogram.py +4 -2
- cirq/vis/state_histogram_test.py +2 -0
- cirq/vis/vis_utils.py +4 -1
- cirq/vis/vis_utils_test.py +3 -0
- cirq/work/collector_test.py +2 -0
- cirq/work/observable_grouping.py +2 -0
- cirq/work/observable_grouping_test.py +2 -0
- cirq/work/observable_measurement_data_test.py +4 -1
- cirq/work/observable_measurement_test.py +3 -0
- cirq/work/observable_settings_test.py +2 -0
- cirq/work/pauli_sum_collector_test.py +2 -0
- {cirq_core-1.6.0.dev20250519212157.dist-info → cirq_core-1.6.0.dev20250520001204.dist-info}/METADATA +1 -1
- {cirq_core-1.6.0.dev20250519212157.dist-info → cirq_core-1.6.0.dev20250520001204.dist-info}/RECORD +166 -166
- {cirq_core-1.6.0.dev20250519212157.dist-info → cirq_core-1.6.0.dev20250520001204.dist-info}/WHEEL +0 -0
- {cirq_core-1.6.0.dev20250519212157.dist-info → cirq_core-1.6.0.dev20250520001204.dist-info}/licenses/LICENSE +0 -0
- {cirq_core-1.6.0.dev20250519212157.dist-info → cirq_core-1.6.0.dev20250520001204.dist-info}/top_level.txt +0 -0
cirq/_version.py
CHANGED
cirq/_version_test.py
CHANGED
cirq/circuits/frozen_circuit.py
CHANGED
|
@@ -30,13 +30,13 @@ from typing import (
|
|
|
30
30
|
Union,
|
|
31
31
|
)
|
|
32
32
|
|
|
33
|
-
import numpy as np
|
|
34
|
-
|
|
35
33
|
from cirq import _compat, protocols
|
|
36
34
|
from cirq.circuits import AbstractCircuit, Alignment, Circuit
|
|
37
35
|
from cirq.circuits.insert_strategy import InsertStrategy
|
|
38
36
|
|
|
39
37
|
if TYPE_CHECKING:
|
|
38
|
+
import numpy as np
|
|
39
|
+
|
|
40
40
|
import cirq
|
|
41
41
|
|
|
42
42
|
|
|
@@ -16,12 +16,12 @@ from __future__ import annotations
|
|
|
16
16
|
|
|
17
17
|
from typing import Any, Dict, Generic, Sequence, Type, TYPE_CHECKING
|
|
18
18
|
|
|
19
|
-
import numpy as np
|
|
20
|
-
|
|
21
19
|
from cirq import sim
|
|
22
20
|
from cirq.sim.simulation_state import TSimulationState
|
|
23
21
|
|
|
24
22
|
if TYPE_CHECKING:
|
|
23
|
+
import numpy as np
|
|
24
|
+
|
|
25
25
|
import cirq
|
|
26
26
|
|
|
27
27
|
|
|
@@ -18,11 +18,11 @@ from enum import Enum
|
|
|
18
18
|
from types import NotImplementedType
|
|
19
19
|
from typing import cast, List, Type, TYPE_CHECKING, Union
|
|
20
20
|
|
|
21
|
-
import numpy as np
|
|
22
|
-
|
|
23
21
|
from cirq import linalg, ops, protocols, transformers
|
|
24
22
|
|
|
25
23
|
if TYPE_CHECKING:
|
|
24
|
+
import numpy as np
|
|
25
|
+
|
|
26
26
|
import cirq
|
|
27
27
|
|
|
28
28
|
|
|
@@ -6,15 +6,17 @@ https://arxiv.org/abs/1811.12926.
|
|
|
6
6
|
from __future__ import annotations
|
|
7
7
|
|
|
8
8
|
from dataclasses import dataclass
|
|
9
|
-
from typing import Callable, Dict, List, Optional, Set, Tuple
|
|
9
|
+
from typing import Callable, Dict, List, Optional, Set, Tuple, TYPE_CHECKING
|
|
10
10
|
|
|
11
|
-
import networkx as nx
|
|
12
11
|
import numpy as np
|
|
13
|
-
import pandas as pd
|
|
14
12
|
|
|
15
13
|
import cirq
|
|
16
14
|
import cirq.contrib.routing as ccr
|
|
17
15
|
|
|
16
|
+
if TYPE_CHECKING:
|
|
17
|
+
import networkx as nx
|
|
18
|
+
import pandas as pd
|
|
19
|
+
|
|
18
20
|
|
|
19
21
|
def generate_model_circuit(
|
|
20
22
|
num_qubits: int, depth: int, *, random_state: cirq.RANDOM_STATE_OR_SEED_LIKE = None
|
|
@@ -14,12 +14,13 @@
|
|
|
14
14
|
|
|
15
15
|
from __future__ import annotations
|
|
16
16
|
|
|
17
|
-
from typing import Iterator
|
|
18
|
-
|
|
19
|
-
import networkx as nx
|
|
17
|
+
from typing import Iterator, TYPE_CHECKING
|
|
20
18
|
|
|
21
19
|
import cirq
|
|
22
20
|
|
|
21
|
+
if TYPE_CHECKING:
|
|
22
|
+
import networkx as nx
|
|
23
|
+
|
|
23
24
|
|
|
24
25
|
def get_grid_moments(
|
|
25
26
|
problem_graph: nx.Graph, two_qubit_gate=cirq.ZZPowGate
|
|
@@ -3,14 +3,16 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import warnings
|
|
6
|
-
from typing import cast, Dict, List, Optional, Sequence, Tuple, Union
|
|
6
|
+
from typing import cast, Dict, List, Optional, Sequence, Tuple, TYPE_CHECKING, Union
|
|
7
7
|
|
|
8
|
-
import numpy as np
|
|
9
8
|
import quimb
|
|
10
9
|
import quimb.tensor as qtn
|
|
11
10
|
|
|
12
11
|
import cirq
|
|
13
12
|
|
|
13
|
+
if TYPE_CHECKING:
|
|
14
|
+
import numpy as np
|
|
15
|
+
|
|
14
16
|
|
|
15
17
|
def _get_quimb_version():
|
|
16
18
|
"""Returns the quimb version and parsed (major,minor) numbers if possible.
|
cirq/contrib/routing/router.py
CHANGED
|
@@ -16,12 +16,12 @@ from __future__ import annotations
|
|
|
16
16
|
|
|
17
17
|
from typing import Callable, Optional, TYPE_CHECKING
|
|
18
18
|
|
|
19
|
-
import networkx as nx
|
|
20
|
-
|
|
21
19
|
from cirq import circuits, protocols
|
|
22
20
|
from cirq.contrib.routing.greedy import route_circuit_greedily
|
|
23
21
|
|
|
24
22
|
if TYPE_CHECKING:
|
|
23
|
+
import networkx as nx
|
|
24
|
+
|
|
25
25
|
from cirq.contrib.routing.swap_network import SwapNetwork
|
|
26
26
|
|
|
27
27
|
ROUTERS = {'greedy': route_circuit_greedily}
|
|
@@ -34,7 +34,6 @@ import numpy as np
|
|
|
34
34
|
from matplotlib import pyplot as plt
|
|
35
35
|
|
|
36
36
|
# this is for older systems with matplotlib <3.2 otherwise 3d projections fail
|
|
37
|
-
from mpl_toolkits import mplot3d
|
|
38
37
|
from scipy.optimize import curve_fit
|
|
39
38
|
|
|
40
39
|
import cirq.vis.heatmap as cirq_heatmap
|
|
@@ -43,6 +42,8 @@ from cirq import circuits, ops, protocols
|
|
|
43
42
|
from cirq.devices import grid_qubit
|
|
44
43
|
|
|
45
44
|
if TYPE_CHECKING:
|
|
45
|
+
from mpl_toolkits import mplot3d
|
|
46
|
+
|
|
46
47
|
import cirq
|
|
47
48
|
|
|
48
49
|
|
|
@@ -33,13 +33,14 @@ from typing import (
|
|
|
33
33
|
Union,
|
|
34
34
|
)
|
|
35
35
|
|
|
36
|
-
import networkx as nx
|
|
37
36
|
import numpy as np
|
|
38
37
|
|
|
39
38
|
from cirq import circuits, devices, ops, protocols, value
|
|
40
39
|
from cirq._doc import document
|
|
41
40
|
|
|
42
41
|
if TYPE_CHECKING:
|
|
42
|
+
import networkx as nx
|
|
43
|
+
|
|
43
44
|
import cirq
|
|
44
45
|
|
|
45
46
|
QidPairT = Tuple['cirq.Qid', 'cirq.Qid']
|
|
@@ -24,7 +24,6 @@ from typing import Any, cast, Dict, Mapping, Optional, Sequence, Tuple, TYPE_CHE
|
|
|
24
24
|
|
|
25
25
|
import networkx as nx
|
|
26
26
|
import numpy as np
|
|
27
|
-
import pandas as pd
|
|
28
27
|
from matplotlib import pyplot as plt
|
|
29
28
|
|
|
30
29
|
from cirq import ops, value, vis
|
|
@@ -45,6 +44,8 @@ from cirq.qis import noise_utils
|
|
|
45
44
|
if TYPE_CHECKING:
|
|
46
45
|
import multiprocessing
|
|
47
46
|
|
|
47
|
+
import pandas as pd
|
|
48
|
+
|
|
48
49
|
import cirq
|
|
49
50
|
|
|
50
51
|
|
cirq/linalg/predicates.py
CHANGED
|
@@ -302,7 +302,7 @@ def slice_for_qubits_equal_to(
|
|
|
302
302
|
out_size = (
|
|
303
303
|
cast(int, num_qubits) if out_size_specified else max(target_qubit_axes, default=-1) + 1
|
|
304
304
|
)
|
|
305
|
-
result = cast(List[Union[slice, int,
|
|
305
|
+
result = cast(List[Union[slice, int, EllipsisType]], [slice(None)] * out_size)
|
|
306
306
|
if not out_size_specified:
|
|
307
307
|
result.append(Ellipsis)
|
|
308
308
|
if qid_shape is None:
|
cirq/ops/gate_operation.py
CHANGED
|
@@ -36,13 +36,14 @@ from typing import (
|
|
|
36
36
|
Union,
|
|
37
37
|
)
|
|
38
38
|
|
|
39
|
-
import numpy as np
|
|
40
39
|
from typing_extensions import Self
|
|
41
40
|
|
|
42
41
|
from cirq import ops, protocols, value
|
|
43
42
|
from cirq.ops import control_values as cv, gate_features, raw_types
|
|
44
43
|
|
|
45
44
|
if TYPE_CHECKING:
|
|
45
|
+
import numpy as np
|
|
46
|
+
|
|
46
47
|
import cirq
|
|
47
48
|
|
|
48
49
|
|
cirq/ops/linear_combinations.py
CHANGED
|
@@ -32,9 +32,7 @@ from typing import (
|
|
|
32
32
|
)
|
|
33
33
|
|
|
34
34
|
import numpy as np
|
|
35
|
-
|
|
36
|
-
from sympy.core.expr import Expr
|
|
37
|
-
from sympy.core.symbol import Symbol
|
|
35
|
+
import sympy
|
|
38
36
|
from sympy.logic.boolalg import And, Not, Or, Xor
|
|
39
37
|
|
|
40
38
|
from cirq import linalg, protocols, qis, value
|
|
@@ -46,6 +44,8 @@ from cirq.ops.projector import ProjectorString
|
|
|
46
44
|
from cirq.value.linear_dict import _format_terms
|
|
47
45
|
|
|
48
46
|
if TYPE_CHECKING:
|
|
47
|
+
from scipy.sparse import csr_matrix
|
|
48
|
+
|
|
49
49
|
import cirq
|
|
50
50
|
|
|
51
51
|
UnitPauliStringT = FrozenSet[Tuple[raw_types.Qid, pauli_gates.Pauli]]
|
|
@@ -490,7 +490,7 @@ class PauliSum:
|
|
|
490
490
|
|
|
491
491
|
@classmethod
|
|
492
492
|
def from_boolean_expression(
|
|
493
|
-
cls, boolean_expr: Expr, qubit_map: Dict[str, cirq.Qid]
|
|
493
|
+
cls, boolean_expr: sympy.Expr, qubit_map: Dict[str, cirq.Qid]
|
|
494
494
|
) -> PauliSum:
|
|
495
495
|
"""Builds the Hamiltonian representation of a Boolean expression.
|
|
496
496
|
|
|
@@ -507,7 +507,7 @@ class PauliSum:
|
|
|
507
507
|
Raises:
|
|
508
508
|
ValueError: If `boolean_expr` is of an unsupported type.
|
|
509
509
|
"""
|
|
510
|
-
if isinstance(boolean_expr, Symbol):
|
|
510
|
+
if isinstance(boolean_expr, sympy.Symbol):
|
|
511
511
|
# In table 1, the entry for 'x' is '1/2.I - 1/2.Z'
|
|
512
512
|
return cls.from_pauli_strings(
|
|
513
513
|
[
|
cirq/ops/pauli_string_phasor.py
CHANGED
|
@@ -27,8 +27,6 @@ from typing import (
|
|
|
27
27
|
Union,
|
|
28
28
|
)
|
|
29
29
|
|
|
30
|
-
import sympy
|
|
31
|
-
|
|
32
30
|
from cirq import protocols, value
|
|
33
31
|
from cirq._compat import deprecated, proper_repr
|
|
34
32
|
from cirq.ops import (
|
|
@@ -42,6 +40,8 @@ from cirq.ops import (
|
|
|
42
40
|
)
|
|
43
41
|
|
|
44
42
|
if TYPE_CHECKING:
|
|
43
|
+
import sympy
|
|
44
|
+
|
|
45
45
|
import cirq
|
|
46
46
|
|
|
47
47
|
|
cirq/ops/raw_types.py
CHANGED
|
@@ -39,7 +39,6 @@ from typing import (
|
|
|
39
39
|
)
|
|
40
40
|
|
|
41
41
|
import numpy as np
|
|
42
|
-
import sympy
|
|
43
42
|
from typing_extensions import Self
|
|
44
43
|
|
|
45
44
|
from cirq import protocols, value
|
|
@@ -52,6 +51,8 @@ line_qubit = LazyLoader("line_qubit", globals(), "cirq.devices.line_qubit")
|
|
|
52
51
|
|
|
53
52
|
|
|
54
53
|
if TYPE_CHECKING:
|
|
54
|
+
import sympy
|
|
55
|
+
|
|
55
56
|
import cirq
|
|
56
57
|
from cirq.ops import control_values as cv
|
|
57
58
|
|
|
@@ -19,12 +19,12 @@ from __future__ import annotations
|
|
|
19
19
|
|
|
20
20
|
from typing import Optional, Sequence, TYPE_CHECKING
|
|
21
21
|
|
|
22
|
-
import numpy as np
|
|
23
|
-
|
|
24
22
|
from cirq.qis import clifford_tableau
|
|
25
23
|
from cirq.sim.clifford.stabilizer_simulation_state import StabilizerSimulationState
|
|
26
24
|
|
|
27
25
|
if TYPE_CHECKING:
|
|
26
|
+
import numpy as np
|
|
27
|
+
|
|
28
28
|
import cirq
|
|
29
29
|
|
|
30
30
|
|
|
@@ -16,13 +16,13 @@ from __future__ import annotations
|
|
|
16
16
|
|
|
17
17
|
from typing import Optional, Sequence, TYPE_CHECKING, Union
|
|
18
18
|
|
|
19
|
-
import numpy as np
|
|
20
|
-
|
|
21
19
|
from cirq._compat import proper_repr
|
|
22
20
|
from cirq.sim.clifford import stabilizer_state_ch_form
|
|
23
21
|
from cirq.sim.clifford.stabilizer_simulation_state import StabilizerSimulationState
|
|
24
22
|
|
|
25
23
|
if TYPE_CHECKING:
|
|
24
|
+
import numpy as np
|
|
25
|
+
|
|
26
26
|
import cirq
|
|
27
27
|
|
|
28
28
|
|
|
@@ -18,7 +18,6 @@ import abc
|
|
|
18
18
|
from types import NotImplementedType
|
|
19
19
|
from typing import Any, cast, Generic, Optional, Sequence, TYPE_CHECKING, TypeVar, Union
|
|
20
20
|
|
|
21
|
-
import numpy as np
|
|
22
21
|
import sympy
|
|
23
22
|
|
|
24
23
|
from cirq import linalg, ops, protocols
|
|
@@ -28,6 +27,8 @@ from cirq.protocols import has_unitary, num_qubits, unitary
|
|
|
28
27
|
from cirq.sim.simulation_state import SimulationState
|
|
29
28
|
|
|
30
29
|
if TYPE_CHECKING:
|
|
30
|
+
import numpy as np
|
|
31
|
+
|
|
31
32
|
import cirq
|
|
32
33
|
|
|
33
34
|
|
|
@@ -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 types import NotImplementedType
|
|
16
18
|
from typing import AbstractSet, List, Sequence, Tuple, Union
|
|
17
19
|
|
|
@@ -83,7 +85,7 @@ class GoodGate(cirq.testing.SingleQubitGate):
|
|
|
83
85
|
exponent=self.exponent, phase_exponent=self.phase_exponent + phase_turns * 2
|
|
84
86
|
)
|
|
85
87
|
|
|
86
|
-
def __pow__(self, exponent: Union[float, sympy.Expr]) ->
|
|
88
|
+
def __pow__(self, exponent: Union[float, sympy.Expr]) -> GoodGate:
|
|
87
89
|
new_exponent = cirq.mul(self.exponent, exponent, NotImplemented)
|
|
88
90
|
if new_exponent is NotImplemented:
|
|
89
91
|
return NotImplemented # pragma: no cover
|
|
@@ -101,7 +103,7 @@ class GoodGate(cirq.testing.SingleQubitGate):
|
|
|
101
103
|
def _parameter_names_(self) -> AbstractSet[str]:
|
|
102
104
|
return cirq.parameter_names(self.exponent) | cirq.parameter_names(self.phase_exponent)
|
|
103
105
|
|
|
104
|
-
def _resolve_parameters_(self, resolver, recursive) ->
|
|
106
|
+
def _resolve_parameters_(self, resolver, recursive) -> GoodGate:
|
|
105
107
|
return GoodGate(
|
|
106
108
|
phase_exponent=resolver.value_of(self.phase_exponent, recursive),
|
|
107
109
|
exponent=resolver.value_of(self.exponent, recursive),
|
cirq/testing/consistent_qasm.py
CHANGED
cirq/testing/deprecation.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 contextlib
|
|
15
18
|
import logging
|
|
16
19
|
import os
|
cirq/testing/deprecation_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 warnings
|
|
15
18
|
|
|
16
19
|
import pytest
|
cirq/testing/devices.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
|
"""Provides test devices that can validate circuits."""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
15
19
|
from typing import AbstractSet, cast, Tuple
|
|
16
20
|
|
|
17
21
|
from cirq import devices, ops
|
cirq/testing/devices_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
|
cirq/testing/equals_tester.py
CHANGED
|
@@ -20,6 +20,8 @@ group are all equal to each other, but that items between each group are never
|
|
|
20
20
|
equal to each other. It will also check that a==b implies hash(a)==hash(b).
|
|
21
21
|
"""
|
|
22
22
|
|
|
23
|
+
from __future__ import annotations
|
|
24
|
+
|
|
23
25
|
import collections
|
|
24
26
|
import itertools
|
|
25
27
|
from typing import Any, Callable, List, Tuple, Union
|
|
@@ -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
|
cirq/testing/gate_features.py
CHANGED
cirq/testing/json.py
CHANGED
|
@@ -12,19 +12,23 @@
|
|
|
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 dataclasses
|
|
16
18
|
import inspect
|
|
17
19
|
import io
|
|
18
20
|
import pathlib
|
|
19
21
|
from dataclasses import dataclass
|
|
20
22
|
from types import ModuleType
|
|
21
|
-
from typing import Dict, Iterator, List, Set, Tuple, Type
|
|
23
|
+
from typing import Dict, Iterator, List, Set, Tuple, Type, TYPE_CHECKING
|
|
22
24
|
|
|
23
25
|
import numpy as np
|
|
24
26
|
import pandas as pd
|
|
25
27
|
|
|
26
28
|
import cirq
|
|
27
|
-
|
|
29
|
+
|
|
30
|
+
if TYPE_CHECKING:
|
|
31
|
+
from cirq.protocols.json_serialization import ObjectFactory
|
|
28
32
|
|
|
29
33
|
# This is the testing framework for json serialization
|
|
30
34
|
# The actual tests live in cirq.protocols.json_serialization_test.py.
|
cirq/testing/json_test.py
CHANGED
cirq/testing/logs.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
|
"""Helper for testing python logging statements."""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
15
19
|
import contextlib
|
|
16
20
|
import logging
|
|
17
21
|
from typing import Iterator, List, Optional
|