* lib/matrix/eigenvalue_decomposition: Fix eigensystem with complex
eigenvectors. Patch by pypypy567. [Bug #7208] [ruby-dev:46251] [rubyspec:242f8e55bd] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
790e7f797b
commit
ad162055c4
@ -1,3 +1,9 @@
|
|||||||
|
Sun Jan 13 14:48:55 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
|
||||||
|
|
||||||
|
* lib/matrix/eigenvalue_decomposition: Fix eigensystem with complex
|
||||||
|
eigenvectors. Patch by pypypy567.
|
||||||
|
[Bug #7208] [ruby-dev:46251] [rubyspec:242f8e55bd]
|
||||||
|
|
||||||
Sun Jan 13 14:06:00 2013 Zachary Scott <zachary@zacharyscott.net>
|
Sun Jan 13 14:06:00 2013 Zachary Scott <zachary@zacharyscott.net>
|
||||||
|
|
||||||
* lib/irb.rb, lib/prime.rb: Typos in overview
|
* lib/irb.rb, lib/prime.rb: Typos in overview
|
||||||
|
@ -84,14 +84,14 @@ class Matrix
|
|||||||
private
|
private
|
||||||
def build_eigenvectors
|
def build_eigenvectors
|
||||||
# JAMA stores complex eigenvectors in a strange way
|
# JAMA stores complex eigenvectors in a strange way
|
||||||
# See http://cio.nist.gov/esd/emaildir/lists/jama/msg01021.html
|
# See http://web.archive.org/web/20111016032731/http://cio.nist.gov/esd/emaildir/lists/jama/msg01021.html
|
||||||
@e.each_with_index.map do |imag, i|
|
@e.each_with_index.map do |imag, i|
|
||||||
if imag == 0
|
if imag == 0
|
||||||
Array.new(@size){|j| @v[j][i]}
|
Array.new(@size){|j| @v[j][i]}
|
||||||
elsif imag > 0
|
elsif imag > 0
|
||||||
Array.new(@size){|j| Complex(@v[j][i], @v[j][i+1])}
|
Array.new(@size){|j| Complex(@v[j][i], @v[j][i+1])}
|
||||||
else
|
else
|
||||||
Array.new(@size){|j| Complex(@v[j][i], -@v[j][i-1])}
|
Array.new(@size){|j| Complex(@v[j][i-1], -@v[j][i])}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user