master,mlpack-1.0.x: Fixed Positive Def Constaint under gmm; previous error was "/gmm/positive_definite_constraint.hpp:28: error: expected primary-expression before â(â token" at lines 27 and 33. (72de45a)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 21:41:50 EST 2015


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

On branches: master,mlpack-1.0.x
Link       : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40

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

commit 72de45a3a41924ea20c09359b063aa71bd4627bc
Author: birm <birm at gatech.edu>
Date:   Tue Feb 4 22:00:31 2014 +0000

    Fixed Positive Def Constaint under gmm; previous error was "/gmm/positive_definite_constraint.hpp:28: error: expected primary-expression before ‘(’ token" at lines 27 and 33.


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

72de45a3a41924ea20c09359b063aa71bd4627bc
 src/mlpack/methods/gmm/positive_definite_constraint.hpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/mlpack/methods/gmm/positive_definite_constraint.hpp b/src/mlpack/methods/gmm/positive_definite_constraint.hpp
index 823f016..c87937c 100644
--- a/src/mlpack/methods/gmm/positive_definite_constraint.hpp
+++ b/src/mlpack/methods/gmm/positive_definite_constraint.hpp
@@ -7,6 +7,8 @@
 #ifndef __MLPACK_METHODS_GMM_POSITIVE_DEFINITE_CONSTRAINT_HPP
 #define __MLPACK_METHODS_GMM_POSITIVE_DEFINITE_CONSTRAINT_HPP
 
+#include <mlpack/core.hpp>
+
 namespace mlpack {
 namespace gmm {
 
@@ -24,13 +26,13 @@ class PositiveDefiniteConstraint
   static void ApplyConstraint(arma::mat& covariance)
   {
     // TODO: make this more efficient.
-    if (det(covariance) <= 1e-50)
+    if (arma::det(covariance) <= 1e-50)
     {
       Log::Debug << "Covariance matrix is not positive definite.  Adding "
           << "perturbation." << std::endl;
 
       double perturbation = 1e-30;
-      while (det(covariance) <= 1e-50)
+      while (arma::det(covariance) <= 1e-50)
       {
         covariance.diag() += perturbation;
         perturbation *= 10;
@@ -43,3 +45,4 @@ class PositiveDefiniteConstraint
 }; // namespace mlpack
 
 #endif
+



More information about the mlpack-git mailing list