Ignore:
Timestamp:
Oct 6, 2007, 1:02:08 AM (14 years ago)
Author:
Peter
Message:

reimplementing yat_assert as a throwing function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/classifier/KNN.h

    r931 r936  
    1414#include <cmath>
    1515#include <map>
     16#include <stdexcept>
    1617
    1718namespace theplu {
     
    129130        for(size_t j=0; j<input.columns(); j++) {
    130131          classifier::DataLookupWeighted1D test(*weighted_input,j,false);
    131           yat_assert(training.size()==test.size());
    132           (*distances)(i,j)=statistics::vector_distance(training.begin(),training.end(),test.begin(),typename statistics::vector_distance_traits<Distance>::distance());
    133           yat_assert(!std::isnan((*distances)(i,j)));
     132          utility::yat_assert<std::runtime_error>(training.size()==test.size());
     133          (*distances)(i,j) =
     134            statistics::vector_distance(training.begin(),training.end(),
     135                                        test.begin(), typename statistics::vector_distance_traits<Distance>::distance());
     136          utility::yat_assert<std::runtime_error>(!std::isnan((*distances)(i,j)));
    134137        }
    135138      }
Note: See TracChangeset for help on using the changeset viewer.