-
Notifications
You must be signed in to change notification settings - Fork 59
Create a notebook for quantum modular arithmetic #1531
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
base: main
Are you sure you want to change the base?
Conversation
8351cca
to
476afec
Compare
neat! isn't there a helper function you introduced that will automatically exhaustively test classical gates? Would probably be neat to have a small, exhaustive and large, fuzzed example for each maybe the "leading order" symbolics helper can be factored out into the sympy support utils |
What about clearly segregating the "reference data" from the checks. add1 = {
bloq: ModAdd(bitsize=8, mod=3),
domain: {'x': range(3), 'y': range(3)},
tof: sympify('4*n'), # Ref 1, Fig 8, "mod add"
exhaustive: True
}
add2 = {
bloq: ModAdd(bitsize=2048, mod=13*15),
...
exhaustive: False
}
...
for data in [add1, add2, ...]:
check_classical(add1)
# >> checking ModAdd(bitsize=8, mod=3)....
# >> exhaustive classical action ✓
check_cost(add1)
# >> reference cost: 4n
# >> computed toffli cost: 4n + 32 + lg(mod)
# >> leading order cost: 4n ✓ |
Is there a straightforward way to get the classical domain from the bloq? Ideally you could just query the classical domain from the data types but e.g. for mod add there are additional restrictions. Should we be using a bounded quint here? It would also be nice if the constructors always took consistent-ish attributes so we could always have one example where we pass in a the same, small qdtype with exhaustive checking and one example where we pass in the same, large qdtype with fuzz testing |
A passing comment -- We should also consider using the QGF(q) type where q is a prime for mod arithmetic. QGF is the correct general type for arbitrary prime and extension fields. We should prefer that over bounded QUINT. |
No description provided.