4
$\begingroup$

I am currently going through Nielsen's QC bible and having still some foundational / conceptual problems with the matter.

Nielsen Quantum Computing

I have tried to retrieve this $8 {\times} 8$ matrix describing the QFT of 3 qubits via Kronecker product in various attempts.

Hadamard transform can be decomposed into $H \otimes 1 \otimes 1$, and the others are fundamentally kronecker products of the 4x4 matrices of S resp. T with the 2x2 identity.

Whats wrong with my approach?

EDIT:

$T\text{=}\left( \begin{array}{cccccccc} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & e^{\frac{\pi i}{4}} & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & e^{\frac{\pi i}{4}} \\ \end{array} \right)$

which is derived from $R_k = \left( \begin{array}{cc} 1 & 0 \\ 0 & e^{2 i \pi /2^k} \\ \end{array} \right)$, being $S$ for $k=1$ and $T$ for $k=2$.

EDIT 2:

The controlled T-operation can be represented in computational basis as

$\left( \begin{array}{cccc} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & e^{2 \pi i / 2^k } \\ \end{array} \right)$.

EDIT 3:

In mathematica, one faulty calculation of mine is:

$\text{SWAP}\text{=}\left( \begin{array}{cccccccc} 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ \end{array} \right)$

SWAP*KroneckerProduct[IdentityMatrix[2], IdentityMatrix[2], H]KroneckerProduct[IdentityMatrix[2], S] KroneckerProduct[ IdentityMatrix[2], H, IdentityMatrix[2]] * T KroneckerProduct[S, IdentityMatrix[2]] KroneckerProduct[H, IdentityMatrix[2], IdentityMatrix[2]] // MatrixForm

which gives:

$\left( \begin{array}{cccccccc} \frac{1}{2 \sqrt{2}} & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & -\frac{1}{2 \sqrt{2}} & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & \frac{e^{\frac{i \pi }{2}}}{2 \sqrt{2}} & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & -\frac{e^{\frac{i \pi }{2}} i^2}{2 \sqrt{2}} \\ \end{array} \right)$

$\endgroup$
  • $\begingroup$ when you say "the others are fundamentally kronecker products of the 4x4 matrices of S resp. T with the 2x2 identity", what 8x8 matrix are you using for the controlled-T operation? I suspect if you tell us that, we'll have more hope of identifying your troubles! $\endgroup$ – DaftWullie May 31 '18 at 14:43
  • $\begingroup$ controlled-$T$ is a $2$-qubit operation, so its matrix should be $4\times 4$. If you want to add the third qubit, then you apply the identity. $\endgroup$ – Josu Etxezarreta Martinez May 31 '18 at 14:57
  • $\begingroup$ @JosuEtxezarretaMartinez Yes, but in this particular case, that identity has to be added in the middle, not at either end. $\endgroup$ – DaftWullie May 31 '18 at 15:03
  • $\begingroup$ So, that looks OK. The next things to check are that you're multiplying the matrices together in the right order (remembering the diagram reads left to right, but you multiply matrices right to left). If that's your problem, you'll just have the transpose of what you want $\endgroup$ – DaftWullie May 31 '18 at 15:13
  • $\begingroup$ You're doing this in Mathematica? Are you really using the * operation (element by element multiplication), rather than matrix multiplication, as given by .? $\endgroup$ – DaftWullie May 31 '18 at 15:28
2
$\begingroup$

The tensor products for the individual gates are all being calculated correctly, and the matrices are being multiplied in the correct order. In this case, it turns out that it is a Mathematica programming error, using the * operator for element-by-element multiplication of matrices rather than matrix multiplication. The first clue was that the overall output was not even unitary, even though the individual gates seemed to be correct.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.