Example #1
0
def qft_be(self, qreg: QRegisterBE, qcirc: QuantumCircuit) -> QFTGate:
    """Add a QFTGate."""
    self._check_qreg(qreg)
    gate = self._attach(QFTGate(qreg, qcirc))
    # Here the QFT algorithm reversed the endianness, so as we don't want some
    # register with a strange behaviour (registers of type QRegisterBE that are
    # in little-endian for example), we reverse the endianness.
    qreg._reverse_access_endian()
    return gate
Example #2
0
def iqft_be(self, qreg: QRegisterBE, qcirc: QuantumCircuit) -> QFTGate:
    """Add an inverted QFTBEGate."""
    self._check_qreg(qreg)
    # The QFT algorithm reverse the endianness, so the inverse QFT algorithm
    # also
    # and as it is the inverse algorithm, the endianness swap should occurs
    # before
    # the inverse QFT algorithm.
    qreg._reverse_access_endian()
    return self._attach(QFTGate(qreg, qcirc).inverse())
Example #3
0
def iapproximate_qft_be(self, qreg: QRegisterBE, qcirc: QuantumCircuit,
                        approximation: int = None) -> ApproximateQFTGate:
    """Add an inverted ApproximateQFTGate."""
    self._check_qreg(qreg)
    # The QFT algorithm reverse the endianness, so the inverse QFT algorithm
    # also
    # and as it is the inverse algorithm, the endianness swap should occurs
    # before
    # the inverse QFT algorithm.
    qreg._reverse_access_endian()
    return self._attach(
        ApproximateQFTGate(qreg, qcirc, approximation).inverse())