mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/matrix/lup_decomposition: Fix bugs with LUP Decomposition of
rectangular matrices. [rubyspec:ba849801a85] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d5b62c3aa1
commit
1f4c792072
2 changed files with 9 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
|||
Mon Jan 14 07:12:52 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
|
||||
|
||||
* lib/matrix/lup_decomposition: Fix bugs with LUP Decomposition of
|
||||
rectangular matrices. [rubyspec:ba849801a85]
|
||||
|
||||
Mon Jan 14 06:46:53 2013 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* regparse.c (add_ctype_to_cc): don't check dup warn on adding
|
||||
|
|
|
@ -19,7 +19,7 @@ class Matrix
|
|||
include Matrix::ConversionHelper
|
||||
|
||||
def l
|
||||
Matrix.build(@row_count, @column_count) do |i, j|
|
||||
Matrix.build(@row_count, [@column_count, @row_count].min) do |i, j|
|
||||
if (i > j)
|
||||
@lu[i][j]
|
||||
elsif (i == j)
|
||||
|
@ -33,7 +33,7 @@ class Matrix
|
|||
# Returns the upper triangular factor +U+
|
||||
|
||||
def u
|
||||
Matrix.build(@column_count, @column_count) do |i, j|
|
||||
Matrix.build([@column_count, @row_count].min, @column_count) do |i, j|
|
||||
if (i <= j)
|
||||
@lu[i][j]
|
||||
else
|
||||
|
@ -45,9 +45,9 @@ class Matrix
|
|||
# Returns the permutation matrix +P+
|
||||
|
||||
def p
|
||||
rows = Array.new(@row_count){Array.new(@column_count, 0)}
|
||||
rows = Array.new(@row_count){Array.new(@row_count, 0)}
|
||||
@pivots.each_with_index{|p, i| rows[i][p] = 1}
|
||||
Matrix.send :new, rows, @column_count
|
||||
Matrix.send :new, rows, @row_count
|
||||
end
|
||||
|
||||
# Returns +L+, +U+, +P+ in an array
|
||||
|
|
Loading…
Reference in a new issue