Opened 14 years ago

Closed 14 years ago

Last modified 7 years ago

#536 closed defect (fixed)

sorting range with NaNs does not behave as desired

Reported by: Peter Owned by: Jari Häkkinen
Priority: major Milestone: yat 0.6
Component: utility Version: trunk
Keywords: Cc:


spin-off from ticket:535

This ticket is for the 0.6 implementation of the bug reported in ticket:535.

As mentioned there, the solution is a functor that works like less but treats NaN as infinity. What to call the functor? Something with less?

Change History (9)

comment:1 Changed 14 years ago by Peter

Let's wait with this until 0.5.3 is merged into trunk.

comment:2 Changed 14 years ago by Peter

(In [1966]) adding functor less_nan (refs #536)

comment:3 Changed 14 years ago by Peter

(In [1967]) refs #536 using less_nan in Vector sort

comment:4 Changed 14 years ago by Peter

This problem also occurs in statistics::mad(3). Should we change DataWeight::operator< to use behave as less_nan<DataWeight>? If yes, we can remove less_nan<DataWeight> as it'd be redundant with less<DataWeight>.

comment:5 Changed 14 years ago by Peter

(In [2003]) refs #536. changed DataWeight? comparison operators to be based on less_nan. Corrected template arguments in binary_function for less_nan

comment:6 Changed 14 years ago by Peter

(In [2004]) simplified code in Percentiler - refs #536

comment:7 Changed 14 years ago by Peter

(In [2005]) simplified code in qQuantileNormalizer - refs #536

comment:8 Changed 14 years ago by Peter

Resolution: fixed
Status: newclosed

(In [2006]) fixes #536. This is the last fix for #536. I don't see how to avoid the copying involved in the 0.5-stable branch fix (ticket:535), but I change so we copy to a vector<double> rather than vector<DataWeight?>. This is because sort_index is faster for std::vector<double>::iterator and StrideIterator?<double*> (the latter for Vector and Matrix iterators). These are actually the special cases that are implemented and in the generic case the range is copied to a vector<double>. So by using a vector<double> directly, we can avoid a copying.

comment:9 Changed 7 years ago by Peter

ticket #875 was marked as related

Note: See TracTickets for help on using tickets.