Class Matrix
Defined in: Matrix.js.
Constructor Attributes | Constructor Name and Description |
---|---|
|
Matrix(rows, columns, values)
Provides a mathematical matrix object
|
Method Attributes | Method Name and Description |
---|---|
{Matrix}
|
add(that)
Adds one matrix to another.
|
{Matrix}
<static>
|
Matrix.columnVector(the)
Given an array of numbers creates a column vector Matrix object.
|
{Matrix}
|
copy()
Provide a copy contructor
|
{boolean}
|
findSink()
An operation on graph adjacency matrix.
|
{Matrix}
|
simple implementation of Floyd-Warshall All-Pairs Shortest Path algorithm for weighted graphs
|
{Matrix[]}
|
Produces two matrices, L and U, which are lower triangular
matrice and upper triangular matrices respectively.
|
{Matrix}
|
multiply(that)
Multiply one matrix by another
|
{Matrix (Nx1 sized)}
|
naiveGaussian(sumvector)
Runs a naive Gaussian elimination on a Matrix or a Matrix and a sum vector.
|
{Matrix}
<static>
|
Matrix.rowVector(the)
Given an array of numbers creates a row Matrix object.
|
{Matrix (Nx1 sized)}
|
scaledPartialPivotGaussian(sumvector)
Runs a Gaussian elimination with scaled partial pivoting on a a Matrix and a sum vector.
|
{Matrix}
|
subtract(that)
Subtract one matrix from another
|
toHTML()
|
|
toString()
|
|
{Matrix}
|
Provides the Transpose matrix operation, i.e.
|
{Matrix}
|
tridiagonalSolve(columnvector)
Solves a symmetric matric of the tri-diagonal form
|
Class Detail
Matrix(rows, columns, values)
Provides a mathematical matrix object
- Parameters:
- rows
- {Integer} number of rows in the matrix
- columns
- {Integer} number of columns in the matrix
- values
- {Double[][]} a multidimensional array with rows and column as specified by the other parameters
Method Detail
{Matrix}
add(that)
Adds one matrix to another.
- Parameters:
- that
- {Matrix} Matrix to be added with.
- Returns:
- {Matrix} The resulting sum
<static>
{Matrix}
Matrix.columnVector(the)
Given an array of numbers creates a column vector Matrix object.
Essentially shortand for creating matrices of form
[[a]
[b]
[...]
[c]]
- Parameters:
- {Double[]} the
- matrix entries
- Returns:
- {Matrix} a X-by-1 matrix
{Matrix}
copy()
Provide a copy contructor
- Returns:
- {Matrix} A copy of the existing matrix
{boolean}
findSink()
An operation on graph adjacency matrix.
It checks if a graph contains a sink node. A node which
has V-1 inbound edges and 0 outbound edges.
Running time is only O(n)
- Returns:
- {boolean}
{Matrix}
FloydWarshall()
simple implementation of Floyd-Warshall All-Pairs Shortest Path algorithm for weighted graphs
- Returns:
- {Matrix} The APSP matrix for a given matrix
{Matrix[]}
LUdecomposition()
Produces two matrices, L and U, which are lower triangular
matrice and upper triangular matrices respectively.
- Returns:
- {Matrix[]} An array of Matrix objects, L =
{Matrix}
multiply(that)
Multiply one matrix by another
- Parameters:
- {Matrix} that
- The matrix being multiplied
- Returns:
- {Matrix} The product matrix
{Matrix (Nx1 sized)}
naiveGaussian(sumvector)
Runs a naive Gaussian elimination on a Matrix or a Matrix and a sum vector.
Given the form Ax = b; A is the matrix and b is the sum vector; x is the result
- Parameters:
- sumvector
- {Matrix (Nx1 sized)} An N row, 1 column vector containing the sums.
- Returns:
- {Matrix (Nx1 sized)} The answer
<static>
{Matrix}
Matrix.rowVector(the)
Given an array of numbers creates a row Matrix object.
Essentially shortand for creating matrices of form [a,b,c,...]
- Parameters:
- {Double[]} the
- matrix entries
- Returns:
- {Matrix} a 1-by-X matrix
{Matrix (Nx1 sized)}
scaledPartialPivotGaussian(sumvector)
Runs a Gaussian elimination with scaled partial pivoting on a a Matrix and a sum vector.
Given the form Ax = b; A is the matrix and b is the sum vector; x is the result
- Parameters:
- sumvector
- {Matrix (Nx1 sized)} An N row, 1 column vector containing the sums.
- Returns:
- {Matrix (Nx1 sized)} The answer P. 267
{Matrix}
subtract(that)
Subtract one matrix from another
- Parameters:
- {Matrix} that
- The term being subtracted
- Returns:
- {Matrix} The difference matrix
toHTML()
toString()
{Matrix}
transpose()
Provides the Transpose matrix operation, i.e. flips the matrix
- Returns:
- {Matrix} The transpose of the original matrix
{Matrix}
tridiagonalSolve(columnvector)
Solves a symmetric matric of the tri-diagonal form
Author: Sahil Diwan.
Author: Sahil Diwan.
- Parameters:
- {Matrix} columnvector
- An N-by-1 matrix
- Returns:
- {Matrix} Solutions in an N-by-1 matrix