Skip to content

Commit e4cd67d

Browse files
tonybruguierrht
authored andcommitted
Remove deprecated two_qubit_matrix_to_diagonal_and_operations and two_qubit_matrix_to_operations (quantumlib#5102)
see title.
1 parent c8bb0fa commit e4cd67d

File tree

6 files changed

+0
-90
lines changed

6 files changed

+0
-90
lines changed

Diff for: cirq-core/cirq/__init__.py

-2
Original file line numberDiff line numberDiff line change
@@ -404,8 +404,6 @@
404404
transformer,
405405
two_qubit_matrix_to_cz_operations,
406406
two_qubit_matrix_to_diagonal_and_cz_operations,
407-
two_qubit_matrix_to_diagonal_and_operations,
408-
two_qubit_matrix_to_operations,
409407
two_qubit_matrix_to_sqrt_iswap_operations,
410408
two_qubit_gate_product_tabulation,
411409
TwoQubitCompilationTargetGateset,

Diff for: cirq-core/cirq/optimizers/__init__.py

-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@
8484
three_qubit_matrix_to_operations,
8585
two_qubit_matrix_to_cz_operations,
8686
two_qubit_matrix_to_diagonal_and_cz_operations,
87-
two_qubit_matrix_to_diagonal_and_operations,
88-
two_qubit_matrix_to_operations,
8987
two_qubit_matrix_to_sqrt_iswap_operations,
9088
)
9189

Diff for: cirq-core/cirq/transformers/__init__.py

-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
three_qubit_matrix_to_operations,
3434
two_qubit_matrix_to_cz_operations,
3535
two_qubit_matrix_to_diagonal_and_cz_operations,
36-
two_qubit_matrix_to_diagonal_and_operations,
37-
two_qubit_matrix_to_operations,
3836
two_qubit_matrix_to_sqrt_iswap_operations,
3937
)
4038

Diff for: cirq-core/cirq/transformers/analytical_decompositions/__init__.py

-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@
4444
from cirq.transformers.analytical_decompositions.two_qubit_to_cz import (
4545
two_qubit_matrix_to_cz_operations,
4646
two_qubit_matrix_to_diagonal_and_cz_operations,
47-
two_qubit_matrix_to_diagonal_and_operations,
48-
two_qubit_matrix_to_operations,
4947
)
5048

5149
from cirq.transformers.analytical_decompositions.two_qubit_to_fsim import (

Diff for: cirq-core/cirq/transformers/analytical_decompositions/two_qubit_to_cz.py

-62
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import numpy as np
2020

21-
from cirq import _compat
2221
from cirq.linalg import predicates
2322
from cirq.linalg.decompositions import num_cnots_required, extract_right_diag
2423

@@ -32,33 +31,6 @@
3231
import cirq
3332

3433

35-
@_compat.deprecated(fix='Please use cirq.two_qubit_matrix_to_cz_operations', deadline='v0.15')
36-
def two_qubit_matrix_to_operations(
37-
q0: 'cirq.Qid',
38-
q1: 'cirq.Qid',
39-
mat: np.ndarray,
40-
allow_partial_czs: bool,
41-
atol: float = 1e-8,
42-
clean_operations: bool = True,
43-
) -> List[ops.Operation]:
44-
"""Decomposes a two-qubit operation into Z/XY/CZ gates.
45-
46-
Args:
47-
q0: The first qubit being operated on.
48-
q1: The other qubit being operated on.
49-
mat: Defines the operation to apply to the pair of qubits.
50-
allow_partial_czs: Enables the use of Partial-CZ gates.
51-
atol: A limit on the amount of absolute error introduced by the
52-
construction.
53-
clean_operations: Enables optimizing resulting operation list by
54-
merging operations and ejecting phased Paulis and Z operations.
55-
56-
Returns:
57-
A list of operations implementing the matrix.
58-
"""
59-
return two_qubit_matrix_to_cz_operations(q0, q1, mat, allow_partial_czs, atol, clean_operations)
60-
61-
6234
def two_qubit_matrix_to_cz_operations(
6335
q0: 'cirq.Qid',
6436
q1: 'cirq.Qid',
@@ -89,40 +61,6 @@ def two_qubit_matrix_to_cz_operations(
8961
return operations
9062

9163

92-
@_compat.deprecated(
93-
fix='Please use cirq.two_qubit_matrix_to_diagonal_and_cz_operations', deadline='v0.15'
94-
)
95-
def two_qubit_matrix_to_diagonal_and_operations(
96-
q0: 'cirq.Qid',
97-
q1: 'cirq.Qid',
98-
mat: np.ndarray,
99-
allow_partial_czs: bool = False,
100-
atol: float = 1e-8,
101-
clean_operations: bool = True,
102-
) -> Tuple[np.ndarray, List['cirq.Operation']]:
103-
"""Decomposes a 2-qubit unitary to a diagonal and the remaining operations.
104-
105-
For a 2-qubit unitary V, return ops, a list of operations and
106-
D diagonal unitary, so that:
107-
V = cirq.Circuit(ops) @ D
108-
109-
Args:
110-
q0: The first qubit being operated on.
111-
q1: The other qubit being operated on.
112-
mat: the input unitary
113-
allow_partial_czs: Enables the use of Partial-CZ gates.
114-
atol: A limit on the amount of absolute error introduced by the
115-
construction.
116-
clean_operations: Enables optimizing resulting operation list by
117-
merging operations and ejecting phased Paulis and Z operations.
118-
Returns:
119-
tuple(ops,D): operations `ops`, and the diagonal `D`
120-
"""
121-
return two_qubit_matrix_to_diagonal_and_cz_operations(
122-
q0, q1, mat, allow_partial_czs, atol, clean_operations
123-
)
124-
125-
12664
def two_qubit_matrix_to_diagonal_and_cz_operations(
12765
q0: 'cirq.Qid',
12866
q1: 'cirq.Qid',

Diff for: cirq-core/cirq/transformers/analytical_decompositions/two_qubit_to_cz_test.py

-20
Original file line numberDiff line numberDiff line change
@@ -121,26 +121,6 @@ def assert_ops_implement_unitary(q0, q1, operations, intended_effect, atol=0.01)
121121
assert cirq.allclose_up_to_global_phase(actual_effect, intended_effect, atol=atol)
122122

123123

124-
def test_two_qubit_matrix_to_operations_deprecated():
125-
q0 = cirq.NamedQubit('q0')
126-
q1 = cirq.NamedQubit('q1')
127-
effect = np.array(
128-
[
129-
[0, 0, 0, 1],
130-
[0, 0, 1, 0],
131-
[0, 1, 0, 0],
132-
[1, 0, 0, 0j],
133-
]
134-
)
135-
136-
with cirq.testing.assert_deprecated('two_qubit_matrix_to_cz_operations', deadline='v0.15'):
137-
_ = cirq.two_qubit_matrix_to_operations(q0, q1, effect, True)
138-
with cirq.testing.assert_deprecated(
139-
'two_qubit_matrix_to_diagonal_and_cz_operations', deadline='v0.15'
140-
):
141-
_ = cirq.two_qubit_matrix_to_diagonal_and_operations(q0, q1, effect, True)
142-
143-
144124
@pytest.mark.parametrize(
145125
'max_partial_cz_depth,max_full_cz_depth,effect',
146126
[

0 commit comments

Comments
 (0)