Parcourir la source

Merge branch 'master' of /home/dbv/git/nice

Bjoern Froehlich il y a 12 ans
Parent
commit
7c7afcce14

+ 14 - 2
core/algebra/progs/testILSConjugateGradients.cpp

@@ -26,11 +26,23 @@ int main(int argc, char* argv[])
 	std::string logfilename;
 	
 	if ( argc < 2 )
-	  logfilename = "/home/bodesheim/testILS-CGM.log";
-	else
+  {
+    std::cerr << "Warning: you have to specify a log-file with write-access. Program will be closed." << std::endl;
+    return -1;
+  }
+  else
+  {
 	  logfilename = argv[1];
+  }
 	
 	logfile = fopen(logfilename.c_str(), "w");
+  
+  //is the given logfile writable
+  if (logfile == NULL) 
+  {
+    std::cerr << "Error opening file" << std::endl;
+    return -1;
+  }
 	
 	// generate matrix A
 	Matrix A(mySize,mySize,0.0);

+ 12 - 0
core/image/Convert.h

@@ -121,6 +121,18 @@ template<class P> class ImageT;
     */
     template<class P>
     void imageToPseudoColor ( const NICE::ImageT<P> & src, NICE::ColorImage & dst );
+    
+    /**
+    * Convert the Image \c src into a RGB-ColorImage \c dst using pseudo colors.
+    * @param src source gray image
+    * @param dst result image
+    * @param _min desired lower bound (smaller initial values will be set to zero after conversion)
+    * @param _max desired upper bound (larger initial values will be set to 255 after conversion)
+    * @author Alexander Freytag
+    * @date 17-04-2013 (dd-mm-yyyy)
+    */    
+    template<class P>
+    void imageToPseudoColorWithRangeSpecification ( const NICE::ImageT<P> & src, NICE::ColorImage & img, const double & _min, const double & _max );    
 
     /**
     * Convert the matrix \c src into a RGB-ColorImage \c dst using pseudo colors.

+ 48 - 8
core/image/Convert.tcc

@@ -126,27 +126,67 @@ void matrixToPseudoColor ( const NICE::MatrixT<P> & m, NICE::ColorImage & img )
 }
 
 template<class P>
-void imageToPseudoColor ( const NICE::ImageT<P> & m, NICE::ColorImage & img )
+void imageToPseudoColor ( const NICE::ImageT<P> & src, NICE::ColorImage & img )
 {
-  img.resize ( m.width(), m.height() );
+  img.resize ( src.width(), src.height() );
 
   // determine maximum and minimum value in the source image
   // for appropiate scaling
   double max = - std::numeric_limits<double>::max();
   double min = std::numeric_limits<double>::max();
-  for ( size_t x = 0 ; x < ( size_t ) m.width(); x++ )
-    for ( size_t y = 0 ; y < ( size_t ) m.height() ; y++ )
+  for ( size_t x = 0 ; x < ( size_t ) src.width(); x++ )
+    for ( size_t y = 0 ; y < ( size_t ) src.height() ; y++ )
     {
-      double v = m.getPixel ( x, y );
+      double v = src.getPixel ( x, y );
       if ( v > max ) max = v;
       if ( v < min ) min = v;
     }
 
-  for ( size_t y = 0 ; y < ( size_t ) m.height() ; y++ )
-    for ( size_t x = 0 ; x < ( size_t ) m.width(); x++ )
+  for ( size_t y = 0 ; y < ( size_t ) src.height() ; y++ )
+    for ( size_t x = 0 ; x < ( size_t ) src.width(); x++ )
     {
       // scale the grayvalue
-      double val = ( m.getPixel ( x, y ) - min ) / ( max - min );
+      double val = ( src.getPixel ( x, y ) - min ) / ( max - min );
+      double r, g, b;
+      // determine the RGB values
+      convertToPseudoColor ( val, r, g, b );
+      img.setPixel ( x, y, 0, ( int ) ( r*255 ) );
+      img.setPixel ( x, y, 1, ( int ) ( g*255 ) );
+      img.setPixel ( x, y, 2, ( int ) ( b*255 ) );
+    }
+}
+
+template<class P>
+void imageToPseudoColorWithRangeSpecification ( const NICE::ImageT<P> & src, NICE::ColorImage & img, const double & _min, const double & _max )
+{
+  img.resize ( src.width(), src.height() );
+
+  double max ( _max );
+  double min ( _min );
+
+  //consistency check
+  if (max < min )
+  {
+    min = max;
+    max = _min;
+  }
+  
+  //to avoid division by numerical zero
+  double rangeSpecified ( fabs(max - min) );
+  if ( rangeSpecified < 10e-10 )
+  { 
+    max = min + 10e-10;
+    rangeSpecified = fabs(max - min);
+  }
+
+  for ( size_t y = 0 ; y < ( size_t ) src.height() ; y++ )
+    for ( size_t x = 0 ; x < ( size_t ) src.width(); x++ )
+    {
+      // scale the grayvalue
+      double val = ( src.getPixel ( x, y ) - min );
+      val = std::max( val , min ); // check for lower bound
+      val = std::min( val , max ); //check for upper bound
+      val /= rangeSpecified; //appropriate scaling
       double r, g, b;
       // determine the RGB values
       convertToPseudoColor ( val, r, g, b );

+ 57 - 0
core/image/FilterT.h

@@ -96,6 +96,63 @@ class FilterT
     * @return void
     **/
     static void gradientStrength ( const NICE::ImageT<SrcType> &src, NICE::ImageT<DstType> &dst );
