Class for representing and manipulating matrices. The entry that lies in the i-th row and the j-th column of a matrix is typically referred to as the i,j entry of the matrix. The m-by-n matrix A would have its entries referred to as: [ a0,0 a0,1 a0,2 ... a0,j ... a0,n ] [ a1,0 a1,1 a1,2 ... a1,j ... a1,n ] [ a2,0 a2,1 a2,2 ... a2,j ... a2,n ] [ . . . . . ] [ . . . . . ] [ . . . . . ] [ ai,0 ai,1 ai,2 ... ai,j ... ai,n ] [ . . . . . ] [ . . . . . ] [ . . . . . ] [ am,0 am,1 am,2 ... am,j ... am,n ]
| Instance Method Summary | |
add(?goog.math.Matrix m) ⇒ !goog.math.MatrixReturns a new matrix that is the sum of this and the provided matrix. | |
appendColumns(?goog.math.Matrix m) ⇒ !goog.math.MatrixAppends the given matrix to the right side of this matrix. | |
appendRows(?goog.math.Matrix m) ⇒ !goog.math.MatrixAppends the given matrix to the bottom of this matrix. | |
equals(?goog.math.Matrix m, number= opt_tolerance) ⇒ booleanReturns whether the given matrix equals this matrix. | |
getCofactor_(number i, number j) ⇒ numberReturns the signed minor. | |
getDeterminant() ⇒ numberReturns the determinant of this matrix. The determinant of a matrix A is often denoted as |A| and can only be applied to a square matrix. | |
getDeterminant_() ⇒ numberReturns the determinant of this matrix. The determinant of a matrix A is often denoted as |A| and can only be applied to a square matrix. Same as public method but without validation. Implemented using Laplace's formula. | |
getInverse() ⇒ ?goog.math.MatrixReturns the inverse of this matrix if it exists or null if the matrix is not invertible. | |
getMinor_(number i, number j) ⇒ numberReturns the determinant of the submatrix resulting from the deletion of row i and column j. | |
getReducedRowEchelonForm() ⇒ !goog.math.MatrixTransforms this matrix into reduced row echelon form. | |
getSize() ⇒ !goog.math.Size | |
getSubmatrixByCoordinates_(number i1, number j1, number= opt_i2, number= opt_j2) ⇒ !goog.math.MatrixReturns a submatrix contained within this matrix. | |
getSubmatrixByDeletion_(number i, number j) ⇒ !goog.math.MatrixReturns a new matrix equal to this one, but with row i and column j deleted. | |
getTranspose() ⇒ !goog.math.MatrixReturn the transpose of this matrix. For an m-by-n matrix, the transpose is the n-by-m matrix which results from turning rows into columns and columns into rows | |
getValueAt(number i, number j) ⇒ ?numberRetrieves the value of a particular coordinate in the matrix or null if the requested coordinates are out of range. | |
isInBounds_(number i, number j) ⇒ booleanReturns whether the given coordinates are contained within the bounds of the matrix. | |
isSquare() ⇒ boolean | |
matrixMultiply_(?goog.math.Matrix m) ⇒ !goog.math.MatrixMatrix multiplication is defined between two matrices only if the number of columns of the first matrix is the same as the number of rows of the second matrix. If A is an m-by-n matrix and B is an n-by-p matrix, then their product AB is an m-by-p matrix | |
multiply((goog.math.Matrix|null|number) m) ⇒ !goog.math.MatrixPerforms matrix or scalar multiplication on a matrix and returns the resultant matrix. Matrix multiplication is defined between two matrices only if the number of columns of the first matrix is the same as the number of rows of the second matrix. If A is an m-by-n matrix and B is an n-by-p matrix, then their product AB is an m-by-p matrix Scalar multiplication returns a matrix of the same size as the original, each value multiplied by the given value. | |
scalarMultiply_(number m) ⇒ !goog.math.MatrixScalar multiplication returns a matrix of the same size as the original, each value multiplied by the given value. | |
setValueAt(number i, number j, number value)Sets the value at a particular coordinate (if the coordinate is within the bounds of the matrix). | |
subtract(?goog.math.Matrix m) ⇒ !goog.math.MatrixReturns a new matrix that is the difference of this and the provided matrix. | |
swapRows_(number i1, number i2)Swaps two rows. | |
toArray() ⇒ !Array | |
toString() ⇒ stringReturns a string representation of the matrix. e.g. [ 12 5 9 1 ] [ 4 16 0 17 ] [ 12 5 1 23 ] | |
| Static Method Summary | |
createIdentityMatrix(number n) ⇒ !goog.math.MatrixCreates a square identity matrix. i.e. for n = 3: [ 1 0 0 ] [ 0 1 0 ] [ 0 0 1 ] | |
createZeroPaddedArray_(number m, number n) ⇒ !ArrayCreates a new zero padded matix. | |
forEach(?goog.math.Matrix matrix, ?Function fn, ?Object= opt_obj)Calls a function for each cell in a matrix. | |
isValidArray(?Array arr) ⇒ booleanTests whether an array is a valid matrix. A valid array is an array of arrays where all arrays are of the same length and all elements are numbers. | |
map(?goog.math.Matrix matrix, ?Function fn, ?Object= opt_obj) ⇒ !goog.math.MatrixCalls a function for every cell in a matrix and inserts the result into a new matrix of equal dimensions. | |