summaryrefslogtreecommitdiff
path: root/lib/matrix.rb
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-16 04:39:37 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-16 04:39:37 +0000
commitc3db24a4dcb96ccf2adc33da51b58e476bbf450d (patch)
treed125e5aeedd76723062bc212891801ba49a2ae6b /lib/matrix.rb
parent9d3638448e0d11ba9e4bd1941934c21cf09edc91 (diff)
* 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
Diffstat (limited to 'lib/matrix.rb')
-rw-r--r--lib/matrix.rb18
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/matrix.rb b/lib/matrix.rb
index 4c94fab9f1..2d5dfea424 100644
--- a/lib/matrix.rb
+++ b/lib/matrix.rb
@@ -50,7 +50,6 @@ end
# * <tt> Matrix.columns(columns) </tt>
# * <tt> Matrix.diagonal(*values) </tt>
# * <tt> Matrix.scalar(n, value) </tt>
-# * <tt> Matrix.scalar(n, value) </tt>
# * <tt> Matrix.identity(n) </tt>
# * <tt> Matrix.unit(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
- # 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.
# Matrix.rows([[25, 93], [-1, 66]])
# => 25 93
# -1 66
+ #
def Matrix.rows(rows, copy = true)
new(:init_rows, rows, copy)
end
@@ -137,7 +137,6 @@ class Matrix
# => 25 -1
# 93 66
#
- #
def Matrix.columns(columns)
rows = (0 ... columns[0].size).collect {|i|
(0 ... columns.size).collect {|j|
@@ -651,13 +650,13 @@ class Matrix
#
# 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
# 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.
#
# Matrix[[7,6], [3,9]].determinant
- # => 63.0
+ # => 45.0
#
def determinant
return 0 unless square?
@@ -692,8 +691,8 @@ class Matrix
#
# Returns the determinant of the matrix. If the matrix is not square, the
- # result is 0. This method's algorism is Gaussian elimination method.
- # This method uses Euclidean algorism. If all elements are integer,
+ # result is 0. This method's algorithm is Gaussian elimination method.
+ # This method uses Euclidean algorithm. If all elements are integer,
# really exact value. But, if an element is a float, can't return
# exact value.
#
@@ -802,7 +801,7 @@ class Matrix
#
# 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.
#
# Matrix[[7,6], [3,9]].rank
@@ -994,7 +993,7 @@ class Matrix
when Vector
Scalar.Raise WrongArgType, other.class, "Numeric or Scalar or Matrix"
when Matrix
- self * other.inverse
+ self * other.inverse
else
x, y = other.coerce(self)
x.quo(y)
@@ -1349,6 +1348,5 @@ class Vector
end
end
-
# Documentation comments:
# - Matrix#coerce and Vector#coerce need to be documented