Browse Source

matio-optional support also for test-programs

Alexander Freytag 12 years ago
parent
commit
00be787c67
1 changed files with 10 additions and 5 deletions
  1. 10 5
      tests/TestFeatureMatrixT.cpp

+ 10 - 5
tests/TestFeatureMatrixT.cpp

@@ -32,7 +32,7 @@ void TestFeatureMatrixT::testSetup()
   if (verboseStartEnd)
   if (verboseStartEnd)
     std::cerr << "================== TestFeatureMatrixT::testSetup ===================== " << std::endl;
     std::cerr << "================== TestFeatureMatrixT::testSetup ===================== " << std::endl;
   
   
-	  std::vector< std::vector<double> > dataMatrix;
+  std::vector< std::vector<double> > dataMatrix;
 
 
   generateRandomFeatures ( d, n, dataMatrix );
   generateRandomFeatures ( d, n, dataMatrix );
 
 
@@ -41,10 +41,10 @@ void TestFeatureMatrixT::testSetup()
   {
   {
     for ( uint k = 0; k < n; k++ )
     for ( uint k = 0; k < n; k++ )
       if ( drand48() < sparse_prob ) 
       if ( drand48() < sparse_prob ) 
-		{
-			dataMatrix[i][k] = 0.0;
-			nrZeros++;
-		}
+      {
+        dataMatrix[i][k] = 0.0;
+        nrZeros++;
+      }
   }
   }
 
 
   if ( verbose ) {
   if ( verbose ) {
@@ -104,6 +104,9 @@ void TestFeatureMatrixT::testMatlabIO()
   if (verboseStartEnd)
   if (verboseStartEnd)
     std::cerr << "================== TestFeatureMatrixT::testMatlabIO ===================== " << std::endl;
     std::cerr << "================== TestFeatureMatrixT::testMatlabIO ===================== " << std::endl;
   
   
+#ifndef NICE_USELIB_MATIO
+  std::cerr << "MatIO library not included -- TestFeatureMatrixT::testMatlabIO not possible" << std::endl;
+#else //#ifdef NICE_USELIB_MATIO
   NICE::MatFileIO matfileIOA = MatFileIO("./sparse3x3matrixA.mat",MAT_ACC_RDONLY);
   NICE::MatFileIO matfileIOA = MatFileIO("./sparse3x3matrixA.mat",MAT_ACC_RDONLY);
   sparse_t sparseA;
   sparse_t sparseA;
   matfileIOA.getSparseVariableViaName(sparseA,"A");
   matfileIOA.getSparseVariableViaName(sparseA,"A");
@@ -176,6 +179,8 @@ void TestFeatureMatrixT::testMatlabIO()
 // 	std::cerr << "fm.get_n(): " << fm.get_n() << " fm.get_d(): " << fm.get_d() << std::endl;
 // 	std::cerr << "fm.get_n(): " << fm.get_n() << " fm.get_d(): " << fm.get_d() << std::endl;
 // 	std::cerr << "fm.computeSparsityRatio() of Imagenet: " << fm.computeSparsityRatio() << std::endl;
 // 	std::cerr << "fm.computeSparsityRatio() of Imagenet: " << fm.computeSparsityRatio() << std::endl;
 
 
+#endif //#ifdef NICE_USELIB_MATIO
+
   if (verboseStartEnd)
   if (verboseStartEnd)
     std::cerr << "================== TestFeatureMatrixT::testMatlabIO done===================== " << std::endl;
     std::cerr << "================== TestFeatureMatrixT::testMatlabIO done===================== " << std::endl;