[TOP][UP][<-PREV][NEXT->]

Matrix

執筆者募集 *1

クラスメソッド:

Matrix.[](*rows)

creates a matrix where `rows' indicates rows. `rows' is an array of arrays, e.g, Matrix[[11, 12], [21, 22]]

Matrix.rows(rows, copy = true)

creates a matrix where `rows' indicates rows. if optional argument `copy' is false, use the array as internal structure of the metrix without copying.

Matrix.columns(columns)

creates a new matrix using `columns` as set of colums vectors.

Matrix.diagonal(*values)

creates a matrix where `columns' indicates columns.

Matrix.scalar(n, value)

creates a diagonal matrix such that the diagal compornents is given by `values'.

Matrix.scalar(n, value)

creates an n-by-n scalar matrix such that the diagal compornent is given by `value'.

Matrix.identity(n)
Matrix.unit(n)
Matrix.I(n)

creates an n-by-n unit matrix.

Matrix.zero(n)

creates an n-by-n zero matrix.

Matrix.row_vector(row)

creates a 1-by-n matrix such the row vector is `row'. `row' is specifed as a Vector or an Array.

Matrix.column_vector(column)

creates a 1-by-n matrix such that column vector is `column'. `column' is specifed as a Vector or an Array.

accessing:

[](i, j)

returns (i,j) compornent

row_size

returns the number of rows

column_size

returns the number of columns

row(i)

returns the i-th row vector. when the block is supplied for the method, the block is iterated over all row vectors.

column(j)

returns the jth column vector. when the block is supplied for the method, the block is iterated over all column vectors.

collect
map

creates a matrix which is the result of iteration of given block over all compornents.

minor(*param)

returns sub matrix. parameter is specified as the following:

  1. from_row, row_size, from_col, size_col
  2. from_row..to_row, from_col..to_col

TESTING:

regular?

Is regular?

singular?

Is singular? i.e. Is non-regular?

square?

Is square?

ARITHMETIC:

*(m)

times

+(m)

plus

-(m)

minus

/(m)

self * m.inv

inverse
inv

inverse

**

power

Matrix functions:

determinant
det

returns the determinant

rank

returns the rank

trace
tr

returns the trace

transpose
t

returns the transposed

CONVERTING:

coerce(other)
row_vectors

array of row vectors

column_vectors

array of column vectors

to_a

converts each element to Array

to_f

converts each element to Float

to_i

converts each element to Integer

to_r

converts each element to Rational

PRINTING:

to_s

returns string representation

inspect

*1matrix.rbから英語のままとってきたので誰か訳してください。


[TOP][UP][<-PREV][NEXT->]