-
Notifications
You must be signed in to change notification settings - Fork 18
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
base: master
Are you sure you want to change the base?
Conversation
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);
Thanks @rriyakumar! 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); |
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.
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).
@rriyakumar |
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);