Skip to content
Browse files

Vectorize

Realized I could scrap one of my for loops in ComputeMarginal
  • Loading branch information...
1 parent 7ab62e4 commit eccbd83a62a1740ba4e41cc05c7a5e6691093c4b @jcbantuelle jcbantuelle committed Mar 20, 2012
Showing with 2 additions and 6 deletions.
  1. +1 −1 assignment_1/228_login_data.mat
  2. +1 −5 assignment_1/ComputeMarginal.m
View
2 assignment_1/228_login_data.mat
@@ -1,4 +1,4 @@
-# Created by Octave 3.4.0, Sun Mar 18 09:18:00 2012 CDT <justin@Jabberwocky.local>
+# Created by Octave 3.4.0, Tue Mar 20 20:26:59 2012 CDT <justin@Jabberwocky.local>
# name: login
# type: sq_string
# elements: 1
View
6 assignment_1/ComputeMarginal.m
@@ -37,10 +37,6 @@
mVal = GetValueOfAssignment(M, mAssignment);
normalization_sum = normalization_sum + mVal;
end;
-for i=1:length(M.val),
- mAssignment = assignments(i,:);
- mVal = GetValueOfAssignment(M, mAssignment) / normalization_sum;
- M = SetValueOfAssignment(M, mAssignment, mVal);
-end;
+M.val = M.val / normalization_sum
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
end

0 comments on commit eccbd83

Please sign in to comment.
Something went wrong with that request. Please try again.