Closed ArcaneArrowX closed 8 years ago
The Ket
class is made of two parts:
After a ket.Single()
, the CVec
you get back is just a pointer to the internal storage for the Ket
instance. That means that you can just use the ket.Qubits()
at that point to manipulate the qubits in any way you want (e.g., apply gates to any of the qubits in the Ket
).
Hi there, so my ultimate goal is to apply certain operations on a qudit (d-level quantum states) state. For instance, multiply the amplitude of the state |4> by a scalar. e.g. |4> to -|4>. Below is a simple code to get the equal superposition of 2^n states in a qudit CVec type.
I couldn't see how applying operations on a specific qudit state is possible by applying gates on post-Hadamard qs (type Qubits). Post Hadamard qs for n = 3 looks something like that
which can be expanded into
So applying any kinds of gate on these qubits before using the Single() command on the k will affect other qudit states that I do not want to touch. That is why I resolved to manipulating psi of CVec type which allows me to operate on a specific qudit states.
After all the operations have been done on psi, is there a pre-defined function/gate in LiQUi|> to convert this CVec type into Qubits type to be measured?