Ignore:
Timestamp:
Oct 9, 2008, 8:31:34 PM (13 years ago)
Author:
Jari Häkkinen
Message:

Fixes #192. Using std::numeric_limits, since impute algorithms are slightly changed template results also changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/utility/kNNI.cc

    r1487 r1554  
    55  Copyright (C) 2005 Peter Johansson
    66  Copyright (C) 2006 Jari Häkkinen
    7   Copyright (C) 2007 Jari Häkkinen, Peter Johansson
    8   Copyright (C) 2008 Peter Johansson
     7  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    98
    109  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    3130#include <fstream>
    3231#include <vector>
     32#include <limits>
    3333
    3434namespace theplu {
     
    5757  unsigned int kNNI::estimate(void)
    5858  {
     59    double small_number=std::numeric_limits<double>::epsilon();
    5960    for (size_t i=0; i<mv_rows_.size(); i++) {
    6061      std::vector<std::pair<size_t,double> >
     
    7071               ++k) {
    7172            // Avoid division with zero (perfect match vectors)
    72             double d=(distance[*k].second ? distance[*k].second : 1e-10);
     73            double d=(distance[*k].second ? distance[*k].second : small_number);
    7374            new_value+=data_(distance[*k].first,j)/d;
    7475            norm+=1.0/d;
Note: See TracChangeset for help on using the changeset viewer.