# Matrix

## Matrix

### ■ ri

``` ---------------------------------------------------------- Class: Matrix
The  Matrix  class represents a mathematical matrix, and provides
methods for creating special-case matrices (zero, identity,
diagonal, singular, vector), operating on them arithmetically and
algebraically, and determining their mathematical properties
(trace, rank, inverse, determinant).

Note that although matrices should theoretically be rectangular,
this is not enforced by the class.

Also note that the determinant of integer matrices may be
incorrectly calculated unless you also  require 'mathn' . This may
be fixed in the future.

Method Catalogue
----------------
To create a matrix:

*     Matrix[*rows]

*     Matrix.[](*rows)

*     Matrix.rows(rows, copy = true)

*     Matrix.columns(columns)

*     Matrix.diagonal(*values)

*     Matrix.scalar(n, value)

*     Matrix.scalar(n, value)

*     Matrix.identity(n)

*     Matrix.unit(n)

*     Matrix.I(n)

*     Matrix.zero(n)

*     Matrix.row_vector(row)

*     Matrix.column_vector(column)

To access Matrix elements/columns/rows/submatrices/properties:

*     [](i, j)

*     #row_size

*     #column_size

*     #row(i)

*     #column(j)

*     #collect

*     #map

*     #minor(*param)

Properties of a matrix:

*     #regular?

*     #singular?

*     #square?

Matrix arithmetic:

*     *(m)

*      (m)

*     -(m)

*     #/(m)

*     #inverse

*     #inv

*     **

Matrix functions:

*     #determinant

*     #det

*     #rank

*     #trace

*     #tr

*     #transpose

*     #t

Conversion to other data types:

*     #coerce(other)

*     #row_vectors

*     #column_vectors

*     #to_a

String representations:

*     #to_s

*     #inspect

------------------------------------------------------------------------

Includes:
---------
ExceptionForMatrix()

Class methods:
--------------
[], column_vector, columns, diagonal, identity, new, row_vector,
rows, scalar, zero

Instance methods:
-----------------
*, **,  , -, /, ==, [], clone, coerce, collect, column,
column_size, column_vectors, compare_by_row_vectors, det,
determinant, eql?, hash, init_rows, inspect, inv, inverse,
inverse_from, map, minor, rank, regular?, row, row_size,
row_vectors, singular?, square?, t, to_a, to_s, tr, trace,
transpose

```

### ■refe

``` ==== Matrix ====
[2002-04-03]  by すす [URL:sugawah@attglobal.net

(数Numericを要素とする)行列を扱うクラス
---- Singleton methods ----
I [] column_vector columns diagonal identity row_vector rows
scalar unit zero
---- Instance methods ----
* **   - /  = collect column column_size column_vectors
det determinant inv inverse map minor power rank regular?
row row_size row_vectors singular? square? t to_a to_f to_i
to_r tr trace transpose
---- Singleton methods (inherited) ----
---- Instance methods (inherited) ----
== === =~ __id__ __send__ _dump _load class clone display
dup eql? equal? extend freeze frozen? hash id initialize
initialize_copy inspect instance_eval instance_of?
instance_variable_get instance_variable_set
method method_missing methods nil? object_id pretty_print
pretty_print_cycle pretty_print_instance_variables
private_methods protected_methods public_methods
remove_instance_variable respond_to? send
singleton_method_undefined singleton_methods taint tainted?
to_ary to_hash to_int to_s to_str type untaint

```
• 2006/05/12 19:52:25 *
• 2006/05/12 19:52:41 -
• 2006/05/12 19:53:19 ==
• 2006/05/15 12:08:43 clone
• 2006/05/15 12:09:33 collect
• 2006/05/15 12:18:15 eql?
• 2006/05/15 12:32:31 inspect
• 2006/05/15 12:39:51 map
• 2006/05/12 20:07:44 Matrix
• 2006/05/15 12:41:16 min
• 2006/05/15 12:42:14 new
• 2006/05/15 12:46:23 pos
• 2006/05/12 20:35:07 Precision
• 2006/05/15 12:56:40 size
• 2006/05/15 13:04:47 to_a
• 2006/05/15 13:05:00 to_f
• 2006/05/15 13:05:16 to_i
• 2006/05/15 13:05:31 to_s
• 2006/05/15 13:06:34 tr
• 2006/05/15 13:07:40 transpose