Class: Matrices

eclairjs/mllib/linalg. Matrices

new Matrices()

Source:

Methods

(static) dense(numRows, numCols, values) → {module:eclairjs/mllib/linalg.Matrix}

Creates a column-major dense matrix.
Parameters:
Name Type Description
numRows number number of rows
numCols number number of columns
values Array.<number> matrix entries in column major
Source:
Returns:
Type
module:eclairjs/mllib/linalg.Matrix

(static) diag(vector) → {module:eclairjs/mllib/linalg.Matrix}

Generate a diagonal matrix in `Matrix` format from the supplied values.
Parameters:
Name Type Description
vector module:eclairjs/mllib/linalg.Vector a `Vector` that will form the values on the diagonal of the matrix on the diagonal
Source:
Returns:
Square `Matrix` with size `values.length` x `values.length` and `values`
Type
module:eclairjs/mllib/linalg.Matrix

(static) eye(n) → {module:eclairjs/mllib/linalg.Matrix}

Generate a dense Identity Matrix in `Matrix` format.
Parameters:
Name Type Description
n number number of rows and columns of the matrix
Source:
Returns:
`Matrix` with size `n` x `n` and values of ones on the diagonal
Type
module:eclairjs/mllib/linalg.Matrix

(static) horzcat(matrices) → {module:eclairjs/mllib/linalg.Matrix}

Horizontally concatenate a sequence of matrices. The returned matrix will be in the format the matrices are supplied in. Supplying a mix of dense and sparse matrices will result in a sparse matrix. If the Array is empty, an empty `DenseMatrix` will be returned.
Parameters:
Name Type Description
matrices Array.<module:eclairjs/mllib/linalg.Matrix> array of matrices
Source:
Returns:
a single `Matrix` composed of the matrices that were horizontally concatenated
Type
module:eclairjs/mllib/linalg.Matrix

(static) ones(numRows, numCols) → {module:eclairjs/mllib/linalg.Matrix}

Generate a `DenseMatrix` consisting of ones.
Parameters:
Name Type Description
numRows number number of rows of the matrix
numCols number number of columns of the matrix
Source:
Returns:
`Matrix` with size `numRows` x `numCols` and values of ones
Type
module:eclairjs/mllib/linalg.Matrix

(static) rand(numRows, numCols, rng) → {module:eclairjs/mllib/linalg.Matrix}

Generate a `DenseMatrix` consisting of `i.i.d.` uniform random numbers.
Parameters:
Name Type Description
numRows number number of rows of the matrix
numCols number number of columns of the matrix
rng Random a random number generator
Source:
Returns:
`Matrix` with size `numRows` x `numCols` and values in U(0, 1)
Type
module:eclairjs/mllib/linalg.Matrix

(static) randn(numRows, numCols, rng) → {module:eclairjs/mllib/linalg.Matrix}

Generate a `DenseMatrix` consisting of `i.i.d.` gaussian random numbers.
Parameters:
Name Type Description
numRows number number of rows of the matrix
numCols number number of columns of the matrix
rng Random a random number generator
Source:
Returns:
`Matrix` with size `numRows` x `numCols` and values in N(0, 1)
Type
module:eclairjs/mllib/linalg.Matrix

(static) sparse(numRows, numCols, colPtrs, rowIndices, values) → {module:eclairjs/mllib/linalg.Matrix}

Creates a column-major sparse matrix in Compressed Sparse Column (CSC) format.
Parameters:
Name Type Description
numRows number number of rows
numCols number number of columns
colPtrs Array.<number> the index corresponding to the start of a new column
rowIndices Array.<number> the row index of the entry
values Array.<number> non-zero matrix entries in column major
Source:
Returns:
Type
module:eclairjs/mllib/linalg.Matrix

(static) speye(n) → {module:eclairjs/mllib/linalg.Matrix}

Generate a sparse Identity Matrix in `Matrix` format.
Parameters:
Name Type Description
n number number of rows and columns of the matrix
Source:
Returns:
`Matrix` with size `n` x `n` and values of ones on the diagonal
Type
module:eclairjs/mllib/linalg.Matrix

(static) sprand(numRows, numCols, density, rng) → {module:eclairjs/mllib/linalg.Matrix}

Generate a `SparseMatrix` consisting of `i.i.d.` gaussian random numbers.
Parameters:
Name Type Description
numRows number number of rows of the matrix
numCols number number of columns of the matrix
density number the desired density for the matrix
rng Random a random number generator
Source:
Returns:
`Matrix` with size `numRows` x `numCols` and values in U(0, 1)
Type
module:eclairjs/mllib/linalg.Matrix

(static) sprandn(numRows, numCols, density, rng) → {module:eclairjs/mllib/linalg.Matrix}

Generate a `SparseMatrix` consisting of `i.i.d.` gaussian random numbers.
Parameters:
Name Type Description
numRows number number of rows of the matrix
numCols number number of columns of the matrix
density number the desired density for the matrix
rng Random a random number generator
Source:
Returns:
`Matrix` with size `numRows` x `numCols` and values in N(0, 1)
Type
module:eclairjs/mllib/linalg.Matrix

(static) vertcat(matrices) → {module:eclairjs/mllib/linalg.Matrix}

Vertically concatenate a sequence of matrices. The returned matrix will be in the format the matrices are supplied in. Supplying a mix of dense and sparse matrices will result in a sparse matrix. If the Array is empty, an empty `DenseMatrix` will be returned.
Parameters:
Name Type Description
matrices Array.<module:eclairjs/mllib/linalg.Matrix> array of matrices
Source:
Returns:
a single `Matrix` composed of the matrices that were vertically concatenated
Type
module:eclairjs/mllib/linalg.Matrix

(static) zeros(numRows, numCols) → {module:eclairjs/mllib/linalg.Matrix}

Generate a `Matrix` consisting of zeros.
Parameters:
Name Type Description
numRows number number of rows of the matrix
numCols number number of columns of the matrix
Source:
Returns:
`Matrix` with size `numRows` x `numCols` and values of zeros
Type
module:eclairjs/mllib/linalg.Matrix