SciRuby / daru

Data Analysis in RUby
BSD 2-Clause "Simplified" License
1.03k stars 139 forks source link

Matrix.column_count returns nil after require 'daru' #393

Closed tramuntanal closed 6 years ago

tramuntanal commented 6 years ago

The bug appears in two forms.

  1. If the Matrix was created before requiring 'daru' colum_size doesn't work:

    irb(main):002:0> require 'matrix'
    => true
    irb(main):003:0> m= Matrix.zero(2)
    => Matrix[[0, 0], [0, 0]]
    irb(main):004:0> m.column_count
    => 2
    irb(main):005:0> m.column_size
    => 2
    irb(main):006:0> require 'daru'
    => true
    irb(main):007:0> m.column_count
    => 2
    irb(main):008:0> m.column_size
    => nil
  2. If the Matrix is created after requiring 'daru' colum_count doesn't work:

    irb(main):001:0> require 'matrix'
    => true
    irb(main):002:0> m= Matrix.zero(2)
    => Matrix[[0, 0], [0, 0]]
    irb(main):003:0> m.column_count
    => 2
    irb(main):004:0> m.column_size
    => 2
    irb(main):005:0> require 'daru'
    => true
    irb(main):006:0> m= Matrix.zero(2)
    => Matrix[[0, 0], [0, 0]]
    irb(main):007:0> m.column_count
    => nil
    irb(main):008:0> m.column_size
    => 2

I can't find any reference to #column_count or #column_size in the Daru code.

zverok commented 6 years ago

Aknowledged. It is nasty bag, caused by backports gem requireing. Unfortunately, it is not that easy to fix: backports required not only in daru itself, but also in packable gem, required by nmatrix. I've did a PR to packable, but I am not sure when it could be merged :( Only after that we can proceed with fixing the bug.

v0dro commented 6 years ago

Issue has been solved by removing backports dependency.

zverok commented 6 years ago

Ugh. We can't mark this issue as a resolved. I should've mark corresponding PR as WIP, sorry :( The problem describe in this comment:

It is nasty bag, caused by backports gem requireing. Unfortunately, it is not that easy to fix: backports required not only in daru itself, but also in packable gem, required by nmatrix. I've did a PR to packable, but I am not sure when it could be merged :( Only after that we can proceed with fixing the bug.

I provided a PR to original packable repo, and it was merged, but only after that I've noticed that SciRuby have taken over packable.

So, the course of actions are:

v0dro commented 6 years ago

If you can submit that PR to sciruby/packable I can merge it and release a new version.

zverok commented 6 years ago

Done the PR to SciRuby/packable.

zverok commented 6 years ago

It is fixed in master, I'll release a new minor version soon.