You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
[<LQD>]
let __UserSample(n:int) =
let k = Ket(n)
let qs = k.Qubits
H >< qs
let mutable psi = k.Single()
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?
The text was updated successfully, but these errors were encountered:
The definition of the qubits that map to the state vector.
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?
The text was updated successfully, but these errors were encountered: