[前][次][番号順一覧][スレッド一覧]

ruby-changes:26747

From: marcandre <ko1@a...>
Date: Sun, 13 Jan 2013 14:50:45 +0900 (JST)
Subject: [ruby-changes:26747] marcandRe: r38799 (trunk): * lib/matrix/eigenvalue_decomposition: Fix eigensystem with complex

marcandre	2013-01-13 14:50:34 +0900 (Sun, 13 Jan 2013)

  New Revision: 38799

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38799

  Log:
    * lib/matrix/eigenvalue_decomposition: Fix eigensystem with complex
      eigenvectors. Patch by pypypy567.
      [Bug #7208] [ruby-dev:46251] [rubyspec:242f8e55bd]

  Modified files:
    trunk/ChangeLog
    trunk/lib/matrix/eigenvalue_decomposition.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 38798)
+++ ChangeLog	(revision 38799)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Jan 13 14:48:55 2013  Marc-Andre Lafortune  <ruby-core@m...>
+
+	* 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@z...>
 
 	* lib/irb.rb, lib/prime.rb: Typos in overview
Index: lib/matrix/eigenvalue_decomposition.rb
===================================================================
--- lib/matrix/eigenvalue_decomposition.rb	(revision 38798)
+++ lib/matrix/eigenvalue_decomposition.rb	(revision 38799)
@@ -84,14 +84,14 @@ class Matrix https://github.com/ruby/ruby/blob/trunk/lib/matrix/eigenvalue_decomposition.rb#L84
   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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]