Эх сурвалжийг харах

small fixes in CRSplineReg

Sven Sickert 11 жил өмнө
parent
commit
607553f7a2

+ 7 - 7
regression/splineregression/CRSplineReg.cpp

@@ -103,14 +103,14 @@ double CRSplineReg::predict ( const NICE::Vector & x )
   int index;
    
   for ( uint i = 0; i < sortedInd.size(); i++ ){
-    if ( sortedInd[i] == dataSet.size() ){
+    if ( sortedInd[i] == (int)dataSet.size() ){
       index = i;
       break;
     }
   }
 
   NICE::Matrix points (4,dimension+1,0.0);
-  if ( index >= 2 && index < (sortedInd.size() - 2) ){	//everything is okay
+  if ( index >= 2 && index < (int)(sortedInd.size() - 2) ){	//everything is okay
     points.setRow(0,dataSet[sortedInd[index-2]]);
     points(0,dimension) = labelSet[sortedInd[index-2]];
     points.setRow(1,dataSet[sortedInd[index-1]]);
@@ -140,7 +140,7 @@ double CRSplineReg::predict ( const NICE::Vector & x )
     points.setRow(3,dataSet[sortedInd[index+2]]);
     points(3,dimension) = labelSet[sortedInd[index+2]]; 
   }
-  else if ( index == (sortedInd.size() - 2) ){	//just one point right from x
+  else if ( index == (int)(sortedInd.size() - 2) ){	//just one point right from x
     points.setRow(0,dataSet[sortedInd[index-2]]);
     points(0,dimension) = labelSet[sortedInd[index-2]];
     points.setRow(1,dataSet[sortedInd[index-1]]);
@@ -150,7 +150,7 @@ double CRSplineReg::predict ( const NICE::Vector & x )
     points.setRow(3,dataSet[sortedInd[index+1]]);
     points(3,dimension) = labelSet[sortedInd[index+1]];   
   }
-  else if ( index == (sortedInd.size() - 1) ){	//x is the farthest right point
+  else if ( index == (int)(sortedInd.size() - 1) ){	//x is the farthest right point
     points.setRow(0,dataSet[sortedInd[index-2]]);
     points(0,dimension) = labelSet[sortedInd[index-2]];
     points.setRow(1,dataSet[sortedInd[index-1]]);
@@ -177,7 +177,7 @@ double CRSplineReg::predict ( const NICE::Vector & x )
   b3 = tau * (t*t*t - t*t);
 
 #pragma omp parallel for  
-  for ( uint i = 0; i < dimension; i++ ){
+  for ( uint i = 0; i < (uint)dimension; i++ ){
     P[i] = b0*points(0,i) + b1*points(1,i) + b2*points(2,i) + b3*points(3,i);
   }
   
@@ -194,7 +194,7 @@ double CRSplineReg::predict ( const NICE::Vector & x )
     b2 = tau * (-3*t*t*t + 4*t*t + t);
     b3 = tau * (t*t*t - t*t);
       
-    for ( uint i = 0; i < dimension; i++ ){
+    for ( uint i = 0; i < (uint)dimension; i++ ){
       P[i] = b0*points(0,i) + b1*points(1,i) + b2*points(2,i) + b3*points(3,i);
     }
     
@@ -208,7 +208,7 @@ double CRSplineReg::predict ( const NICE::Vector & x )
       b3 = tau * (t*t*t - t*t);
 
 #pragma omp parallel for      
-      for ( uint i = 0; i < dimension; i++ ){
+      for ( uint i = 0; i < (uint)dimension; i++ ){
 	P[i] = b0*points(0,i) + b1*points(1,i) + b2*points(2,i) + b3*points(3,i);
       }
       diff1 = (P-x).normL2();