Should I declare Hadamard gate before calling the Basis Encoding method #1613
Replies: 2 comments
-
Hi @HuangChiEn! I believe this is working as expected, no Hadamard is needed 🙂 With the basis embedding, we are associating each input with a computational basis of the qubit system. For example, consider input data PauliX(0)
PauliX(3) For more details, check out the PennyLane glossary :) |
Beta Was this translation helpful? Give feedback.
-
@HuangChiEn hope this helps! If you have any other questions, please feel free to open a post over at the PennyLane discussion forum. The forum is actively moderated and visited by PennyLane developers, unlike the GitHub discussion forum. |
Beta Was this translation helpful? Give feedback.
-
While I saw the source code of Basis encoding, I just wonder that should I declare Hadamard gate before calling the Basis Encoding method ? Since the Basis Encoding just wraps the non-zero bit with the PauliX gate (bit flip), while it does not work without putting the initial state into superposition.
By the way, I also have no idea how to put the suitable place (wires) of Hadamard gate, the number of Hadamard gate depends on the number of data you have.
However, the measurement result will be various according to the place you set the Hadamard gate.
For example, see the pennylane tutorial :
tutorial
I solve it, and I should place the H gate on the q1 wires, but I would not solve it every time manually, especially in the multi-qubit (e.g. num_qubit=16) !!
Any suggestion will be appreciated !!
Beta Was this translation helpful? Give feedback.
All reactions