+    
+    
+    /**
+    * Blurs Image \c src into the Image \c dst using a mean filter.
+    * @param src  source gray image
+    * @param size mean mask of size (2*\c size + 1) x (2*\c size + 1)
+    * @param dst  Optional buffer to be used as target.<br>
+    *             Create a new Image if \c dst == NULL.<br>
+    *             If \c dst != NULL then size must be equal to \c src 's size!
+    * @throw ImageException will be thrown if \c dst != NULL and the size of \c src and \c dst is not equal.
+    * @return Pointer to Image
+    */
+    ImageT<DstType> * filterMean ( const ImageT<SrcType>& src, const uint& size, ImageT<DstType>* dst = NULL );     
+    
+    /**
+      * Blurs Image \c src into the Image \c dst using a mean filter. This is the
+      * implementation of the filter with a runtime independent of the filter size.
+      * It is significantly faster for large filter sizes. An analysis can be done with the program
+      * testApproxGaussFilter.
+      * The second template parameter gives the type used to store sums of gray-values. The third template
+      * parameter specifies the data type of the temporary image used to handle the seperability of the mean filter.
+      * Boundary handling is done with a cropped filter if use_filtersize_independent_implementation is set to true, otherwise the borders of the image
+      * are ignored.
+      * @param src  source gray image
+      * @param size mean mask of size (2*\c size + 1) x (2*\c size + 1)
+      * @param dst  Optional buffer to be used as target.<br>
+      *             Create a new Image if \c dst == NULL.<br>
+      *             If \c dst != NULL then size must be equal to \c src 's size!
+      * @throw ImageException will be thrown if \c dst != NULL and the size of \c src and \c dst is not equal.
+      * @return Pointer to Image
+      */
+    ImageT<DstType> * filterMeanLargeFS ( const ImageT<SrcType>& src, const uint& size, ImageT<DstType>* dst = NULL );    
+      
+    /**
+    * @brief Blurs Image \c src into the Image \c dst by approximating a gauss filter with a specific standard deviation through multiple mean filters
+    * The size of the mean filters is automatically calculated
+    * The second template parameter gives the type used to store sums of gray-values. The third template parameter,
+    * which is only necessary if use_filtersize_independent_implementation
+    * is set to true, specifies the data type of the temporary image used to handle the seperability of the mean filter.
+    * Boundary handling is done with a cropped filter if use_filtersize_independent_implementation is set to true, otherwise the borders of the image
+    * are ignored.
+      * @param src  source gray image
+      * @param sigma standard deviation of the gauss filter
+      * @param dst  Optional buffer to be used as target.<br>
+      *             Create a new Image if \c dst == NULL.<br>
+      *             If \c dst != NULL then size must be equal to \c src 's size!
+    * @param use_filtersize_independent_implementation  if this flag is set to true, we use the implementation of the mean filter with a runtime
+    *  independent of the filter size. This is beneficial for large filter sizes. However, for small filter sizes (<10) the standard implementation is faster.
+    *  An analysis can be done with the program testApproxGaussFilter.
+      * @throw ImageException will be thrown if \c dst != NULL and the size of \c src and \c dst is not equal
+      *                       or an invalid size \c size is specified.
+      * @return Pointer to Image
+      */
+    NICE::ImageT<DstType> * filterGaussSigmaApproximate ( const NICE::ImageT<SrcType> &src, double sigma, NICE::ImageT<DstType> *dst = NULL,
+        bool use_filtersize_independent_implementation = true );  
+  
+ 
 };
 
 // float specializations using IPP

+ 171 - 0
core/image/FilterT.tcc

@@ -146,4 +146,175 @@ void FilterT<SrcType, CalcType, DstType>::gradientStrength ( const NICE::ImageT<
   return;
 }
 
+template<class SrcType, class CalcType, class DstType>
+ImageT<DstType> * FilterT<SrcType, CalcType, DstType>::filterMean ( const NICE::ImageT<SrcType>& src, const uint& size, ImageT<DstType>* dst )
+{
+  ImageT<DstType>* result = createResultBuffer ( src, dst );
+
+  int isize = size;
+  int is = isize + 1;
+  int msize = ( 2 * isize + 1 ) * ( 2 * isize + 1 );
+  CalcType sum = 0;
+
+  int xend = src.width() - isize;
+
+  const SrcType* pSrc;
+  DstType* pDst;
+  for ( int y = isize; y < src.height() - isize; ++y ) {
+    sum = 0;
+
+    for ( int j = y - isize; j <= y + isize; ++j ) {
+      pSrc = src.getPixelPointerY ( j );
+      for ( uint i = 0; i <= 2*size; ++i, ++pSrc )
+        sum += *pSrc;
+    }
+
+    pSrc = src.getPixelPointerXY ( is, y );
+    pDst = result->getPixelPointerXY ( isize, y );
+    *pDst = sum / msize;
+    ++pDst;
+
+    for ( int x = is; x < xend; ++x, ++pSrc, ++pDst ) {
+      for ( int i = -isize; i <= isize; ++i ) {
+        sum += * ( pSrc + size + i * src.getStepsize() );
+        sum -= * ( pSrc - is + i * src.getStepsize() );
+      }
+      *pDst = sum / msize;
+    }
+  }
+
+  return result;
+}
+
+template<class SrcType, class CalcType, class DstType>
+ImageT<DstType> * FilterT<SrcType, CalcType, DstType>::filterMeanLargeFS ( const ImageT<SrcType>& src, const uint& size, ImageT<DstType>* dst )
+{
+  ImageT<DstType>* result = createResultBuffer ( src, dst );
+  ImageT<CalcType> tmp ( src.width(), src.height() );
+
+  unsigned int isize = size;
+  unsigned int n = 2 * isize + 1;
+  CalcType sum = 0;
+
+  unsigned int xend = src.width();
+  unsigned int yend = src.height();
+
+  // legend of the following comments
+  // current pixel in dst = x
+  // end of filter mask and current pixel in src = e
+  // the examples use a size=2 filter, is=3, n=5
+  for ( int y = 0; y < src.height(); ++y ) {
+    sum = 0;
+
+    const SrcType* pSrc = src.getPixelPointerY ( y );
+    DstType *pDst = tmp.getPixelPointerY ( y );
+
+    // first position: [eoooooooooooooooooo]
+    // last position:  [-eooooooooooooooooo]
+    for ( unsigned int e = 0; e < size; ++e ) {
+      sum += * ( pSrc );
+      pSrc++;
+    }
+    // first position: [x-eoooooooooooooooo]
+    // last position:  [s-x-eoooooooooooooo]
+    for ( unsigned int e = size; e < n; ++e ) {
+      sum += * ( pSrc );
+      pSrc++;
+      *pDst = sum / ( e + 1 );
+      pDst++;
+    }
+    // first position: [os-x-eooooooooooooo]
+    // last position:  [oooooooooooooos-x-e]
+    for ( unsigned int e = n;e < xend; ++e ) {
+      sum -= * ( pSrc - n );
+      sum += * ( pSrc );
+      pSrc++;
+      *pDst = sum / n;
+      pDst++;
+    }
+    // first position: [ooooooooooooooos-x-]
+    // last position:  [oooooooooooooooos-x]
+    for ( unsigned int x = xend - size; x < xend; ++x ) {
+      sum -= * ( pSrc - ( xend - x + 1 ) );
+      *pDst = sum / ( size + xend - x );
+      pDst++;
+    }
+  }
+
+  // now let us filter along the columns
+  long long linestep = src.rowStepsize() / src.bytedepth();
+
+  for ( unsigned int x = 0; x < xend; ++x ) {
+    sum = 0;
+
+    const CalcType* pSrc = tmp.getPixelPointerXY ( x, 0 );
+    SrcType *pDst = result->getPixelPointerXY ( x, 0 );
+
+    for ( unsigned int e = 0; e < size; ++e ) {
+      sum += * ( pSrc );
+      pSrc += linestep;
+    }
+    for ( unsigned int e = size; e < n; ++e ) {
+      sum += * ( pSrc );
+      pSrc += linestep;
+      *pDst = sum / ( e + 1 );
+      pDst += linestep;
+    }
+    for ( unsigned int e = n;e < yend; ++e ) {
+      sum -= * ( pSrc - n * linestep );
+      sum += * ( pSrc );
+      pSrc += linestep;
+      *pDst = sum / n;
+      pDst += linestep;
+    }
+    for ( unsigned int y = yend - size; y < yend; ++y ) {
+      sum -= * ( pSrc - ( yend - y + 1 ) * linestep );
+      *pDst = sum / ( size + yend - y );
+      pDst += linestep;
+    }
+  }
+
+  return result;
+}    
+
+template<class SrcType, class CalcType, class DstType>
+ImageT<DstType> * FilterT<SrcType, CalcType, DstType>::filterGaussSigmaApproximate ( const NICE::ImageT<SrcType> &src, double sigma, NICE::ImageT<DstType> *dst,
+    bool use_filtersize_independent_implementation )
+{
+  // We use the idea of Wells 1986
+  // Efficient Synthesis of Gaussian Filters by Cascaded Uniform Filters
+  // http://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=04767776
+  // However, the idea is mainly from the lecture script of Prof. Schukat-Talamazzini.
+  //
+  // 4x mean filter of size (2M+1) x (2M+1) is nearly the same as a
+  // gauss filter with sigma = sqrt(4/3(M^2+M))
+  // stddev of a mean filter of size 2M+1 is 1/3 M (M+1)
+  // after applying it 4 times (convolution) the stddev is 4/3 M (M+1)
+  // After some school math stuff (solving quadratic equations),
+  // we can derive the formula used below.
+  // copy-n-paste for gnuplot: plot [0:10] (sqrt(1+3*x*x)-1)/2
+  ImageT<DstType>* result = createResultBuffer ( src, dst );
+  NICE::ImageT<CalcType> tmp ( src.width(), src.height() );
+
+  int M = ( int ) ( ( sqrt ( 1 + 3 * sigma * sigma ) - 1 ) / 2.0 + 0.5 );
+  if ( M < 1 ) {
+    fthrow ( Exception, "Unable to approximate an Gaussian filter of this small scale (sigma=" << sigma << ")" );
+  }
+
+  if ( use_filtersize_independent_implementation )
+  {
+    this->filterMeanLargeFS ( src, M, &tmp );
+    this->filterMeanLargeFS ( tmp, M, result );
+    this->filterMeanLargeFS ( *result, M, &tmp );
+    this->filterMeanLargeFS ( tmp, M, result );
+  } else {
+    this->filterMean ( src, M, &tmp );
+    this->filterMean ( tmp, M, result );
+    this->filterMean ( *result, M, &tmp );
+    this->filterMean ( tmp, M, result );
+  }
+
+  return result;
+}
+
 } //namespace

+ 1 - 1
core/image/MultiChannelImageT.h

@@ -109,7 +109,7 @@ public:
    * @param channel channel
    * @return P mean value of given area
    **/
-  P getIntegralValue(int ulx, int uly, int lrx, int lry, int channel);
+  P getIntegralValue(int ulx, int uly, int lrx, int lry, int channel) const;
 
   /** convert to ice image */
   void convertToGrey( NICE::Image & img, uint channel = 0, bool normalize = true ) const;

+ 1 - 1
core/image/MultiChannelImageT.tcc

@@ -448,7 +448,7 @@ void MultiChannelImageT<P>::calcIntegral( uint channel )
 }
 
 template<class P>
-P MultiChannelImageT<P>::getIntegralValue(int ulx, int uly, int lrx, int lry, int channel)
+P MultiChannelImageT<P>::getIntegralValue(int ulx, int uly, int lrx, int lry, int channel) const
 {
   ulx = std::max(ulx-1, -1);
   ulx = std::min(ulx, xsize-1);

+ 21 - 11
core/matlabAccess/MatFileIO.cpp

@@ -30,7 +30,10 @@ namespace NICE {
       } 
       
       // Default destructor
-      MatFileIO::~MatFileIO() {}
+      MatFileIO::~MatFileIO() {
+        
+        Mat_Close(mat);
+      }
       
       //------------------------------------------------------
       // count number of stored variables
@@ -59,17 +62,14 @@ namespace NICE {
       
       matvar_t * MatFileIO::getVariableViaName(std::string _name) {
       
-// 	std::cout << "MatFileIO::getVariableViaName: method entered" << std::endl;
-	char * cString = new char[256];
-// 	std::cout << "MatFileIO::getVariableViaName: cString init done" << std::endl;
-	return Mat_VarRead(mat,strcpy(cString,_name.c_str()));
+        return Mat_VarRead(mat,_name.c_str());
 	
       }
       
       void MatFileIO::getSparseVariableViaName(sparse_t & sparseVariable, std::string _name) {
 	
 	matvar_t * matvar = getVariableViaName(_name);
-	
+
 	if (matvar == NULL) {
 	  
 	  fthrow(Exception, "MatFileIO::getSparseVariableViaName(sparse_t & sparseVariable, std::string _name): variable with specified name does not exist");
@@ -78,12 +78,17 @@ namespace NICE {
 
 	if (matvar->class_type != MAT_C_SPARSE) {
 	  
+          Mat_VarFree(matvar);
 	  fthrow(Exception, "MatFileIO::getSparseVariableViaName(sparse_t & sparseVariable, std::string _name): format of variable is not sparse");
 	  return;
 	}
 	
-	sparseVariable = *((sparse_t*)matvar->data);
-	sparseVariable.data = (double*) sparseVariable.data;
+	sparse_t * sparse_ptr = (sparse_t*) matvar->data;
+	sparse_ptr->data = (double*) sparse_ptr->data;
+        sparseVariable = *sparse_ptr;
+        matvar->data = NULL;
+        Mat_VarFree(matvar);
+        free(sparse_ptr);
       }
 
       
@@ -99,6 +104,7 @@ namespace NICE {
 	
 	if (matvar->rank != 2) {
 	  
+          Mat_VarFree(matvar);
 	  fthrow(Exception, "MatFileIO::getFeatureMatrixViaName(char * _name, feature_matrix_order order): dimension of variable != 2");
 	  return;
 	}
@@ -408,10 +414,12 @@ namespace NICE {
           
 	} else {
 	  
+          Mat_VarFree(matvar);
 	  fthrow(Exception, "MatFileIO::getFeatureMatrixViaName(char * _name, feature_matrix_order order): wrong feature_matrix_order specified");
 	  return;
 	}	
 	
+	Mat_VarFree(matvar);
       }
       
       void MatFileIO::getVectorViaName(NICE::Vector & vec, std::string _name) {
@@ -420,14 +428,15 @@ namespace NICE {
 	
 	if (matvar == NULL) {
 	  
-	  fthrow(Exception, "MatFileIO::getFeatureMatrixViaName(char * _name, feature_matrix_order order): variable with specified name does not exist");
+	  fthrow(Exception, "MatFileIO::getVectorViaName(NICE::Vector & vec, std::string _name): variable with specified name does not exist");
 	  return;
 	}
 	
 	// it can happen that a vector is treated as (N x 1) or (1 x N) matrix with two dimensions
 	if (matvar->rank > 2 || ( (matvar->rank == 2) && (matvar->dims[0] != 1) && (matvar->dims[1] != 1) ) ) {
 	  
-	  fthrow(Exception, "MatFileIO::getFeatureMatrixViaName(char * _name, feature_matrix_order order): dimension of variable > 1");
+          Mat_VarFree(matvar);
+	  fthrow(Exception, "MatFileIO::getVectorViaName(NICE::Vector & vec, std::string _name): dimension of variable > 1");
 	  return;
 	}  
 	
@@ -652,7 +661,8 @@ namespace NICE {
 	  
 	}
 	
-	vec = NICE::Vector(v);	
+	vec = NICE::Vector(v);
+        Mat_VarFree(matvar);
       }
 }
 

+ 7 - 4
core/matlabAccess/MatFileIO.h

@@ -25,7 +25,11 @@
 #else //#ifdef NICE_USELIB_MATIO
 
 #include <matio/matio.h>
+#include <matio/matio_private.h>
 
+#ifndef sparse_t
+#define sparse_t mat_sparse_t
+#endif
 
 namespace NICE {
   
@@ -39,7 +43,7 @@ namespace NICE {
 
       //------------------------------------------------------
       // several constructors and destructors
-      //------------------------------------------------------
+      //----------------------------------------------------
 
       /** 
       * @brief Default constructor
@@ -130,9 +134,8 @@ namespace NICE {
       * @param _name name of the variable
       * @param vec result: vector with name _name in format NICE::Vector 
       */ 
-      void getVectorViaName(NICE::Vector & vec, std::string _name);
-      
-      
+      void getVectorViaName(NICE::Vector & vec, std::string _name);  
+            
   }; // class
   
 } // namespace

+ 1 - 0
core/matlabAccess/libdepend.inc

@@ -1,3 +1,4 @@
 $(call PKG_DEPEND_INT,core/basics/)
 $(call PKG_DEPEND_INT,core/vector/)
 $(call PKG_DEPEND_EXT_ESSENTIAL,MATIO)
+$(call PKG_DEPEND_EXT_ESSENTIAL,HDF5)

+ 16 - 8
core/matlabAccess/progs/testMatFileIO.cpp

@@ -25,13 +25,21 @@ int main (int argc, char* argv[])
 #ifdef NICE_USELIB_MATIO	
   std::string filenameA = "/home/bodesheim/data/2012-01-09-testMatFileIO/sparse3x3matrixA.mat";
 
+#if defined(MAT73) && MAT73
+  printf("\nMAT73 defined \n");
+#endif  
+  
   // A
   MatFileIO matfileIOA = MatFileIO(filenameA,MAT_ACC_RDONLY);
   printf("\n%d \n", matfileIOA.getNumberOfVariables());
   
   sparse_t sparseA;
   matfileIOA.getSparseVariableViaName(sparseA,"A");
-  for (uint i = 0; i < sparseA.nzmax; i++) std::cout << ((double*)sparseA.data)[i]<< "  "; 
+  printf("\nget done\n");
+  printf("\n%d\n", (int) sparseA.nzmax);
+  printf("\n%d\n", (int) sparseA.ndata);
+  
+  for (uint i = 0; i < (int) sparseA.nzmax; i++) std::cout << ((double*)sparseA.data)[i]<< "  "; 
   std::cerr << std::endl;
   std::cerr << "now start reading imagenet-data" << std::endl;
   
@@ -71,27 +79,27 @@ int main (int argc, char* argv[])
   MatFileIO matfileIO = MatFileIO(filename,MAT_ACC_RDONLY);
   printf("\nnumber of variables: %d \n", matfileIO.getNumberOfVariables()); 
   
-  sparse_t *sparse;
-  matfileIO.getSparseVariableViaName(*sparse,variable1);
+  sparse_t sparse;
+  matfileIO.getSparseVariableViaName(sparse,variable1);
   
   printf("\nSparse Matrix \n"); 
 
   for ( int i = 0; i < 5; i++ ) {
-    for ( int j = sparse->jc[i]; j < sparse->jc[i+1] && j < sparse->ndata && j < sparse->jc[i]+5; j++ ) {
+    for ( int j = sparse.jc[i]; j < sparse.jc[i+1] && j < sparse.ndata && j < sparse.jc[i]+5; j++ ) {
                               
-	printf("\t\t(%d,%d)\t%f", sparse->ir[j]+1,i+1,((double*)sparse->data)[j]);
+	printf("\t\t(%d,%d)\t%f", sparse.ir[j]+1,i+1,((double*)sparse.data)[j]);
     }
     printf("\n");
   }
   
 //   int count = 0;
 //   
-//   for ( int i = 0; i < sparse->njc-1; i++ ) {
-//     for ( int j = sparse->jc[i]; j < sparse->jc[i+1] && j < sparse->ndata; j++ )
+//   for ( int i = 0; i < sparse.njc-1; i++ ) {
+//     for ( int j = sparse.jc[i]; j < sparse.jc[i+1] && j < sparse.ndata; j++ )
 //                          
 //       if (count < 15) {
 //       
-// 	printf("    (%d,%d)  %f\n", sparse->ir[j]+1,i+1, data[j]);
+// 	printf("    (%d,%d)  %f\n", sparse.ir[j]+1,i+1, data[j]);
 // 	count++;
 //       }     
 //   }

+ 1 - 1
core/vector/Distance.tcc

@@ -17,7 +17,7 @@ template<class T>
 T EuclidianDistance<T>::doCalculate(const VectorT<T>& v1, const VectorT<T>& v2) const {
 
     if(v1.size()!=v2.size())
-        _THROW_EVector("Input vectors must have the same size.");
+        _THROW_EVector("Input vectors must have the same size. v1: ");
 
     T dist = T(0);