Changeset 1210 for trunk


Ignore:
Timestamp:
Mar 6, 2008, 5:00:44 PM (14 years ago)
Author:
Peter
Message:

refs #223 change fabs to std::abs

Location:
trunk/test
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/alignment_test.cc

    r1121 r1210  
    6969double match(const double x, const double y, const double s)
    7070{
    71   return 2*gsl_cdf_gaussian_Q(fabs(x-y),sqrt(2)*s);
     71  return 2*gsl_cdf_gaussian_Q(std::abs(x-y),sqrt(2)*s);
    7272}
    7373 
  • trunk/test/averager_test.cc

    r1120 r1210  
    107107     
    108108
    109   if ( fabs(a.variance() - a.std()*a.std())>
     109  if ( std::abs(a.variance() - a.std()*a.std())>
    110110       std::numeric_limits<double>().round_error() ){
    111111    ok=false;
     
    189189  for (int i=0; i<10; i++)
    190190    ap.add(static_cast<double>(i),i);
    191   if (fabs(ap.correlation()-1)>tol){
     191  if (std::abs(ap.correlation()-1)>tol){
    192192    ok=false;
    193193    *error << "correlation: " << ap.correlation() << std::endl;
     
    252252//  std::cout << (a.n()==b.n()) << std::endl;
    253253//  std::cout << (a.mean()==b.mean()) << std::endl;
    254 //  std::cout << (fabs(a.variance()-b.variance()<1e-15)) << std::endl;
     254//  std::cout << (std::abs(a.variance()-b.variance()<1e-15)) << std::endl;
    255255  return (a.n()==b.n() && a.mean()==b.mean() &&
    256           fabs(a.variance()-b.variance()<1e-15));
     256          std::abs(a.variance()-b.variance()<1e-15));
    257257}
    258258
     
    261261{
    262262  bool equal = true;
    263   if  ( fabs(a.mean()-b.mean())>tol){
     263  if  ( std::abs(a.mean()-b.mean())>tol){
    264264    equal=false;
    265265    *error << "mean:\t" << a.mean() << "\t" << b.mean() << std::endl;
    266266  }
    267   if ( fabs(a.variance()-b.variance())>tol ) {
     267  if ( std::abs(a.variance()-b.variance())>tol ) {
    268268    equal=false;
    269269    *error << "error for variance:\t" << a.variance() << " " << b.variance()
    270270           << std::endl;
    271271  }
    272   if ( fabs(a.standard_error()-b.standard_error())>tol ) {
     272  if ( std::abs(a.standard_error()-b.standard_error())>tol ) {
    273273    equal =false;
    274274    *error << "error for standard error:\t" << std::endl;
     
    281281{
    282282  bool equal = true;
    283   if  ( fabs(a.mean()-b.mean())>tol){
     283  if  ( std::abs(a.mean()-b.mean())>tol){
    284284    equal=false;
    285285    *error << "mean:\t" << a.mean() << "\t" << b.mean() << std::endl;
    286286  }
    287   if ( fabs(a.variance()-b.variance())>tol ) {
     287  if ( std::abs(a.variance()-b.variance())>tol ) {
    288288    equal=false;
    289289    *error << "error for variance:\t" << a.variance() << " " << b.variance()
    290290           << std::endl;
    291291  }
    292   if ( fabs(a.standard_error()-b.standard_error())>tol ) {
     292  if ( std::abs(a.standard_error()-b.standard_error())>tol ) {
    293293    equal =false;
    294294    *error << "error for standard error:\t" << std::endl;
     
    301301{
    302302  bool ok = true;
    303   if  ( fabs(a.covariance()-b.covariance())>tol){
     303  if  ( std::abs(a.covariance()-b.covariance())>tol){
    304304    ok=false;
    305305    *error << "error covariance: " << a.covariance() << "\t"
    306306           << b.covariance() << std::endl;
    307307  }
    308   if ( fabs(a.correlation()-b.correlation())>tol ) {
     308  if ( std::abs(a.correlation()-b.correlation())>tol ) {
    309309    ok=false;
    310310    *error << "error correlation" << std::endl;
     
    317317{
    318318  bool ok = true;
    319   if  ( fabs(a.covariance()-b.covariance())>tol){
     319  if  ( std::abs(a.covariance()-b.covariance())>tol){
    320320    ok=false;
    321321    *error << "error covariance: " << a.covariance() << "\t"
    322322           << b.covariance() << std::endl;
    323323  }
    324   if ( fabs(a.correlation()-b.correlation())>tol ) {
     324  if ( std::abs(a.correlation()-b.correlation())>tol ) {
    325325    ok=false;
    326326    *error << "error correlation" << std::endl;
     
    336336{
    337337  bool ok = true;
    338   if  ( fabs(a.covariance()-b.covariance())>tol){
     338  if  ( std::abs(a.covariance()-b.covariance())>tol){
    339339    ok=false;
    340340    *error << "error covariance: " << a.covariance() << "\t"
    341341           << b.covariance() << std::endl;
    342342  }
    343   if ( fabs(a.correlation()-b.correlation())>tol ) {
     343  if ( std::abs(a.correlation()-b.correlation())>tol ) {
    344344    ok=false;
    345345    *error << "error correlation" << std::endl;
  • trunk/test/distance_test.cc

    r1121 r1210  
    6060  statistics::EuclideanDistance eucl_dist;
    6161  double dist=eucl_dist(a.begin(),a.end(),b.begin());
    62   if(fabs(dist-2.23607)>tolerance) {
     62  if(std::abs(dist-2.23607)>tolerance) {
    6363    *error << "Error in unweighted Euclidean distance " << std::endl;
    6464    ok=false;
     
    6767  statistics::PearsonDistance pear_dist;
    6868  dist=pear_dist(a.begin(),a.end(),b.begin());
    69   if(fabs(dist-1.5)>tolerance) {
     69  if(std::abs(dist-1.5)>tolerance) {
    7070    *error << "Error in unweighted Pearson distance " << std::endl;
    7171    ok=false;
     
    8686  dist=eucl_dist(aw.begin(),aw.end(),bw.begin());
    8787 
    88   if(fabs(dist-sqrt(6))>tolerance) {
     88  if(std::abs(dist-sqrt(6))>tolerance) {
    8989    *error << "Error in weighted Euclidean distance " << std::endl;
    9090    ok=false;
     
    9393  dist=pear_dist(aw.begin(),aw.end(),bw.begin());
    9494 
    95   if(fabs(dist-2)>tolerance) {
     95  if(std::abs(dist-2)>tolerance) {
    9696    *error << "Error in weighted Pearson distance " << std::endl;
    9797    ok=false;
     
    106106 
    107107  dist=eucl_dist(sa.begin(),sa.end(),sb.begin());
    108   if(fabs(dist-2.23607)>tolerance) {
     108  if(std::abs(dist-2.23607)>tolerance) {
    109109    *error << "Error in distance for std::vector " << std::endl;
    110110    ok=false;
     
    115115  std::copy(sa.begin(),sa.end(),std::back_inserter<std::list<double> >(la));
    116116  dist=eucl_dist(la.begin(),la.end(),sb.begin());
    117   if(fabs(dist-2.23607)>tolerance) {
     117  if(std::abs(dist-2.23607)>tolerance) {
    118118    *error << "Error in distance for std::list " << std::endl;
    119119    ok=false;
  • trunk/test/feature_selection_test.cc

    r1134 r1210  
    9999
    100100  classifier::DataLookupWeighted1D row(dataviewweighted,best_feature,true);
    101   double score_diff=fabs(snr.score(targets,row)-1.47804);
     101  double score_diff=std::abs(snr.score(targets,row)-1.47804);
    102102  if(score_diff>0.00001) {
    103103    *error << "\nERROR: Best score not what expected!\n" << std::endl;
  • trunk/test/kernel_test.cc

    r1134 r1210  
    152152  for(u_int i=0;i<control.rows();i++)
    153153    for(u_int j=0;j<control.columns();j++)
    154       if (fabs(kernel(i,j)-control(i,j))>error_bound)
     154      if (std::abs(kernel(i,j)-control(i,j))>error_bound)
    155155        return false;
    156156
     
    191191  for(u_int i=0;i<control.rows();i++)
    192192    for(u_int j=0;j<control.columns();j++)
    193       if (fabs(kernel(i,j)-control(i,j))>error_bound)
     193      if (std::abs(kernel(i,j)-control(i,j))>error_bound)
    194194        return false;
    195195
  • trunk/test/knn_test.cc

    r1157 r1210  
    4545  for (size_t i=0; i<a.rows(); i++){
    4646    for (size_t j=0; j<a.columns(); j++){
    47       sl += fabs(a(i,j)-b(i,j));
     47      sl += std::abs(a(i,j)-b(i,j));
    4848    }
    4949  }
     
    179179  if (!(std::isinf(prediction1(0,0)) && std::isinf(prediction1(0,1)) &&
    180180        std::isinf(prediction1(1,2)) &&
    181         fabs(prediction1(1,3)-(1.0/3.67423461417))<slack_bound &&
    182         fabs(prediction1(1,0)-(1.0/2.82842712475+1.0/2.44948974278))<slack_bound)){
     181        std::abs(prediction1(1,3)-(1.0/3.67423461417))<slack_bound &&
     182        std::abs(prediction1(1,0)-(1.0/2.82842712475+1.0/2.44948974278))<slack_bound)){
    183183    *error << "Difference to expected prediction too large\n";
    184184    ok = false;
     
    202202  if (!(std::isnan(prediction1(0,0)) && std::isnan(prediction1(0,1)) &&
    203203        std::isnan(prediction1(0,2)) && std::isnan(prediction1(0,3)) &&
    204         fabs(prediction1(1,0)-2.0)<slack_bound &&
    205         fabs(prediction1(1,1)-2.0)<slack_bound &&
    206         fabs(prediction1(1,2)-2.0)<slack_bound &&
    207         fabs(prediction1(1,3)-2.0)<slack_bound)) {
     204        std::abs(prediction1(1,0)-2.0)<slack_bound &&
     205        std::abs(prediction1(1,1)-2.0)<slack_bound &&
     206        std::abs(prediction1(1,2)-2.0)<slack_bound &&
     207        std::abs(prediction1(1,3)-2.0)<slack_bound)) {
    208208    *error << "Difference to expected prediction too large\n";
    209209    ok = false;
  • trunk/test/ncc_test.cc

    r1158 r1210  
    4949  for (size_t i=0; i<a.rows(); i++){
    5050    for (size_t j=0; j<a.columns(); j++){
    51       sl += fabs(a(i,j)-b(i,j));
     51      sl += std::abs(a(i,j)-b(i,j));
    5252    }
    5353  }
     
    172172  }
    173173  if(!(std::isnan(prediction1(0,0)) &&
    174        fabs(prediction1(1,0)-sqrt(3.0))<slack_bound &&
    175        fabs(prediction1(0,1)-sqrt(3.0))<slack_bound &&
    176        fabs(prediction1(1,1)-sqrt(15.0))<slack_bound &&
    177        fabs(prediction1(0,2)-sqrt(27.0))<slack_bound)) { 
     174       std::abs(prediction1(1,0)-sqrt(3.0))<slack_bound &&
     175       std::abs(prediction1(0,1)-sqrt(3.0))<slack_bound &&
     176       std::abs(prediction1(1,1)-sqrt(15.0))<slack_bound &&
     177       std::abs(prediction1(0,2)-sqrt(27.0))<slack_bound)) { 
    178178    ok=false;
    179179    *error << "Test failed: predictions incorrect" << std::endl;
     
    190190       std::isnan(prediction1(0,2)) &&
    191191       std::isnan(prediction1(1,0)) &&
    192        fabs(prediction1(0,1))<slack_bound &&
    193        fabs(prediction1(1,2))<slack_bound &&
    194        fabs(prediction1(1,3))<slack_bound && 
    195        fabs(prediction1(0,3)-2.0)<slack_bound &&
    196        fabs(prediction1(1,1)-2.0)<slack_bound)) {
     192       std::abs(prediction1(0,1))<slack_bound &&
     193       std::abs(prediction1(1,2))<slack_bound &&
     194       std::abs(prediction1(1,3))<slack_bound && 
     195       std::abs(prediction1(0,3)-2.0)<slack_bound &&
     196       std::abs(prediction1(1,1)-2.0)<slack_bound)) {
    197197    ok=false;
    198198    *error << "Test failed: predictions incorrect" << std::endl;
     
    214214        std::isnan(prediction1(0,2)) && std::isnan(prediction1(0,3)) &&
    215215        std::isnan(prediction1(1,0)) &&
    216         fabs(prediction1(1,1)-2.0)<slack_bound &&
    217         fabs(prediction1(1,2))<slack_bound &&
    218         fabs(prediction1(1,3))<slack_bound)) {
     216        std::abs(prediction1(1,1)-2.0)<slack_bound &&
     217        std::abs(prediction1(1,2))<slack_bound &&
     218        std::abs(prediction1(1,3))<slack_bound)) {
    219219    *error << "Difference to expected prediction too large\n";
    220220    ok = false;
  • trunk/test/nni_test.cc

    r1121 r1210  
    7575  for (unsigned int i=0; i<control.rows(); i++)
    7676    for (unsigned int j=0; j<control.columns(); j++)
    77       if (fabs(control(i,j))>error_bound) {
     77      if (std::abs(control(i,j))>error_bound) {
    7878        if (print)
    7979          std::cerr << "kNNI FAILED, error on row " << i << " and "
    80                     << "column " << j << " is " << fabs(control(i,j))
     80                    << "column " << j << " is " << std::abs(control(i,j))
    8181                    << ". Expected less than " << error_bound << std::endl;
    8282        ok=false; // calculation result out of accepted error bounds
     
    106106  for (unsigned int i=0; i<control.rows(); i++)
    107107    for (unsigned int j=0; j<control.columns(); j++)
    108       if (fabs(control(i,j))>error_bound) {
     108      if (std::abs(control(i,j))>error_bound) {
    109109        if (print)
    110110          std::cerr << "WeNNI FAILED, error on row " << i << " and "
    111                     << "column " << j << " is " << fabs(control(i,j))
     111                    << "column " << j << " is " << std::abs(control(i,j))
    112112                    << ". Expected less than " << error_bound << std::endl;
    113113        ok=false; // calculation result out of accepted error bounds
     
    137137  for (unsigned int i=0; i<control.rows(); i++)
    138138    for (unsigned int j=0; j<control.columns(); j++)
    139       if (fabs(control(i,j))>error_bound) {
     139      if (std::abs(control(i,j))>error_bound) {
    140140        if (print)
    141141          std::cerr << "WeNNI binary weight test FAILED.\nError on row " << i
    142                     << " and column " << j << " is " << fabs(control(i,j))
     142                    << " and column " << j << " is " << std::abs(control(i,j))
    143143                    << ". Expected less than " << error_bound << std::endl;
    144144        ok=false; // calculation result out of accepted error bounds
  • trunk/test/regression_test.cc

    r1183 r1210  
    8686  regression::Polynomial polynomial(1);
    8787  polynomial.fit(x,y);
    88   if ( fabs(linear.beta()-polynomial.fit_parameters()(1))>0.0001 ){
     88  if ( std::abs(linear.beta()-polynomial.fit_parameters()(1))>0.0001 ){
    8989    *error << "error: beta and fit_parameters(1) not equal" << std::endl;
    9090    *error << "       beta = " << linear.beta() << std::endl;
     
    9393    ok = false;
    9494  }
    95   if ( fabs(polynomial.fit_parameters()(0)-linear.alpha()+
     95  if ( std::abs(polynomial.fit_parameters()(0)-linear.alpha()+
    9696            linear.beta()*1985)>0.0001){
    9797    *error << "error: fit_parameters(0) = "
     
    101101    ok = false;
    102102  }
    103   if ( fabs(polynomial.chisq()-linear.chisq())>0.0001){
     103  if ( std::abs(polynomial.chisq()-linear.chisq())>0.0001){
    104104    *error << "error: chisq not same in linear and polynomial(1)"
    105105           << std::endl;
    106106    ok = false;
    107107  }
    108   if ( fabs(polynomial.predict(1.0)-linear.predict(1.0))>0.0001){
     108  if ( std::abs(polynomial.predict(1.0)-linear.predict(1.0))>0.0001){
    109109    *error << "error: predict not same in linear and polynomial(1)"
    110110           << std::endl;
    111111    ok = false;
    112112  }
    113   if ( fabs(polynomial.standard_error2(1985)-linear.standard_error2(1985))
     113  if ( std::abs(polynomial.standard_error2(1985)-linear.standard_error2(1985))
    114114       >0.0001){
    115115    *error << "error: standard_error not same in linear and polynomial(1)"
     
    126126  double y_predicted = linear_w.predict(1990);
    127127  double y_predicted_err = linear_w.prediction_error2(1990);
    128   if (fabs(y_predicted-12.8)>0.001){
     128  if (std::abs(y_predicted-12.8)>0.001){
    129129    *error << "error: cannot reproduce fit." << std::endl;
    130130    *error << "predicted value: " << y_predicted << " expected 12.8"
     
    139139  regression::PolynomialWeighted polynomial_w(1);
    140140  polynomial_w.fit(x,y,w);
    141   if ( fabs(linear_w.beta()-polynomial_w.fit_parameters()(1))>10e-7 ){
     141  if ( std::abs(linear_w.beta()-polynomial_w.fit_parameters()(1))>10e-7 ){
    142142    *error << "error: beta and fit_parameters(1) not equal" << std::endl;
    143143    *error << "       beta = " << linear_w.beta() << std::endl;
     
    146146    ok = false;
    147147  }
    148   if ( fabs(polynomial_w.fit_parameters()(0)-linear_w.alpha()+
     148  if ( std::abs(polynomial_w.fit_parameters()(0)-linear_w.alpha()+
    149149            linear_w.beta()*1990)>0.0001){
    150150    *error << "error: fit_parameters(0) = "
     
    154154    ok = false;
    155155  }
    156   if ( fabs(polynomial_w.s2()-linear_w.s2())>0.0001){
     156  if ( std::abs(polynomial_w.s2()-linear_w.s2())>0.0001){
    157157    *error << "error: chisq not same in linear and polynomial(1)"
    158158           << std::endl;
    159159    ok = false;
    160160  }
    161   if ( fabs(polynomial_w.predict(1.0)-linear_w.predict(1.0))>0.0001){
     161  if ( std::abs(polynomial_w.predict(1.0)-linear_w.predict(1.0))>0.0001){
    162162    *error << "error: predict not same in linear and polynomial(1)"
    163163           << std::endl;
    164164    ok = false;
    165165  }
    166   if ( fabs(polynomial_w.standard_error2(1985)-linear_w.standard_error2(1985))
     166  if ( std::abs(polynomial_w.standard_error2(1985)-linear_w.standard_error2(1985))
    167167       >0.0001){
    168168    *error << "error: standard_error not same in linear and polynomial(1)"
     
    218218    polynomialfit.fit(x,ln_y);
    219219    utility::Vector fit=polynomialfit.fit_parameters();
    220     if (fabs(fit(0)-1.012229646706 + fit(1)-0.012561322528 +
     220    if (std::abs(fit(0)-1.012229646706 + fit(1)-0.012561322528 +
    221221             fit(2)+1.159674470130)>1e-11) {
    222222      *error << "regression_Polynomial: cannot reproduce fit." << std::endl;
     
    267267  r.fit(x,y);
    268268  rw.fit(x,y,w);
    269   if (fabs(r.predict(2000) - rw.predict(2000))>1e-15) {
     269  if (std::abs(r.predict(2000) - rw.predict(2000))>1e-15) {
    270270    ok = false;
    271271    *error << "Error: predict not equal\n"
     
    274274           << std::endl;
    275275  }
    276   if (fabs(r.s2()-rw.s2(1.0))>10E-7){
     276  if (std::abs(r.s2()-rw.s2(1.0))>10E-7){
    277277    ok = false;
    278278    *error << "Error: s2 not equal non-weighted version." << std::endl;
     
    280280    *error << "non-weighted s2 = " << r.s2() << std::endl;
    281281  }
    282   if (fabs(r.standard_error2(2000)-rw.standard_error2(2000))>10e-7){
     282  if (std::abs(r.standard_error2(2000)-rw.standard_error2(2000))>10e-7){
    283283    ok = false;
    284284    *error << "Error: standard_error not equal non-weighted version."
    285285           << std::endl;
    286286  }
    287   if (fabs(r.r2()-rw.r2())>10E-7){
     287  if (std::abs(r.r2()-rw.r2())>10E-7){
    288288    ok = false;
    289289    *error << "Error: r2 not equal non-weighted version." << std::endl;
     
    291291    *error << "non-weighted r2 = " << r.r2() << std::endl;
    292292  }
    293   if (fabs(r.prediction_error2(2000)-rw.prediction_error2(2000,1))>10e-7){
     293  if (std::abs(r.prediction_error2(2000)-rw.prediction_error2(2000,1))>10e-7){
    294294    ok = false;
    295295    *error << "Error: prediction_error2 not equal non-weighted version.\n"
     
    318318  w*=2;
    319319  wr.fit(x,y,w);
    320   if (fabs(wr.predict(2000)-predict)>10e-11){
     320  if (std::abs(wr.predict(2000)-predict)>10e-11){
    321321    ok = false;
    322322    *error << "Error: predict not equal after rescaling.\n";
     
    325325    *error << "       predict = " << wr.predict(2000) << "\n";
    326326  }
    327   if (fabs(wr.s2(2)-s2)>10e-11){
     327  if (std::abs(wr.s2(2)-s2)>10e-11){
    328328    ok = false;
    329329    *error << "Error: s2 not equal after rescaling.\n";
     
    332332    *error << "difference " << s2-wr.s2(2.0) << std::endl;
    333333  }
    334   if (fabs(wr.standard_error2(2000)-standard_error2)>10e-6){
     334  if (std::abs(wr.standard_error2(2000)-standard_error2)>10e-6){
    335335    ok = false;
    336336    *error << "Error: standard_error2 not equal after rescaling.\n";
     
    342342           << std::endl;
    343343  }
    344   if (fabs(wr.r2()-r2)>10e-6){
     344  if (std::abs(wr.r2()-r2)>10e-6){
    345345    ok = false;
    346346    *error << "Error: r2 not equal after rescaling.\n";
    347347  }
    348   if (fabs(wr.prediction_error2(2000,2)-prediction_error2)>10e-6){
     348  if (std::abs(wr.prediction_error2(2000,2)-prediction_error2)>10e-6){
    349349    ok = false;
    350350    *error << "Error: prediction_error2 not equal after rescaling.\n";
     
    382382
    383383  wr.fit(x2,y2,w2);
    384   if (fabs(wr.predict(2000) - predict)>1e-10) {
     384  if (std::abs(wr.predict(2000) - predict)>1e-10) {
    385385    ok = false;
    386386    *error << "Error: predict not equal.\n";
     
    390390
    391391  }
    392   if (fabs(wr.prediction_error2(2000) - prediction_error2)>1e-13) {
     392  if (std::abs(wr.prediction_error2(2000) - prediction_error2)>1e-13) {
    393393    ok = false;
    394394    *error << "Error: prediction_error2 not equal.\n";
    395395  }
    396   if (fabs(wr.r2() - r2)>1e-15) {
     396  if (std::abs(wr.r2() - r2)>1e-15) {
    397397    ok = false;
    398398    *error << "Error: r2 not equal.\n";
     
    400400    *error << "   r2: " << wr.r2() << "\n";
    401401  }
    402   if (fabs(wr.s2() - s2)>1e-15) {
     402  if (std::abs(wr.s2() - s2)>1e-15) {
    403403    ok = false;
    404404    *error << "Error: s2 not equal.\n";
    405405  }
    406   if (fabs(wr.standard_error2(2000) - standard_error2)>1e-15) {
     406  if (std::abs(wr.standard_error2(2000) - standard_error2)>1e-15) {
    407407    ok = false;
    408408    *error << "Error: standard_error2 not equal.\n";
     
    441441  }
    442442
    443   if (fabs(md.standard_error2(z)-mdw.standard_error2(z))>10e-6){
     443  if (std::abs(md.standard_error2(z)-mdw.standard_error2(z))>10e-6){
    444444    ok = false;
    445445    *error << "Error: standard_error2 not equal\n"
     
    448448           << std::endl;
    449449  }
    450   if (fabs(md.prediction_error2(z)-mdw.prediction_error2(z,1.0))>10e-7){
     450  if (std::abs(md.prediction_error2(z)-mdw.prediction_error2(z,1.0))>10e-7){
    451451    ok = false;
    452452    *error << "Error: prediction_error2 not equal\n"
     
    465465  w*=2;
    466466  mdw.fit(data,y,w);
    467   if (fabs(mdw.predict(z)-predict)>10e-10){
     467  if (std::abs(mdw.predict(z)-predict)>10e-10){
    468468    ok = false;
    469469    *error << "Error: predict not equal after rescaling.\n";
     
    471471    *error << "   predict = " << mdw.predict(z) << "\n";
    472472  }
    473   if (fabs(mdw.prediction_error2(z,2)-prediction_error2)>10e-7){
     473  if (std::abs(mdw.prediction_error2(z,2)-prediction_error2)>10e-7){
    474474    ok = false;
    475475    *error << "Error: prediction_error2 not equal after rescaling.\n";
     
    478478    *error << "       predict_error2 = " << mdw.prediction_error2(z,2) << "\n";
    479479  }
    480   if (fabs(mdw.s2(2)-s2)>10e-10){
     480  if (std::abs(mdw.s2(2)-s2)>10e-10){
    481481    ok = false;
    482482    *error << "Error: s2 not equal after rescaling.\n";
     
    484484    *error << "       s2 = " << mdw.s2(2) << "\n";
    485485  }
    486   if (fabs(mdw.standard_error2(z)-standard_error2)>10e-7){
     486  if (std::abs(mdw.standard_error2(z)-standard_error2)>10e-7){
    487487    ok = false;
    488488    *error << "Error: standard_error2 not equal after rescaling.\n";
  • trunk/test/statistics_test.cc

    r1120 r1210  
    5252  double tolerance=1e-10;
    5353  double skewness_gsl=statistics::skewness(gsl_vec);
    54   if (fabs(skewness_gsl)>tolerance)
     54  if (std::abs(skewness_gsl)>tolerance)
    5555    return -1;
    5656  double kurtosis_gsl=statistics::kurtosis(gsl_vec);
    57   if (fabs(kurtosis_gsl+1.5616363636363637113)>tolerance)
     57  if (std::abs(kurtosis_gsl+1.5616363636363637113)>tolerance)
    5858    return -1; 
    5959  return 0;
  • trunk/test/svm_test.cc

    r1133 r1210  
    101101
    102102  double tol=1e-6;
    103   if (fabs(classifier2.alpha()(1)-2)>tol ||
    104       fabs(classifier2.alpha()(2)-2)>tol){
     103  if (std::abs(classifier2.alpha()(1)-2)>tol ||
     104      std::abs(classifier2.alpha()(2)-2)>tol){
    105105    *error << "wrong alpha" << std::endl;
    106106    *error << "alpha: " << classifier2.alpha() <<  std::endl;
Note: See TracChangeset for help on using the changeset viewer.