public class Matrices
extends Object
Matrix.| Constructor and Description |
|---|
Matrices() |
| Modifier and Type | Method and Description |
|---|---|
static Matrix |
dense(int numRows,
int numCols,
double[] values)
Creates a column-major dense matrix.
|
static Matrix |
diag(Vector vector)
Generate a diagonal matrix in
Matrix format from the supplied values. |
static Matrix |
eye(int n)
Generate a dense Identity Matrix in
Matrix format. |
static Matrix |
horzcat(Matrix[] matrices)
Horizontally concatenate a sequence of matrices.
|
static Matrix |
ones(int numRows,
int numCols)
Generate a
DenseMatrix consisting of ones. |
static Matrix |
rand(int numRows,
int numCols,
java.util.Random rng)
Generate a
DenseMatrix consisting of i.i.d. uniform random numbers. |
static Matrix |
randn(int numRows,
int numCols,
java.util.Random rng)
Generate a
DenseMatrix consisting of i.i.d. gaussian random numbers. |
static Matrix |
sparse(int numRows,
int numCols,
int[] colPtrs,
int[] rowIndices,
double[] values)
Creates a column-major sparse matrix in Compressed Sparse Column (CSC) format.
|
static Matrix |
speye(int n)
Generate a sparse Identity Matrix in
Matrix format. |
static Matrix |
sprand(int numRows,
int numCols,
double density,
java.util.Random rng)
Generate a
SparseMatrix consisting of i.i.d. gaussian random numbers. |
static Matrix |
sprandn(int numRows,
int numCols,
double density,
java.util.Random rng)
Generate a
SparseMatrix consisting of i.i.d. gaussian random numbers. |
static Matrix |
vertcat(Matrix[] matrices)
Vertically concatenate a sequence of matrices.
|
static Matrix |
zeros(int numRows,
int numCols)
Generate a
Matrix consisting of zeros. |
public static Matrix dense(int numRows, int numCols, double[] values)
numRows - number of rowsnumCols - number of columnsvalues - matrix entries in column majorpublic static Matrix sparse(int numRows, int numCols, int[] colPtrs, int[] rowIndices, double[] values)
numRows - number of rowsnumCols - number of columnscolPtrs - the index corresponding to the start of a new columnrowIndices - the row index of the entryvalues - non-zero matrix entries in column majorpublic static Matrix zeros(int numRows, int numCols)
Matrix consisting of zeros.numRows - number of rows of the matrixnumCols - number of columns of the matrixMatrix with size numRows x numCols and values of zerospublic static Matrix ones(int numRows, int numCols)
DenseMatrix consisting of ones.numRows - number of rows of the matrixnumCols - number of columns of the matrixMatrix with size numRows x numCols and values of onespublic static Matrix eye(int n)
Matrix format.n - number of rows and columns of the matrixMatrix with size n x n and values of ones on the diagonalpublic static Matrix speye(int n)
Matrix format.n - number of rows and columns of the matrixMatrix with size n x n and values of ones on the diagonalpublic static Matrix rand(int numRows, int numCols, java.util.Random rng)
DenseMatrix consisting of i.i.d. uniform random numbers.numRows - number of rows of the matrixnumCols - number of columns of the matrixrng - a random number generatorMatrix with size numRows x numCols and values in U(0, 1)public static Matrix sprand(int numRows, int numCols, double density, java.util.Random rng)
SparseMatrix consisting of i.i.d. gaussian random numbers.numRows - number of rows of the matrixnumCols - number of columns of the matrixdensity - the desired density for the matrixrng - a random number generatorMatrix with size numRows x numCols and values in U(0, 1)public static Matrix randn(int numRows, int numCols, java.util.Random rng)
DenseMatrix consisting of i.i.d. gaussian random numbers.numRows - number of rows of the matrixnumCols - number of columns of the matrixrng - a random number generatorMatrix with size numRows x numCols and values in N(0, 1)public static Matrix sprandn(int numRows, int numCols, double density, java.util.Random rng)
SparseMatrix consisting of i.i.d. gaussian random numbers.numRows - number of rows of the matrixnumCols - number of columns of the matrixdensity - the desired density for the matrixrng - a random number generatorMatrix with size numRows x numCols and values in N(0, 1)public static Matrix diag(Vector vector)
Matrix format from the supplied values.vector - a Vector that will form the values on the diagonal of the matrixMatrix with size values.length x values.length and values
on the diagonalpublic static Matrix horzcat(Matrix[] matrices)
DenseMatrix will be returned.matrices - array of matricesMatrix composed of the matrices that were horizontally concatenatedpublic static Matrix vertcat(Matrix[] matrices)
DenseMatrix will be returned.matrices - array of matricesMatrix composed of the matrices that were vertically concatenated