Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions qiskit/circuit/library/standard_gates/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,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
74 changes: 0 additions & 74 deletions qiskit/circuit/library/standard_gates/boolean_logical_gates.py

This file was deleted.

24 changes: 1 addition & 23 deletions qiskit/circuit/library/standard_gates/i.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,11 @@

"""Identity gate."""

import warnings
import numpy
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,
Expand Down Expand Up @@ -62,14 +51,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__()
24 changes: 1 addition & 23 deletions qiskit/circuit/library/standard_gates/rx.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,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:**
Expand Down Expand Up @@ -215,15 +205,3 @@ def to_matrix(self):
[-isin, 0, cos, 0],
[0, 0, 0, 1]],
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)
24 changes: 1 addition & 23 deletions qiskit/circuit/library/standard_gates/ry.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,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:**
Expand Down Expand Up @@ -210,15 +200,3 @@ def to_matrix(self):
[sin, 0, cos, 0],
[0, 0, 0, 1]],
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)
24 changes: 1 addition & 23 deletions qiskit/circuit/library/standard_gates/rz.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,7 @@ def to_matrix(self):
[0, np.exp(ilam2)]], 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
Expand Down Expand Up @@ -226,15 +216,3 @@ def to_matrix(self):
[0, 0, numpy.exp(arg), 0],
[0, 0, 0, 1]],
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)
24 changes: 1 addition & 23 deletions qiskit/circuit/library/standard_gates/swap.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,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:**
Expand Down Expand Up @@ -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__()
24 changes: 1 addition & 23 deletions qiskit/circuit/library/standard_gates/u1.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,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
Expand Down Expand Up @@ -237,18 +227,6 @@ def to_matrix(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.

Expand Down
24 changes: 1 addition & 23 deletions qiskit/circuit/library/standard_gates/u3.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,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).
Expand Down Expand Up @@ -231,18 +221,6 @@ def to_matrix(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:
Expand Down
Loading