1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/matrix.rb: Fix typos in doc and indent

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
marcandre 2009-09-16 04:39:37 +00:00
parent 9d3638448e
commit c3db24a4dc

View file

@ -50,7 +50,6 @@ end
# * <tt> Matrix.columns(columns) </tt> # * <tt> Matrix.columns(columns) </tt>
# * <tt> Matrix.diagonal(*values) </tt> # * <tt> Matrix.diagonal(*values) </tt>
# * <tt> Matrix.scalar(n, value) </tt> # * <tt> Matrix.scalar(n, value) </tt>
# * <tt> Matrix.scalar(n, value) </tt>
# * <tt> Matrix.identity(n) </tt> # * <tt> Matrix.identity(n) </tt>
# * <tt> Matrix.unit(n) </tt> # * <tt> Matrix.unit(n) </tt>
# * <tt> Matrix.I(n) </tt> # * <tt> Matrix.I(n) </tt>
@ -122,11 +121,12 @@ class Matrix
# #
# Creates a matrix where +rows+ is an array of arrays, each of which is a row # Creates a matrix where +rows+ is an array of arrays, each of which is a row
# to the matrix. If the optional argument +copy+ is false, use the given # of the matrix. If the optional argument +copy+ is false, use the given
# arrays as the internal structure of the matrix without copying. # arrays as the internal structure of the matrix without copying.
# Matrix.rows([[25, 93], [-1, 66]]) # Matrix.rows([[25, 93], [-1, 66]])
# => 25 93 # => 25 93
# -1 66 # -1 66
#
def Matrix.rows(rows, copy = true) def Matrix.rows(rows, copy = true)
new(:init_rows, rows, copy) new(:init_rows, rows, copy)
end end
@ -137,7 +137,6 @@ class Matrix
# => 25 -1 # => 25 -1
# 93 66 # 93 66
# #
#
def Matrix.columns(columns) def Matrix.columns(columns)
rows = (0 ... columns[0].size).collect {|i| rows = (0 ... columns[0].size).collect {|i|
(0 ... columns.size).collect {|j| (0 ... columns.size).collect {|j|
@ -651,13 +650,13 @@ class Matrix
# #
# Returns the determinant of the matrix. If the matrix is not square, the # Returns the determinant of the matrix. If the matrix is not square, the
# result is 0. This method's algorism is Gaussian elimination method # result is 0. This method's algorithm is Gaussian elimination method
# and using Numeric#quo(). Beware that using Float values, with their # and using Numeric#quo(). Beware that using Float values, with their
# usual lack of precision, can affect the value returned by this method. Use # usual lack of precision, can affect the value returned by this method. Use
# Rational values or Matrix#det_e instead if this is important to you. # Rational values or Matrix#det_e instead if this is important to you.
# #
# Matrix[[7,6], [3,9]].determinant # Matrix[[7,6], [3,9]].determinant
# => 63.0 # => 45.0
# #
def determinant def determinant
return 0 unless square? return 0 unless square?
@ -692,8 +691,8 @@ class Matrix
# #
# Returns the determinant of the matrix. If the matrix is not square, the # Returns the determinant of the matrix. If the matrix is not square, the
# result is 0. This method's algorism is Gaussian elimination method. # result is 0. This method's algorithm is Gaussian elimination method.
# This method uses Euclidean algorism. If all elements are integer, # This method uses Euclidean algorithm. If all elements are integer,
# really exact value. But, if an element is a float, can't return # really exact value. But, if an element is a float, can't return
# exact value. # exact value.
# #
@ -802,7 +801,7 @@ class Matrix
# #
# Returns the rank of the matrix. This method uses Euclidean # Returns the rank of the matrix. This method uses Euclidean
# algorism. If all elements are integer, really exact value. But, if # algorithm. If all elements are integer, really exact value. But, if
# an element is a float, can't return exact value. # an element is a float, can't return exact value.
# #
# Matrix[[7,6], [3,9]].rank # Matrix[[7,6], [3,9]].rank
@ -1349,6 +1348,5 @@ class Vector
end end
end end
# Documentation comments: # Documentation comments:
# - Matrix#coerce and Vector#coerce need to be documented # - Matrix#coerce and Vector#coerce need to be documented