|
MathWorx | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object | +--Matrix
Defined in Matrix.js
Requires:
Field Summary | |
Array |
components
an Array whose elements are Vectors, the vectors being rows of the matrix |
Constructor Summary | |
Matrix(<Object> elements)
Constructor function. |
Method Summary | |
Matrix
|
add(<Matrix> matrix)
Adds a matrix to another one of the same size. |
Matrix
|
augment(<Matrix> matrix)
Augments a matrix to the right of a matrix. |
Boolean
|
canMultiplyFromLeft(<Object> matrix)
Tests to see whether the supplied matrix can be multiplied by this matrix in Matrix.prototype.form = this;times matrix. |
Vector
|
col(<Integer> j)
Returns the j'th column as a vector. |
Object
|
det()
Shorthand for determinant() |
Number
|
determinant()
Calculates the determinant of a square matrix (returns null if matrix not a square). |
Object
|
dimensions()
Returns the dimensions of the matrix as an Object. |
Boolean
|
equalTo(<Matrix> matrix)
Checks two matrices for equality. |
Number
|
get(<Integer> i,<Integer> j)
Returns the i,j'th element of the matrix. |
Vector
|
getDiagonal()
Gets and returns the diagonal entries of a square matrix. |
Object
|
indexOf(<Number> val)
Returns the indices of the FIRST occurence of a given value. |
Matrix
|
invert()
Inverts an invertible matrix and returns the inverse. |
Boolean
|
invertible()
Tests to see if a matrix is or is not invertible. |
Boolean
|
isSingular()
Tests a matrix for singularity. |
Boolean
|
isSquare()
Tests to see if a matrix is square or not. |
Matrix
|
map(<Function> func)
Maps a matrix onto a new one according to a supplied function. |
Number
|
max()
Returns the absolute maximum component of the matrix. |
Matrix
|
minor(<Integer> row, <Integer> col, <Integer> numrows, <Integer> numcols)
Creates a sub-matrix from the original matrix. |
Object
|
multiply(<Object> matrix)
If possible, multiplies the supplied matrix by this matrix. |
Matrix
|
multiplyBy(<Number> k)
Multiplies a matrix by a scalar value. |
Matrix
|
negative()
Returns the negative version of the current matrix. |
Integer
|
numCols()
Get the number of columns in the matrix. |
Integer
|
numRows()
Get the number of rows in the matrix. |
Number
|
rank()
Calculates the rank of a matrix. |
Matrix
|
round()
Rounds all the elements of a matrix into a new one. |
Vector
|
row(<Integer> i)
Returns a specific row of the matrix as a Vector (which it is already) |
Boolean
|
sameSizeAs(<Matrix> matrix)
Tests to see if two matrices are the same size. |
void
|
setElement(<Integer> i, <Integer> j, <Number> val)
Sets the i,j'th element to val. |
Object
|
snapTo(<Number> val)
Sets all values within range of Zero (set in easyload.js) to val. |
Matrix
|
subtract(<Matrix> matrix)
Subtracts another matrix of the same size from this one. |
String
|
toString()
Creates and returns a string representation of the matrix. |
Matrix
|
toUpperTriangular()
Uses a modified version of Gaussian elimination to create and return a new, upper triangular version of the original matrix while preserving determinant and rank. |
Vector
|
toVector()
Makes a Vector out of a 1-D (row or column) Matrix. |
Object
|
tr()
Shorthand for trace() function. |
Number
|
trace()
Computes the trace of a square matrix (returns null if matrix is not a square). |
Matrix
|
transpose()
Creates a new matrix that is the transpose of the original matrix. |
<static> Object
|
diagonal(<Object> elements)
Creates a diagonal matrix (off-diagonal elements are 0) from a given array of elements |
<static> Matrix
|
I(<Integer> n)
Creates the Identity matrix of dimension N. |
<static> Object
|
random(<Integer> rows, <Integer> cols, <Integer> max)
Creates a rows x cols matrix with random elements between 0 and max |
<static> Matrix
|
zero(<Integer> rows, <Integer> cols)
Creates a rows x cols matrix with all 0 elements. |
Field Detail |
Array components
Constructor Detail |
Matrix(<Object> elements)
elements
- The elements of the new matrix. Can either be an Array (one-dimensional, multi-dimensional, or an Array of Vector objects) or a Matrix (in which case it will be cloned into a new one).
Method Detail |
Matrix add(<Matrix> matrix)
matrix
- the matrix to be added to the original one
Matrix augment(<Matrix> matrix)
matrix
- the matrix to augment
Boolean canMultiplyFromLeft(<Object> matrix)
matrix
- Matrix, Vector, or scalar to be tested
Vector col(<Integer> j)
j
- the number of the column you want
Object det()
Number determinant()
Object dimensions()
Boolean equalTo(<Matrix> matrix)
matrix
- the matrix to compare to the original
Number get(<Integer> i,<Integer> j)
i
- the row number of the element
j
- the column number of the element
Vector getDiagonal()
Object indexOf(<Number> val)
val
- the component for which to find the indices
Matrix invert()
Boolean invertible()
Boolean isSingular()
Boolean isSquare()
Matrix map(<Function> func)
func
- the mapping function
Number max()
Matrix minor(<Integer> row, <Integer> col, <Integer> numrows, <Integer> numcols)
row
- the row to start at
col
- the column to start at
numrows
- the number of rows for the submatrix
numcols
- the number of columns
Object multiply(<Object> matrix)
matrix
- the matrix, vector, or number (will do scalar multiplication) to be multiplied
Matrix multiplyBy(<Number> k)
k
- the scalar by which to multiply the matrix
Matrix negative()
Integer numCols()
Integer numRows()
Number rank()
Matrix round()
Vector row(<Integer> i)
i
- the row you want
Boolean sameSizeAs(<Matrix> matrix)
matrix
- the matrix with which size is to be compared
void setElement(<Integer> i, <Integer> j, <Number> val)
i
- the row of the element to set
j
- the column of the element to set
val
- the value to set element (i,j) to
Object snapTo(<Number> val)
val
- the number to snap the matrix to
Matrix subtract(<Matrix> matrix)
matrix
- the matrix to be subtracted the original one
String toString()
Matrix toUpperTriangular()
Vector toVector()
Object tr()
Number trace()
Matrix transpose()
<static> Object diagonal(<Object> elements)
elements
- either a Vector or 1-D array that will become the diagonal elements of a matrix that has elements.length rows and columns
<static> Matrix I(<Integer> n)
n
- the size of the identity matrix to be created
<static> Object random(<Integer> rows, <Integer> cols, <Integer> max)
rows
- the number of rows
cols
- the number of columns
max
- (Optional) - the maximum value (included) that any element can have; if supplied, all elements will be integers
<static> Matrix zero(<Integer> rows, <Integer> cols)
rows
- the number of rows for the 0 matrix
cols
- the number of columns
|
MathWorx | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |