Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More intuitive documentation around applying gates to tableaux with apply!() #106

Open
amicciche opened this issue Apr 22, 2023 · 1 comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@amicciche
Copy link
Member

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.

@Krastanov
Copy link
Member

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. ...")

@Krastanov Krastanov added documentation Improvements or additions to documentation good first issue Good for newcomers labels Apr 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants