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

ruby-changes:53290

From: marcandre <ko1@a...>
Date: Sat, 3 Nov 2018 03:10:25 +0900 (JST)
Subject: [ruby-changes:53290] marcandRe: r65504 (trunk): lib/matrix: Use consistent style

marcandre	2018-11-03 02:52:20 +0900 (Sat, 03 Nov 2018)

  New Revision: 65504

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65504

  Log:
    lib/matrix: Use consistent style

  Modified files:
    trunk/lib/matrix/eigenvalue_decomposition.rb
    trunk/lib/matrix.rb
Index: lib/matrix/eigenvalue_decomposition.rb
===================================================================
--- lib/matrix/eigenvalue_decomposition.rb	(revision 65503)
+++ lib/matrix/eigenvalue_decomposition.rb	(revision 65504)
@@ -82,8 +82,8 @@ class Matrix https://github.com/ruby/ruby/blob/trunk/lib/matrix/eigenvalue_decomposition.rb#L82
     end
     alias_method :to_a, :to_ary
 
-  private
-    def build_eigenvectors
+
+    private def build_eigenvectors
       # JAMA stores complex eigenvectors in a strange way
       # 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|
@@ -96,9 +96,10 @@ class Matrix https://github.com/ruby/ruby/blob/trunk/lib/matrix/eigenvalue_decomposition.rb#L96
         end
       end
     end
+
     # Complex scalar division.
 
-    def cdiv(xr, xi, yr, yi)
+    private def cdiv(xr, xi, yr, yi)
       if (yr.abs > yi.abs)
         r = yi/yr
         d = yr + r*yi
@@ -113,7 +114,7 @@ class Matrix https://github.com/ruby/ruby/blob/trunk/lib/matrix/eigenvalue_decomposition.rb#L114
 
     # Symmetric Householder reduction to tridiagonal form.
 
-    def tridiagonalize
+    private def tridiagonalize
 
       #  This is derived from the Algol procedures tred2 by
       #  Bowdler, Martin, Reinsch, and Wilkinson, Handbook for
@@ -231,7 +232,7 @@ class Matrix https://github.com/ruby/ruby/blob/trunk/lib/matrix/eigenvalue_decomposition.rb#L232
 
     # Symmetric tridiagonal QL algorithm.
 
-    def diagonalize
+    private def diagonalize
       #  This is derived from the Algol procedures tql2, by
       #  Bowdler, Martin, Reinsch, and Wilkinson, Handbook for
       #  Auto. Comp., Vol.ii-Linear Algebra, and the corresponding
@@ -350,7 +351,7 @@ class Matrix https://github.com/ruby/ruby/blob/trunk/lib/matrix/eigenvalue_decomposition.rb#L351
 
     # Nonsymmetric reduction to Hessenberg form.
 
-    def reduce_to_hessenberg
+    private def reduce_to_hessenberg
       #  This is derived from the Algol procedures orthes and ortran,
       #  by Martin and Wilkinson, Handbook for Auto. Comp.,
       #  Vol.ii-Linear Algebra, and the corresponding
@@ -440,11 +441,9 @@ class Matrix https://github.com/ruby/ruby/blob/trunk/lib/matrix/eigenvalue_decomposition.rb#L441
       end
     end
 
-
-
     # Nonsymmetric reduction from Hessenberg to real Schur form.
 
-    def hessenberg_to_real_schur
+    private def hessenberg_to_real_schur
 
       #  This is derived from the Algol procedure hqr2,
       #  by Martin and Wilkinson, Handbook for Auto. Comp.,
Index: lib/matrix.rb
===================================================================
--- lib/matrix.rb	(revision 65503)
+++ lib/matrix.rb	(revision 65504)
@@ -289,10 +289,9 @@ class Matrix https://github.com/ruby/ruby/blob/trunk/lib/matrix.rb#L289
     @column_count = column_count
   end
 
-  def new_matrix(rows, column_count = rows[0].size) # :nodoc:
+  private def new_matrix(rows, column_count = rows[0].size) # :nodoc:
     self.class.send(:new, rows, column_count) # bypass privacy of Matrix.new
   end
-  private :new_matrix
 
   #
   # Returns element (+i+,+j+) of the matrix.  That is: row +i+, column +j+.
@@ -1015,7 +1014,7 @@ class Matrix https://github.com/ruby/ruby/blob/trunk/lib/matrix.rb#L1014
   end
   alias_method :inv, :inverse
 
-  def inverse_from(src) # :nodoc:
+  private def inverse_from(src) # :nodoc:
     last = row_count - 1
     a = src.to_a
 
@@ -1058,7 +1057,6 @@ class Matrix https://github.com/ruby/ruby/blob/trunk/lib/matrix.rb#L1057
     end
     self
   end
-  private :inverse_from
 
   #
   # Matrix exponentiation.
@@ -1165,7 +1163,7 @@ class Matrix https://github.com/ruby/ruby/blob/trunk/lib/matrix.rb#L1163
   # with smaller bignums (if any), while a matrix of Float will usually have
   # intermediate results with better precision.
   #
-  def determinant_bareiss
+  private def determinant_bareiss
     size = row_count
     last = size - 1
     a = to_a
@@ -1191,7 +1189,6 @@ class Matrix https://github.com/ruby/ruby/blob/trunk/lib/matrix.rb#L1189
     end
     sign * pivot
   end
-  private :determinant_bareiss
 
   #
   # deprecated; use Matrix#determinant
@@ -1506,7 +1503,7 @@ class Matrix https://github.com/ruby/ruby/blob/trunk/lib/matrix.rb#L1503
     # Converts the obj to an Array. If copy is set to true
     # a copy of obj will be made if necessary.
     #
-    def convert_to_array(obj, copy = false) # :nodoc:
+    private def convert_to_array(obj, copy = false) # :nodoc:
       case obj
       when Array
         copy ? obj.dup : obj
@@ -1522,7 +1519,6 @@ class Matrix https://github.com/ruby/ruby/blob/trunk/lib/matrix.rb#L1519
         converted
       end
     end
-    private :convert_to_array
   end
 
   extend ConversionHelper
@@ -1532,14 +1528,13 @@ class Matrix https://github.com/ruby/ruby/blob/trunk/lib/matrix.rb#L1528
     # Applies the operator +oper+ with argument +obj+
     # through coercion of +obj+
     #
-    def apply_through_coercion(obj, oper)
+    private def apply_through_coercion(obj, oper)
       coercion = obj.coerce(self)
       raise TypeError unless coercion.is_a?(Array) && coercion.length == 2
       coercion[0].public_send(oper, coercion[1])
     rescue
       raise TypeError, "#{obj.inspect} can't be coerced into #{self.class}"
     end
-    private :apply_through_coercion
 
     #
     # Helper method to coerce a value into a specific class.

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

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