# How to perform this $d$-dimensional unitary operation on IBM Q?

$$U_{a,b}=\sum^{d-1}_{x=0}\omega^{bx}|x+a\rangle\langle x|$$,$$\omega=e^{\frac{2\pi i}{d}}$$,$$a,b\in\{0,1,2,...,d-1\}$$ Can someone please give me the pic of the quantum circuit?

• $a, b$ are like some fixed parameters? And you are looking for a generic circuit that performs $U_{a,b}$ for all possible values of $a$ and $b$? – tsgeorgios Oct 29 '20 at 10:32
• Yes,exactly. It's easy to perform it on 2-dimendision system,but I don't how to extend to high-dimensional – Williamyang Oct 29 '20 at 13:55

Since we are talking about a unitary operation on qubits, i assume $$d = 2^n$$ where $$n$$ is the number of qubits.

We define the unitary operations $$V_{a} = \sum_{x=0}^{d - 1} | x + a \rangle \langle x|$$ and $$D_{b} = \sum_{x=0}^{d - 1} \omega_d^{bx} | x \rangle \langle x|$$.

Notice that we can write $$U_{a, b} = V_a \cdot D_b$$.

In the Fourier basis (see here) we have $$QFT^{\dagger} \cdot V_a \cdot QFT = D_{-a}$$ since for a basis state $$|x \rangle$$ \begin{align*} V_a \cdot QFT \cdot |x \rangle &= V_a \cdot \frac{1}{\sqrt{d}} \sum_{k=0}^{d-1} \omega_d^{kx} |k \rangle \\ & = \frac{1}{\sqrt{d}} \sum_{k=0}^{d-1} \omega_d^{kx} |k + a\rangle \\ & = \frac{1}{\sqrt{d}} \sum_{k=0}^{d-1} \omega_d^{(k - a)x} |k \rangle \\ & = \omega_d^{-ax} QFT \cdot |x \rangle \end{align*} and so $$QFT^{\dagger} \cdot V_a \cdot QFT \cdot |x \rangle = D_{-a} \cdot |x \rangle$$ which proves the previous identity.

We conclude that is enough to implement $$D_b$$ and then $$U_{a, b} = QFT \cdot D_{-a} \cdot QFT^{\dagger} \cdot D_b$$

But since $$\omega_d^{b x} = \omega_d^{b \sum_{k=0}^{n-1} x_k 2^k} = \prod_{k=0}^{n-1} \omega_d^{b 2^k x_k}$$, it holds that

$$D_b |x \rangle = \omega_d^{b x} |x \rangle = \Big( \prod_{k=0}^{n-1} \omega_d^{b 2^k x_k} \Big) |x_{n-1} .. x_1 \rangle = \otimes_{k=0}^{n-1} \Big( \omega_d^{b 2^k x_k} |x_k \rangle \Big) = \otimes_{k=0}^{n-1} P_k |x_k \rangle$$

where $$P_k$$ are the single qubit phase gates $$P_k = \begin{bmatrix} 1 & 0 \\ 0 & e^{i\frac{2 \pi b \cdot 2^k}{d}} \end{bmatrix}$$

If you want to implement this in Qiskit, see QFT and Phase Gate and be careful with Qiskit convention that $$q_0$$ is the least significant qubit.

Here is the circuit for $$n = 3, a, b = 1$$ made in IBM Q: For different values of $$a, b$$ just multiply then angles of $$U1$$ gates in $$D_{-a}, D_b$$ by $$a, b$$ accordingly.

• I have one question: How to get $QFT^{\dagger} \cdot V_a \cdot QFT = D_{-a}$ by $QFT^{\dagger} \cdot V_a \cdot QFT \cdot |x \rangle = D_{-a} \cdot |x \rangle$ as it is calculation of matrices and vectors, not numbers. – Williamyang Mar 2 at 8:42
• Since the two matrices agree on every basis state $| x \rangle$ they must be equal. – tsgeorgios Mar 2 at 9:52