I would like to create a n-dimensional Hadamard transform in Q# with n in set of even integers.
Asked
Active
Viewed 325 times
2 Answers
3
If you're looking to implement $H^\otimes$ (i.e., applying the Hadamard transform to each of the $n$ qubits), you can use library operation ApplyToEach:
using (register = Qubit[n]) {
ApplyToEach(H, register);
}
If you are indeed looking for quantum Fourier transform, as the other answer suggests, the Q# library operation that implements it is ApplyQuantumFourierTransform.

Mariia Mykhailova
- 9,010
- 1
- 12
- 39
-
thank you! if I have a register like |000>, |111> I would need to use quantum fourier transform? – Mridul Jun 26 '20 at 02:16
-
1That really depends on what you want to do with it. Quantum Fourier transform will prepare a superposition of basis states with complex amplitudes, applying an H gate - a superposition of basis states with amplitudes +1 and -1, depending on the input state. – Mariia Mykhailova Jun 26 '20 at 03:33
1
The higher order analog of Hadamard Transform is the Quantum Fourier Transform. You can learn more about it on Wikipedia.

Martin Vesely
- 13,891
- 4
- 28
- 65

vasjain
- 802
- 5
- 21
-
1I would rather said that Hadamard $n$ dimensional transform is equivalent to application of QFT on state $|0\rangle ^ {\otimes n}$. – Martin Vesely Jun 26 '20 at 06:59