# How can I create an n-dimensional Hadamard transform in Q#?

I would like to create a n-dimensional Hadamard transform in Q# with n in set of even integers.

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.

• thank you! if I have a register like |000>, |111> I would need to use quantum fourier transform? Jun 26 '20 at 2:16
• That 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. Jun 26 '20 at 3:33

• I would rather said that Hadamard $n$ dimensional transform is equivalent to application of QFT on state $|0\rangle ^ {\otimes n}$. Jun 26 '20 at 6:59