-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Improves An introduction to algorithms #1445
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
I have added few necessary links and changed images to SVG. |
"\n", | ||
"Algorithms are configurable and often part of the configuration will be in the form of smaller building blocks, of which different instances of the building block type can be given. For instance with `VQE`, the Variational Quantum Eigensolver, it takes a trial wavefunction, in the form of a `QuantumCircuit` and a classical optimizer among other things.\n", | ||
"Algorithms are configurable and often part of the configuration will be in the form of smaller building blocks, of which different instances of the building block type can be given. For instance with [`VQE`](https://qiskit.org/documentation/stubs/qiskit.algorithms.VQE.html#qiskit.algorithms.VQE), the Variational Quantum Eigensolver, it takes a trial wavefunction, in the form of a [`QuantumCircuit`](https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.html#quantumcircuit) and a classical optimizer among other things.\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is the old, now deprecated VQE that used QuantumInstance. This is the new Estimator based VQE https://qiskit.org/documentation/stubs/qiskit.algorithms.minimum_eigensolvers.VQE.html#qiskit.algorithms.minimum_eigensolvers.VQE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for looking over this, looks good to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for adding the cross-reference. Can you remove the backticks '`' around the methods when links are added? This is a known bug with nbsphinx and sphinx that the resulting html will render like the following when backticks and a link are added, even though your local jupyter notebook (and ReviewNB) render correctly.
As a tip, check the output by building the doc locally or check the artifact generated by the CI tests in the PR (see the images below to download artifact).
After downloading the artifcat, unzip and open index.html
and find the pages that you made changes to check the changes render as expected.
@@ -15,11 +15,11 @@ | |||
"source": [ | |||
"## How is the algorithm library structured?\n", | |||
"\n", | |||
"Qiskit provides a number of [Algorithms](https://qiskit.org/documentation/apidoc/algorithms.html) and they are grouped by category according to the task they can perform. For instance `Minimum Eigensolvers` to find the smallest eigen value of an operator, for example ground state energy of a chemistry Hamiltonian or a solution to an optimization problem when expressed as an Ising Hamiltonian. There are `Time Evolvers` for the time evolution of quantum systems and `Amplitude Estimators` for value estimation that can be used say in financial applications. The full set of categories can be seen in the Algorithms documentation link above.\n", | |||
"Qiskit provides a number of [Algorithms](https://qiskit.org/documentation/apidoc/algorithms.html) and they are grouped by category according to the task they can perform. For instance [`Minimum Eigensolvers`](https://qiskit.org/documentation/stubs/qiskit.algorithms.minimum_eigensolvers.html#module-qiskit.algorithms.minimum_eigensolvers) to find the smallest eigen value of an operator, for example ground state energy of a chemistry Hamiltonian or a solution to an optimization problem when expressed as an Ising Hamiltonian. There are [`Time Evolvers`](https://qiskit.org/documentation/apidoc/algorithms.html#time-evolvers) for the time evolution of quantum systems and [`Amplitude Estimators`](https://qiskit.org/documentation/apidoc/algorithms.html#amplitude-estimators) for value estimation that can be used say in financial applications. The full set of categories can be seen in the Algorithms documentation link above.\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Qiskit provides a number of [Algorithms](https://qiskit.org/documentation/apidoc/algorithms.html) and they are grouped by category according to the task they can perform. For instance [`Minimum Eigensolvers`](https://qiskit.org/documentation/stubs/qiskit.algorithms.minimum_eigensolvers.html#module-qiskit.algorithms.minimum_eigensolvers) to find the smallest eigen value of an operator, for example ground state energy of a chemistry Hamiltonian or a solution to an optimization problem when expressed as an Ising Hamiltonian. There are [`Time Evolvers`](https://qiskit.org/documentation/apidoc/algorithms.html#time-evolvers) for the time evolution of quantum systems and [`Amplitude Estimators`](https://qiskit.org/documentation/apidoc/algorithms.html#amplitude-estimators) for value estimation that can be used say in financial applications. The full set of categories can be seen in the Algorithms documentation link above.\n", | |
"Qiskit provides a number of [Algorithms](https://qiskit.org/documentation/apidoc/algorithms.html) and they are grouped by category according to the task they can perform. For instance [`Minimum Eigensolvers`](https://qiskit.org/documentation/stubs/qiskit.algorithms.minimum_eigensolvers.html#module-qiskit.algorithms.minimum_eigensolvers) to find the smallest eigen value of an operator, for example ground state energy of a chemistry Hamiltonian or a solution to an optimization problem when expressed as an Ising Hamiltonian. There are [Time Evolvers](https://qiskit.org/documentation/apidoc/algorithms.html#time-evolvers) for the time evolution of quantum systems and [Amplitude Estimators](https://qiskit.org/documentation/apidoc/algorithms.html#amplitude-estimators) for value estimation that can be used say in financial applications. The full set of categories can be seen in the Algorithms documentation link above.\n", |
Can you remove the backticks '`' around the methods when links are added? See the main PR review comment for the reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I thought if it had rendered correctly on Github then it would be fine but as you said there's a bug that is creating a problem then I would remove them.
Also, thanks for suggesting about artifact generated by the CI tests as I was not aware about that bug so I didn't check that but will fix this now.
@HuangJunye I have checked the docs locally and it's working fine now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This looks good to me. Can you please confirm you're happy with this? If so, I'll set to merge.
Yeah Sure, Please go Ahead |
This PR is ready for review. |
<!--⚠️ If you do not respect this template, your pull request will be closed.⚠️ Your pull request title should be short detailed and understandable for all.⚠️ If your pull request fixes an open issue, please link to the issue. ✅ I have added the tests to cover my changes. ✅ I have updated the documentation accordingly. ✅ I have read the CONTRIBUTING document. --> ### Summary I have coded a script which (when directory is specified) checks for the broken links in the Jupyter notebooks and tells its exact place and the error it shows. ``` import os import nbformat as nbf import re import requests # Code to populate file_list with relevant .ipynb files file_list = [] for root, dirs, files in os.walk("qiskit-tutorials/tutorials/"): for file in files: if file.endswith(".ipynb"): file_list.append(os.path.join(root, file)) # Including the relative path of the file INLINE_LINK_RE = re.compile(r'\[([^\]]+)\]\(([^)]+)\)') for file_path in file_list: try: with open(file_path) as file: nb = nbf.read(file, 4) except OSError as e: print(f"Error occurred while reading file: {file_path}") print("Error message:", str(e)) print() continue for cell in nb["cells"]: if cell["cell_type"] != "markdown": continue links = list(INLINE_LINK_RE.findall(cell["source"])) for link in links: if not link: continue link_text, link_url = link if link_url.lower().endswith(('.png', '.jpg', '.jpeg', '.gif')): continue # Skip image links try: response = requests.get(link_url) if response.status_code != 200: print(f"Broken link found in file: {file_path}") print(f"Link: {link_text}") print(f"URL: {link_url}") print("HTTP status code:", response.status_code) print() except requests.RequestException as e: print(f"Error occurred while checking link in file: {file_path}") print(f"Link: {link_text}") print(f"URL: {link_url}") print("Error message:", str(e)) print() ``` ### Details and comments This code is part of QAMP Project [Issues in Qiskit Tutorials #37](qiskit-advocate/qamp-spring-23#37) which can read many files at once and can find broken links with their exact position and error code it is showing. I ran this above code throughout the repo and checked each and every Jupyter notebook files, based on the output I have fixed many links. This PR is just the Last PR of the of project, which fixes the remaining broken links. All the other broken links are already fixed in the past PRs which are made throughout this project. #1445 #1446 #1467 #1483 #1484. This project also fixes #1402
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
### Summary This PR will improve the tutorial [01_algorithms_introduction](https://qiskit.org/documentation/tutorials/algorithms/01_algorithms_introduction.html) ### Details and comments fixes Qiskit/qiskit-tutorials#1402 Part of Qiskit/qiskit-tutorials#1401
Summary
This PR will improve the tutorial 01_algorithms_introduction
Details and comments
fixes #1402
Part of #1401