cirq-core 1.5.0.dev20240907074237__py3-none-any.whl → 1.5.0.dev20240911234931__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/__init__.py +585 -568
- cirq/_version.py +1 -1
- cirq/_version_test.py +1 -1
- cirq/circuits/__init__.py +15 -9
- cirq/contrib/__init__.py +2 -2
- cirq/contrib/acquaintance/__init__.py +44 -29
- cirq/contrib/acquaintance/strategies/__init__.py +9 -3
- cirq/contrib/bayesian_network/__init__.py +3 -1
- cirq/contrib/circuitdag/__init__.py +1 -1
- cirq/contrib/circuitdag/circuit_dag.py +6 -8
- cirq/contrib/graph_device/__init__.py +8 -8
- cirq/contrib/noise_models/__init__.py +5 -6
- cirq/contrib/paulistring/__init__.py +18 -10
- cirq/contrib/qasm_import/__init__.py +2 -2
- cirq/contrib/qcircuit/__init__.py +6 -4
- cirq/contrib/quantum_volume/__init__.py +7 -7
- cirq/contrib/quimb/__init__.py +16 -13
- cirq/contrib/quirk/__init__.py +1 -1
- cirq/contrib/routing/__init__.py +12 -9
- cirq/contrib/svg/__init__.py +1 -1
- cirq/devices/__init__.py +34 -25
- cirq/experiments/__init__.py +45 -34
- cirq/interop/__init__.py +4 -1
- cirq/interop/quirk/__init__.py +7 -4
- cirq/interop/quirk/cells/__init__.py +17 -6
- cirq/ion/__init__.py +4 -2
- cirq/linalg/__init__.py +61 -51
- cirq/neutral_atoms/__init__.py +2 -2
- cirq/ops/__init__.py +171 -130
- cirq/ops/boolean_hamiltonian.py +2 -1
- cirq/protocols/__init__.py +135 -83
- cirq/protocols/json_test_data/__init__.py +1 -1
- cirq/qis/__init__.py +48 -36
- cirq/sim/__init__.py +55 -37
- cirq/sim/clifford/__init__.py +17 -9
- cirq/study/__init__.py +26 -21
- cirq/testing/__init__.py +84 -58
- cirq/testing/_compat_test_data/module_a/__init__.py +2 -2
- cirq/testing/_compat_test_data/module_a/sub/subsub/__init__.py +1 -1
- cirq/testing/json.py +2 -1
- cirq/transformers/__init__.py +95 -83
- cirq/transformers/analytical_decompositions/__init__.py +27 -24
- cirq/transformers/gauge_compiling/__init__.py +22 -9
- cirq/transformers/heuristic_decompositions/__init__.py +3 -3
- cirq/transformers/routing/__init__.py +14 -5
- cirq/transformers/target_gatesets/__init__.py +7 -5
- cirq/value/__init__.py +50 -30
- cirq/vis/__init__.py +9 -6
- cirq/work/__init__.py +19 -13
- {cirq_core-1.5.0.dev20240907074237.dist-info → cirq_core-1.5.0.dev20240911234931.dist-info}/METADATA +1 -1
- {cirq_core-1.5.0.dev20240907074237.dist-info → cirq_core-1.5.0.dev20240911234931.dist-info}/RECORD +54 -54
- {cirq_core-1.5.0.dev20240907074237.dist-info → cirq_core-1.5.0.dev20240911234931.dist-info}/LICENSE +0 -0
- {cirq_core-1.5.0.dev20240907074237.dist-info → cirq_core-1.5.0.dev20240911234931.dist-info}/WHEEL +0 -0
- {cirq_core-1.5.0.dev20240907074237.dist-info → cirq_core-1.5.0.dev20240911234931.dist-info}/top_level.txt +0 -0
cirq/testing/__init__.py
CHANGED
|
@@ -15,109 +15,135 @@
|
|
|
15
15
|
"""Utilities for testing code."""
|
|
16
16
|
|
|
17
17
|
from cirq.testing.circuit_compare import (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
# pylint: disable=line-too-long
|
|
19
|
+
assert_circuits_with_terminal_measurements_are_equivalent as assert_circuits_with_terminal_measurements_are_equivalent,
|
|
20
|
+
assert_circuits_have_same_unitary_given_final_permutation as assert_circuits_have_same_unitary_given_final_permutation,
|
|
21
|
+
assert_has_consistent_apply_channel as assert_has_consistent_apply_channel,
|
|
22
|
+
assert_has_consistent_apply_unitary as assert_has_consistent_apply_unitary,
|
|
23
|
+
assert_has_consistent_apply_unitary_for_various_exponents as assert_has_consistent_apply_unitary_for_various_exponents,
|
|
24
|
+
assert_has_diagram as assert_has_diagram,
|
|
25
|
+
assert_same_circuits as assert_same_circuits,
|
|
26
|
+
highlight_text_differences as highlight_text_differences,
|
|
27
|
+
assert_has_consistent_qid_shape as assert_has_consistent_qid_shape,
|
|
27
28
|
)
|
|
28
29
|
|
|
29
|
-
from cirq.testing.consistent_act_on import
|
|
30
|
+
from cirq.testing.consistent_act_on import (
|
|
31
|
+
# pylint: disable=line-too-long
|
|
32
|
+
assert_all_implemented_act_on_effects_match_unitary as assert_all_implemented_act_on_effects_match_unitary,
|
|
33
|
+
)
|
|
30
34
|
|
|
31
|
-
from cirq.testing.consistent_channels import
|
|
35
|
+
from cirq.testing.consistent_channels import (
|
|
36
|
+
assert_consistent_channel as assert_consistent_channel,
|
|
37
|
+
assert_consistent_mixture as assert_consistent_mixture,
|
|
38
|
+
)
|
|
32
39
|
|
|
33
40
|
from cirq.testing.consistent_controlled_gate_op import (
|
|
34
|
-
assert_controlled_and_controlled_by_identical,
|
|
35
|
-
assert_controlled_unitary_consistent,
|
|
41
|
+
assert_controlled_and_controlled_by_identical as assert_controlled_and_controlled_by_identical,
|
|
42
|
+
assert_controlled_unitary_consistent as assert_controlled_unitary_consistent,
|
|
36
43
|
)
|
|
37
44
|
|
|
38
45
|
from cirq.testing.consistent_decomposition import (
|
|
39
|
-
assert_decompose_ends_at_default_gateset,
|
|
40
|
-
assert_decompose_is_consistent_with_unitary,
|
|
46
|
+
assert_decompose_ends_at_default_gateset as assert_decompose_ends_at_default_gateset,
|
|
47
|
+
assert_decompose_is_consistent_with_unitary as assert_decompose_is_consistent_with_unitary,
|
|
41
48
|
)
|
|
42
49
|
|
|
43
50
|
from cirq.testing.consistent_pauli_expansion import (
|
|
44
|
-
|
|
51
|
+
# pylint: disable=line-too-long
|
|
52
|
+
assert_pauli_expansion_is_consistent_with_unitary as assert_pauli_expansion_is_consistent_with_unitary,
|
|
45
53
|
)
|
|
46
54
|
|
|
47
|
-
from cirq.testing.consistent_phase_by import
|
|
55
|
+
from cirq.testing.consistent_phase_by import (
|
|
56
|
+
assert_phase_by_is_consistent_with_unitary as assert_phase_by_is_consistent_with_unitary,
|
|
57
|
+
)
|
|
48
58
|
|
|
49
59
|
from cirq.testing.consistent_protocols import (
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
60
|
+
# pylint: disable=line-too-long
|
|
61
|
+
assert_eigengate_implements_consistent_protocols as assert_eigengate_implements_consistent_protocols,
|
|
62
|
+
assert_has_consistent_trace_distance_bound as assert_has_consistent_trace_distance_bound,
|
|
63
|
+
assert_implements_consistent_protocols as assert_implements_consistent_protocols,
|
|
64
|
+
assert_commutes_magic_method_consistent_with_unitaries as assert_commutes_magic_method_consistent_with_unitaries,
|
|
54
65
|
)
|
|
55
66
|
|
|
56
|
-
from cirq.testing.consistent_qasm import
|
|
67
|
+
from cirq.testing.consistent_qasm import (
|
|
68
|
+
assert_qasm_is_consistent_with_unitary as assert_qasm_is_consistent_with_unitary,
|
|
69
|
+
)
|
|
57
70
|
|
|
58
|
-
from cirq.testing.consistent_resolve_parameters import
|
|
71
|
+
from cirq.testing.consistent_resolve_parameters import (
|
|
72
|
+
assert_consistent_resolve_parameters as assert_consistent_resolve_parameters,
|
|
73
|
+
)
|
|
59
74
|
|
|
60
|
-
from cirq.testing.consistent_specified_has_unitary import
|
|
75
|
+
from cirq.testing.consistent_specified_has_unitary import (
|
|
76
|
+
assert_specifies_has_unitary_if_unitary as assert_specifies_has_unitary_if_unitary,
|
|
77
|
+
)
|
|
61
78
|
|
|
62
|
-
from cirq.testing.deprecation import assert_deprecated
|
|
79
|
+
from cirq.testing.deprecation import assert_deprecated as assert_deprecated
|
|
63
80
|
|
|
64
|
-
from cirq.testing.devices import ValidatingTestDevice
|
|
81
|
+
from cirq.testing.devices import ValidatingTestDevice as ValidatingTestDevice
|
|
65
82
|
|
|
66
|
-
from cirq.testing.equals_tester import EqualsTester
|
|
83
|
+
from cirq.testing.equals_tester import EqualsTester as EqualsTester
|
|
67
84
|
|
|
68
|
-
from cirq.testing.equivalent_basis_map import
|
|
85
|
+
from cirq.testing.equivalent_basis_map import (
|
|
86
|
+
assert_equivalent_computational_basis_map as assert_equivalent_computational_basis_map,
|
|
87
|
+
)
|
|
69
88
|
|
|
70
|
-
from cirq.testing.equivalent_repr_eval import assert_equivalent_repr
|
|
89
|
+
from cirq.testing.equivalent_repr_eval import assert_equivalent_repr as assert_equivalent_repr
|
|
71
90
|
|
|
72
91
|
from cirq.testing.gate_features import (
|
|
73
|
-
SingleQubitGate,
|
|
74
|
-
TwoQubitGate,
|
|
75
|
-
ThreeQubitGate,
|
|
76
|
-
DoesNotSupportSerializationGate,
|
|
92
|
+
SingleQubitGate as SingleQubitGate,
|
|
93
|
+
TwoQubitGate as TwoQubitGate,
|
|
94
|
+
ThreeQubitGate as ThreeQubitGate,
|
|
95
|
+
DoesNotSupportSerializationGate as DoesNotSupportSerializationGate,
|
|
77
96
|
)
|
|
78
97
|
|
|
79
|
-
from cirq.testing.json import assert_json_roundtrip_works
|
|
98
|
+
from cirq.testing.json import assert_json_roundtrip_works as assert_json_roundtrip_works
|
|
80
99
|
|
|
81
100
|
from cirq.testing.lin_alg_utils import (
|
|
82
|
-
assert_allclose_up_to_global_phase,
|
|
83
|
-
random_density_matrix,
|
|
84
|
-
random_orthogonal,
|
|
85
|
-
random_special_orthogonal,
|
|
86
|
-
random_special_unitary,
|
|
87
|
-
random_superposition,
|
|
88
|
-
random_unitary,
|
|
101
|
+
assert_allclose_up_to_global_phase as assert_allclose_up_to_global_phase,
|
|
102
|
+
random_density_matrix as random_density_matrix,
|
|
103
|
+
random_orthogonal as random_orthogonal,
|
|
104
|
+
random_special_orthogonal as random_special_orthogonal,
|
|
105
|
+
random_special_unitary as random_special_unitary,
|
|
106
|
+
random_superposition as random_superposition,
|
|
107
|
+
random_unitary as random_unitary,
|
|
89
108
|
)
|
|
90
109
|
|
|
91
|
-
from cirq.testing.logs import assert_logs
|
|
110
|
+
from cirq.testing.logs import assert_logs as assert_logs
|
|
92
111
|
|
|
93
|
-
from cirq.testing.no_identifier_qubit import NoIdentifierQubit
|
|
112
|
+
from cirq.testing.no_identifier_qubit import NoIdentifierQubit as NoIdentifierQubit
|
|
94
113
|
|
|
95
|
-
from cirq.testing.op_tree import assert_equivalent_op_tree
|
|
114
|
+
from cirq.testing.op_tree import assert_equivalent_op_tree as assert_equivalent_op_tree
|
|
96
115
|
|
|
97
|
-
from cirq.testing.order_tester import OrderTester
|
|
116
|
+
from cirq.testing.order_tester import OrderTester as OrderTester
|
|
98
117
|
|
|
99
|
-
from cirq.testing.pytest_randomly_utils import
|
|
118
|
+
from cirq.testing.pytest_randomly_utils import (
|
|
119
|
+
retry_once_with_later_random_values as retry_once_with_later_random_values,
|
|
120
|
+
)
|
|
100
121
|
|
|
101
122
|
from cirq.testing.random_circuit import (
|
|
102
|
-
DEFAULT_GATE_DOMAIN,
|
|
103
|
-
random_circuit,
|
|
104
|
-
random_two_qubit_circuit_with_czs,
|
|
123
|
+
DEFAULT_GATE_DOMAIN as DEFAULT_GATE_DOMAIN,
|
|
124
|
+
random_circuit as random_circuit,
|
|
125
|
+
random_two_qubit_circuit_with_czs as random_two_qubit_circuit_with_czs,
|
|
105
126
|
)
|
|
106
127
|
|
|
107
128
|
from cirq.testing.repr_pretty_tester import (
|
|
108
|
-
assert_repr_pretty,
|
|
109
|
-
assert_repr_pretty_contains,
|
|
110
|
-
FakePrinter,
|
|
129
|
+
assert_repr_pretty as assert_repr_pretty,
|
|
130
|
+
assert_repr_pretty_contains as assert_repr_pretty_contains,
|
|
131
|
+
FakePrinter as FakePrinter,
|
|
111
132
|
)
|
|
112
133
|
|
|
113
134
|
from cirq.testing.routing_devices import (
|
|
114
|
-
construct_grid_device,
|
|
115
|
-
construct_ring_device,
|
|
116
|
-
RoutingTestingDevice,
|
|
135
|
+
construct_grid_device as construct_grid_device,
|
|
136
|
+
construct_ring_device as construct_ring_device,
|
|
137
|
+
RoutingTestingDevice as RoutingTestingDevice,
|
|
117
138
|
)
|
|
118
139
|
|
|
119
|
-
from cirq.testing.sample_circuits import nonoptimal_toffoli_circuit
|
|
140
|
+
from cirq.testing.sample_circuits import nonoptimal_toffoli_circuit as nonoptimal_toffoli_circuit
|
|
120
141
|
|
|
121
|
-
from cirq.testing.sample_gates import
|
|
142
|
+
from cirq.testing.sample_gates import (
|
|
143
|
+
PhaseUsingCleanAncilla as PhaseUsingCleanAncilla,
|
|
144
|
+
PhaseUsingDirtyAncilla as PhaseUsingDirtyAncilla,
|
|
145
|
+
)
|
|
122
146
|
|
|
123
|
-
from cirq.testing.consistent_unitary import
|
|
147
|
+
from cirq.testing.consistent_unitary import (
|
|
148
|
+
assert_unitary_is_consistent as assert_unitary_is_consistent,
|
|
149
|
+
)
|
|
@@ -5,9 +5,9 @@ import logging
|
|
|
5
5
|
|
|
6
6
|
from cirq.testing._compat_test_data.module_a import module_b
|
|
7
7
|
|
|
8
|
-
from cirq.testing._compat_test_data.module_a.dupe import DUPE_CONSTANT
|
|
8
|
+
from cirq.testing._compat_test_data.module_a.dupe import DUPE_CONSTANT as DUPE_CONSTANT
|
|
9
9
|
|
|
10
|
-
from cirq.testing._compat_test_data.module_a.types import SampleType
|
|
10
|
+
from cirq.testing._compat_test_data.module_a.types import SampleType as SampleType
|
|
11
11
|
|
|
12
12
|
MODULE_A_ATTRIBUTE = "module_a"
|
|
13
13
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
# pylint: disable=wrong-or-nonexistent-copyright-notice
|
|
2
|
-
from cirq.testing._compat_test_data.module_a.sub.subsub.dupe import DUPE_CONSTANT
|
|
2
|
+
from cirq.testing._compat_test_data.module_a.sub.subsub.dupe import DUPE_CONSTANT as DUPE_CONSTANT
|
cirq/testing/json.py
CHANGED
|
@@ -11,18 +11,19 @@
|
|
|
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
|
import dataclasses
|
|
15
16
|
import inspect
|
|
16
17
|
import io
|
|
17
18
|
import pathlib
|
|
18
19
|
from dataclasses import dataclass
|
|
20
|
+
from types import ModuleType
|
|
19
21
|
from typing import List, Type, Dict, Iterator, Tuple, Set
|
|
20
22
|
|
|
21
23
|
import numpy as np
|
|
22
24
|
import pandas as pd
|
|
23
25
|
|
|
24
26
|
import cirq
|
|
25
|
-
from cirq._import import ModuleType
|
|
26
27
|
|
|
27
28
|
# This is the testing framework for json serialization
|
|
28
29
|
# The actual tests live in cirq.protocols.json_serialization_test.py.
|
cirq/transformers/__init__.py
CHANGED
|
@@ -15,124 +15,136 @@
|
|
|
15
15
|
"""Classes and methods for transforming circuits."""
|
|
16
16
|
|
|
17
17
|
from cirq.transformers.analytical_decompositions import (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
18
|
+
# pylint: disable=line-too-long
|
|
19
|
+
compute_cphase_exponents_for_fsim_decomposition as compute_cphase_exponents_for_fsim_decomposition,
|
|
20
|
+
decompose_cphase_into_two_fsim as decompose_cphase_into_two_fsim,
|
|
21
|
+
decompose_clifford_tableau_to_operations as decompose_clifford_tableau_to_operations,
|
|
22
|
+
decompose_multi_controlled_x as decompose_multi_controlled_x,
|
|
23
|
+
decompose_multi_controlled_rotation as decompose_multi_controlled_rotation,
|
|
24
|
+
decompose_two_qubit_interaction_into_four_fsim_gates as decompose_two_qubit_interaction_into_four_fsim_gates,
|
|
25
|
+
is_negligible_turn as is_negligible_turn,
|
|
26
|
+
parameterized_2q_op_to_sqrt_iswap_operations as parameterized_2q_op_to_sqrt_iswap_operations,
|
|
27
|
+
prepare_two_qubit_state_using_cz as prepare_two_qubit_state_using_cz,
|
|
28
|
+
prepare_two_qubit_state_using_iswap as prepare_two_qubit_state_using_iswap,
|
|
29
|
+
prepare_two_qubit_state_using_sqrt_iswap as prepare_two_qubit_state_using_sqrt_iswap,
|
|
30
|
+
quantum_shannon_decomposition as quantum_shannon_decomposition,
|
|
31
|
+
single_qubit_matrix_to_gates as single_qubit_matrix_to_gates,
|
|
32
|
+
single_qubit_matrix_to_pauli_rotations as single_qubit_matrix_to_pauli_rotations,
|
|
33
|
+
single_qubit_matrix_to_phased_x_z as single_qubit_matrix_to_phased_x_z,
|
|
34
|
+
single_qubit_matrix_to_phxz as single_qubit_matrix_to_phxz,
|
|
35
|
+
single_qubit_op_to_framed_phase_form as single_qubit_op_to_framed_phase_form,
|
|
36
|
+
three_qubit_matrix_to_operations as three_qubit_matrix_to_operations,
|
|
37
|
+
two_qubit_matrix_to_cz_isometry as two_qubit_matrix_to_cz_isometry,
|
|
38
|
+
two_qubit_matrix_to_cz_operations as two_qubit_matrix_to_cz_operations,
|
|
39
|
+
two_qubit_matrix_to_diagonal_and_cz_operations as two_qubit_matrix_to_diagonal_and_cz_operations,
|
|
40
|
+
two_qubit_matrix_to_ion_operations as two_qubit_matrix_to_ion_operations,
|
|
41
|
+
two_qubit_matrix_to_sqrt_iswap_operations as two_qubit_matrix_to_sqrt_iswap_operations,
|
|
42
|
+
unitary_to_pauli_string as unitary_to_pauli_string,
|
|
42
43
|
)
|
|
43
44
|
|
|
44
45
|
from cirq.transformers.heuristic_decompositions import (
|
|
45
|
-
TwoQubitGateTabulation,
|
|
46
|
-
TwoQubitGateTabulationResult,
|
|
47
|
-
two_qubit_gate_product_tabulation,
|
|
46
|
+
TwoQubitGateTabulation as TwoQubitGateTabulation,
|
|
47
|
+
TwoQubitGateTabulationResult as TwoQubitGateTabulationResult,
|
|
48
|
+
two_qubit_gate_product_tabulation as two_qubit_gate_product_tabulation,
|
|
48
49
|
)
|
|
49
50
|
|
|
50
51
|
from cirq.transformers.routing import (
|
|
51
|
-
AbstractInitialMapper,
|
|
52
|
-
HardCodedInitialMapper,
|
|
53
|
-
LineInitialMapper,
|
|
54
|
-
MappingManager,
|
|
55
|
-
RouteCQC,
|
|
56
|
-
routed_circuit_with_mapping,
|
|
52
|
+
AbstractInitialMapper as AbstractInitialMapper,
|
|
53
|
+
HardCodedInitialMapper as HardCodedInitialMapper,
|
|
54
|
+
LineInitialMapper as LineInitialMapper,
|
|
55
|
+
MappingManager as MappingManager,
|
|
56
|
+
RouteCQC as RouteCQC,
|
|
57
|
+
routed_circuit_with_mapping as routed_circuit_with_mapping,
|
|
57
58
|
)
|
|
58
59
|
|
|
59
60
|
from cirq.transformers.target_gatesets import (
|
|
60
|
-
create_transformer_with_kwargs,
|
|
61
|
-
CompilationTargetGateset,
|
|
62
|
-
CZTargetGateset,
|
|
63
|
-
SqrtIswapTargetGateset,
|
|
64
|
-
TwoQubitCompilationTargetGateset,
|
|
61
|
+
create_transformer_with_kwargs as create_transformer_with_kwargs,
|
|
62
|
+
CompilationTargetGateset as CompilationTargetGateset,
|
|
63
|
+
CZTargetGateset as CZTargetGateset,
|
|
64
|
+
SqrtIswapTargetGateset as SqrtIswapTargetGateset,
|
|
65
|
+
TwoQubitCompilationTargetGateset as TwoQubitCompilationTargetGateset,
|
|
65
66
|
)
|
|
66
67
|
|
|
67
|
-
from cirq.transformers.align import align_left, align_right
|
|
68
|
+
from cirq.transformers.align import align_left as align_left, align_right as align_right
|
|
68
69
|
|
|
69
|
-
from cirq.transformers.stratify import stratified_circuit
|
|
70
|
+
from cirq.transformers.stratify import stratified_circuit as stratified_circuit
|
|
70
71
|
|
|
71
|
-
from cirq.transformers.expand_composite import expand_composite
|
|
72
|
+
from cirq.transformers.expand_composite import expand_composite as expand_composite
|
|
72
73
|
|
|
73
|
-
from cirq.transformers.eject_phased_paulis import eject_phased_paulis
|
|
74
|
+
from cirq.transformers.eject_phased_paulis import eject_phased_paulis as eject_phased_paulis
|
|
74
75
|
|
|
75
|
-
from cirq.transformers.optimize_for_target_gateset import
|
|
76
|
+
from cirq.transformers.optimize_for_target_gateset import (
|
|
77
|
+
optimize_for_target_gateset as optimize_for_target_gateset,
|
|
78
|
+
)
|
|
76
79
|
|
|
77
|
-
from cirq.transformers.drop_empty_moments import drop_empty_moments
|
|
80
|
+
from cirq.transformers.drop_empty_moments import drop_empty_moments as drop_empty_moments
|
|
78
81
|
|
|
79
|
-
from cirq.transformers.drop_negligible_operations import
|
|
82
|
+
from cirq.transformers.drop_negligible_operations import (
|
|
83
|
+
drop_negligible_operations as drop_negligible_operations,
|
|
84
|
+
)
|
|
80
85
|
|
|
81
|
-
from cirq.transformers.dynamical_decoupling import
|
|
86
|
+
from cirq.transformers.dynamical_decoupling import (
|
|
87
|
+
add_dynamical_decoupling as add_dynamical_decoupling,
|
|
88
|
+
)
|
|
82
89
|
|
|
83
|
-
from cirq.transformers.eject_z import eject_z
|
|
90
|
+
from cirq.transformers.eject_z import eject_z as eject_z
|
|
84
91
|
|
|
85
92
|
from cirq.transformers.measurement_transformers import (
|
|
86
|
-
defer_measurements,
|
|
87
|
-
dephase_measurements,
|
|
88
|
-
drop_terminal_measurements,
|
|
93
|
+
defer_measurements as defer_measurements,
|
|
94
|
+
dephase_measurements as dephase_measurements,
|
|
95
|
+
drop_terminal_measurements as drop_terminal_measurements,
|
|
89
96
|
)
|
|
90
97
|
|
|
91
|
-
from cirq.transformers.merge_k_qubit_gates import merge_k_qubit_unitaries
|
|
98
|
+
from cirq.transformers.merge_k_qubit_gates import merge_k_qubit_unitaries as merge_k_qubit_unitaries
|
|
92
99
|
|
|
93
100
|
from cirq.transformers.merge_single_qubit_gates import (
|
|
94
|
-
merge_single_qubit_gates_to_phased_x_and_z,
|
|
95
|
-
merge_single_qubit_gates_to_phxz,
|
|
96
|
-
merge_single_qubit_moments_to_phxz,
|
|
101
|
+
merge_single_qubit_gates_to_phased_x_and_z as merge_single_qubit_gates_to_phased_x_and_z,
|
|
102
|
+
merge_single_qubit_gates_to_phxz as merge_single_qubit_gates_to_phxz,
|
|
103
|
+
merge_single_qubit_moments_to_phxz as merge_single_qubit_moments_to_phxz,
|
|
97
104
|
)
|
|
98
105
|
|
|
99
|
-
from cirq.transformers.qubit_management_transformers import
|
|
106
|
+
from cirq.transformers.qubit_management_transformers import (
|
|
107
|
+
map_clean_and_borrowable_qubits as map_clean_and_borrowable_qubits,
|
|
108
|
+
)
|
|
100
109
|
|
|
101
|
-
from cirq.transformers.synchronize_terminal_measurements import
|
|
110
|
+
from cirq.transformers.synchronize_terminal_measurements import (
|
|
111
|
+
synchronize_terminal_measurements as synchronize_terminal_measurements,
|
|
112
|
+
)
|
|
102
113
|
|
|
103
114
|
from cirq.transformers.transformer_api import (
|
|
104
|
-
LogLevel,
|
|
105
|
-
TRANSFORMER,
|
|
106
|
-
TransformerContext,
|
|
107
|
-
TransformerLogger,
|
|
108
|
-
transformer,
|
|
115
|
+
LogLevel as LogLevel,
|
|
116
|
+
TRANSFORMER as TRANSFORMER,
|
|
117
|
+
TransformerContext as TransformerContext,
|
|
118
|
+
TransformerLogger as TransformerLogger,
|
|
119
|
+
transformer as transformer,
|
|
109
120
|
)
|
|
110
121
|
|
|
111
122
|
from cirq.transformers.transformer_primitives import (
|
|
112
|
-
map_moments,
|
|
113
|
-
map_operations,
|
|
114
|
-
map_operations_and_unroll,
|
|
115
|
-
merge_k_qubit_unitaries_to_circuit_op,
|
|
116
|
-
merge_moments,
|
|
117
|
-
merge_operations,
|
|
118
|
-
merge_operations_to_circuit_op,
|
|
119
|
-
toggle_tags,
|
|
120
|
-
unroll_circuit_op,
|
|
121
|
-
unroll_circuit_op_greedy_earliest,
|
|
122
|
-
unroll_circuit_op_greedy_frontier,
|
|
123
|
+
map_moments as map_moments,
|
|
124
|
+
map_operations as map_operations,
|
|
125
|
+
map_operations_and_unroll as map_operations_and_unroll,
|
|
126
|
+
merge_k_qubit_unitaries_to_circuit_op as merge_k_qubit_unitaries_to_circuit_op,
|
|
127
|
+
merge_moments as merge_moments,
|
|
128
|
+
merge_operations as merge_operations,
|
|
129
|
+
merge_operations_to_circuit_op as merge_operations_to_circuit_op,
|
|
130
|
+
toggle_tags as toggle_tags,
|
|
131
|
+
unroll_circuit_op as unroll_circuit_op,
|
|
132
|
+
unroll_circuit_op_greedy_earliest as unroll_circuit_op_greedy_earliest,
|
|
133
|
+
unroll_circuit_op_greedy_frontier as unroll_circuit_op_greedy_frontier,
|
|
123
134
|
)
|
|
124
135
|
|
|
125
|
-
|
|
126
136
|
from cirq.transformers.gauge_compiling import (
|
|
127
|
-
CZGaugeTransformer,
|
|
128
|
-
ConstantGauge,
|
|
129
|
-
Gauge,
|
|
130
|
-
GaugeSelector,
|
|
131
|
-
GaugeTransformer,
|
|
132
|
-
ISWAPGaugeTransformer,
|
|
133
|
-
SpinInversionGaugeTransformer,
|
|
134
|
-
SqrtCZGaugeTransformer,
|
|
135
|
-
SqrtISWAPGaugeTransformer,
|
|
137
|
+
CZGaugeTransformer as CZGaugeTransformer,
|
|
138
|
+
ConstantGauge as ConstantGauge,
|
|
139
|
+
Gauge as Gauge,
|
|
140
|
+
GaugeSelector as GaugeSelector,
|
|
141
|
+
GaugeTransformer as GaugeTransformer,
|
|
142
|
+
ISWAPGaugeTransformer as ISWAPGaugeTransformer,
|
|
143
|
+
SpinInversionGaugeTransformer as SpinInversionGaugeTransformer,
|
|
144
|
+
SqrtCZGaugeTransformer as SqrtCZGaugeTransformer,
|
|
145
|
+
SqrtISWAPGaugeTransformer as SqrtISWAPGaugeTransformer,
|
|
136
146
|
)
|
|
137
147
|
|
|
138
|
-
from cirq.transformers.randomized_measurements import
|
|
148
|
+
from cirq.transformers.randomized_measurements import (
|
|
149
|
+
RandomizedMeasurements as RandomizedMeasurements,
|
|
150
|
+
)
|
|
@@ -15,64 +15,67 @@
|
|
|
15
15
|
"""Utilities for analytical decomposition of cirq gates."""
|
|
16
16
|
|
|
17
17
|
from cirq.transformers.analytical_decompositions.clifford_decomposition import (
|
|
18
|
-
decompose_clifford_tableau_to_operations,
|
|
18
|
+
decompose_clifford_tableau_to_operations as decompose_clifford_tableau_to_operations,
|
|
19
19
|
)
|
|
20
20
|
|
|
21
21
|
from cirq.transformers.analytical_decompositions.controlled_gate_decomposition import (
|
|
22
|
-
decompose_multi_controlled_x,
|
|
23
|
-
decompose_multi_controlled_rotation,
|
|
22
|
+
decompose_multi_controlled_x as decompose_multi_controlled_x,
|
|
23
|
+
decompose_multi_controlled_rotation as decompose_multi_controlled_rotation,
|
|
24
24
|
)
|
|
25
25
|
|
|
26
26
|
from cirq.transformers.analytical_decompositions.cphase_to_fsim import (
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
# pylint: disable=line-too-long
|
|
28
|
+
compute_cphase_exponents_for_fsim_decomposition as compute_cphase_exponents_for_fsim_decomposition,
|
|
29
|
+
decompose_cphase_into_two_fsim as decompose_cphase_into_two_fsim,
|
|
29
30
|
)
|
|
30
31
|
|
|
31
32
|
from cirq.transformers.analytical_decompositions.quantum_shannon_decomposition import (
|
|
32
|
-
quantum_shannon_decomposition,
|
|
33
|
+
quantum_shannon_decomposition as quantum_shannon_decomposition,
|
|
33
34
|
)
|
|
34
35
|
|
|
35
36
|
from cirq.transformers.analytical_decompositions.single_qubit_decompositions import (
|
|
36
|
-
is_negligible_turn,
|
|
37
|
-
single_qubit_matrix_to_gates,
|
|
38
|
-
single_qubit_matrix_to_pauli_rotations,
|
|
39
|
-
single_qubit_matrix_to_phased_x_z,
|
|
40
|
-
single_qubit_matrix_to_phxz,
|
|
41
|
-
single_qubit_op_to_framed_phase_form,
|
|
37
|
+
is_negligible_turn as is_negligible_turn,
|
|
38
|
+
single_qubit_matrix_to_gates as single_qubit_matrix_to_gates,
|
|
39
|
+
single_qubit_matrix_to_pauli_rotations as single_qubit_matrix_to_pauli_rotations,
|
|
40
|
+
single_qubit_matrix_to_phased_x_z as single_qubit_matrix_to_phased_x_z,
|
|
41
|
+
single_qubit_matrix_to_phxz as single_qubit_matrix_to_phxz,
|
|
42
|
+
single_qubit_op_to_framed_phase_form as single_qubit_op_to_framed_phase_form,
|
|
42
43
|
)
|
|
43
44
|
|
|
44
45
|
from cirq.transformers.analytical_decompositions.three_qubit_decomposition import (
|
|
45
|
-
three_qubit_matrix_to_operations,
|
|
46
|
+
three_qubit_matrix_to_operations as three_qubit_matrix_to_operations,
|
|
46
47
|
)
|
|
47
48
|
|
|
48
49
|
from cirq.transformers.analytical_decompositions.two_qubit_to_cz import (
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
# pylint: disable=line-too-long
|
|
51
|
+
two_qubit_matrix_to_cz_operations as two_qubit_matrix_to_cz_operations,
|
|
52
|
+
two_qubit_matrix_to_diagonal_and_cz_operations as two_qubit_matrix_to_diagonal_and_cz_operations,
|
|
51
53
|
)
|
|
52
54
|
|
|
53
55
|
from cirq.transformers.analytical_decompositions.two_qubit_to_fsim import (
|
|
54
|
-
|
|
56
|
+
# pylint: disable=line-too-long
|
|
57
|
+
decompose_two_qubit_interaction_into_four_fsim_gates as decompose_two_qubit_interaction_into_four_fsim_gates,
|
|
55
58
|
)
|
|
56
59
|
|
|
57
60
|
from cirq.transformers.analytical_decompositions.two_qubit_to_ms import (
|
|
58
|
-
two_qubit_matrix_to_ion_operations,
|
|
61
|
+
two_qubit_matrix_to_ion_operations as two_qubit_matrix_to_ion_operations,
|
|
59
62
|
)
|
|
60
63
|
|
|
61
64
|
from cirq.transformers.analytical_decompositions.two_qubit_to_sqrt_iswap import (
|
|
62
|
-
parameterized_2q_op_to_sqrt_iswap_operations,
|
|
63
|
-
two_qubit_matrix_to_sqrt_iswap_operations,
|
|
65
|
+
parameterized_2q_op_to_sqrt_iswap_operations as parameterized_2q_op_to_sqrt_iswap_operations,
|
|
66
|
+
two_qubit_matrix_to_sqrt_iswap_operations as two_qubit_matrix_to_sqrt_iswap_operations,
|
|
64
67
|
)
|
|
65
68
|
|
|
66
69
|
from cirq.transformers.analytical_decompositions.two_qubit_state_preparation import (
|
|
67
|
-
prepare_two_qubit_state_using_cz,
|
|
68
|
-
prepare_two_qubit_state_using_sqrt_iswap,
|
|
69
|
-
prepare_two_qubit_state_using_iswap,
|
|
70
|
+
prepare_two_qubit_state_using_cz as prepare_two_qubit_state_using_cz,
|
|
71
|
+
prepare_two_qubit_state_using_sqrt_iswap as prepare_two_qubit_state_using_sqrt_iswap,
|
|
72
|
+
prepare_two_qubit_state_using_iswap as prepare_two_qubit_state_using_iswap,
|
|
70
73
|
)
|
|
71
74
|
|
|
72
75
|
from cirq.transformers.analytical_decompositions.single_to_two_qubit_isometry import (
|
|
73
|
-
two_qubit_matrix_to_cz_isometry,
|
|
76
|
+
two_qubit_matrix_to_cz_isometry as two_qubit_matrix_to_cz_isometry,
|
|
74
77
|
)
|
|
75
78
|
|
|
76
79
|
from cirq.transformers.analytical_decompositions.pauli_string_decomposition import (
|
|
77
|
-
unitary_to_pauli_string,
|
|
80
|
+
unitary_to_pauli_string as unitary_to_pauli_string,
|
|
78
81
|
)
|
|
@@ -14,13 +14,26 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
from cirq.transformers.gauge_compiling.gauge_compiling import (
|
|
17
|
-
ConstantGauge,
|
|
18
|
-
Gauge,
|
|
19
|
-
GaugeSelector,
|
|
20
|
-
GaugeTransformer,
|
|
17
|
+
ConstantGauge as ConstantGauge,
|
|
18
|
+
Gauge as Gauge,
|
|
19
|
+
GaugeSelector as GaugeSelector,
|
|
20
|
+
GaugeTransformer as GaugeTransformer,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
from cirq.transformers.gauge_compiling.sqrt_cz_gauge import (
|
|
24
|
+
SqrtCZGaugeTransformer as SqrtCZGaugeTransformer,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
from cirq.transformers.gauge_compiling.spin_inversion_gauge import (
|
|
28
|
+
SpinInversionGaugeTransformer as SpinInversionGaugeTransformer,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
from cirq.transformers.gauge_compiling.cz_gauge import CZGaugeTransformer as CZGaugeTransformer
|
|
32
|
+
|
|
33
|
+
from cirq.transformers.gauge_compiling.iswap_gauge import (
|
|
34
|
+
ISWAPGaugeTransformer as ISWAPGaugeTransformer,
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
from cirq.transformers.gauge_compiling.sqrt_iswap_gauge import (
|
|
38
|
+
SqrtISWAPGaugeTransformer as SqrtISWAPGaugeTransformer,
|
|
21
39
|
)
|
|
22
|
-
from cirq.transformers.gauge_compiling.sqrt_cz_gauge import SqrtCZGaugeTransformer
|
|
23
|
-
from cirq.transformers.gauge_compiling.spin_inversion_gauge import SpinInversionGaugeTransformer
|
|
24
|
-
from cirq.transformers.gauge_compiling.cz_gauge import CZGaugeTransformer
|
|
25
|
-
from cirq.transformers.gauge_compiling.iswap_gauge import ISWAPGaugeTransformer
|
|
26
|
-
from cirq.transformers.gauge_compiling.sqrt_iswap_gauge import SqrtISWAPGaugeTransformer
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"""Utilities for heuristic decomposition of cirq gates."""
|
|
16
16
|
|
|
17
17
|
from cirq.transformers.heuristic_decompositions.two_qubit_gate_tabulation import (
|
|
18
|
-
TwoQubitGateTabulation,
|
|
19
|
-
TwoQubitGateTabulationResult,
|
|
20
|
-
two_qubit_gate_product_tabulation,
|
|
18
|
+
TwoQubitGateTabulation as TwoQubitGateTabulation,
|
|
19
|
+
TwoQubitGateTabulationResult as TwoQubitGateTabulationResult,
|
|
20
|
+
two_qubit_gate_product_tabulation as two_qubit_gate_product_tabulation,
|
|
21
21
|
)
|
|
@@ -14,8 +14,17 @@
|
|
|
14
14
|
|
|
15
15
|
"""Routing utilities in Cirq."""
|
|
16
16
|
|
|
17
|
-
from cirq.transformers.routing.initial_mapper import
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
from cirq.transformers.routing.initial_mapper import (
|
|
18
|
+
AbstractInitialMapper as AbstractInitialMapper,
|
|
19
|
+
HardCodedInitialMapper as HardCodedInitialMapper,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
from cirq.transformers.routing.mapping_manager import MappingManager as MappingManager
|
|
23
|
+
|
|
24
|
+
from cirq.transformers.routing.line_initial_mapper import LineInitialMapper as LineInitialMapper
|
|
25
|
+
|
|
26
|
+
from cirq.transformers.routing.route_circuit_cqc import RouteCQC as RouteCQC
|
|
27
|
+
|
|
28
|
+
from cirq.transformers.routing.visualize_routed_circuit import (
|
|
29
|
+
routed_circuit_with_mapping as routed_circuit_with_mapping,
|
|
30
|
+
)
|
|
@@ -15,11 +15,13 @@
|
|
|
15
15
|
"""Gatesets which can act as compilation targets in Cirq."""
|
|
16
16
|
|
|
17
17
|
from cirq.transformers.target_gatesets.compilation_target_gateset import (
|
|
18
|
-
create_transformer_with_kwargs,
|
|
19
|
-
CompilationTargetGateset,
|
|
20
|
-
TwoQubitCompilationTargetGateset,
|
|
18
|
+
create_transformer_with_kwargs as create_transformer_with_kwargs,
|
|
19
|
+
CompilationTargetGateset as CompilationTargetGateset,
|
|
20
|
+
TwoQubitCompilationTargetGateset as TwoQubitCompilationTargetGateset,
|
|
21
21
|
)
|
|
22
22
|
|
|
23
|
-
from cirq.transformers.target_gatesets.cz_gateset import CZTargetGateset
|
|
23
|
+
from cirq.transformers.target_gatesets.cz_gateset import CZTargetGateset as CZTargetGateset
|
|
24
24
|
|
|
25
|
-
from cirq.transformers.target_gatesets.sqrt_iswap_gateset import
|
|
25
|
+
from cirq.transformers.target_gatesets.sqrt_iswap_gateset import (
|
|
26
|
+
SqrtIswapTargetGateset as SqrtIswapTargetGateset,
|
|
27
|
+
)
|