(self, basis, **options)
return matrixFT
Represents the (I)QFT In the Z Basis
Represents the (I)QFT In the Z Basis
Represents the ( I ) QFT In the Z Basis
def _represent_ZGate(self, basis, **options):
        """
            Represents the (I)QFT In the Z Basis
        """
        nqubits = options.get('nqubits', 0)
        if nqubits == 0:
            raise QuantumError(
                'The number of qubits must be given as nqubits.')
        if nqubits < self.min_qubits:
            raise QuantumError(
                'The number of qubits %r is too small for the gate.' % nqubits
            )
        size = self.size
        omega = self.omega

        #Make a matrix that has the basic Fourier Transform Matrix
        arrayFT = [[omega**(
            i*j % size)/sqrt(size) for i in range(size)] for j in range(size)]
        matrixFT = Matrix(arrayFT)

        #Embed the FT Matrix in a higher space, if necessary
        if self.label[0] != 0:
            matrixFT = matrix_tensor_product(eye(2**self.label[0]), matrixFT)
        if self.min_qubits < nqubits:
            matrixFT = matrix_tensor_product(
                matrixFT, eye(2**(nqubits - self.min_qubits)))

        return matrixFT
def _represent_ZGate ( self , basis , * * options ) : nqubits = options . get ( 'nqubits' , 0 ) if nqubits == 0 : raise QuantumError ( 'The number of qubits must be given as nqubits.' ) if nqubits < self . min_qubits : raise QuantumError ( 'The number of qubits %r is too small for the gate.' % nqubits ) size = self . size omega = self . omega #Make a matrix that has the basic Fourier Transform Matrix arrayFT = [ [ omega ** ( i * j % size ) / sqrt ( size ) for i in range ( size ) ] for j in range ( size ) ] matrixFT = Matrix ( arrayFT ) #Embed the FT Matrix in a higher space, if necessary if self . label [ 0 ] != 0 : matrixFT = matrix_tensor_product ( eye ( 2 ** self . label [ 0 ] ) , matrixFT ) if self . min_qubits < nqubits : matrixFT = matrix_tensor_product ( matrixFT , eye ( 2 ** ( nqubits - self . min_qubits ) ) ) return matrixFT