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

Add tutorial 13_trotterQRTE.ipynb #66

Merged
merged 13 commits into from
Aug 24, 2023

Conversation

ialsina
Copy link
Contributor

@ialsina ialsina commented Aug 23, 2023

Summary

Qiskit Algorithms tutorial for Trotter QRTE.

Details and comments

The original discussion can be found in the original Qiskit PR.

@CLAassistant
Copy link

CLAassistant commented Aug 23, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@woodsp-ibm woodsp-ibm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI is failing due to the fact that we spell check content that becomes part of the published docs and this ends up failing. Colorplot, I mentioned in the review below, is a title I think we can alter to fix that and at the same time make it more informative as a title. Others like exponentials and the names should be added the .pylintdict in the root (lowercase and in alphabetic order so its easier for us to manage). The spelling failures are in the CI build details. Names we often end up doing this with - and sometimes with plurals exponentials - its an adjective which I guess is why the dictionary does not have a plural form - but I get that its used sometimes as you have it so adding it to the dict will allow it to stay like this ie matrix exponentials

docs/tutorials/13_trotterQRTE.ipynb Outdated Show resolved Hide resolved
docs/tutorials/13_trotterQRTE.ipynb Outdated Show resolved Hide resolved
docs/tutorials/13_trotterQRTE.ipynb Outdated Show resolved Hide resolved
}
],
"source": [
"result.evolved_state"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to print this here so it can be seen as a circuit. As it stands currently this cell does output something <qiskit.circuit.quantumcircuit.QuantumCircuit at 0x7f3146a42d50> but its just the name/instance. That can be suppressed (add a trailing ; to the line) but maybe printing the circuit would be better for the reader?

Copy link
Contributor Author

@ialsina ialsina Aug 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are totally right about this cell output. Nothing ended up convincing me. There was already a comment in the original discussion that was never resolved. Let me paste part of it below:

[...] I would draw the quantum circuit, using 'mpl' as the output argument. However, this quantum circuit isn't composed of standard gates. One would need to decompose it two times, and then decompose it specifying which gates to decompose, via a line like result.evolved_state.decompose(reps=2).decompose('disentangler_dg').decompose('multiplex1_reverse_dg').draw('mpl')
but this seems a bit specific for a tutorial like this. For this reason, I decided to show that it is (an instance of) a QuantumCircuit. [...]

I attach below a couple of images that will hopefully give an impression of why I am not a big fan of this solution. Let me know what are your thoughts on this! :)

image
image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest drawing both the "raw" output of evolved_state and the decomposed version + a short explanation of why we are decomposing (to show the standard gates that are used in this circuit).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After a brief chat with Elena, for now we are going with both: result.evolved_state.draw('mpl') and the version that brings all gates to standard Circuit Library gates. That comes in commit 0d31c9f. 👍

docs/tutorials/13_trotterQRTE.ipynb Outdated Show resolved Hide resolved
docs/tutorials/13_trotterQRTE.ipynb Outdated Show resolved Hide resolved
Copy link
Member

@woodsp-ibm woodsp-ibm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is all the other link formatting issues like the one I first commented on - not sure if you saw the note I had put in there about others.

docs/tutorials/13_trotterQRTE.ipynb Outdated Show resolved Hide resolved
docs/tutorials/13_trotterQRTE.ipynb Outdated Show resolved Hide resolved
.pylintdict Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Aug 24, 2023

Pull Request Test Coverage Report for Build 5963765342

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 90.038%

Totals Coverage Status
Change from base Build 5953878576: 0.0%
Covered Lines: 6444
Relevant Lines: 7157

💛 - Coveralls

ElePT
ElePT previously approved these changes Aug 24, 2023
Copy link
Collaborator

@ElePT ElePT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you very much @ialsina for this great work. I will wait for @woodsp-ibm approval, but I think it's ready to be merged.

@woodsp-ibm
Copy link
Member

@ialsina LGTM - thanks for work and contributing this tutorial.

@mergify mergify bot merged commit 3d25648 into qiskit-community:main Aug 24, 2023
15 checks passed
@ialsina
Copy link
Contributor Author

ialsina commented Aug 24, 2023

@woodsp-ibm @ElePT Thank you for your reviews! From my side it was a pleasure :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants