Skip to content

Commit

Permalink
avoid SEGV in RubyVM::InstructionSequence with ruby ver 2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
masa16 committed Jan 22, 2019
1 parent da2c864 commit 87732ca
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions lib/numo/linalg/function.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1084,14 +1084,11 @@ def lstsq(a, b, driver:'lsd', rcond:-1)
when n
resids = (x[n..-1,true].abs**2).sum(axis:0)
when NArray
if true
resids = (x[false,n..-1,true].abs**2).sum(axis:-2)
else
resids = x[false,0,true].new_zeros
mask = rank.eq(n)
# NArray does not suppurt this yet.
resids[mask,true] = (x[mask,n..-1,true].abs**2).sum(axis:-2)
end
resids = (x[false,n..-1,true].abs**2).sum(axis:-2)
## NArray does not suppurt this yet.
# resids = x[false,0,true].new_zeros
# mask = rank.eq(n)
# resids[mask,true] = (x[mask,n..-1,true].abs**2).sum(axis:-2)
end
end
x = x[false,0...n,true]
Expand Down

0 comments on commit 87732ca

Please sign in to comment.