From f12e638ec44a813d802b0b5f15980299e95dcfa2 Mon Sep 17 00:00:00 2001 From: Luciano Bello Date: Thu, 18 Jun 2020 20:21:34 -0400 Subject: [PATCH 1/7] remove deprecated gates --- .../library/standard_gates/__init__.py | 13 ---- .../standard_gates/boolean_logical_gates.py | 76 ------------------- qiskit/circuit/library/standard_gates/i.py | 23 +----- qiskit/circuit/library/standard_gates/rx.py | 24 +----- qiskit/circuit/library/standard_gates/ry.py | 24 +----- qiskit/circuit/library/standard_gates/rz.py | 24 +----- qiskit/circuit/library/standard_gates/swap.py | 24 +----- qiskit/circuit/library/standard_gates/u1.py | 24 +----- qiskit/circuit/library/standard_gates/u3.py | 24 +----- qiskit/circuit/library/standard_gates/x.py | 48 +----------- qiskit/circuit/library/standard_gates/y.py | 24 +----- qiskit/circuit/library/standard_gates/z.py | 24 +----- .../quantum_initializer/diagonal.py | 24 +----- qiskit/extensions/quantum_initializer/uc.py | 36 +-------- .../quantum_initializer/uc_pauli_rot.py | 24 +----- qiskit/extensions/quantum_initializer/ucrx.py | 37 +-------- qiskit/extensions/quantum_initializer/ucry.py | 27 +------ qiskit/extensions/quantum_initializer/ucrz.py | 37 +-------- test/python/circuit/test_controlled_gate.py | 64 ---------------- 19 files changed, 20 insertions(+), 581 deletions(-) delete mode 100644 qiskit/circuit/library/standard_gates/boolean_logical_gates.py diff --git a/qiskit/circuit/library/standard_gates/__init__.py b/qiskit/circuit/library/standard_gates/__init__.py index 99c09d32db31..99983c3857f5 100644 --- a/qiskit/circuit/library/standard_gates/__init__.py +++ b/qiskit/circuit/library/standard_gates/__init__.py @@ -86,16 +86,3 @@ from .z import ZGate, CZGate from .multi_control_rotation_gates import mcrx, mcry, mcrz - -# deprecated gates -from .boolean_logical_gates import logical_and, logical_or -from .u1 import Cu1Gate -from .u3 import Cu3Gate -from .x import CnotGate, ToffoliGate -from .swap import FredkinGate -from .i import IdGate -from .rx import CrxGate -from .ry import CryGate -from .rz import CrzGate -from .y import CyGate -from .z import CzGate diff --git a/qiskit/circuit/library/standard_gates/boolean_logical_gates.py b/qiskit/circuit/library/standard_gates/boolean_logical_gates.py deleted file mode 100644 index e388b7f17dd8..000000000000 --- a/qiskit/circuit/library/standard_gates/boolean_logical_gates.py +++ /dev/null @@ -1,76 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017, 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The Boolean Logical AND and OR Gates.""" - -import warnings -from qiskit.circuit import QuantumCircuit - - -def logical_and(self, qr_variables, qb_target, qr_ancillae, flags=None, mct_mode='no-ancilla'): - """Build a collective conjunction (AND) circuit in place using mct. - - Args: - self (QuantumCircuit): The QuantumCircuit object to build the conjunction on. - qr_variables (QuantumRegister): The QuantumRegister holding the variable qubits. - qb_target (Qubit): The target qubit to hold the conjunction result. - qr_ancillae (QuantumRegister): The ancillary QuantumRegister for building the mct. - flags (list[int]): A list of +1/-1/0 to mark negations or omissions of qubits. - mct_mode (str): The mct building mode. - """ - # pylint: disable=cyclic-import - from qiskit.circuit.library import AND - - warnings.warn('The QuantumCircuit.AND method is deprecated as of Terra 0.13.1 / Aqua 0.7.0 and ' - 'will be removed no earlier than 3 months after the release date. ' - 'The logic AND has moved to qiskit.circuit.library.AND and has become a circuit ' - 'object which can be appended to your existing circuit.', - DeprecationWarning, stacklevel=2) - and_circuit = AND(num_variable_qubits=len(qr_variables), flags=flags, mcx_mode=mct_mode) - qubits = qr_variables[:] + [qb_target] - if qr_ancillae: - qubits += qr_ancillae[:and_circuit.num_ancilla_qubits] - - self.append(and_circuit.to_gate(), qubits) - - -def logical_or(self, qr_variables, qb_target, qr_ancillae, flags=None, mct_mode='basic'): - """Build a collective disjunction (OR) circuit in place using mct. - - Args: - self (QuantumCircuit): The QuantumCircuit object to build the disjunction on. - qr_variables (QuantumRegister): The QuantumRegister holding the variable qubits. - flags (list[int]): A list of +1/-1/0 to mark negations or omissions of qubits. - qb_target (Qubit): The target qubit to hold the disjunction result. - qr_ancillae (QuantumRegister): The ancillary QuantumRegister for building the mct. - mct_mode (str): The mct building mode. - """ - # pylint: disable=cyclic-import - from qiskit.circuit.library import OR - - warnings.warn('The QuantumCircuit.OR method is deprecated as of Terra 0.13.1 / Aqua 0.7.0 and ' - 'will be removed no earlier than 3 months after the release date. ' - 'The logic OR has moved to qiskit.circuit.library.OR and has become a circuit ' - 'object which can be appended to your existing circuit.', - DeprecationWarning, stacklevel=2) - or_circuit = OR(num_variable_qubits=len(qr_variables), flags=flags, mcx_mode=mct_mode) - qubits = qr_variables[:] + [qb_target] - if qr_ancillae: - qubits += qr_ancillae[:or_circuit.num_ancilla_qubits] - - self.append(or_circuit.to_gate(), qubits) - - -QuantumCircuit.AND = logical_and -QuantumCircuit.OR = logical_or diff --git a/qiskit/circuit/library/standard_gates/i.py b/qiskit/circuit/library/standard_gates/i.py index 82558bd79a6c..84fd950e3f5a 100644 --- a/qiskit/circuit/library/standard_gates/i.py +++ b/qiskit/circuit/library/standard_gates/i.py @@ -19,17 +19,7 @@ from qiskit.circuit.gate import Gate -class IMeta(type): - """A metaclass to ensure that Id and I are of the same type. - - Can be removed when IdGate gets removed. - """ - @classmethod - def __instancecheck__(mcs, inst): - return type(inst) in {IGate, IdGate} # pylint: disable=unidiomatic-typecheck - - -class IGate(Gate, metaclass=IMeta): +class IGate(Gate): r"""Identity gate. Identity gate corresponds to a single-qubit gate wait cycle, @@ -64,14 +54,3 @@ def to_matrix(self): """Return a numpy.array for the identity gate.""" return numpy.array([[1, 0], [0, 1]], dtype=complex) - - -class IdGate(IGate, metaclass=IMeta): - """The deprecated IGate class.""" - - def __init__(self): - warnings.warn('The class IdGate is deprecated as of 0.14.0, and ' - 'will be removed no earlier than 3 months after that release date. ' - 'You should use the class IGate instead.', - DeprecationWarning, stacklevel=2) - super().__init__() diff --git a/qiskit/circuit/library/standard_gates/rx.py b/qiskit/circuit/library/standard_gates/rx.py index c28256c6e308..1bb41acca420 100644 --- a/qiskit/circuit/library/standard_gates/rx.py +++ b/qiskit/circuit/library/standard_gates/rx.py @@ -97,17 +97,7 @@ def to_matrix(self): [-1j * sin, cos]], dtype=complex) -class CRXMeta(type): - """A metaclass to ensure that CrxGate and CRXGate are of the same type. - - Can be removed when CrxGate gets removed. - """ - @classmethod - def __instancecheck__(mcs, inst): - return type(inst) in {CRXGate, CrxGate} # pylint: disable=unidiomatic-typecheck - - -class CRXGate(ControlledGate, metaclass=CRXMeta): +class CRXGate(ControlledGate): r"""Controlled-RX gate. **Circuit symbol:** @@ -210,15 +200,3 @@ def inverse(self): # [0, 0, 1, 0], # [0, -isin, 0, cos]], # dtype=complex) - - -class CrxGate(CRXGate, metaclass=CRXMeta): - """The deprecated CRXGate class.""" - - def __init__(self, theta): - import warnings - warnings.warn('The class CrxGate is deprecated as of 0.14.0, and ' - 'will be removed no earlier than 3 months after that release date. ' - 'You should use the class CRXGate instead.', - DeprecationWarning, stacklevel=2) - super().__init__(theta) diff --git a/qiskit/circuit/library/standard_gates/ry.py b/qiskit/circuit/library/standard_gates/ry.py index b6ca8648fed7..6a31e17d5942 100644 --- a/qiskit/circuit/library/standard_gates/ry.py +++ b/qiskit/circuit/library/standard_gates/ry.py @@ -97,17 +97,7 @@ def to_matrix(self): [sin, cos]], dtype=complex) -class CRYMeta(type): - """A metaclass to ensure that CryGate and CRYGate are of the same type. - - Can be removed when CryGate gets removed. - """ - @classmethod - def __instancecheck__(mcs, inst): - return type(inst) in {CRYGate, CryGate} # pylint: disable=unidiomatic-typecheck - - -class CRYGate(ControlledGate, metaclass=CRYMeta): +class CRYGate(ControlledGate): r"""Controlled-RY gate. **Circuit symbol:** @@ -205,15 +195,3 @@ def inverse(self): # [0, 0, 1, 0], # [0, sin, 0, cos]], # dtype=complex) - - -class CryGate(CRYGate, metaclass=CRYMeta): - """The deprecated CRYGate class.""" - - def __init__(self, theta): - import warnings - warnings.warn('The class CryGate is deprecated as of 0.14.0, and ' - 'will be removed no earlier than 3 months after that release date. ' - 'You should use the class CRYGate instead.', - DeprecationWarning, stacklevel=2) - super().__init__(theta) diff --git a/qiskit/circuit/library/standard_gates/rz.py b/qiskit/circuit/library/standard_gates/rz.py index 8ee5b7c97c7f..b26fe8d923f2 100644 --- a/qiskit/circuit/library/standard_gates/rz.py +++ b/qiskit/circuit/library/standard_gates/rz.py @@ -109,17 +109,7 @@ def inverse(self): # [0, numpy.exp(1j * lam / 2)]], dtype=complex) -class CRZMeta(type): - """A metaclass to ensure that CrzGate and CRZGate are of the same type. - - Can be removed when CrzGate gets removed. - """ - @classmethod - def __instancecheck__(mcs, inst): - return type(inst) in {CRZGate, CrzGate} # pylint: disable=unidiomatic-typecheck - - -class CRZGate(ControlledGate, metaclass=CRZMeta): +class CRZGate(ControlledGate): r"""Controlled-RZ gate. This is a diagonal but non-symmetric gate that induces a @@ -221,15 +211,3 @@ def inverse(self): # [0, 0, 1, 0], # [0, 0, 0, numpy.exp(arg)]], # dtype=complex) - - -class CrzGate(CRZGate, metaclass=CRZMeta): - """The deprecated CRZGate class.""" - - def __init__(self, theta): - import warnings - warnings.warn('The class CrzGate is deprecated as of 0.14.0, and ' - 'will be removed no earlier than 3 months after that release date. ' - 'You should use the class CRZGate instead.', - DeprecationWarning, stacklevel=2) - super().__init__(theta) diff --git a/qiskit/circuit/library/standard_gates/swap.py b/qiskit/circuit/library/standard_gates/swap.py index f1e6a5d5389b..13d13cd056e8 100644 --- a/qiskit/circuit/library/standard_gates/swap.py +++ b/qiskit/circuit/library/standard_gates/swap.py @@ -104,17 +104,7 @@ def to_matrix(self): [0, 0, 0, 1]], dtype=complex) -class CSwapMeta(type): - """A Metaclass to ensure that CSwapGate and FredkinGate are of the same type. - - Can be removed when FredkinGate gets removed. - """ - @classmethod - def __instancecheck__(mcs, inst): - return type(inst) in {CSwapGate, FredkinGate} # pylint: disable=unidiomatic-typecheck - - -class CSwapGate(ControlledGate, metaclass=CSwapMeta): +class CSwapGate(ControlledGate): r"""Controlled-X gate. **Circuit symbol:** @@ -240,15 +230,3 @@ def to_matrix(self): return self._matrix1 else: return self._matrix0 - - -class FredkinGate(CSwapGate, metaclass=CSwapMeta): - """The deprecated CSwapGate class.""" - - def __init__(self): - import warnings - warnings.warn('The class FredkinGate is deprecated as of 0.14.0, and ' - 'will be removed no earlier than 3 months after that release date. ' - 'You should use the class CSwapGate instead.', - DeprecationWarning, stacklevel=2) - super().__init__() diff --git a/qiskit/circuit/library/standard_gates/u1.py b/qiskit/circuit/library/standard_gates/u1.py index 4c9f5bb18204..d1f3f8abc681 100644 --- a/qiskit/circuit/library/standard_gates/u1.py +++ b/qiskit/circuit/library/standard_gates/u1.py @@ -122,17 +122,7 @@ def to_matrix(self): return numpy.array([[1, 0], [0, numpy.exp(1j * lam)]], dtype=complex) -class CU1Meta(type): - """A metaclass to ensure that Cu1Gate and CU1Gate are of the same type. - - Can be removed when Cu1Gate gets removed. - """ - @classmethod - def __instancecheck__(mcs, inst): - return type(inst) in {CU1Gate, Cu1Gate} # pylint: disable=unidiomatic-typecheck - - -class CU1Gate(ControlledGate, metaclass=CU1Meta): +class CU1Gate(ControlledGate): r"""Controlled-U1 gate. This is a diagonal and symmetric gate that induces a @@ -231,18 +221,6 @@ def inverse(self): # dtype=complex) -class Cu1Gate(CU1Gate, metaclass=CU1Meta): - """The deprecated CU1Gate class.""" - - def __init__(self, theta): - import warnings - warnings.warn('The class Cu1Gate is deprecated as of 0.14.0, and ' - 'will be removed no earlier than 3 months after that release date. ' - 'You should use the class CU1Gate instead.', - DeprecationWarning, stacklevel=2) - super().__init__(theta) - - class MCU1Gate(ControlledGate): r"""Multi-controlled-U1 gate. diff --git a/qiskit/circuit/library/standard_gates/u3.py b/qiskit/circuit/library/standard_gates/u3.py index 221e444bc78f..2fd9d44cda7f 100644 --- a/qiskit/circuit/library/standard_gates/u3.py +++ b/qiskit/circuit/library/standard_gates/u3.py @@ -105,17 +105,7 @@ def to_matrix(self): ], dtype=complex) -class CU3Meta(type): - """A metaclass to ensure that Cu3Gate and CU3Gate are of the same type. - - Can be removed when Cu3Gate gets removed. - """ - @classmethod - def __instancecheck__(mcs, inst): - return type(inst) in {CU3Gate, Cu3Gate} # pylint: disable=unidiomatic-typecheck - - -class CU3Gate(ControlledGate, metaclass=CU3Meta): +class CU3Gate(ControlledGate): r"""Controlled-U3 gate (3-parameter two-qubit gate). This is a controlled version of the U3 gate (generic single qubit rotation). @@ -228,18 +218,6 @@ def inverse(self): # dtype=complex) -class Cu3Gate(CU3Gate, metaclass=CU3Meta): - """The deprecated CU3Gate class.""" - - def __init__(self, theta, phi, lam): - import warnings - warnings.warn('The class Cu3Gate is deprecated as of 0.14.0, and ' - 'will be removed no earlier than 3 months after that release date. ' - 'You should use the class CU3Gate instead.', - DeprecationWarning, stacklevel=2) - super().__init__(theta, phi, lam) - - def _generate_gray_code(num_bits): """Generate the gray code for ``num_bits`` bits.""" if num_bits <= 0: diff --git a/qiskit/circuit/library/standard_gates/x.py b/qiskit/circuit/library/standard_gates/x.py index ac998678e591..1f2e8b52efad 100644 --- a/qiskit/circuit/library/standard_gates/x.py +++ b/qiskit/circuit/library/standard_gates/x.py @@ -116,17 +116,7 @@ def to_matrix(self): [1, 0]], dtype=complex) -class CXMeta(type): - """A metaclass to ensure that CnotGate and CXGate are of the same type. - - Can be removed when CnotGate gets removed. - """ - @classmethod - def __instancecheck__(mcs, inst): - return type(inst) in {CnotGate, CXGate} # pylint: disable=unidiomatic-typecheck - - -class CXGate(ControlledGate, metaclass=CXMeta): +class CXGate(ControlledGate): r"""Controlled-X gate. **Circuit symbol:** @@ -228,29 +218,7 @@ def to_matrix(self): [0, 0, 0, 1]], dtype=complex) -class CnotGate(CXGate, metaclass=CXMeta): - """The deprecated CXGate class.""" - - def __init__(self, label=None, ctrl_state=None): - import warnings - warnings.warn('The class CnotGate is deprecated as of 0.14.0, and ' - 'will be removed no earlier than 3 months after that release date. ' - 'You should use the class CXGate instead.', - DeprecationWarning, stacklevel=2) - super().__init__(label=label, ctrl_state=ctrl_state) - - -class CCXMeta(type): - """A metaclass to ensure that CCXGate and ToffoliGate are of the same type. - - Can be removed when ToffoliGate gets removed. - """ - @classmethod - def __instancecheck__(mcs, inst): - return type(inst) in {CCXGate, ToffoliGate} # pylint: disable=unidiomatic-typecheck - - -class CCXGate(ControlledGate, metaclass=CCXMeta): +class CCXGate(ControlledGate): r"""CCX gate, also known as Toffoli gate. **Circuit symbol:** @@ -382,18 +350,6 @@ def to_matrix(self): ctrl_state=self.ctrl_state) -class ToffoliGate(CCXGate, metaclass=CCXMeta): - """The deprecated CCXGate class.""" - - def __init__(self): - import warnings - warnings.warn('The class ToffoliGate is deprecated as of 0.14.0, and ' - 'will be removed no earlier than 3 months after that release date. ' - 'You should use the class CCXGate instead.', - DeprecationWarning, stacklevel=2) - super().__init__() - - class RCCXGate(Gate): """The simplified Toffoli gate, also referred to as Margolus gate. diff --git a/qiskit/circuit/library/standard_gates/y.py b/qiskit/circuit/library/standard_gates/y.py index eb5d1cb255b1..0076c103ccc6 100644 --- a/qiskit/circuit/library/standard_gates/y.py +++ b/qiskit/circuit/library/standard_gates/y.py @@ -109,17 +109,7 @@ def to_matrix(self): [1j, 0]], dtype=complex) -class CYMeta(type): - """A metaclass to ensure that CyGate and CYGate are of the same type. - - Can be removed when CyGate gets removed. - """ - @classmethod - def __instancecheck__(mcs, inst): - return type(inst) in {CYGate, CyGate} # pylint: disable=unidiomatic-typecheck - - -class CYGate(ControlledGate, metaclass=CYMeta): +class CYGate(ControlledGate): r"""Controlled-Y gate. **Circuit symbol:** @@ -214,15 +204,3 @@ def to_matrix(self): return self._matrix1 else: return self._matrix0 - - -class CyGate(CYGate, metaclass=CYMeta): - """A deprecated CYGate class.""" - - def __init__(self, label=None, ctrl_state=None): - import warnings - warnings.warn('The class CyGate is deprecated as of 0.14.0, and ' - 'will be removed no earlier than 3 months after that release date. ' - 'You should use the class CYGate instead.', - DeprecationWarning, stacklevel=2) - super().__init__(label=label, ctrl_state=ctrl_state) diff --git a/qiskit/circuit/library/standard_gates/z.py b/qiskit/circuit/library/standard_gates/z.py index 2001f03e6412..45007d147b26 100644 --- a/qiskit/circuit/library/standard_gates/z.py +++ b/qiskit/circuit/library/standard_gates/z.py @@ -109,17 +109,7 @@ def to_matrix(self): [0, -1]], dtype=complex) -class CZMeta(type): - """A metaclass to ensure that CzGate and CZGate are of the same type. - - Can be removed when CzGate gets removed. - """ - @classmethod - def __instancecheck__(mcs, inst): - return type(inst) in {CZGate, CzGate} # pylint: disable=unidiomatic-typecheck - - -class CZGate(ControlledGate, metaclass=CZMeta): +class CZGate(ControlledGate): r"""Controlled-Z gate. This is a Clifford and symmetric gate. @@ -188,15 +178,3 @@ def to_matrix(self): [0, 1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1]], dtype=complex) - - -class CzGate(CZGate, metaclass=CZMeta): - """The deprecated CZGate class.""" - - def __init__(self, label=None, ctrl_state=None): - import warnings - warnings.warn('The class CzGate is deprecated as of 0.14.0, and ' - 'will be removed no earlier than 3 months after that release date. ' - 'You should use the class CZGate instead.', - DeprecationWarning, stacklevel=2) - super().__init__(label=label, ctrl_state=ctrl_state) diff --git a/qiskit/extensions/quantum_initializer/diagonal.py b/qiskit/extensions/quantum_initializer/diagonal.py index 1083ffd36946..8f765ffef6cb 100644 --- a/qiskit/extensions/quantum_initializer/diagonal.py +++ b/qiskit/extensions/quantum_initializer/diagonal.py @@ -34,17 +34,7 @@ _EPS = 1e-10 # global variable used to chop very small numbers to zero -class DiagonalMeta(type): - """A metaclass to ensure that DiagonalGate and DiagGate are of the same type. - - Can be removed when DiagGate gets removed. - """ - @classmethod - def __instancecheck__(mcs, inst): - return type(inst) in {DiagonalGate, DiagGate} # pylint: disable=unidiomatic-typecheck - - -class DiagonalGate(Gate, metaclass=DiagonalMeta): +class DiagonalGate(Gate): """ diag = list of the 2^k diagonal entries (for a diagonal gate on k qubits). Must contain at least two entries. @@ -150,18 +140,6 @@ def diagonal(self, diag, qubit): return self.append(DiagonalGate(diag), qubit) -class DiagGate(DiagonalGate, metaclass=DiagonalMeta): - """The deprecated DiagonalGate class.""" - - def __init__(self, diag): - import warnings - warnings.warn('The class DiagGate is deprecated as of 0.14.0, and ' - 'will be removed no earlier than 3 months after that release date. ' - 'You should use the class DiagonalGate instead.', - DeprecationWarning, stacklevel=2) - super().__init__(diag) - - def diag_gate(self, diag, qubit): """Deprecated version of QuantumCircuit.diagonal.""" import warnings diff --git a/qiskit/extensions/quantum_initializer/uc.py b/qiskit/extensions/quantum_initializer/uc.py index bfba80c691b0..73d5c69864c9 100644 --- a/qiskit/extensions/quantum_initializer/uc.py +++ b/qiskit/extensions/quantum_initializer/uc.py @@ -53,17 +53,7 @@ _DECOMPOSER1Q = OneQubitEulerDecomposer('U3') -class UCMeta(type): - """A metaclass to ensure that UCGate and UCG are of the same type. - - Can be removed when UCGG gets removed. - """ - @classmethod - def __instancecheck__(mcs, inst): - return type(inst) in {UCGate, UCG} # pylint: disable=unidiomatic-typecheck - - -class UCGate(Gate, metaclass=UCMeta): +class UCGate(Gate): """Uniformly controlled gate (also called multiplexed gate). The decomposition is based on: https://arxiv.org/pdf/quant-ph/0410066.pdf. """ @@ -321,28 +311,4 @@ def uc(self, gate_list, q_controls, q_target, up_to_diagonal=False): return self.append(UCGate(gate_list, up_to_diagonal), [q_target] + q_controls) -class UCG(UCGate, metaclass=UCMeta): - """The deprecated UCGate class.""" - - def __init__(self, gate_list, up_to_diagonal=False): - import warnings - warnings.warn('The class UCG is deprecated as of 0.14.0, and ' - 'will be removed no earlier than 3 months after that release date. ' - 'You should use the class UCGate instead.', - DeprecationWarning, stacklevel=2) - super().__init__(gate_list, up_to_diagonal) - - -def ucg(self, angle_list, q_controls, q_target, up_to_diagonal=False): - """Deprecated version of uc.""" - - import warnings - warnings.warn('The QuantumCircuit.ucg() method is deprecated as of 0.14.0, and ' - 'will be removed no earlier than 3 months after that release date. ' - 'You should use the QuantumCircuit.uc() method instead.', - DeprecationWarning, stacklevel=2) - return uc(self, angle_list, q_controls, q_target, up_to_diagonal) - - QuantumCircuit.uc = uc -QuantumCircuit.ucg = ucg # deprecated, but still supported diff --git a/qiskit/extensions/quantum_initializer/uc_pauli_rot.py b/qiskit/extensions/quantum_initializer/uc_pauli_rot.py index d2487f84e0bb..3f90bacd4ca5 100644 --- a/qiskit/extensions/quantum_initializer/uc_pauli_rot.py +++ b/qiskit/extensions/quantum_initializer/uc_pauli_rot.py @@ -34,17 +34,7 @@ _EPS = 1e-10 # global variable used to chop very small numbers to zero -class UCPauliRotMeta(type): - """A metaclass to ensure that UCPauliRotGate and UCRot are of the same type. - - Can be removed when UCRot gets removed. - """ - @classmethod - def __instancecheck__(mcs, inst): - return type(inst) in {UCPauliRotGate, UCRot} # pylint: disable=unidiomatic-typecheck - - -class UCPauliRotGate(Gate, metaclass=UCPauliRotMeta): +class UCPauliRotGate(Gate): """ Uniformly controlled rotations (also called multiplexed rotations). The decomposition is based on 'Synthesis of Quantum Logic Circuits' @@ -174,15 +164,3 @@ def _dec_uc_rotations(angles, start_index, end_index, reversed_dec): def _update_angles(angle1, angle2): """Calculate the new rotation angles according to Shende's decomposition.""" return (angle1 + angle2) / 2.0, (angle1 - angle2) / 2.0 - - -class UCRot(UCPauliRotGate, metaclass=UCPauliRotMeta): - """The deprecated DiagonalGate class.""" - - def __init__(self, angle_list, rot_axis): - import warnings - warnings.warn('The class UCRot is deprecated as of 0.14.0, and ' - 'will be removed no earlier than 3 months after that release date. ' - 'You should use the class UCPauliRotGate instead.', - DeprecationWarning, stacklevel=2) - super().__init__(angle_list, rot_axis) diff --git a/qiskit/extensions/quantum_initializer/ucrx.py b/qiskit/extensions/quantum_initializer/ucrx.py index e89abe7c27a7..417f1c2d02d4 100644 --- a/qiskit/extensions/quantum_initializer/ucrx.py +++ b/qiskit/extensions/quantum_initializer/ucrx.py @@ -28,20 +28,10 @@ from qiskit.circuit.quantumcircuit import QuantumCircuit from qiskit.circuit.quantumregister import QuantumRegister from qiskit.exceptions import QiskitError -from qiskit.extensions.quantum_initializer.uc_pauli_rot import UCPauliRotGate, UCPauliRotMeta +from qiskit.extensions.quantum_initializer.uc_pauli_rot import UCPauliRotGate -class UCRXMeta(UCPauliRotMeta): - """A metaclass to ensure that UCRXGate and UCX are of the same type. - - Can be removed when UCX gets removed. - """ - @classmethod - def __instancecheck__(mcs, inst): - return type(inst) in {UCRXGate, UCX} # pylint: disable=unidiomatic-typecheck - - -class UCRXGate(UCPauliRotGate, metaclass=UCRXMeta): +class UCRXGate(UCPauliRotGate): """ Uniformly controlled rotations (also called multiplexed rotations). The decomposition is based on @@ -103,27 +93,4 @@ def ucrx(self, angle_list, q_controls, q_target): return self.append(UCRXGate(angle_list), [q_target] + q_controls, []) -class UCX(UCRXGate, metaclass=UCRXMeta): - """The deprecated UCRXGate class.""" - - def __init__(self, angle_list): - import warnings - warnings.warn('The class UCX is deprecated as of 0.14.0, and ' - 'will be removed no earlier than 3 months after that release date. ' - 'You should use the class UCRXGate instead.', - DeprecationWarning, stacklevel=2) - super().__init__(angle_list) - - -def ucx(self, angle_list, q_controls, q_target): - """Deprecated version of ucrx.""" - import warnings - warnings.warn('The QuantumCircuit. ucx() method is deprecated as of 0.14.0, and ' - 'will be removed no earlier than 3 months after that release date. ' - 'You should use the QuantumCircuit. ucrx() method instead.', - DeprecationWarning, stacklevel=2) - return ucrx(self, angle_list, q_controls, q_target) - - QuantumCircuit.ucrx = ucrx -QuantumCircuit.ucx = ucx # deprecated, but still supported diff --git a/qiskit/extensions/quantum_initializer/ucry.py b/qiskit/extensions/quantum_initializer/ucry.py index 41704419a418..b98863c46df8 100644 --- a/qiskit/extensions/quantum_initializer/ucry.py +++ b/qiskit/extensions/quantum_initializer/ucry.py @@ -25,20 +25,10 @@ from qiskit.circuit.quantumcircuit import QuantumCircuit from qiskit.circuit.quantumregister import QuantumRegister from qiskit.exceptions import QiskitError -from qiskit.extensions.quantum_initializer.uc_pauli_rot import UCPauliRotGate, UCPauliRotMeta +from qiskit.extensions.quantum_initializer.uc_pauli_rot import UCPauliRotGate -class UCRYMeta(UCPauliRotMeta): - """A metaclass to ensure that UCRYGate and UCY are of the same type. - - Can be removed when UCY gets removed. - """ - @classmethod - def __instancecheck__(mcs, inst): - return type(inst) in {UCRYGate, UCY} # pylint: disable=unidiomatic-typecheck - - -class UCRYGate(UCPauliRotGate, metaclass=UCRYMeta): +class UCRYGate(UCPauliRotGate): """ Uniformly controlled rotations (also called multiplexed rotations). The decomposition is based on @@ -100,18 +90,6 @@ def ucry(self, angle_list, q_controls, q_target): return self.append(UCRYGate(angle_list), [q_target] + q_controls, []) -class UCY(UCRYGate, metaclass=UCRYMeta): - """The deprecated UCRYGate class.""" - - def __init__(self, angle_list): - import warnings - warnings.warn('The class UCY is deprecated as of 0.14.0, and ' - 'will be removed no earlier than 3 months after that release date. ' - 'You should use the class UCRYGate instead.', - DeprecationWarning, stacklevel=2) - super().__init__(angle_list) - - def ucy(self, angle_list, q_controls, q_target): """Deprecated version of ucry.""" import warnings @@ -123,4 +101,3 @@ def ucy(self, angle_list, q_controls, q_target): QuantumCircuit.ucry = ucry -QuantumCircuit.ucy = ucy # deprecated, but still supported diff --git a/qiskit/extensions/quantum_initializer/ucrz.py b/qiskit/extensions/quantum_initializer/ucrz.py index 8a74d8c214eb..37bc4cd42d12 100644 --- a/qiskit/extensions/quantum_initializer/ucrz.py +++ b/qiskit/extensions/quantum_initializer/ucrz.py @@ -25,20 +25,10 @@ from qiskit.circuit.quantumcircuit import QuantumCircuit from qiskit.circuit.quantumregister import QuantumRegister from qiskit.exceptions import QiskitError -from qiskit.extensions.quantum_initializer.uc_pauli_rot import UCPauliRotGate, UCPauliRotMeta +from qiskit.extensions.quantum_initializer.uc_pauli_rot import UCPauliRotGate -class UCRZMeta(UCPauliRotMeta): - """A metaclass to ensure that UCRZGate and UCZ are of the same type. - - Can be removed when UCZ gets removed. - """ - @classmethod - def __instancecheck__(mcs, inst): - return type(inst) in {UCRZGate, UCZ} # pylint: disable=unidiomatic-typecheck - - -class UCRZGate(UCPauliRotGate, metaclass=UCRZMeta): +class UCRZGate(UCPauliRotGate): """ Uniformly controlled rotations (also called multiplexed rotations). The decomposition is based on @@ -101,27 +91,4 @@ def ucrz(self, angle_list, q_controls, q_target): return self.append(UCRZGate(angle_list), [q_target] + q_controls, []) -class UCZ(UCRZGate, metaclass=UCRZMeta): - """The deprecated UCRZGate class.""" - - def __init__(self, angle_list): - import warnings - warnings.warn('The class UCZ is deprecated as of 0.14.0, and ' - 'will be removed no earlier than 3 months after that release date. ' - 'You should use the class UCRZGate instead.', - DeprecationWarning, stacklevel=2) - super().__init__(angle_list) - - -def ucz(self, angle_list, q_controls, q_target): - """Deprecated version of ucrz.""" - import warnings - warnings.warn('The QuantumCircuit.ucz() method is deprecated as of 0.14.0, and ' - 'will be removed no earlier than 3 months after that release date. ' - 'You should use the QuantumCircuit.ucrz() method instead.', - DeprecationWarning, stacklevel=2) - return ucrz(self, angle_list, q_controls, q_target) - - QuantumCircuit.ucrz = ucrz -QuantumCircuit.ucz = ucz # deprecated, but still supported diff --git a/test/python/circuit/test_controlled_gate.py b/test/python/circuit/test_controlled_gate.py index a9c89863e2ee..81e805f8a2f6 100644 --- a/test/python/circuit/test_controlled_gate.py +++ b/test/python/circuit/test_controlled_gate.py @@ -1030,70 +1030,6 @@ def test_controlled_standard_gates(self, num_ctrl_qubits, gate_class): self.assertTrue(matrix_equal(Operator(cgate).data, target_mat, ignore_phase=True)) -@ddt -class TestDeprecatedGates(QiskitTestCase): - """Test controlled of deprecated gates.""" - - import qiskit.extensions as ext - - import qiskit.circuit.library.standard_gates.i as i - import qiskit.circuit.library.standard_gates.rx as rx - import qiskit.circuit.library.standard_gates.ry as ry - import qiskit.circuit.library.standard_gates.rz as rz - import qiskit.circuit.library.standard_gates.swap as swap - import qiskit.circuit.library.standard_gates.u1 as u1 - import qiskit.circuit.library.standard_gates.u3 as u3 - import qiskit.circuit.library.standard_gates.x as x - import qiskit.circuit.library.standard_gates.y as y - import qiskit.circuit.library.standard_gates.z as z - - import qiskit.extensions.quantum_initializer.diagonal as diagonal - import qiskit.extensions.quantum_initializer.uc as uc - import qiskit.extensions.quantum_initializer.uc_pauli_rot as uc_pauli_rot - import qiskit.extensions.quantum_initializer.ucrx as ucrx - import qiskit.extensions.quantum_initializer.ucry as ucry - import qiskit.extensions.quantum_initializer.ucrz as ucrz - - @data((diagonal.DiagonalGate, diagonal.DiagGate, [[1, 1]]), - (i.IGate, i.IdGate, []), - (rx.CRXGate, rx.CrxGate, [0.1]), - (ry.CRYGate, ry.CryGate, [0.1]), - (rz.CRZGate, rz.CrzGate, [0.1]), - (swap.CSwapGate, swap.FredkinGate, []), - (u1.CU1Gate, u1.Cu1Gate, [0.1]), - (u3.CU3Gate, u3.Cu3Gate, [0.1, 0.2, 0.3]), - (uc.UCGate, uc.UCG, [[np.array([[1, 0], [0, 1]])]]), - (uc_pauli_rot.UCPauliRotGate, uc_pauli_rot.UCRot, [[0.1], 'X']), - (ucrx.UCRXGate, ucrx.UCX, [[0.1]]), - (ucry.UCRYGate, ucry.UCY, [[0.1]]), - (ucrz.UCRZGate, ucrz.UCZ, [[0.1]]), - (x.CXGate, x.CnotGate, []), - (x.CCXGate, x.ToffoliGate, []), - (y.CYGate, y.CyGate, []), - (z.CZGate, z.CzGate, []), - (i.IGate, ext.IdGate, []), - (rx.CRXGate, ext.CrxGate, [0.1]), - (ry.CRYGate, ext.CryGate, [0.1]), - (rz.CRZGate, ext.CrzGate, [0.1]), - (swap.CSwapGate, ext.FredkinGate, []), - (u1.CU1Gate, ext.Cu1Gate, [0.1]), - (u3.CU3Gate, ext.Cu3Gate, [0.1, 0.2, 0.3]), - (x.CXGate, ext.CnotGate, []), - (x.CCXGate, ext.ToffoliGate, []), - (y.CYGate, ext.CyGate, []), - (z.CZGate, ext.CzGate, [])) - @unpack - def test_deprecated_gates(self, new, old, params): - """Test types of the deprecated gate classes.""" - # assert old gate class derives from new - self.assertTrue(issubclass(old, new)) - - # assert both are representatives of one another - self.assertTrue(isinstance(new(*params), old)) - with self.assertWarns(DeprecationWarning): - self.assertTrue(isinstance(old(*params), new)) - - @ddt class TestParameterCtrlState(QiskitTestCase): """Test gate equality with ctrl_state parameter.""" From 2e8582d7409deee3c6ec7edefa33b0d1e6593a19 Mon Sep 17 00:00:00 2001 From: Cryoris Date: Fri, 19 Jun 2020 08:21:25 +0200 Subject: [PATCH 2/7] remove extensions/standard --- qiskit/extensions/standard/__init__.py | 65 ------------------- qiskit/extensions/standard/barrier.py | 19 ------ .../standard/boolean_logical_gates.py | 19 ------ qiskit/extensions/standard/ccx.py | 25 ------- qiskit/extensions/standard/ch.py | 24 ------- qiskit/extensions/standard/crx.py | 24 ------- qiskit/extensions/standard/cry.py | 24 ------- qiskit/extensions/standard/crz.py | 24 ------- qiskit/extensions/standard/cswap.py | 24 ------- qiskit/extensions/standard/cu1.py | 23 ------- qiskit/extensions/standard/cu3.py | 24 ------- qiskit/extensions/standard/cx.py | 24 ------- qiskit/extensions/standard/cy.py | 24 ------- qiskit/extensions/standard/cz.py | 24 ------- qiskit/extensions/standard/dcx.py | 19 ------ .../standard/equivalence_library.py | 19 ------ qiskit/extensions/standard/h.py | 19 ------ qiskit/extensions/standard/i.py | 19 ------ qiskit/extensions/standard/iden.py | 24 ------- qiskit/extensions/standard/iswap.py | 19 ------ qiskit/extensions/standard/ms.py | 19 ------ .../standard/multi_control_rotation_gates.py | 20 ------ qiskit/extensions/standard/r.py | 19 ------ qiskit/extensions/standard/rx.py | 19 ------ qiskit/extensions/standard/rxx.py | 19 ------ qiskit/extensions/standard/ry.py | 19 ------ qiskit/extensions/standard/ryy.py | 19 ------ qiskit/extensions/standard/rz.py | 19 ------ qiskit/extensions/standard/rzx.py | 19 ------ qiskit/extensions/standard/rzz.py | 19 ------ qiskit/extensions/standard/s.py | 19 ------ qiskit/extensions/standard/swap.py | 19 ------ qiskit/extensions/standard/t.py | 19 ------ qiskit/extensions/standard/u1.py | 19 ------ qiskit/extensions/standard/u2.py | 19 ------ qiskit/extensions/standard/u3.py | 19 ------ qiskit/extensions/standard/x.py | 23 ------- qiskit/extensions/standard/y.py | 19 ------ qiskit/extensions/standard/z.py | 19 ------ 39 files changed, 852 deletions(-) delete mode 100644 qiskit/extensions/standard/__init__.py delete mode 100644 qiskit/extensions/standard/barrier.py delete mode 100644 qiskit/extensions/standard/boolean_logical_gates.py delete mode 100644 qiskit/extensions/standard/ccx.py delete mode 100644 qiskit/extensions/standard/ch.py delete mode 100644 qiskit/extensions/standard/crx.py delete mode 100644 qiskit/extensions/standard/cry.py delete mode 100644 qiskit/extensions/standard/crz.py delete mode 100644 qiskit/extensions/standard/cswap.py delete mode 100644 qiskit/extensions/standard/cu1.py delete mode 100644 qiskit/extensions/standard/cu3.py delete mode 100644 qiskit/extensions/standard/cx.py delete mode 100644 qiskit/extensions/standard/cy.py delete mode 100644 qiskit/extensions/standard/cz.py delete mode 100644 qiskit/extensions/standard/dcx.py delete mode 100644 qiskit/extensions/standard/equivalence_library.py delete mode 100644 qiskit/extensions/standard/h.py delete mode 100644 qiskit/extensions/standard/i.py delete mode 100644 qiskit/extensions/standard/iden.py delete mode 100644 qiskit/extensions/standard/iswap.py delete mode 100644 qiskit/extensions/standard/ms.py delete mode 100644 qiskit/extensions/standard/multi_control_rotation_gates.py delete mode 100644 qiskit/extensions/standard/r.py delete mode 100644 qiskit/extensions/standard/rx.py delete mode 100644 qiskit/extensions/standard/rxx.py delete mode 100644 qiskit/extensions/standard/ry.py delete mode 100644 qiskit/extensions/standard/ryy.py delete mode 100644 qiskit/extensions/standard/rz.py delete mode 100644 qiskit/extensions/standard/rzx.py delete mode 100644 qiskit/extensions/standard/rzz.py delete mode 100644 qiskit/extensions/standard/s.py delete mode 100644 qiskit/extensions/standard/swap.py delete mode 100644 qiskit/extensions/standard/t.py delete mode 100644 qiskit/extensions/standard/u1.py delete mode 100644 qiskit/extensions/standard/u2.py delete mode 100644 qiskit/extensions/standard/u3.py delete mode 100644 qiskit/extensions/standard/x.py delete mode 100644 qiskit/extensions/standard/y.py delete mode 100644 qiskit/extensions/standard/z.py diff --git a/qiskit/extensions/standard/__init__.py b/qiskit/extensions/standard/__init__.py deleted file mode 100644 index eb9e808896b4..000000000000 --- a/qiskit/extensions/standard/__init__.py +++ /dev/null @@ -1,65 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""This module is deprecated, the gates moved to qiskit/circuit/library.""" - -import warnings -from .barrier import Barrier -from .h import HGate, CHGate -from .i import IGate -from .ms import MSGate -from .r import RGate -from .rx import RXGate, CRXGate -from .rxx import RXXGate -from .ry import RYGate, CRYGate -from .ryy import RYYGate -from .rz import RZGate, CRZGate -from .rzz import RZZGate -from .rzx import RZXGate -from .s import SGate, SdgGate -from .swap import SwapGate, CSwapGate -from .iswap import iSwapGate -from .dcx import DCXGate -from .t import TGate, TdgGate -from .u1 import U1Gate, CU1Gate, MCU1Gate -from .u2 import U2Gate -from .u3 import U3Gate, CU3Gate -from .x import ( - XGate, CXGate, CCXGate, RCCXGate, C3XGate, RC3XGate, C4XGate, - MCXGate, MCXGrayCode, MCXRecursive, MCXVChain -) -from .y import YGate, CYGate -from .z import ZGate, CZGate - -# to be converted to gates -from .boolean_logical_gates import logical_or, logical_and -from .multi_control_rotation_gates import mcrx, mcry, mcrz - -# deprecated gates, to be removed -from .i import IdGate -from .x import ToffoliGate -from .swap import FredkinGate -from .x import CnotGate -from .y import CyGate -from .z import CzGate -from .u1 import Cu1Gate -from .u3 import Cu3Gate -from .rx import CrxGate -from .ry import CryGate -from .rz import CrzGate - -warnings.warn('The module qiskit.extensions.standard is deprecated as of 0.14.0 and will be ' - 'removed no earlier than 3 months after the release. You should import the ' - 'standard gates from qiskit.circuit.library.standard_gates instead.', - DeprecationWarning, stacklevel=2) diff --git a/qiskit/extensions/standard/barrier.py b/qiskit/extensions/standard/barrier.py deleted file mode 100644 index 050f89ffbd1a..000000000000 --- a/qiskit/extensions/standard/barrier.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017, 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The standard gates moved to qiskit/circuit/library.""" - -from qiskit.circuit.barrier import Barrier - -__all__ = ['Barrier'] diff --git a/qiskit/extensions/standard/boolean_logical_gates.py b/qiskit/extensions/standard/boolean_logical_gates.py deleted file mode 100644 index 3e165afa605b..000000000000 --- a/qiskit/extensions/standard/boolean_logical_gates.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017, 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The Boolean Logical AND and OR Gates.""" - -from qiskit.circuit.library.standard_gates import logical_and, logical_or - -__all__ = ['logical_and', 'logical_or'] diff --git a/qiskit/extensions/standard/ccx.py b/qiskit/extensions/standard/ccx.py deleted file mode 100644 index 3ae87a4cc57f..000000000000 --- a/qiskit/extensions/standard/ccx.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -""" -Controlled-Controlled-X (or Toffoli) Gate. -""" - -import warnings -from qiskit.circuit.library.standard_gates.x import ToffoliGate - -warnings.warn('This module is deprecated.', - category=DeprecationWarning, stacklevel=2) - -__all__ = ['ToffoliGate'] diff --git a/qiskit/extensions/standard/ch.py b/qiskit/extensions/standard/ch.py deleted file mode 100644 index 480f329a76e8..000000000000 --- a/qiskit/extensions/standard/ch.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -""" -Controlled-H gate. -""" -import warnings -from qiskit.circuit.library.standard_gates.h import CHGate - -warnings.warn('This module is deprecated.', - category=DeprecationWarning, stacklevel=2) - -__all__ = ['CHGate'] diff --git a/qiskit/extensions/standard/crx.py b/qiskit/extensions/standard/crx.py deleted file mode 100644 index 94f944645571..000000000000 --- a/qiskit/extensions/standard/crx.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -""" -Controlled-rx gate. -""" -import warnings -from qiskit.circuit.library.standard_gates.rx import CrxGate - -warnings.warn('This module is deprecated.', - category=DeprecationWarning, stacklevel=2) - -__all__ = ['CrxGate'] diff --git a/qiskit/extensions/standard/cry.py b/qiskit/extensions/standard/cry.py deleted file mode 100644 index 27295a6bb34f..000000000000 --- a/qiskit/extensions/standard/cry.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -""" -Controlled-ry gate. -""" -import warnings -from qiskit.circuit.library.standard_gates.ry import CryGate - -warnings.warn('This module is deprecated.', - category=DeprecationWarning, stacklevel=2) - -__all__ = ['CryGate'] diff --git a/qiskit/extensions/standard/crz.py b/qiskit/extensions/standard/crz.py deleted file mode 100644 index fb89fb57177a..000000000000 --- a/qiskit/extensions/standard/crz.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -""" -Controlled-rz gate. -""" -import warnings -from qiskit.circuit.library.standard_gates.rz import CrzGate - -warnings.warn('This module is deprecated.', - category=DeprecationWarning, stacklevel=2) - -__all__ = ['CrzGate'] diff --git a/qiskit/extensions/standard/cswap.py b/qiskit/extensions/standard/cswap.py deleted file mode 100644 index e53236cadf97..000000000000 --- a/qiskit/extensions/standard/cswap.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -""" -Controlled-Swap gate or Fredkin gate. -""" -import warnings -from qiskit.circuit.library.standard_gates.swap import FredkinGate - -warnings.warn('This module is deprecated.', - category=DeprecationWarning, stacklevel=2) - -__all__ = ['FredkinGate'] diff --git a/qiskit/extensions/standard/cu1.py b/qiskit/extensions/standard/cu1.py deleted file mode 100644 index 5bba2e6c5282..000000000000 --- a/qiskit/extensions/standard/cu1.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The standard gates moved to qiskit/circuit/library.""" - -import warnings -from qiskit.circuit.library.standard_gates.u1 import Cu1Gate - -warnings.warn('This module is deprecated. The Cu1Gate can now be found in u1.py', - category=DeprecationWarning, stacklevel=2) - -__all__ = ['Cu1Gate'] diff --git a/qiskit/extensions/standard/cu3.py b/qiskit/extensions/standard/cu3.py deleted file mode 100644 index 93ac5364a5ee..000000000000 --- a/qiskit/extensions/standard/cu3.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -""" -Controlled-u3 gate. -""" -import warnings -from qiskit.circuit.library.standard_gates.u3 import Cu3Gate - -warnings.warn('This module is deprecated.', - category=DeprecationWarning, stacklevel=2) - -__all__ = ['Cu3Gate'] diff --git a/qiskit/extensions/standard/cx.py b/qiskit/extensions/standard/cx.py deleted file mode 100644 index 8539cc1768dc..000000000000 --- a/qiskit/extensions/standard/cx.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -""" -Controlled-not gate. -""" -import warnings -from qiskit.circuit.library.standard_gates.x import CnotGate - -warnings.warn('This module is deprecated.', - category=DeprecationWarning, stacklevel=2) - -__all__ = ['CnotGate'] diff --git a/qiskit/extensions/standard/cy.py b/qiskit/extensions/standard/cy.py deleted file mode 100644 index 541f0e722ace..000000000000 --- a/qiskit/extensions/standard/cy.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -""" -Controlled-Y gate. -""" -import warnings -from qiskit.circuit.library.standard_gates.y import CyGate - -warnings.warn('This module is deprecated.', - category=DeprecationWarning, stacklevel=2) - -__all__ = ['CyGate'] diff --git a/qiskit/extensions/standard/cz.py b/qiskit/extensions/standard/cz.py deleted file mode 100644 index e862cbc3175d..000000000000 --- a/qiskit/extensions/standard/cz.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -""" -Controlled-Phase gate. -""" -import warnings -from qiskit.circuit.library.standard_gates.z import CzGate - -warnings.warn('This module is deprecated.', - category=DeprecationWarning, stacklevel=2) - -__all__ = ['CzGate'] diff --git a/qiskit/extensions/standard/dcx.py b/qiskit/extensions/standard/dcx.py deleted file mode 100644 index 442cc9cab690..000000000000 --- a/qiskit/extensions/standard/dcx.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017, 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The standard gates moved to qiskit/circuit/library.""" - -from qiskit.circuit.library.standard_gates.dcx import DCXGate - -__all__ = ['DCXGate'] diff --git a/qiskit/extensions/standard/equivalence_library.py b/qiskit/extensions/standard/equivalence_library.py deleted file mode 100644 index 40210b8f74b3..000000000000 --- a/qiskit/extensions/standard/equivalence_library.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017, 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""Standard gates.""" - -from qiskit.circuit.library.standard_gates.equivalence_library import StandardEquivalenceLibrary - -__all__ = ['StandardEquivalenceLibrary'] diff --git a/qiskit/extensions/standard/h.py b/qiskit/extensions/standard/h.py deleted file mode 100644 index a9c711f381d8..000000000000 --- a/qiskit/extensions/standard/h.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017, 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The standard gates moved to qiskit/circuit/library.""" - -from qiskit.circuit.library.standard_gates.h import HGate, CHGate - -__all__ = ['HGate', 'CHGate'] diff --git a/qiskit/extensions/standard/i.py b/qiskit/extensions/standard/i.py deleted file mode 100644 index ff18079407e1..000000000000 --- a/qiskit/extensions/standard/i.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017, 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The standard gates moved to qiskit/circuit/library.""" - -from qiskit.circuit.library.standard_gates.i import IGate, IdGate - -__all__ = ['IGate', 'IdGate'] diff --git a/qiskit/extensions/standard/iden.py b/qiskit/extensions/standard/iden.py deleted file mode 100644 index d50e23c6caaf..000000000000 --- a/qiskit/extensions/standard/iden.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -""" -Identity gate. -""" -import warnings -from qiskit.circuit.library.standard_gates.i import IdGate - -warnings.warn('This module is deprecated.', - category=DeprecationWarning, stacklevel=2) - -__all__ = ['IdGate'] diff --git a/qiskit/extensions/standard/iswap.py b/qiskit/extensions/standard/iswap.py deleted file mode 100644 index 04e0997dd513..000000000000 --- a/qiskit/extensions/standard/iswap.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017, 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The standard gates moved to qiskit/circuit/library.""" - -from qiskit.circuit.library.standard_gates.iswap import iSwapGate - -__all__ = ['iSwapGate'] diff --git a/qiskit/extensions/standard/ms.py b/qiskit/extensions/standard/ms.py deleted file mode 100644 index 9502ad9a6146..000000000000 --- a/qiskit/extensions/standard/ms.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017, 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The standard gates moved to qiskit/circuit/library.""" - -from qiskit.circuit.library.standard_gates.ms import MSGate - -__all__ = ['MSGate'] diff --git a/qiskit/extensions/standard/multi_control_rotation_gates.py b/qiskit/extensions/standard/multi_control_rotation_gates.py deleted file mode 100644 index 72c7f76ef906..000000000000 --- a/qiskit/extensions/standard/multi_control_rotation_gates.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017, 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. -""" -Multiple-Controlled U3 gate. Not using ancillary qubits. -""" - -from qiskit.circuit.library.standard_gates import mcrx, mcry, mcrz - -__all__ = ['mcrx', 'mcry', 'mcrz'] diff --git a/qiskit/extensions/standard/r.py b/qiskit/extensions/standard/r.py deleted file mode 100644 index 89861d59c2c7..000000000000 --- a/qiskit/extensions/standard/r.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017, 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The standard gates moved to qiskit/circuit/library.""" - -from qiskit.circuit.library.standard_gates.r import RGate - -__all__ = ['RGate'] diff --git a/qiskit/extensions/standard/rx.py b/qiskit/extensions/standard/rx.py deleted file mode 100644 index 64475e078d55..000000000000 --- a/qiskit/extensions/standard/rx.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017, 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The standard gates moved to qiskit/circuit/library.""" - -from qiskit.circuit.library.standard_gates.rx import RXGate, CRXGate, CrxGate - -__all__ = ['RXGate', 'CRXGate', 'CrxGate'] diff --git a/qiskit/extensions/standard/rxx.py b/qiskit/extensions/standard/rxx.py deleted file mode 100644 index 148612de4c07..000000000000 --- a/qiskit/extensions/standard/rxx.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017, 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The standard gates moved to qiskit/circuit/library.""" - -from qiskit.circuit.library.standard_gates.rxx import RXXGate - -__all__ = ['RXXGate'] diff --git a/qiskit/extensions/standard/ry.py b/qiskit/extensions/standard/ry.py deleted file mode 100644 index 69a523927f56..000000000000 --- a/qiskit/extensions/standard/ry.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017, 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The standard gates moved to qiskit/circuit/library.""" - -from qiskit.circuit.library.standard_gates.ry import RYGate, CRYGate, CryGate - -__all__ = ['RYGate', 'CRYGate', 'CryGate'] diff --git a/qiskit/extensions/standard/ryy.py b/qiskit/extensions/standard/ryy.py deleted file mode 100644 index 38db5b4e5369..000000000000 --- a/qiskit/extensions/standard/ryy.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017, 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The standard gates moved to qiskit/circuit/library.""" - -from qiskit.circuit.library.standard_gates.ryy import RYYGate - -__all__ = ['RYYGate'] diff --git a/qiskit/extensions/standard/rz.py b/qiskit/extensions/standard/rz.py deleted file mode 100644 index 1b17539f5a53..000000000000 --- a/qiskit/extensions/standard/rz.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017, 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The standard gates moved to qiskit/circuit/library.""" - -from qiskit.circuit.library.standard_gates.rz import RZGate, CRZGate, CrzGate - -__all__ = ['RZGate', 'CRZGate', 'CrzGate'] diff --git a/qiskit/extensions/standard/rzx.py b/qiskit/extensions/standard/rzx.py deleted file mode 100644 index 4bec325dde80..000000000000 --- a/qiskit/extensions/standard/rzx.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017, 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The standard gates moved to qiskit/circuit/library.""" - -from qiskit.circuit.library.standard_gates.rzx import RZXGate - -__all__ = ['RZXGate'] diff --git a/qiskit/extensions/standard/rzz.py b/qiskit/extensions/standard/rzz.py deleted file mode 100644 index adb1986ef96b..000000000000 --- a/qiskit/extensions/standard/rzz.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017, 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The standard gates moved to qiskit/circuit/library.""" - -from qiskit.circuit.library.standard_gates.rzz import RZZGate - -__all__ = ['RZZGate'] diff --git a/qiskit/extensions/standard/s.py b/qiskit/extensions/standard/s.py deleted file mode 100644 index b8bdafbd851d..000000000000 --- a/qiskit/extensions/standard/s.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017, 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The standard gates moved to qiskit/circuit/library.""" - -from qiskit.circuit.library.standard_gates.s import SGate, SdgGate - -__all__ = ['SGate', 'SdgGate'] diff --git a/qiskit/extensions/standard/swap.py b/qiskit/extensions/standard/swap.py deleted file mode 100644 index dea4a2d6ac08..000000000000 --- a/qiskit/extensions/standard/swap.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017, 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The standard gates moved to qiskit/circuit/library.""" - -from qiskit.circuit.library.standard_gates.swap import SwapGate, CSwapGate, FredkinGate - -__all__ = ['SwapGate', 'CSwapGate', 'FredkinGate'] diff --git a/qiskit/extensions/standard/t.py b/qiskit/extensions/standard/t.py deleted file mode 100644 index 63f6dfa327d1..000000000000 --- a/qiskit/extensions/standard/t.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017, 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The standard gates moved to qiskit/circuit/library.""" - -from qiskit.circuit.library.standard_gates.t import TGate, TdgGate - -__all__ = ['TGate', 'TdgGate'] diff --git a/qiskit/extensions/standard/u1.py b/qiskit/extensions/standard/u1.py deleted file mode 100644 index 2f72c049bbb7..000000000000 --- a/qiskit/extensions/standard/u1.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017, 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The standard gates moved to qiskit/circuit/library.""" - -from qiskit.circuit.library.standard_gates.u1 import U1Gate, CU1Gate, Cu1Gate, MCU1Gate - -__all__ = ['U1Gate', 'Cu1Gate', 'CU1Gate', 'MCU1Gate'] diff --git a/qiskit/extensions/standard/u2.py b/qiskit/extensions/standard/u2.py deleted file mode 100644 index 3902199297b2..000000000000 --- a/qiskit/extensions/standard/u2.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017, 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The standard gates moved to qiskit/circuit/library.""" - -from qiskit.circuit.library.standard_gates.u2 import U2Gate - -__all__ = ['U2Gate'] diff --git a/qiskit/extensions/standard/u3.py b/qiskit/extensions/standard/u3.py deleted file mode 100644 index 33e6c7144216..000000000000 --- a/qiskit/extensions/standard/u3.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017, 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The standard gates moved to qiskit/circuit/library.""" - -from qiskit.circuit.library.standard_gates.u3 import U3Gate, CU3Gate, Cu3Gate - -__all__ = ['U3Gate', 'Cu3Gate', 'CU3Gate'] diff --git a/qiskit/extensions/standard/x.py b/qiskit/extensions/standard/x.py deleted file mode 100644 index 5d8d6f4688aa..000000000000 --- a/qiskit/extensions/standard/x.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017, 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The standard gates moved to qiskit/circuit/library.""" - -from qiskit.circuit.library.standard_gates.x import ( - XGate, CXGate, CCXGate, C3XGate, C4XGate, RCCXGate, RC3XGate, CnotGate, ToffoliGate, - MCXGate, MCXGrayCode, MCXVChain, MCXRecursive -) - -__all__ = ['XGate', 'CXGate', 'CCXGate', 'C3XGate', 'C4XGate', 'RCCXGate', 'RC3XGate', - 'CnotGate', 'ToffoliGate', 'MCXGate', 'MCXGrayCode', 'MCXVChain', 'MCXRecursive'] diff --git a/qiskit/extensions/standard/y.py b/qiskit/extensions/standard/y.py deleted file mode 100644 index 5f173e31f2b4..000000000000 --- a/qiskit/extensions/standard/y.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017, 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The standard gates moved to qiskit/circuit/library.""" - -from qiskit.circuit.library.standard_gates.y import YGate, CYGate, CyGate - -__all__ = ['YGate', 'CYGate', 'CyGate'] diff --git a/qiskit/extensions/standard/z.py b/qiskit/extensions/standard/z.py deleted file mode 100644 index a0fd69574018..000000000000 --- a/qiskit/extensions/standard/z.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2017, 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The standard gates moved to qiskit/circuit/library.""" - -from qiskit.circuit.library.standard_gates.z import ZGate, CZGate, CzGate - -__all__ = ['ZGate', 'CZGate', 'CzGate'] From 009de30e6adde0fd2c6583852c2ee05866e4a2cb Mon Sep 17 00:00:00 2001 From: Cryoris Date: Fri, 19 Jun 2020 08:45:07 +0200 Subject: [PATCH 3/7] remove deprecated gates in quantum init --- qiskit/extensions/quantum_initializer/diag.py | 25 ------------------- qiskit/extensions/quantum_initializer/ucg.py | 25 ------------------- .../extensions/quantum_initializer/ucrot.py | 25 ------------------- qiskit/extensions/quantum_initializer/ucx.py | 25 ------------------- qiskit/extensions/quantum_initializer/ucy.py | 25 ------------------- qiskit/extensions/quantum_initializer/ucz.py | 25 ------------------- 6 files changed, 150 deletions(-) delete mode 100644 qiskit/extensions/quantum_initializer/diag.py delete mode 100644 qiskit/extensions/quantum_initializer/ucg.py delete mode 100644 qiskit/extensions/quantum_initializer/ucrot.py delete mode 100644 qiskit/extensions/quantum_initializer/ucx.py delete mode 100644 qiskit/extensions/quantum_initializer/ucy.py delete mode 100644 qiskit/extensions/quantum_initializer/ucz.py diff --git a/qiskit/extensions/quantum_initializer/diag.py b/qiskit/extensions/quantum_initializer/diag.py deleted file mode 100644 index f8cae74dad7f..000000000000 --- a/qiskit/extensions/quantum_initializer/diag.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The diagonal gate. - -This module is deprecated, see diagonal.py -""" - -import warnings -# pylint: disable=unused-import -from qiskit.extensions.quantum_initializer.diagonal import DiagGate, diag_gate - -warnings.warn('This module is deprecated. The DiagonalGate/DiagGate is now in diagonal.py', - category=DeprecationWarning, stacklevel=2) diff --git a/qiskit/extensions/quantum_initializer/ucg.py b/qiskit/extensions/quantum_initializer/ucg.py deleted file mode 100644 index 980d54013b5e..000000000000 --- a/qiskit/extensions/quantum_initializer/ucg.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The uniformly controlled gate. - -This module is deprecated, see uc.py. -""" - -import warnings -# pylint: disable=unused-import -from qiskit.extensions.quantum_initializer.uc import UCG, ucg - -warnings.warn('This module is deprecated. The UCGate/UCG can now be found in uc.py', - category=DeprecationWarning, stacklevel=2) diff --git a/qiskit/extensions/quantum_initializer/ucrot.py b/qiskit/extensions/quantum_initializer/ucrot.py deleted file mode 100644 index 514a86f7d471..000000000000 --- a/qiskit/extensions/quantum_initializer/ucrot.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The uniformly controlled Pauli rotation gate. - -This module is deprecated, see uc_pauli_rot.py -""" - -import warnings -# pylint: disable=unused-import -from qiskit.extensions.quantum_initializer.uc_pauli_rot import UCRot - -warnings.warn('This module is deprecated. The UCPauliRotGate/UCRot is now in uc_pauli_rot.py', - category=DeprecationWarning, stacklevel=2) diff --git a/qiskit/extensions/quantum_initializer/ucx.py b/qiskit/extensions/quantum_initializer/ucx.py deleted file mode 100644 index 9da13eda5d28..000000000000 --- a/qiskit/extensions/quantum_initializer/ucx.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The uniformly controlled RX gate. - -This module is deprecated, see ucrx.py -""" - -import warnings -# pylint: disable=unused-import -from qiskit.extensions.quantum_initializer.ucrx import UCX, ucx - -warnings.warn('This module is deprecated. The UCRXGate/UCX can now be found in ucrx.py', - category=DeprecationWarning, stacklevel=2) diff --git a/qiskit/extensions/quantum_initializer/ucy.py b/qiskit/extensions/quantum_initializer/ucy.py deleted file mode 100644 index f993508bcd46..000000000000 --- a/qiskit/extensions/quantum_initializer/ucy.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The uniformly controlled RY gate. - -This module is deprecated, see ucry.py -""" - -import warnings -# pylint: disable=unused-import -from qiskit.extensions.quantum_initializer.ucry import UCY, ucy - -warnings.warn('This module is deprecated. The UCRYGate/UCY can now be found in ucry.py', - category=DeprecationWarning, stacklevel=2) diff --git a/qiskit/extensions/quantum_initializer/ucz.py b/qiskit/extensions/quantum_initializer/ucz.py deleted file mode 100644 index b3ca60da5ee1..000000000000 --- a/qiskit/extensions/quantum_initializer/ucz.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2020. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""The uniformly controlled RZ gate. - -This module is deprecated, see ucrz.py -""" - -import warnings -# pylint: disable=unused-import -from qiskit.extensions.quantum_initializer.ucrz import UCZ, ucz - -warnings.warn('This module is deprecated. The UCRZGate/UCZ can now be found in ucrz.py', - category=DeprecationWarning, stacklevel=2) From 5a346d57729e1a0421305b37b65ff847c18dd3cb Mon Sep 17 00:00:00 2001 From: Cryoris Date: Fri, 19 Jun 2020 09:01:29 +0200 Subject: [PATCH 4/7] rm unused import --- qiskit/circuit/library/standard_gates/i.py | 1 - 1 file changed, 1 deletion(-) diff --git a/qiskit/circuit/library/standard_gates/i.py b/qiskit/circuit/library/standard_gates/i.py index 84fd950e3f5a..5efc2e2bf03f 100644 --- a/qiskit/circuit/library/standard_gates/i.py +++ b/qiskit/circuit/library/standard_gates/i.py @@ -14,7 +14,6 @@ """Identity gate.""" -import warnings import numpy from qiskit.circuit.gate import Gate From de29bb119b48530aeeee42e0a0b8459490ace79f Mon Sep 17 00:00:00 2001 From: Cryoris Date: Fri, 26 Jun 2020 10:46:49 +0200 Subject: [PATCH 5/7] add reno --- .../notes/removing-deprecated-gates-ecb7d0fc37617078.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 releasenotes/notes/removing-deprecated-gates-ecb7d0fc37617078.yaml diff --git a/releasenotes/notes/removing-deprecated-gates-ecb7d0fc37617078.yaml b/releasenotes/notes/removing-deprecated-gates-ecb7d0fc37617078.yaml new file mode 100644 index 000000000000..22f2a56c644a --- /dev/null +++ b/releasenotes/notes/removing-deprecated-gates-ecb7d0fc37617078.yaml @@ -0,0 +1,8 @@ +--- +deprecations: + - | + The submodule ``qiskit.extensions.standard`` has been removed along with + the deprecated gates in ``qiskit.extensions.quantum_initializer``. + The correct import location for the standard gates is + ``qiskit.circuit.library``, or ``qiskit.circuit.library.standard_gates``. + All gates continue to be importable from ``qiskit.extensions``. From 8db99f47f6b7517aa28c4a1960d7a5691f58dd3b Mon Sep 17 00:00:00 2001 From: Cryoris Date: Wed, 12 Aug 2020 17:48:04 +0200 Subject: [PATCH 6/7] don't use Cnot --- test/python/transpiler/test_faulty_backend.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/python/transpiler/test_faulty_backend.py b/test/python/transpiler/test_faulty_backend.py index 62065ab5dbba..6454573c4801 100644 --- a/test/python/transpiler/test_faulty_backend.py +++ b/test/python/transpiler/test_faulty_backend.py @@ -20,7 +20,7 @@ from qiskit.compiler import transpile from qiskit.test import QiskitTestCase from qiskit.converters import circuit_to_dag -from qiskit.extensions.standard import CnotGate +from qiskit.circuit.library import CXGate from qiskit.transpiler import TranspilerError from ..providers.faulty_backends import FakeOurenseFaultyQ1, FakeOurenseFaultyCX01, \ FakeOurenseFaultyCX13 @@ -60,7 +60,7 @@ class TestFaultyCX01(TestFaultyBackendCase): def assertIdleCX01(self, circuit): """Asserts the CX(0, 1) (and symmetric) is not used in the circuit""" physical_qubits = QuantumRegister(5, 'q') - cx_nodes = circuit_to_dag(circuit).op_nodes(CnotGate) + cx_nodes = circuit_to_dag(circuit).op_nodes(CXGate) for node in cx_nodes: if set(node.qargs) == {physical_qubits[0], physical_qubits[1]}: raise AssertionError('Faulty CX(Q0, Q1) (or symmetric) is being used.') @@ -127,7 +127,7 @@ class TestFaultyCX13(TestFaultyBackendCase): def assertIdleCX13(self, circuit): """Asserts the CX(1, 3) (and symmetric) is not used in the circuit""" physical_qubits = QuantumRegister(5, 'q') - cx_nodes = circuit_to_dag(circuit).op_nodes(CnotGate) + cx_nodes = circuit_to_dag(circuit).op_nodes(CXGate) for node in cx_nodes: if set(node.qargs) == {physical_qubits[1], physical_qubits[3]}: raise AssertionError('Faulty CX(Q1, Q3) (or symmetric) is being used.') From 51de95302201f38d91bf6a807848b57b0efab6a5 Mon Sep 17 00:00:00 2001 From: Cryoris Date: Thu, 13 Aug 2020 09:14:01 +0200 Subject: [PATCH 7/7] remove deprecated iden method --- qiskit/circuit/quantumcircuit.py | 9 --------- .../removing-deprecated-gates-ecb7d0fc37617078.yaml | 3 ++- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/qiskit/circuit/quantumcircuit.py b/qiskit/circuit/quantumcircuit.py index cd21f470952d..15f937bcc788 100644 --- a/qiskit/circuit/quantumcircuit.py +++ b/qiskit/circuit/quantumcircuit.py @@ -1957,15 +1957,6 @@ def id(self, qubit, *, q=None): # pylint: disable=invalid-name,unused-argument """Apply :class:`~qiskit.circuit.library.IGate`.""" return self.i(qubit) - @deprecate_arguments({'q': 'qubit'}) - def iden(self, qubit, *, q=None): # pylint: disable=unused-argument - """Deprecated identity gate.""" - warnings.warn('The QuantumCircuit.iden() method is deprecated as of 0.14.0, and ' - 'will be removed no earlier than 3 months after that release date. ' - 'You should use the QuantumCircuit.i() method instead.', - DeprecationWarning, stacklevel=2) - return self.i(qubit) - def ms(self, theta, qubits): # pylint: disable=invalid-name """Apply :class:`~qiskit.circuit.library.MSGate`.""" from .library.standard_gates.ms import MSGate diff --git a/releasenotes/notes/removing-deprecated-gates-ecb7d0fc37617078.yaml b/releasenotes/notes/removing-deprecated-gates-ecb7d0fc37617078.yaml index 22f2a56c644a..d1c93e6bfb8e 100644 --- a/releasenotes/notes/removing-deprecated-gates-ecb7d0fc37617078.yaml +++ b/releasenotes/notes/removing-deprecated-gates-ecb7d0fc37617078.yaml @@ -3,6 +3,7 @@ deprecations: - | The submodule ``qiskit.extensions.standard`` has been removed along with the deprecated gates in ``qiskit.extensions.quantum_initializer``. - The correct import location for the standard gates is + The correct import location for the standard gates is ``qiskit.circuit.library``, or ``qiskit.circuit.library.standard_gates``. All gates continue to be importable from ``qiskit.extensions``. + Also, the deprecated ``QuantumCircuit.iden`` method has been removed.