(self)
return circuit
Decomposes IQFT into elementary gates.
Decomposes IQFT into elementary gates.
Decomposes IQFT into elementary gates .
def decompose(self):
        """Decomposes IQFT into elementary gates."""
        start = self.args[0]
        finish = self.args[1]
        circuit = 1
        for i in range((finish - start)//2):
            circuit = SwapGate(i + start, finish - i - 1)*circuit
        for level in range(start, finish):
            for i in reversed(range(level - start)):
                circuit = CGate(level - i - 1, RkGate(level, -i - 2))*circuit
            circuit = HadamardGate(level)*circuit
        return circuit
def decompose ( self ) : start = self . args [ 0 ] finish = self . args [ 1 ] circuit = 1 for i in range ( ( finish - start ) // 2 ) : circuit = SwapGate ( i + start , finish - i - 1 ) * circuit for level in range ( start , finish ) : for i in reversed ( range ( level - start ) ) : circuit = CGate ( level - i - 1 , RkGate ( level , - i - 2 ) ) * circuit circuit = HadamardGate ( level ) * circuit return circuit