[mlpack-git] master: Fix use of uninitialized value; this should help segfaulting SVDBatch tests. (c95b87a)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 22:02:17 EST 2015


Repository : https://github.com/mlpack/mlpack

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40

>---------------------------------------------------------------

commit c95b87a76453c1b80d32f3d520f04d204ed7af2c
Author: Ryan Curtin <ryan at ratml.org>
Date:   Mon Nov 3 20:28:12 2014 +0000

    Fix use of uninitialized value; this should help segfaulting SVDBatch tests.


>---------------------------------------------------------------

c95b87a76453c1b80d32f3d520f04d204ed7af2c
 .../amf/termination_policies/simple_tolerance_termination.hpp        | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/mlpack/methods/amf/termination_policies/simple_tolerance_termination.hpp b/src/mlpack/methods/amf/termination_policies/simple_tolerance_termination.hpp
index 7a34ccb..d847a62 100644
--- a/src/mlpack/methods/amf/termination_policies/simple_tolerance_termination.hpp
+++ b/src/mlpack/methods/amf/termination_policies/simple_tolerance_termination.hpp
@@ -45,6 +45,7 @@ class SimpleToleranceTermination
     iteration = 1;
     residue = DBL_MIN;
     reverseStepCount = 0;
+    isCopy = false;
 
     this->V = &V;
 
@@ -93,10 +94,10 @@ class SimpleToleranceTermination
     iteration++;
 
     // if residue tolerance is not satisfied
-    if((residueOld - residue) / residueOld < tolerance && iteration > 4)
+    if ((residueOld - residue) / residueOld < tolerance && iteration > 4)
     {
       // check if this is a first of successive drops
-      if(reverseStepCount == 0 && isCopy == false)
+      if (reverseStepCount == 0 && isCopy == false)
       {
         // store a copy of W and H matrix
         isCopy = true;



More information about the mlpack-git mailing list