public abstract class SparseMatrixBase extends MatrixBase implements SparseMatrix
Matrix
.Matrix.Partition, Matrix.WriteFormat
INDEFINITE, POSITIVE_DEFINITE, SPD, SYMMETRIC
Constructor and Description |
---|
SparseMatrixBase() |
Modifier and Type | Method and Description |
---|---|
void |
set(Matrix M)
Sets the size and values of this matrix to those of another matrix.
|
void |
setCCSValues(double[] vals,
int[] rowIdxs,
int[] colOffs,
int nvals,
int ncols,
Matrix.Partition part)
Sets the contents of this matrix given a set of values in compressed
column storage (CCS).
|
void |
setCRSValues(double[] vals,
int[] colIdxs,
int[] rowOffs,
int nvals,
int nrows,
Matrix.Partition part)
Sets the contents of this matrix given a set of values in compressed row
storage (CRS).
|
void |
setRandom(double lower,
double upper,
java.util.Random generator)
Sets this matrix to have a random sparsity structure and values,
with between one and ten nonzero elements per row.
|
void |
setRandom(double lower,
double upper,
java.util.Random generator,
boolean symmetric)
Sets this matrix to have a random sparsity structure and values,
with between one and ten nonzero elements per row.
|
void |
writeToFileCRS(java.lang.String fileName,
java.lang.String fmtStr) |
colSize, containsNaN, determinant, epsilonEquals, equals, frobeniusNorm, frobeniusNormSquared, get, get, get, getCCSIndices, getCCSIndices, getCCSIndices, getCCSValues, getCCSValues, getCCSValues, getColumn, getColumn, getColumn, getCRSIndices, getCRSIndices, getCRSIndices, getCRSValues, getCRSValues, getCRSValues, getDefaultFormat, getRow, getRow, getRow, getSize, getSubMatrix, hasNaN, idString, infinityNorm, isFixedSize, isSymmetric, isWritable, maxNorm, mul, mul, mul, mulAdd, mulAdd, mulAdd, mulTranspose, mulTranspose, mulTranspose, mulTransposeAdd, mulTransposeAdd, mulTransposeAdd, numNonZeroVals, numNonZeroVals, oneNorm, rowSize, scan, scan, setCRSValues, setDefaultFormat, setSize, toString, toString, toString, trace, write, write, write, write, write, write, write, writeToFile
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
scale
checkConsistency, colSize, determinant, epsilonEquals, equals, frobeniusNorm, frobeniusNormSquared, get, get, getCCSIndices, getCCSIndices, getCCSIndices, getCCSValues, getCCSValues, getCCSValues, getColumn, getColumn, getColumn, getCRSIndices, getCRSIndices, getCRSIndices, getCRSValues, getCRSValues, getCRSValues, getRow, getRow, getRow, getSize, getSubMatrix, infinityNorm, isFixedSize, isSymmetric, maxNorm, mul, mul, mul, mulAdd, mulAdd, mulAdd, mulTranspose, mulTranspose, mulTranspose, mulTransposeAdd, mulTransposeAdd, mulTransposeAdd, numNonZeroVals, numNonZeroVals, oneNorm, rowSize, scan, set, setSize, toString, toString, trace, write, write, write
public void set(Matrix M)
public void setCRSValues(double[] vals, int[] colIdxs, int[] rowOffs, int nvals, int nrows, Matrix.Partition part)
part
specifies what portion of
the matrix is supplied. If it is Full
, then the
entire matrix is supplied. If it is Matrix.Partition.UpperTriangular
,
then only the upper triangular part is assumed to be supplied, and the
lower triangular part is set from its transpose (matrix bounds
permitting). For Partition.UpperTriangular, supplied entries which are
not upper triangular will either be ignored or generate an exception.
All specified data must fit within the current matrix bounds; the matrix is not resized.
CRS data takes the form of three arrays:
vals
and
colIdxs
corresponding to the first non-zero element in each
row. All values are 1-based, so that first offset value is
1, the second offset value is n+1, where n is the number of non-zero
elements in the first row, etc. The final value is set to nvals+1, where
nvals is the number of non-zero elements in the matrix.setCRSValues
in interface Matrix
vals
- non-zero element values. This array must have a length equal at
least to nvals
.colIdxs
- column indices for each non-zero element.
This array must have a length equal at
least to nvals
.rowOffs
- row start offsets into vals
and
colIdxs
. This array must have a length equal at least to
nrows+1, where nrows is the number of rows in this matrix.nvals
- number of non-zero valuesnrows
- number of specified rows. Indicates the maximum value of
rowOffs
that will be used; will not resize matrix.part
- must be either Full
or
UpperTriangular
.public void setCCSValues(double[] vals, int[] rowIdxs, int[] colOffs, int nvals, int ncols, Matrix.Partition part)
part
specifies what
portion of the matrix is supplied. If it is Full
,
then the entire matrix is supplied. If it is Matrix.Partition.LowerTriangular
, then only the lower triangular part is
assumed to be supplied, and the upper triangular part is set from its
transpose (matrix bounds permitting). For Partition.LowerTriangular,
supplied entries which are not lower triangular will either be ignored or
generate an exception.
All specified data must fit within the current matrix bounds; the matrix is not resized.
CCCS data takes the form of three arrays:
vals
and
colIdxs
corresponding to the first non-zero element in each
column. All values are 1-based, so that first offset value is 1, the
second offset value is n+1, where n is the number of non-zero elements in
the first column, etc. The final value is set to nvals+1, where nvals is
the number of non-zero elements in the matrix.setCCSValues
in interface Matrix
vals
- non-zero element values. This array must have a length equal at
least to nvals
.rowIdxs
- row indices for each non-zero element.
This array must have a length equal at
least to nvals
.colOffs
- column start offsets into vals
and
rowIdxs
. This array must have a length equal at least to
ncols+1, where ncols is the number of columns in this matrix.nvals
- number of non-zero valuesncols
- number of specified columns. Indicates the maximum value of
colOffs
that will be used; will not resize matrix.part
- must be either Full
or
LowerTriangular
.public void setRandom(double lower, double upper, java.util.Random generator)
lower
- lower random value (inclusive)upper
- upper random value (exclusive)generator
- random number generatorpublic void setRandom(double lower, double upper, java.util.Random generator, boolean symmetric)
lower
- lower random value (inclusive)upper
- upper random value (exclusive)generator
- random number generatorsymmetric
- ensure that the resulting structure and values are symmetric.
Ignored if the matrix is not square.public void writeToFileCRS(java.lang.String fileName, java.lang.String fmtStr)