Closed Zshan0 closed 2 years ago
@Zshan0 This is great! My only particular point to add is that dump_callback()
and dump_ids_callback()
should not have the self
parameter, because they are specifically C callbacks, called from the Python code by the underlying C++ Qrack library itself, believe it or not. If you could revert just those two self
parameters, we'll get this right in!
I'm suggesting a few changes that could be discussed and bundled together in this PR itself.
permutation_expectation
here must return the value result
. The same applies for joint_ensemble_probability
. If that is the correct behavior, I'll just add it to this PR.Another suggestion that I would make is that the upcoming unitary hack is a good opportunity to add tests/CI for pyqrack :D
@Zshan0 Correct, permutation_expectation()
and joint_ensemble_probability()
should return their result
, after the shared C library interface is polled for exception. As for the ctypes
wildcard import, you can go ahead and import the explicit ctypes
native type classes that we use, if you like.
I can do import ctypes
and make changes from c_ulonglong
to ctypes.c_ulonlong
rather than importing all the required classes, whatever you think would be better :)
Honestly, you're probably more aware of Python standards than I am, so I leave the choice for ctypes
to your best judgement! (I'm basically a C++ developer providing an interface, in this case.)
There were a few minor bugs that went unnoticed, a few more of them persist that require discussion that can be continued on this thread before it is merged with the main branch.