public abstract class DenseMatrixBase extends MatrixBase implements DenseMatrix
Matrix.Matrix.Partition, Matrix.WriteFormatINDEFINITE, POSITIVE_DEFINITE, SPD, SYMMETRIC| Constructor and Description |
|---|
DenseMatrixBase() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(DenseMatrixBase M)
Adds matrix M to this matrix provided dimensions match
|
void |
checkConsistency()
Check that the internal structures of this matrix are consistent.
|
void |
set(double[] values)
Sets the elements of this matrix from an array of doubles.
|
void |
set(double[][] values)
Sets the elements of this matrix from a 2-dimensional array of doubles.
|
void |
set(double[] values,
int[] indices,
int numValues)
Sets the elements of this matrix from an array of doubles and a list of
indices.
|
abstract void |
set(int i,
int j,
double value)
Sets a single element of this matrix.
|
void |
set(Matrix M)
Sets the size and values of this matrix to those of another matrix.
|
void |
set(Vector v)
Sets the size and values of this matrix to correspond to those of vector
object.
|
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 |
setColumn(int j,
double[] values)
Sets a column of this matrix from an array of doubles.
|
void |
setColumn(int j,
Vector v)
Sets a column of this matrix from a
Vector. |
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 |
setRow(int i,
double[] values)
Set a row of this matrix from an array of doubles.
|
void |
setRow(int i,
Vector v)
Sets a row of this matrix from a
Vector. |
void |
setSubMatrix(int baseRow,
int baseCol,
Matrix Msrc)
Sets a submatrix of this matrix object.
|
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, maxNorm, mul, mul, mul, mulAdd, mulAdd, mulAdd, mulTranspose, mulTranspose, mulTranspose, mulTransposeAdd, mulTransposeAdd, mulTransposeAdd, numNonZeroVals, numNonZeroVals, oneNorm, rowSize, scan, setCRSValues, setDefaultFormat, setSize, toString, toString, toString, trace, write, write, write, write, write, write, writeToFileequals, getClass, hashCode, notify, notifyAll, wait, wait, waitcolSize, 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, setSize, toString, toString, trace, write, write, writepublic abstract void set(int i,
int j,
double value)
set in interface DenseMatrixi - element row indexj - element column indexvalue - element valuepublic void set(double[] values)
(i,j) is stored at location i*colSize()+j.set in interface DenseMatrixvalues - array from which values are copiedpublic void set(double[][] values)
values - array from which values are copiedjava.lang.IllegalArgumentException - values has inconsistent row sizesImproperSizeException - dimensions of values do not match the size of this matrixpublic void set(Matrix M)
public void set(Vector v)
set in interface DenseMatrixv - vector whose size and values are copiedpublic void set(double[] values,
int[] indices,
int numValues)
indices[k*2] and
indices[k*2+1], respectively. All non-specified elements
are set to zero.public void setColumn(int j,
double[] values)
setColumn in interface DenseMatrixj - column indexvalues - array from which column values are copiedpublic void setRow(int i,
double[] values)
setRow in interface DenseMatrixi - row indexvalues - array from which the row is copiedpublic void setColumn(int j,
Vector v)
Vector.setColumn in interface DenseMatrixj - column indexv - vector from which the column is copiedpublic void setRow(int i,
Vector v)
Vector.setRow in interface DenseMatrixi - row indexv - vector from which the row is copiedpublic void setSubMatrix(int baseRow,
int baseCol,
Matrix Msrc)
throws ImproperSizeException
baseRow and baseCol,
and the new values are given by the matrix object Msrc.
The size of the submatrix is determined by the dimensions of
Msrc.setSubMatrix in interface DenseMatrixbaseRow - index of the first row of the submatrixbaseCol - index of the first column of the submatrixMsrc - new values for the submatrix.ImproperSizeException - if baseRow or baseCol are negative, or if
the submatrix exceeds the current matrix boundsMatrixNd.copySubMatrix(int, int, int, int, maspack.matrix.Matrix, int, int)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 Matrixvals - 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 Matrixvals - 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 checkConsistency()
checkConsistency in interface Matrixpublic void add(DenseMatrixBase M)
M - matrix to add to this