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
When I first looked through the documentation, I found this example on the Manual page:
apply!(s, tCNOT, [4,2])
This became the basis for how I thought to use apply!(). For a while, I could not figure out how to use apply!() to apply a simple X gate to qubit (let's say qubit 2). The documentation says that sX is supported by apply!(), but using only the aforementioned example as a base, you'd get an error if you tried:
apply!(s, sX, [2])
I now know that I should do apply!(s, sX(2)), but this perhaps is unintuitive to some people. My suggestion is to either make applying various gates with apply!() uniform in how to provide arguments, or at least provide some more explanations and simple examples early in the documentation so that it's more clear how to apply gates.
The text was updated successfully, but these errors were encountered:
Good point! We should probably define a few methods that raise errors. Something along the lines of
apply!(s, ::Type{<:AbstractSymbolicOperator}, indices) = error("The point of symbolic operators like $(...) is to be able to contain the indices withing the operator object. Please use `apply!(s, $(...)(indices...))`")
apply!(s, ::AbstractSymbolicOperator, indices) = # similar to the error from above
apply!(s, ::CliffordOperator) = error("If you want to use a dense `CliffordOperator`, you need to specify on which qubits it acts, e.g. ...")
When I first looked through the documentation, I found this example on the Manual page:
apply!(s, tCNOT, [4,2])
This became the basis for how I thought to use apply!(). For a while, I could not figure out how to use apply!() to apply a simple X gate to qubit (let's say qubit 2). The documentation says that sX is supported by apply!(), but using only the aforementioned example as a base, you'd get an error if you tried:
apply!(s, sX, [2])
I now know that I should do apply!(s, sX(2)), but this perhaps is unintuitive to some people. My suggestion is to either make applying various gates with apply!() uniform in how to provide arguments, or at least provide some more explanations and simple examples early in the documentation so that it's more clear how to apply gates.
The text was updated successfully, but these errors were encountered: