[#23457] [Bug #1471] "Mutual join" deadlock detection faulty in 1.8.6 and 1.8.7 — John Carter <redmine@...>

Bug #1471: "Mutual join" deadlock detection faulty in 1.8.6 and 1.8.7

17 messages 2009/05/15

[#23483] [Bug #1478] Ruby archive — Oleg Puchinin <redmine@...>

Bug #1478: Ruby archive

29 messages 2009/05/16
[#29225] [Feature #1478] Ruby archive — Luis Lavena <redmine@...> 2010/04/02

Issue #1478 has been updated by Luis Lavena.

[#30345] Re: [Feature #1478] Ruby archive — "NAKAMURA, Hiroshi" <nakahiro@...> 2010/05/21

On Fri, Apr 2, 2010 at 17:13, Luis Lavena <redmine@ruby-lang.org> wrote:

[#30346] Re: [Feature #1478] Ruby archive — Jonathan Nielsen <jonathan@...> 2010/05/21

> Thanks for your comment.

[#30347] Re: [Feature #1478] Ruby archive — Jonathan Nielsen <jonathan@...> 2010/05/21

OK Hiroshi, I read some of the comments earlier in the thread that I

[#30355] Re: [Feature #1478] Ruby archive — Caleb Clausen <vikkous@...> 2010/05/21

On 5/20/10, Jonathan Nielsen <jonathan@jmnet.us> wrote:

[#30364] Re: [Feature #1478] Ruby archive — Benoit Daloze <eregontp@...> 2010/05/22

Hi,

[#23505] [Bug #1494] tempfile#unlink may silently fail on windows — Nicholas Manning <redmine@...>

Bug #1494: tempfile#unlink may silently fail on windows

19 messages 2009/05/19

[#23572] [Bug #1525] Deadlock in Ruby 1.9's VM caused by ConditionVariable.wait and fork? — Hongli Lai <redmine@...>

Bug #1525: Deadlock in Ruby 1.9's VM caused by ConditionVariable.wait and fork?

27 messages 2009/05/27

[#23595] Meaning of RUBY_PLATFORM — Rick DeNatale <rick.denatale@...>

The RUBY_PLATFORM constant is documented in the latest Pickaxe as "The

17 messages 2009/05/28
[#23596] Re: Meaning of RUBY_PLATFORM — Luis Lavena <luislavena@...> 2009/05/28

On Thu, May 28, 2009 at 3:41 PM, Rick DeNatale <rick.denatale@gmail.com> wrote:

[#23602] Re: Meaning of RUBY_PLATFORM — Rick DeNatale <rick.denatale@...> 2009/05/28

On Thu, May 28, 2009 at 2:52 PM, Luis Lavena <luislavena@gmail.com> wrote:

[#23608] Re: Meaning of RUBY_PLATFORM — Luis Lavena <luislavena@...> 2009/05/28

On Thu, May 28, 2009 at 7:08 PM, Rick DeNatale <rick.denatale@gmail.com> wrote:

[#23609] Re: Meaning of RUBY_PLATFORM — Rick DeNatale <rick.denatale@...> 2009/05/29

On Thu, May 28, 2009 at 7:22 PM, Luis Lavena <luislavena@gmail.com> wrote:

[ruby-core:23556] [Bug #1515] [PATCH] Teach Matrix#square? About Non-Square Matrices; Fix Crasher

From: Run Paint Run Run <redmine@...>
Date: 2009-05-25 20:24:06 UTC
List: ruby-core #23556
Bug #1515: [PATCH] Teach Matrix#square? About Non-Square Matrices; Fix Crasher
http://redmine.ruby-lang.org/issues/show/1515

Author: Run Paint Run Run
Status: Open, Priority: Normal
ruby -v: ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux] / ruby 1.9.0 (2008-06-20 revision 17482) [i486-linux]

The .square? method of the Matrix class regards a matrix as square if it contains the same number of rows as it does columns in the first row. Thus, Matrix[ [1,2],[1] ].square? returns true. Not only is this wrong, as admitted in the source code, but it also breaks other methods that rely upon it. For example:

irb(main):003:0> Matrix[ [1,2],[1] ].determinant
NoMethodError: undefined method `-' for nil:NilClass
	from /usr/lib/ruby/1.9.0/matrix.rb:715:in `block (2 levels) in determinant'
	from /usr/lib/ruby/1.9.0/matrix.rb:713:in `upto'
	from /usr/lib/ruby/1.9.0/matrix.rb:713:in `block in determinant'
	from /usr/lib/ruby/1.9.0/matrix.rb:710:in `upto'
	from /usr/lib/ruby/1.9.0/matrix.rb:710:in `determinant'
	from (irb):3
	from /usr/bin/irb1.9:12:in `<main>'

This occurs on the following versions:
* ruby 1.9.0 (2008-06-20 revision 17482) [i486-linux]
* ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
And it's been confirmed on 1.9.1, too.

There are a host of issues with this class, some of which I'll report separately, but this can be fixed with a trivial change to the .square? method: "@rows.all?{|r| r.size == @rows.size}". With this patch:

>> Matrix[ [1,2],[1] ].determinant
=> 0
>> Matrix[ [1,2],[1] ].square?
=> false

This is consistent with the documentation which states that non-square matrices will have a determinant of 0.


----------------------------------------
http://redmine.ruby-lang.org

In This Thread

Prev Next