classiq-library icon indicating copy to clipboard operation
classiq-library copied to clipboard

Updated Glued Trees notebook to use Classiq's built in Pauli decomposition function

Open adam-godel opened this issue 1 year ago • 5 comments

Hello! Since Classiq recently added a built-in Pauli decomposition function matrix_to_hamiltonian, I have updated the glued trees notebook to include it instead of using Qiskit as a dependency. This means that all of the helper methods converting the Pauli list to Classiq's Hamiltonian object format are no longer necessary.

For the purpose of the (optional) caching used in the notebook, I have added the jsonpickle library to cache the Hamiltonian object directly as opposed to using a list of tuples which is then converted into the Hamiltonian object as was used previously.

Overall, I think this makes the notebook a lot cleaner and more focused on the actual quantum algorithm as opposed to type conversions. Let me know if you have any questions or if there is anything I need to fix!

adam-godel avatar Aug 12 '24 15:08 adam-godel

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@adam-godel Great contribution! 1 - in order for the test to pass, put !pip install jsonpickle in the notebook 2 - All latex except for the big matrix will be rendered correctly so better to leave it as latex and not as images

orsa-classiq avatar Aug 20 '24 14:08 orsa-classiq

@orsa-classiq I have made the requested changes! I think the test is still failing because the testing script can't locate the cache file, but I think it should be okay since it's not due to any changes from this pull request.

adam-godel avatar Aug 20 '24 15:08 adam-godel

It fails becuase of the tqdm package (I think the same trick of !pip install should work here)

orsa-classiq avatar Aug 20 '24 16:08 orsa-classiq

@orsa-classiq I have added it. I believe the test is still failing for the reason I stated above.

adam-godel avatar Aug 20 '24 18:08 adam-godel

@adam-godel Indeed now we got to the problem you said I've merge a potential fix. Please try to rebase and see if the test is solved now

orsa-classiq avatar Aug 22 '24 13:08 orsa-classiq