Browse Source

fixed win32 build for core/algebra

Johannes R 12 năm trước cách đây
mục cha
commit
80b2f85fbf

+ 1 - 1
core/algebra/CholeskyRobust.cpp

@@ -61,7 +61,7 @@ CholeskyRobust::robustChol (const Matrix & A, Matrix & cholA)
 		cerr << "CholeskyRobust::robustChol: Cholesky condition (logdet): " << m_logDetMatrix << endl;
 
   // if the log determinant is NaN or Inf, then we should warn!
-	if (!finite (m_logDetMatrix))
+	if (!NICE::isFinite (m_logDetMatrix))
 	{
 		fthrow (Exception,
 						"The matrix has infinite or not defined log determinant !");

+ 4 - 2
core/algebra/DiagonalMatrixApprox.cpp

@@ -12,6 +12,8 @@
 
 #include "DiagonalMatrixApprox.h"
 
+#include "core/basics/numerictools.h"
+
 using namespace NICE;
 using namespace std;
 
@@ -67,7 +69,7 @@ void DiagonalMatrixApprox::approx ( const Matrix & A, Vector & D ) const
       cerr << D << endl;
     }
 
-    if ( !finite(f) )
+	if ( !NICE::isFinite(f) )
     {
       f = f0;
       D = D0;
@@ -152,7 +154,7 @@ double DiagonalMatrixApproxOptimizationProblem::computeObjective()
     cerr << "DiagonalMatrixApprox: maximum eigenvalue is " << eigenvalues.Max() << endl;
   //}
 
-  if ( !finite(fval) )
+  if ( !NICE::isFinite(fval) )
   {
     // some numerical problems occured
     fval = numeric_limits<double>::infinity();

+ 5 - 1
core/algebra/EigValues.cpp

@@ -44,7 +44,11 @@ EVArnoldi::getEigenvalues ( const GenericMatrix & data, Vector & eigenvalues,
   //random initialisation
   for ( uint i = 0; i < k; i++ )
     for ( uint j = 0; j < n; j++ )
-      rmatrix ( j, i ) = drand48 ();
+#ifdef WIN32
+		rmatrix (j, i) = double(rand())/RAND_MAX;
+#else
+		rmatrix (j, i) = drand48 ();
+#endif
 //       rmatrix ( j, i ) = 0.5;
       //TODO the random initialization might help, but it is bad for reproducibility :(
 

+ 1 - 1
core/algebra/GMSparseVectorMatrix.cpp

@@ -202,7 +202,7 @@ GMSparseVectorMatrix::mult (GMSparseVectorMatrix & y, GMSparseVectorMatrix & out
 			if (fabs (val) > 10e-7)
 				out[r][c] = val;
 
-			if (!finite (val * val))
+			if (!NICE::isFinite (val * val))
 			{
 				cout << "val " << val << endl;
 				for (int i = 0; i < rowsy; i++)