Bug #1020

Matrix#rank loops in some circumstances

Added by Dave Thomas about 3 years ago. Updated 10 months ago.

[ruby-core:21385]
Status:Closed Start date:01/17/2009
Priority:Normal Due date:
Assignee:Yuki Sonoda % Done:

100%

Category:-
Target version:3.0
ruby -v:ruby 1.9.1p5000 (2009-01-16 trunk 21610) [i386-darwin9.6.0]

Description

$ ruby -v -r matrix -e 'p Matrix[ [1,2,3], [4,5,6], [7,8,9] ].rank'
ruby 1.9.1p5000 (2009-01-16 trunk 21610) [i386-darwin9.6.0]
<< loops... >>

The answer should be 2.

Associated revisions

Revision 24211
Added by _ wanabe over 2 years ago

* lib/matrix.rb (Matrix#rank): revert a part of r20859 to avoid infinite loop. [Bug #1020]

Revision 24211
Added by _ wanabe over 2 years ago

* lib/matrix.rb (Matrix#rank): revert a part of r20859 to avoid infinite loop. [Bug #1020]

History

Updated by Koichi Sasada about 3 years ago

  • Assignee set to Yuki Sonoda
  • Target version set to 3.0
  • ruby -v set to ruby 1.9.1p5000 (2009-01-16 trunk 21610) [i386-darwin9.6.0]

Updated by Run Paint Run Run over 2 years ago

Similarly:

    $ ruby1.8 -rmatrix -ve 'p Matrix[ [1, 2, 0, 3], [1, -2, 3, 0], [0, 0, 4, 8], [2, 4, 0, 6] ].rank'
    ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
    3

    $ ruby -rmatrix -ve 'p Matrix[ [1, 2, 0, 3], [1, -2, 3, 0], [0, 0, 4, 8], [2, 4, 0, 6] ].rank'
    ruby 1.9.1p129 (2009-05-12 revision 23412) [i686-linux]
    ^C/usr/local/lib/ruby/1.9.1/matrix.rb:775:in `block in rank': Interrupt
	from /usr/local/lib/ruby/1.9.1/matrix.rb:774:in `loop'
	from /usr/local/lib/ruby/1.9.1/matrix.rb:774:in `rank'
	from -e:1:in `<main>'

The second example just hangs until I kill it. 

Updated by _ wanabe over 2 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100
Applied in changeset r24211.

Also available in: Atom PDF