-
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
Decomposition - symmetric and anti-symmetric #62
base: master
Are you sure you want to change the base?
Changes from 5 commits
0c83cee
ffe0861
571cb0f
dd25ba8
94437b0
87d93fc
adb3700
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -349,6 +349,19 @@ | |
%% Pg. 55, SCM-BCR | ||
%% Pg. 56, Decomposition into symmetric and anti-symmetric parts | ||
|
||
b = dec2bin(2^4-1:-1:0)-'0'; | ||
b1 = b(:,1); b2 = b(:,2); b3 = b(:,3); b4 = b(:,4); | ||
|
||
f = b1 + 2*b1.*b2 - 4*b1.*b2.*b3 + 2*b1.*b2.*b3.*b4; | ||
f_sym = (1/2)*(f + (1 - f)); | ||
f_anti = (1/2)*(f - (1 - f)); | ||
|
||
f_new = f_sym + f_anti; | ||
|
||
LHS=min(reshape(f_new,[])); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi, So this commit is almost good, but I'd suggest you trying to run this code in the MatLab environment (https://matlab.mathworks.com/, should be free for UWaterloo ppl) and you'll discover that your reshape function is incorrectly used (take a look at the reference here: https://www.mathworks.com/help/matlab/ref/reshape.html). Let me know if you have any questions! |
||
RHS=min(reshape(f,[])); | ||
isequal(LHS,RHS); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes no sense. I don't see why you did There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is to make the transpose of the matrix. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ndattani my alternative solution is below. I will add that to the code if you approve. % f_sym = (1/2)(f(b) + (1-f(b)) % f_anti = (1/2)(f(b) - (1-f(b)) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Anyone who has used MATLAB for as long as me would know that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I looked into how decomposition into symmetric and antisymmetric would be and I see there are 2 ways to do it. One this by adding and subtracting transpose into f, divided by two. Source: https://www.mathworks.com/matlabcentral/answers/401295-how-to-find-the-symmetric-and-skew-symmetric-part-of-a-specified-matrix. The other is from the paper attached to the part in the book: https://www.maths.lth.se/matematiklth/vision/publdb/reports/pdf/kahl-strandmark-iccv-11.pdf. Notation: f - (1-transpose of f), divided by 2. Can you please explain the difference between those 2? Thank you. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The second example doesn't use the transpose. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like I confused myself somewhere, my apologies. I will fix that tomorrow since I currently have to prepare to move. |
||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
QUANTUM GADGETS | ||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
|
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.
It would be better if this example had the following:
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.
I will add that asap.