Changeset 2003


Ignore:
Timestamp:
Jun 13, 2009, 10:48:10 PM (12 years ago)
Author:
Peter
Message:

refs #536. changed DataWeight? comparison operators to be based on less_nan. Corrected template arguments in binary_function for less_nan

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEWS

    r1998 r2003  
    55Version 0.6 (released DATE)
    66
     7  - DataWeight comparison operators were changed in case of NaN (ticket:536)
    78  - new option --libs-without-cblas in yat-config (ticket:523)
    89  - blas is no longer hard-coded into libyat.so and libyat.la (ticket:518)
  • trunk/yat/utility/DataWeight.cc

    r1797 r2003  
    2222
    2323#include "DataWeight.h"
     24#include "stl_utility.h"
    2425
    2526namespace theplu {
     
    6869  bool operator<(const DataWeight& lhs, const DataWeight& rhs)
    6970  {
    70     return lhs.data() < rhs.data();
     71    less_nan<DataWeight> comp;
     72    return comp(lhs, rhs);
    7173  }
    7274
     
    7476  bool operator>(const DataWeight& lhs, const DataWeight& rhs)
    7577  {
    76     return lhs.data() > rhs.data();
     78    return rhs < lhs;
    7779  }
    7880
     
    8082  bool operator<=(const DataWeight& lhs, const DataWeight& rhs)
    8183  {
    82     return lhs.data() <= rhs.data();
     84    return lhs < rhs || lhs == rhs;
    8385  }
    8486
     
    8688  bool operator>=(const DataWeight& lhs, const DataWeight& rhs)
    8789  {
    88     return lhs.data() >= rhs.data();
     90    return lhs > rhs || lhs == rhs;
    8991  }
    9092
  • trunk/yat/utility/DataWeight.h

    r1887 r2003  
    9696     \brief comparison operator
    9797
    98      \return true if lhs data is less than rhs data
     98     \return less_nan(lhs.data(), rhs.data())
     99
     100     \see less_nan
    99101
    100102     \relates DataWeight
     
    105107     \brief comparison operator
    106108
    107      \return true if lhs data is greater than rhs data
     109     \return \a rhs < \a lhs
    108110
    109111     \relates DataWeight
     
    114116     \brief comparison operator
    115117
    116      \return true if lhs.data() <= rhs.data()
     118     \return true if \a lhs < \a rhs or lhs == rhs
    117119
    118120     \relates DataWeight
     
    123125     \brief comparison operator
    124126
    125      \return true if lhs.data() >= rhs.data()
     127     \return true if \a lhs > rhs or \a lhs == \a rhs
    126128
    127129     \relates DataWeight
  • trunk/yat/utility/stl_utility.h

    r2001 r2003  
    211211  */
    212212  template<typename T>
    213   struct less_nan : std::binary_function<bool, T, T>
     213  struct less_nan : std::binary_function<T, T, bool>
    214214  {
    215215    /**
     
    234234  template<>
    235235  struct less_nan<DataWeight>
    236     : std::binary_function<bool, DataWeight, DataWeight>
     236    : std::binary_function<DataWeight, DataWeight, bool>
    237237  {
    238238    /**
Note: See TracChangeset for help on using the changeset viewer.