public interface MatrixBlock extends DenseMatrix, Clonable
Matrix.Partition, Matrix.WriteFormat
INDEFINITE, POSITIVE_DEFINITE, SPD, SYMMETRIC
Modifier and Type | Method and Description |
---|---|
void |
add(Matrix M)
Adds the contents of a Matrix to this matrix block.
|
void |
addNumNonZerosByCol(int[] offsets,
int idx,
Matrix.Partition part)
Adds the number of non-zero entries in each column of this block matrix to
the current values stored in the array
offsets , starting
at the location specified by idx . |
void |
addNumNonZerosByRow(int[] offsets,
int idx,
Matrix.Partition part)
Adds the number of non-zero entries in each row of this block matrix to
the current values stored in the array
offsets , starting
at the location specified by idx . |
MatrixBlock |
clone()
Creates a clone of this MatrixBlock, which duplicates the size, storage
capacity, and values.
|
MatrixBlock |
createTranspose()
Creates a new MatrixBlock which is the transpose of this one.
|
MatrixBlock |
down()
Returns the next matrix block in a block matrix column.
|
int |
getBlockCCSIndices(int[] rowIdxs,
int rowOff,
int[] offsets,
Matrix.Partition part) |
int |
getBlockCCSValues(double[] vals,
int[] offsets,
Matrix.Partition part)
Stores the values of non-zero entries for this matrix block.
|
int |
getBlockCol()
Gets the number of the block column of this matrix block within a
SparseBlockMatrix . |
int |
getBlockCRSIndices(int[] colIdxs,
int colOff,
int[] offsets,
Matrix.Partition part)
Stores the column indices of the non-zero entries for this matrix block.
|
int |
getBlockCRSValues(double[] vals,
int[] offsets,
Matrix.Partition part)
Stores the values of non-zero entries for this matrix block.
|
int |
getBlockNumber()
Gets the number of this block within a
SparseBlockMatrix . |
int |
getBlockRow()
Gets the number of the block row of this matrix block within a
SparseBlockMatrix . |
void |
mulAdd(double[] y,
int yIdx,
double[] x,
int xidx)
Pre-multiplies a column vector by this matrix block and adds the result to
a set of existing values.
|
void |
mulAdd(Matrix M1,
Matrix M2)
Multiplies M1 by M2 and places the result in this matrix.
|
void |
mulTransposeAdd(double[] y,
int yIdx,
double[] x,
int xidx)
Post-multiplies a row vector by this matrix block and adds the result to a
set of existing values.
|
void |
mulTransposeLeftAdd(Matrix M1,
Matrix M2)
Multiplies M1^T by M2 and places the result in this matrix.
|
void |
mulTransposeRightAdd(Matrix M1,
Matrix M2)
Multiplies M1 by M2^T and places the result in this matrix.
|
void |
negate()
Negates this matrix in place.
|
MatrixBlock |
next()
Returns the next matrix block in a block matrix row.
|
void |
scale(double s)
Scales the elements of this matrix block by a scale factor.
|
void |
scaledAdd(double s,
Matrix M)
Adds the scaled contents of a Matrix to this matrix block.
|
void |
setBlockCol(int blkCol)
Sets the number of the block column of this matrix block within a
SparseBlockMatrix . |
void |
setBlockNumber(int num)
Sets the number of this block within a
SparseBlockMatrix . |
void |
setBlockRow(int blkRow)
Sets the number of the block row of this matrix block within a
SparseBlockMatrix . |
void |
setDown(MatrixBlock blk)
Sets the next matrix block in a block matrix column.
|
void |
setNext(MatrixBlock blk)
Sets the next matrix block in a block matrix row.
|
void |
setZero()
Sets the contents of this matrix block to zero.
|
void |
sub(Matrix M)
Subtract the contents of a Matrix from this matrix block.
|
boolean |
valueIsNonZero(int i,
int j)
Returns true if the value at the specified location is structurally
non-zero.
|
set, set, set, setColumn, setColumn, setRow, setRow, setSubMatrix
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, set, setCCSValues, setCRSValues, setSize, toString, toString, trace, write, write, write
MatrixBlock down()
void setDown(MatrixBlock blk)
maspack.matrix
.blk
- next matrix block in a columnMatrixBlock next()
void setNext(MatrixBlock blk)
maspack.matrix
.blk
- next matrix block in a rowvoid setZero()
void scale(double s)
s
- scaling factorvoid add(Matrix M)
M
- matrix to addImproperSizeException
- if the matrix sizes do not conformvoid scaledAdd(double s, Matrix M)
s
- scaling factorM
- matrix to addImproperSizeException
- if the matrix sizes do not conformvoid sub(Matrix M)
M
- matrix to subtractImproperSizeException
- if the matrix sizes do not conformvoid negate()
int getBlockCol()
SparseBlockMatrix
.int getBlockRow()
SparseBlockMatrix
.void setBlockCol(int blkCol)
SparseBlockMatrix
. Use of this
method is reserved to maspack.matrix
.blkCol
- column number for this blockvoid setBlockRow(int blkRow)
SparseBlockMatrix
. Use of this
method is reserved to maspack.matrix
.blkRow
- row number for this blockint getBlockNumber()
SparseBlockMatrix
. Block numbers are used for fast access. If
the block does not belong to a SparseBlockMatrix, then -1 is returned.void setBlockNumber(int num)
SparseBlockMatrix
. Use
of this method is reserved to maspack.matrix
.num
- number for this blockvoid mulAdd(Matrix M1, Matrix M2)
M1
- left matrix termM2
- right matrix termvoid mulTransposeRightAdd(Matrix M1, Matrix M2)
M1
- left matrix termM2
- right matrix termvoid mulTransposeLeftAdd(Matrix M1, Matrix M2)
M1
- left matrix termM2
- right matrix termvoid mulAdd(double[] y, int yIdx, double[] x, int xidx)
x
, starting at location xIdx
, and
the result is added to values in y
, starting at location
yIdx
.y
- accumulates resulting valuesyIdx
- starting index for accumulating valuesx
- supplies column vector valuesxidx
- starting index for column vector valuesvoid mulTransposeAdd(double[] y, int yIdx, double[] x, int xidx)
x
, starting at location xIdx
, and the
result is added to values in y
, starting at location
yIdx
.y
- accumulates resulting valuesyIdx
- starting index for accumulating valuesx
- supplies row vector valuesxidx
- starting index for row vector valuesint getBlockCRSIndices(int[] colIdxs, int colOff, int[] offsets, Matrix.Partition part)
colIdxs
, starting at a location given by
offsets[i]
. Indices are 0-based. Upon return,
offsets[i]
should be incremented by the number of non-zero
values in row i.colIdxs
- stores column indices of non-zero entriescolOff
- starting column index for the first column of this blockoffsets
- offsets within colIdxs
for storing each row's indices; upon
return, should be incremented by the number of non-zero entries in each
row.part
- specifies whether to store column indices for the entire block or a
specified sub-portion.int getBlockCRSValues(double[] vals, int[] offsets, Matrix.Partition part)
vals
,
starting at a location given by offsets[i]
. Upon return,
offsets[i]
should be incremented by the number of non-zero
values in row i.vals
- stores values of non-zero entriesoffsets
- offsets within vals
for storing each row's values; upon
return, should be incremented by the number of non-zero entries in each
row.part
- specifies whether to store the entire block or a specified sub-portion.void addNumNonZerosByRow(int[] offsets, int idx, Matrix.Partition part)
offsets
, starting
at the location specified by idx
.offsets
- values to be incremented by the number of non-zero entries in each rowidx
- starting location within offsets
part
- specifies whether to consider the entire block or a specified sub-portion.int getBlockCCSIndices(int[] rowIdxs, int rowOff, int[] offsets, Matrix.Partition part)
rowIdxs
- stores row indices of non-zero entriesrowOff
- starting row index for the first row of this blockoffsets
- offsets within rowIdxs
for storing each column's indices;
upon return, should be incremented by the number of non-zero entries in
each column.part
- specifies whether to store row indices for the entire block or a specified
sub-portion.int getBlockCCSValues(double[] vals, int[] offsets, Matrix.Partition part)
vals
, starting at a location given by
offsets[j]
. Upon return, offsets[j]
should
be incremented by the number of non-zero values in column j.vals
- stores values of non-zero entriesoffsets
- offsets within vals
for storing each columns's values; upon
return, should be incremented by the number of non-zero entries in each
column.part
- specifies whether to store the entire block or a specified sub-portion.void addNumNonZerosByCol(int[] offsets, int idx, Matrix.Partition part)
offsets
, starting
at the location specified by idx
.offsets
- values to be incremented by the number of non-zero entries in each columnidx
- starting location within offsets
part
- specifies whether to consider the entire block or a specified sub-portion.boolean valueIsNonZero(int i, int j)
i
- row indexj
- column indexMatrixBlock createTranspose()
MatrixBlock clone()