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

Update reproducing.m, PTR-BCR-4 #54

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

tiresias7
Copy link

Update the PTR-BCR-4 part, Eq. 68

Update the PTR-BCR-4 part, Eq. 68
@tiresias7
Copy link
Author

More details on discord!

@ndattani
Copy link
Member

ndattani commented Apr 7, 2022

Thank you so much @tiresias7! Preferably all communications about this Pull Request can remain here in this thread, rather than in private messages in Discord, because it will be much easier to find things that way.

I would also encourage you to do the following:

  • Test the equation in the "Summary" section for k = 8.
  • Test the equation in the "Alternate forms" section for k=8.
  • Expand the equation in the "Example" section and add it in a new line (with an equation number too). You can add this into the book's source code here.
  • Once you're done the above step, then add "LaTeX" to your resume :) Please don't send me a new copy of the resume though.
  • The expanded version of the "Example" should also be tested in reproducing.m.
  • Once the added equation is in the book's PDF file, please show a screenshot of just that equation (not the full page) in a reply here, so that I can verify that the PDF looks good :)

If you need help compiling the book's source code, you can ask Eric Huang (ehuan2) in this thread.

@ndattani
Copy link
Member

ndattani commented Apr 7, 2022

@ehuan2 Can you write some advice here about how you compiled the book's source code locally into a PDF with only +10 changes?

@ehuan2
Copy link
Member

ehuan2 commented Apr 7, 2022

@ehuan2 Can you write some advice here about how you compiled the book's source code locally into a PDF with only +10 changes?

Yeah so the issue that was creating a lot of changes that we don't need necessarily was the fact that my compiler created log files that looked very different because of different versions, different file systems, etc. So I just kind of ignored those changes when adding to the commit. Another thing is what you're using, I have TeXWorks installed on Windows, and that allows you to compile with lots of different stuff, which some didn't work until I compiled with just pdfLatex.

Another option is just to compile online using something like overleaf, and copying it back locally.

@tiresias7
Copy link
Author

Hi @ndattani ! Today I finished one of my final exams and decided to complete the steps.

However, I'm a little bit stuck. In PTR-BCR-4, it requires k=2^(m+1). Maybe k=6 won't work for this?

Also, I'm wondering if I'm doing the right thing with Github. I first merged the current version of the whole branch to my fork, and then pushed the commits in this pull request to the patch-1 branch (I guess?). Am I doing the right thing?

@ndattani
Copy link
Member

ndattani commented Apr 12, 2022 via email

Added Eq.71 and 73 with k=8, checked correctness
Added an equation, also fixed some typo
Added equation 73
@tiresias7
Copy link
Author

Hi @ndattani ! I think I've done all the things. k=8 is really big, so I used the for-clause to avoid listing out all the products of b1,2,...,11.

I have changed the tex file. Hope it's good. I also fixed some typos on the same page - I couldn't believe it when I found that the original formula on the book has actually a typo. How did I make it last time?

Here is the formula:
image

Since I have done some other changes, I decided to post the whole page of pdf here.
4a5928ac10cbe23b0a989c480e55310

Thank you so much for your help!
P.S. The formulas are really messy and the sum notations are unclear. I had a hard time struggling to find that the two sum notations start at different integers (1 and 0).

This was referenced Apr 19, 2022
@@ -157,6 +157,81 @@
%% Pg. 21, PTR-BCR-2
%% Pg. 22, PTR-BCR-3 (example appears to be the same as PTR-BCR-1, and may have to be redone)
%% Pg. 23, PTR-BCR-4

% Eq. 72
Copy link
Member

Choose a reason for hiding this comment

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

Equation numbers can change, when new questions get added or old ones get removed. Instead of calling something "Eq. 72" it's better to give a description, such as "Equation in Summary section of PTR-BCR-4". Earlier we were using equation numbers in this file, but now things are changing and we're moving away from using equation numbers in that way (and we're moving more towards using descriptions).

@@ -157,6 +157,81 @@
%% Pg. 21, PTR-BCR-2
%% Pg. 22, PTR-BCR-3 (example appears to be the same as PTR-BCR-1, and may have to be redone)
%% Pg. 23, PTR-BCR-4

Copy link
Member

Choose a reason for hiding this comment

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

Eq. 71 should come before Eq. 72.

LHS = min(reshape(b1.*b2.*b3.*b4, 4, []));
RHS = min(reshape((b1 + b2 + b3 + b4 - ba1 - 2*ba2).^2, 4, []));
isequal(LHS,RHS); % Gives 1, confirmed by Nike on 6 April.

Copy link
Member

@ndattani ndattani Apr 20, 2022

Choose a reason for hiding this comment

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

While I appreciate that it would take a long time to type out b1*b2 + b1*b3 + b1*b4 + ... for all terms, I think that it would be more "readable". For all other quadratizations verified in this file so far, it's easy to compare the equation in the book with the code and immediately see that they're the same. In this case, it's a lot more complicated. Perhaps you can use MATLAB's symbolic computing toolbox to help.

I think I'd prefer MATLAB code that looks as close as possible to the equations in the book, then we can also keep your code containing the for loops (so we have two different verifications for each equation: one "long" one that's easy to read, and one "compact" one which requires the reader to interpret a bunch of for and end statements).

@ndattani
Copy link
Member

This is very good work all around @tiresias7 !

"P.S. The formulas are really messy and the sum notations are unclear. I had a hard time struggling to find that the two sum notations start at different integers (1 and 0)."

  • I'm very impressed that you found those typos! Have you looked at "Remark 5" from the paper in the Bibliography section? That should make it clear where the indices should start and end.
  • By changing the starting indices to be from 0 instead of 1, the first equation in the "Example" section would have to change too. Can you make it so that all indices start at 1 (i.e. adjust the exponents accordingly)? This way the general equation in the Summary section doesn't need indices (it should be consistent that all indices start at 1 and go as high as possible, unless an upper index is explicitly stated).
  • For the first equation of the Example section, the a_1 and a_2 should have 1 and 2 as subscripts
  • The citation in the Bibliography section is showing up as a question mark. Are you able to get that fixed by compiling this way?
  • Please also push your .pdf file to your fork :)

@ndattani
Copy link
Member

@tiresias7
I'll be publishing the next version of the book soon.
If you want your name mentioned here: https://arxiv.org/abs/1901.04405 and here: https://github.com/HPQC-LABS/Book_About_Quadratization you would only need to fix the above issues so that this branch can be merged into the Master branch.

@tiresias7
Copy link
Author

@ndattani I'm so sorry that I've left this task undone. Is it still possible for me to finish this now?

@ndattani
Copy link
Member

@tiresias7 yes for sure!

@tiresias7
Copy link
Author

It has been a long way before I pick this up so it's a little hard for me to catch up. I've changed the comments for equations to be clearer and more direct. I also changed one of the formulas to become a more the readable and easy-to-check form (however very long) and check that LHS = RHS. If I'm going to do the same thing to the other formula, it would be 4 times longer than this current line, which is already 300 characters long. Should I do it or it is too long an example?

@tiresias7
Copy link
Author

Besides this, do I also have to change the pdf file?

By changing the starting indices to be from 0 instead of 1, the first equation in the "Example" section would have to change too. Can you make it so that all indices start at 1 (i.e. adjust the exponents accordingly)? This way the general equation in the Summary section doesn't need indices (it should be consistent that all indices start at 1 and go as high as possible, unless an upper index is explicitly stated).

In my understanding, I'm going to change indices to 1. Is that right?

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.

None yet

3 participants