0

Consider the statevector $|\psi_1\rangle=(a_0,...,a_{N-1})^T$.

My goal is to shift the elements around to end up with $|\psi_2\rangle=(a_{3N/4},...,a_{N-1},a_0,...a_{N/2},\vec{\phi})^T$ where $\vec{\phi}$ represents the remaining elements in any order.

My question is, what gate operations do I need to implement to perform this operation?

thespaceman
  • 597
  • 6
  • 16

1 Answers1

2

In block notation, we can write $|\psi_1\rangle$ and $|\psi_2\rangle$ as $[A \quad B \quad C \quad D]^T$ and $[D \quad A \quad B \quad C ]^T$ respectively. So, it's a cyclic permutation of four elements which has the unitary:

$$\left( {\begin{array}{*{20}{c}} 0&0&0&1 \\ 1&0&0&0 \\ 0&1&0&0 \\ 0&0&1&0 \end{array}} \right)$$ And by inspecting the basis vectors of each block, we can easily note that the unitary should by applied to the last two qubits.

The below Qiskit code demonstrates the solution:

from qiskit.circuit import QuantumCircuit
from qiskit.quantum_info import Statevector
from qiskit.visualization import array_to_latex
import numpy as np

Define ψ_1

n = 4 data = [] for m in range(2 ** n): data.append(m)

norm_factor = np.linalg.norm(data)

psi_1 = Statevector(data / norm_factor)

Build the unitary

U = [ [0, 0, 0, 1], [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], ]

circ = QuantumCircuit(n) circ.unitary(U, [n - 2, n - 1])

Apply the operation

psi_2 = psi_1.evolve(circ)

Display the result

display(array_to_latex(norm_factor * psi_1.data, max_size=2 ** n)) display(array_to_latex(norm_factor * psi_2.data, max_size=2 ** n))

The result

$$\begin{bmatrix} 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 \\ \end{bmatrix}$$ $$\begin{bmatrix}12 & 13 & 14 & 15 & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 \\ \end{bmatrix}$$

Egretta.Thula
  • 11,986
  • 1
  • 13
  • 34