ruby-numo / numo-narray

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

Inconsistency in `Numo::DFloat#dot` after `require 'numo/linalg' #99

Open giuse opened 6 years ago

giuse commented 6 years ago

Not sure whether this should go here or in numo-linalg.

require 'numo/narray'
# => true
a = Numo::DFloat.zeros(1,10)
# => Numo::DFloat#shape=[1,10]
# [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
b = Numo::DFloat.zeros(1)
# => Numo::DFloat#shape=[1]
# [0]
a.dot b
# => Numo::DFloat#shape=[1]
# [0]
require 'numo/linalg'
# => true
a.dot b
# Numo::NArray::ShapeError: na must be == nx: na=10 nx=1
# from /home/giuse/.rvm/gems/ruby-2.4.2/gems/numo-linalg-0.1.2/lib/numo/linalg/function.rb:20:in `dgemv'

And even worse (this was my initial failure):

# starting from fresh console
require 'numo/linalg'
# => true
a = Numo::DFloat.zeros(1)
# => Numo::DFloat#shape=[1]
# [0]
b = Numo::DFloat.zeros(1, 5600)
# => Numo::DFloat#shape=[1,5600]
# [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...]]
a.dot b
# /home/giuse/.rvm/gems/ruby-2.4.2/gems/numo-linalg-0.1.2/lib/numo/linalg/function.rb:20: [BUG] Segmentation fault at 0x00000000038f34a0
# ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]
# [full stack trace available upon request]

Gem versions:

$ gem list numo

*** LOCAL GEMS ***

numo-gsl (0.1.2)
numo-linalg (0.1.2)
numo-narray (0.9.1.2)