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

Library/arielsmoler/cad 25376/add solving qlsp with aqc notebook #688

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

arielsmoler
Copy link
Member

PR Description

Some notes

  • Please make sure that you placed the files in an appropriate folder

  • And that the files have indicative names.

  • Please note that Classiq runs automatic code linting, which may minorly alter some files.

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@@ -0,0 +1,7 @@
{
"friendly_name": "Solving QLSP wuth AQC - Part 1",
Copy link
Collaborator

Choose a reason for hiding this comment

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

*with - typo

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also I wouldn't call it 'Part 1'. In the IDE I would give it a stand-alone name. Maybe 'naive' or 'linear scheduling' or 'trotterization' etc

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch

@@ -0,0 +1,7 @@
{
Copy link
Collaborator

Choose a reason for hiding this comment

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

type in the filename
vqls -> qlsp

Copy link
Member Author

Choose a reason for hiding this comment

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

for sure1

@@ -0,0 +1,867 @@
{
Copy link
Collaborator

@orsa-classiq orsa-classiq Dec 29, 2024

Choose a reason for hiding this comment

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

"(see our AQC tutorial)." -> put a link to the tutorial

"2.1 Null Space of H0" -> contructing H0?

"bounded below by 1/k" -> bounded from below by 1/k. (maybe write each one of them in the previous sections instead here?). Don't forget to remove 'VERIFY'

maybe explain what is the Null space (in a few words, like: in the Null space, i.e. has eigenvalue 0)

"There exists a state " -> maybe there exist an additional state. I would explain that unlike the regular adiabatic algo usages, here this is not the ground state, and also there is a degeneracy in the number of states. The authors prove that if we start in the eigenstate |x> and evolve slowly enough, we will remain in this eigenstate path


Reply via ReviewNB

Copy link
Member Author

Choose a reason for hiding this comment

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

edited

@@ -0,0 +1,867 @@
{
Copy link
Collaborator

@orsa-classiq orsa-classiq Dec 29, 2024

Choose a reason for hiding this comment

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

Line #45.        HO_HAMILTONIAN = matrix_to_hamiltonian(H0)

I think that it is possible to use the prepare_state(b) to directly encode the exp(iH0*t) by using the phase operator, like the grover-diffuser, and the projector_controlled_phase operation in the qsvt.

You do something like:

A*B_dag*phase(t)*B*A_dag

where A = inplace_prepare_state(b, qvar)

B = aux = (qvar == 0)

phase(t) = phase(aux, t)

like:

within_apply(lambda: [inverse(inplace_prepare_state(b, 0, qvar),
                      assign(qvar==0, aux)],
             lambda: phase(aux * t, 1))

Reply via ReviewNB

Copy link
Member

Choose a reason for hiding this comment

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

Cool!! @orsa-classiq

Copy link
Member Author

Choose a reason for hiding this comment

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

this is super interesting!! and actually quite impressive - i tried to work my way through it but u will be happy to get a better understanding as it looks brilliant

@@ -0,0 +1,867 @@
{
Copy link
Collaborator

@orsa-classiq orsa-classiq Dec 29, 2024

Choose a reason for hiding this comment

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

I would also add a zoom-in picture to the y values [-1.3, 1.3]


Reply via ReviewNB

Copy link
Member Author

Choose a reason for hiding this comment

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

added :)

@@ -0,0 +1,867 @@
{
Copy link
Collaborator

@orsa-classiq orsa-classiq Dec 29, 2024

Choose a reason for hiding this comment

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

something parsed wrong with the $ signs in the first line (maybe its just the review-nb)


Reply via ReviewNB

Copy link
Member Author

Choose a reason for hiding this comment

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

see what you mean - i think its only the ReviewNB

@@ -0,0 +1,867 @@
{
Copy link
Collaborator

@orsa-classiq orsa-classiq Dec 29, 2024

Choose a reason for hiding this comment

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

Line #39.        # Calculate phase difference

I don't understand this measure. Phase difference is acceptable as QC is always up to a global phase


Reply via ReviewNB

Copy link
Member Author

Choose a reason for hiding this comment

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

correct. it was for my own sake to see that ther is "only" a global phase difference as the states seemed different but the similarity was high. removed it

@@ -0,0 +1,867 @@
{
Copy link
Collaborator

@orsa-classiq orsa-classiq Dec 29, 2024

Choose a reason for hiding this comment

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

Line #43.    

redundant lines


Reply via ReviewNB

@@ -0,0 +1,867 @@
{
Copy link
Collaborator

@orsa-classiq orsa-classiq Dec 29, 2024

Choose a reason for hiding this comment

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

Line #2.    # Use np.linalg.solve() to find x

redundant comment, does not add information to the next line


Reply via ReviewNB

Copy link
Member Author

Choose a reason for hiding this comment

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

removed

@@ -0,0 +1,867 @@
{
Copy link
Collaborator

@orsa-classiq orsa-classiq Dec 29, 2024

Choose a reason for hiding this comment

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

I would write here \ in the complexity part what we did here that was not optimal. e.g suzuki-trotter instead of dyson, non-optimal schedule function, brute-force encoding of the pauli-operators (which scale exponentially)


Reply via ReviewNB

Copy link
Member Author

Choose a reason for hiding this comment

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

good point. added

@@ -0,0 +1,867 @@
{
Copy link
Member

@TomerGoldfriend TomerGoldfriend Dec 30, 2024

Choose a reason for hiding this comment

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

Maybe comment that this is a purely mathematical pre-process. That you do it here exact, however, in real life probably the condition number will be approximated somehow, or known in advance from some external considerations.


Reply via ReviewNB

Copy link
Member Author

Choose a reason for hiding this comment

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

added

@@ -0,0 +1,867 @@
{
Copy link
Member

@TomerGoldfriend TomerGoldfriend Dec 30, 2024

Choose a reason for hiding this comment

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

I would put all the equations in the appendix (Technical details) and put here only the bottom line (with referring to the "Technical Details" section):

The formula shows that the adiabatic error is minimized when:





Reply via ReviewNB

Copy link
Member Author

Choose a reason for hiding this comment

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

great idea! done

@@ -0,0 +1,867 @@
{
Copy link
Member

@TomerGoldfriend TomerGoldfriend Dec 30, 2024

Choose a reason for hiding this comment

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

cab --> can


Reply via ReviewNB

Copy link
Member Author

Choose a reason for hiding this comment

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

:)

@arielsmoler arielsmoler force-pushed the Library/arielsmoler/CAD-25376/add-solving-qlsp-with-aqc-notebook branch from 9b88c24 to 70680ed Compare January 9, 2025 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants