ruby-numo / numo-narray

Ruby/Numo::NArray - New NArray class library
http://ruby-numo.github.io/narray/
BSD 3-Clause "New" or "Revised" License
415 stars 41 forks source link

Bug in `Numo::DFloat#sort` #97

Open giuse opened 6 years ago

giuse commented 6 years ago

I include the exact values with which I found this bug to be reproducible, as it does not present itself with the usual Numo::DFloat.new(20).rand:

a = Numo::NArray[0.0, 0.07429146315444714, 0.0, 0.09308358588720718, 0.0,
  0.011095908735781, 0.0, 0.0208258994189262, 0.051828227889227724,
  0.6506334068053423, 0.00017601901052727637, 0.0, 0.03211119153729845, 0.0, 
  0.061203570274688306, 0.0, 0.004750727286554533, 0.0, 0.0, 0.0]
# => Numo::DFloat#shape=[20]
# [0, 0.0742915, 0, 0.0930836, 0, 0.0110959, 0, 0.0208259, 0.0518282, ...]
a.sort.to_a == a.to_a.sort
# => false
a.sort.to_a
# => [0.0,
# 0.0,
# 0.061203570274688306,
# 0.09308358588720718,
# 0.03211119153729845,
# 0.011095908735781,
# 0.004750727286554533,
# 0.0208258994189262,
# 0.051828227889227724,
# 0.6506334068053423,
# 0.0,
# 0.0,
# 0.00017601901052727637,
# 0.0,
# 0.0,
# 0.0,
# 0.0,
# 0.0,
# 0.0,
# 0.07429146315444714]
masa16 commented 6 years ago

This bug was fixed after https://github.com/ruby-numo/numo-narray/issues/90

giuse commented 6 years ago

The latest published gem version is 0.9.1.2, which does not include the commit e3d14227e9574ccf8c8415751c8a6a97c6da3dd0 which fixes this bug. Could you please release an hotfix?
I have my reasons for not pointing my Gemfile dependency to the GitHub repo directly. Thank you.