summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-13 05:50:34 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-13 05:50:34 +0000
commitad162055c41cbcb279705480c8405219688e34f2 (patch)
tree4aa4a08d2e6b57d2371c547e7f6032e038207ca8
parent790e7f797b94d5bcbe79448a17189f845aca1498 (diff)
* 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
-rw-r--r--ChangeLog6
-rw-r--r--lib/matrix/eigenvalue_decomposition.rb4
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index f53ac70a41..f01befbe71 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
* lib/irb.rb, lib/prime.rb: Typos in overview
diff --git a/lib/matrix/eigenvalue_decomposition.rb b/lib/matrix/eigenvalue_decomposition.rb
index ab5888ff37..1949406687 100644
--- a/lib/matrix/eigenvalue_decomposition.rb
+++ b/lib/matrix/eigenvalue_decomposition.rb
@@ -84,14 +84,14 @@ class Matrix
private
def build_eigenvectors
# 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|
if imag == 0
Array.new(@size){|j| @v[j][i]}
elsif imag > 0
Array.new(@size){|j| Complex(@v[j][i], @v[j][i+1])}
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