Project

General

Profile

Actions

Bug #1531

closed

Matrix#determinant fails on some matrices

Added by marcandre (Marc-Andre Lafortune) over 15 years ago. Updated over 13 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.9.2dev (2009-05-24 trunk 23554) [i386-darwin9.7.0]
Backport:
[ruby-core:23597]

Description

=begin
ruby1.9 -r matrix -e 'Matrix[[0,1],[1,0]].determinant'
/usr/local/ruby191/lib/ruby/1.9.1/matrix.rb:685:in block (2 levels) in determinant': undefined method +' for nil:NilClass (NoMethodError)
from /usr/local/ruby191/lib/ruby/1.9.1/matrix.rb:684:in loop' from /usr/local/ruby191/lib/ruby/1.9.1/matrix.rb:684:in block in determinant'
from /usr/local/ruby191/lib/ruby/1.9.1/matrix.rb:681:in loop' from /usr/local/ruby191/lib/ruby/1.9.1/matrix.rb:681:in determinant'
from -e:1:in `'

Same with determinant_e.

To fix: gsub('ii','i') in matrix.rb
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0