Optional
options: IWrap1DOptionsReadonly
columnsReadonly
rowsNumber of rows of the matrix.
Readonly
sizeTotal number of elements in the matrix.
Adds the values of a vector to each column.
Array or vector.
Adds the values of a vector to each row.
Array or vector.
Applies a callback for each element of the matrix. The function is called in the matrix (this) context.
Function that will be called for each element in the matrix.
Center the matrix in-place. By default, the mean value of the matrix is subtracted from every value.
Optional
options: ICenterOptionsCenter the matrix in-place. By default, the mean values in the give dimension are subtracted from the values.
center by 'row' or 'column'.
Optional
options: ICenterByOptionsCreates an exact and independent copy of the matrix.
Computes the cumulative sum of the matrix elements (in place, row by row).
Alias for AbstractMatrix.diag.
Divides the values of each column by those of a vector.
Array or vector.
Divides the values of each row by those of a vector.
Array or vector.
Computes the dot (scalar) product between the matrix and another.
Fills the matrix with a given value. All elements will be set to this value.
New value.
Multiplies the values of a column with a scalar.
Column index.
Multiplies the values of a vector with each column.
Array or vector.
Multiplies the values of a row with a scalar.
Row index.
Multiplies the values of a vector with each row.
Array or vector.
Negates the matrix. All elements will be multiplied by -1
.
Alias for AbstractMatrix.neg.
Creates a new matrix that is a repetition of the current matrix. New matrix has rows times the number of rows of the original matrix, and columns times the number of columns of the original matrix.
Optional
options: IRepeatOptionsvar matrix = new Matrix([[1, 2]]);
matrix.repeat({ rows: 2 }); // [[1, 2], [1, 2]]
Scale the matrix in-place. By default, values are divided by their standard deviation.
Optional
options: IScaleOptionsScale the matrix in-place. By default, values are divided by the standard deviation in the given dimension.
scale by 'row' or 'column'.
Optional
options: IScaleByOptionsReturns a new column-by-column scaled matrix.
Optional
options: IScaleOptionsvar matrix = new Matrix([[1, 2], [-1, 0]]);
var scaledMatrix = matrix.scaleColumns(); // [[1, 1], [0, 0]]
Returns a new row-by-row scaled matrix.
Optional
options: IScaleOptionsReturn a new matrix based on a selection of rows and columns. Order of the indices matters and the same index can be used more than once.
The row indices to select.
The column indices to select.
Sets a given element of the matrix.
Index of the element's row.
Index of the element's column.
The new value for the element.
Sets a column at the given index.
Column index.
Array or vector to set.
Sets a row at the given index.
Row index.
Array or vector to set.
Set a part of the matrix to the given sub-matrix.
The source matrix from which to extract values.
The index of the first row to set.
The index of the first column to set.
Sorts the columns in-place.
Optional
compareFunction: ((a, b) => number)Sorts the rows in-place.
Optional
compareFunction: ((a, b) => number)Returns the standard deviation of all elements of the matrix.
Optional
options: IVarianceOptionsReturns the standard deviation by the given dimension.
standard deviation by 'row' or 'column'.
Optional
options: IVarianceByOptionsSubtracts the values of a vector from each column.
Array or vector.
Returns a subset of the matrix based on an array of column indices.
Array containing the column indices.
Optional
startRow: numberFirst row index. Default: 0
.
Optional
endRow: numberLast row index. Default: this.rows - 1
.
Returns a subset of the matrix based on an array of row indices.
Array containing the row indices.
Optional
startColumn: numberFirst column index. Default: 0
.
Optional
endColumn: numberLast column index. Default: this.columns - 1
.
Subtracts the values of a vector from each row.
Array or vector.
Swap two columns.
First column index.
Second column index.
Swap two rows.
First row index.
Second row index.
Alias for AbstractMatrix.kroneckerProduct.
Optional
options: IToStringOptionsReturns the variance of all elements of the matrix.
Optional
options: IVarianceOptionsReturns the variance by the given dimension.
variance by 'row' or 'column'.
Optional
options: IVarianceByOptionsStatic
absStatic
acosStatic
acoshStatic
addStatic
andStatic
asinStatic
asinhStatic
atanStatic
atanhStatic
cbrtStatic
ceilStatic
checkStatic
clz32Static
columnStatic
copyStatic
cosStatic
coshStatic
diagCreates a diagonal matrix based on the given array.
Array containing the data for the diagonal.
Optional
rows: numberNumber of rows. Default: data.length
.
Optional
columns: numberNumber of columns. Default: rows
.
Static
diagonalAlias for AbstractMatrix.diag.
Optional
rows: numberOptional
columns: numberStatic
divStatic
divideStatic
expStatic
expm1Static
eyeCreates an identity matrix with the given dimension. Values of the diagonal will be 1 and others will be 0.
Number of rows.
Optional
columns: numberNumber of columns. Default: rows
.
Optional
value: numberValue to fill the diagonal with. Default: 1
.
Static
floorStatic
from1DArrayStatic
froundStatic
identityAlias for AbstractMatrix.eye.
Optional
columns: numberOptional
value: numberStatic
isReturns whether value
is a Matrix.
The value to check.
Static
leftStatic
logStatic
log10Static
log1pStatic
log2Static
maxStatic
minStatic
modStatic
modulusStatic
mulStatic
multiplyStatic
notStatic
onesCreates a matrix with the given dimensions. Values will be set to one.
Number of rows.
Number of columns.
The new matrix.
Static
orStatic
powStatic
randCreates a matrix with the given dimensions. Values will be randomly set.
Number of rows.
Number of columns.
Optional
options: IRandomOptionsOptions object.
The new matrix.
Static
randCreates a matrix with the given dimensions. Values will be random integers.
Number of rows.
Number of columns.
Optional
options: IRandomIntOptionsStatic
randomOptional
options: IRandomOptionsStatic
rightStatic
roundStatic
rowStatic
signStatic
signStatic
sinStatic
sinhStatic
sqrtStatic
subStatic
subtractStatic
tanStatic
tanhStatic
truncStatic
xorStatic
zeroStatic
zerosCreates a matrix with the given dimensions. Values will be set to zero. This is equivalent to calling the Matrix constructor.
is private. Don't override it.
Number of rows.
Number of columns.
The new matrix.
Number of columns of the matrix.