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

Changes for PTR-BCR-2 #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

rriyakumar
Copy link

Added in the following proof for PTR-BCR-2:

%% Pg. 21, PTR-BCR-2

b = dec2bin(2^6-1: -1:0)-'0';
b1=b(:,1);b2=b(:,2);b3=b(:,3);b4=b(:,4);ba1=b(:,5);ba2=b(:,6);
LHS = min(reshape (b1.*b2.*b3.b4,2,[]));
RHS = min(reshape (1/2
(4 + b1 + b2 + b3 + b4 - ba1 - 2.ba2).(3 + b1 + b2 + b3 + b4 - ba1 - 2.*ba2),2,[]));
isequal(LHS,RHS);

Added in the following proof for PTR-BCR-4:


%% Pg. 21, PTR-BCR-2

b = dec2bin(2^6-1:-1:0)-'0';
b1=b(:,1);b2=b(:,2);b3=b(:,3);b4=b(:,4);ba1=b(:,5);ba2=b(:,6);
LHS = min(reshape (b1.*b2.*b3.*b4,2,[]));
RHS = min(reshape (1/2*(4 + b1 + b2 + b3 + b4 - ba1 - 2.*ba2).*(3 + b1 + b2 + b3 + b4 - ba1 - 2.*ba2),2,[]));
isequal(LHS,RHS);
@ndattani
Copy link
Member

ndattani commented Apr 19, 2022

Thanks @rriyakumar!
Your comment on the pull request doesn't need to repeat what you've already written in the commit message (notice that this information is duplicated). Also, your commit message still talks about "PTR-BCR-4" even though the comment in your code says that you're dealing with PTR-BCR-2.

I see that you listed @ehuan2 to peer-review your code. His last exam is on April 21st, so it will probably take at least until April 21st to get feedback on your code. I would also recommend to look at the feedback I gave to @tiresias7 on Pull Request #54 too since we probably want similar things to be done for the PTR-BCR-2 page before merging your code into the Master branch.

b1=b(:,1);b2=b(:,2);b3=b(:,3);b4=b(:,4);ba1=b(:,5);ba2=b(:,6);
LHS = min(reshape (b1.*b2.*b3.*b4,2,[]));
RHS = min(reshape (1/2*(4 + b1 + b2 + b3 + b4 - ba1 - 2.*ba2).*(3 + b1 + b2 + b3 + b4 - ba1 - 2.*ba2),2,[]));
isequal(LHS,RHS);
Copy link
Member

@ehuan2 ehuan2 Apr 28, 2022

Choose a reason for hiding this comment

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

Sorry for the super late review! So this right here actually doesn't give us the correct verification because the answer after isequal(LHS, RHS) is actually 0, when we want it to be 1. My suggestion (and what I believe to be the issue, though I'm not 100% on this fact since I'm not an expert) is the fact that we're reshaping the answer. So once we reshape the multiplication, what we're doing essentially is saying that the minimum over every two pairs of answers (ie over ba1, ba2) should give the same answer, though I think it should be over all of them (ie no need to reshape).

@ndattani
Copy link
Member

@rriyakumar
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.

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