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/WeNNI.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 <cmath>
    3231#include <fstream>
     32#include <limits>
    3333
    3434namespace theplu {
     
    5252  unsigned int WeNNI::estimate(void)
    5353  {
     54    double small_number=std::numeric_limits<double>::epsilon();
    5455    for (size_t i=0; i<data_.rows(); i++) {
    5556      std::vector<std::pair<size_t,double> > distance(calculate_distances(i));
     
    6465             ++k) {
    6566          // Avoid division with zero (perfect match vectors)
    66           double d=(distance[*k].second ? distance[*k].second : 1e-10);
     67          double d=(distance[*k].second ? distance[*k].second : small_number);
    6768          new_value+=(weight_(distance[*k].first,j) *
    6869                      data_(distance[*k].first,j)/d);
Note: See TracChangeset for help on using the changeset viewer.