|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmaspack.matrix.MatrixBase
maspack.matrix.DenseMatrixBase
maspack.matrix.Matrix2dBase
maspack.matrix.Matrix2d
maspack.matrix.Matrix2x2Block
public class Matrix2x2Block
Implements a 3 x 3 matrix block using a single Matrix3d object.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface maspack.matrix.Matrix |
---|
Matrix.Partition, Matrix.WriteFormat |
Field Summary |
---|
Fields inherited from class maspack.matrix.Matrix2d |
---|
IDENTITY, ZERO |
Fields inherited from class maspack.matrix.Matrix2dBase |
---|
m00, m01, m10, m11 |
Fields inherited from interface maspack.matrix.Matrix |
---|
INDEFINITE, POSITIVE_DEFINITE, SPD, SYMMETRIC |
Constructor Summary | |
---|---|
Matrix2x2Block()
Creates a new Matrix2x2Block. |
Method Summary | |
---|---|
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 . |
Matrix2x2Block |
clone()
Creates a clone of this matrix block, with the link and offset information set to be undefined. |
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 |
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. |
MatrixBlock |
next()
Returns the next matrix block in a block matrix row. |
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 |
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. |
Methods inherited from class maspack.matrix.Matrix2d |
---|
add, add, invert, invert, mul, mul, mulInverse, mulInverseBoth, mulInverseLeft, mulInverseRight, mulTranspose, mulTransposeBoth, mulTransposeLeft, mulTransposeRight, negate, scale, scale, scaledAdd, scaledAdd, setColumns, setDiagonal, setDiagonal, setDiagonal, setRandom, setRandom, setRandom, setRows, setZero, sub, sub, transpose |
Methods inherited from class maspack.matrix.Matrix2dBase |
---|
colSize, determinant, epsilonEquals, equals, frobeniusNorm, get, get, getColumn, getColumn, getColumn, getRow, getRow, getRow, infinityNorm, mul, mul, mul, mulAdd, mulInverse, mulInverse, mulInverseTranspose, mulInverseTranspose, mulTranspose, mulTranspose, negate, oneNorm, rowSize, set, set, set, set, setColumn, setColumn, setIdentity, setRow, setRow, transpose |
Methods inherited from class maspack.matrix.DenseMatrixBase |
---|
add, checkConsistency, set, set, set, setCCSValues, setColumn, setCRSValues, setRow, setSubMatrix |
Methods inherited from class maspack.matrix.MatrixBase |
---|
containsNaN, epsilonEquals, equals, get, getCCSIndices, getCCSIndices, getCCSValues, getCCSValues, getColumn, getCRSIndices, getCRSIndices, getCRSValues, getCRSValues, getDefaultFormat, getRow, getSize, getSubMatrix, hasNaN, idString, isFixedSize, isSymmetric, mul, mul, mulAdd, mulAdd, mulAdd, mulTranspose, mulTranspose, mulTranspose, mulTransposeAdd, mulTransposeAdd, mulTransposeAdd, numNonZeroVals, numNonZeroVals, scan, setCRSValues, setDefaultFormat, setSize, toString, toString, toString, trace, write, write, write, write, write, writeToFile |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface maspack.matrix.MatrixBlock |
---|
scale, setZero |
Methods inherited from interface maspack.matrix.DenseMatrix |
---|
set, set, set, setColumn, setColumn, setRow, setRow, setSubMatrix |
Methods inherited from interface maspack.matrix.Matrix |
---|
checkConsistency, colSize, determinant, epsilonEquals, equals, frobeniusNorm, get, get, getCCSIndices, getCCSIndices, getCCSValues, getCCSValues, getColumn, getColumn, getColumn, getCRSIndices, getCRSIndices, getCRSValues, getCRSValues, getRow, getRow, getRow, getSize, getSubMatrix, infinityNorm, isFixedSize, isSymmetric, mul, mul, mul, mulAdd, mulAdd, mulAdd, mulTranspose, mulTranspose, mulTranspose, mulTransposeAdd, mulTransposeAdd, mulTransposeAdd, numNonZeroVals, numNonZeroVals, oneNorm, rowSize, scan, set, set, setCCSValues, setCRSValues, setSize, toString, trace, write, write, write |
Constructor Detail |
---|
public Matrix2x2Block()
Method Detail |
---|
public MatrixBlock next()
next
in interface MatrixBlock
public void setNext(MatrixBlock blk)
maspack.matrix
.
setNext
in interface MatrixBlock
blk
- next matrix block in a rowpublic MatrixBlock down()
down
in interface MatrixBlock
public void setDown(MatrixBlock blk)
maspack.matrix
.
setDown
in interface MatrixBlock
blk
- next matrix block in a columnpublic int getBlockRow()
SparseBlockMatrix
.
getBlockRow
in interface MatrixBlock
public void setBlockRow(int blkRow)
SparseBlockMatrix
. Use of this
method is reserved to maspack.matrix
.
setBlockRow
in interface MatrixBlock
blkRow
- row number for this blockpublic int getBlockCol()
SparseBlockMatrix
.
getBlockCol
in interface MatrixBlock
public void setBlockCol(int blkCol)
SparseBlockMatrix
. Use of this
method is reserved to maspack.matrix
.
setBlockCol
in interface MatrixBlock
blkCol
- column number for this blockpublic int getBlockNumber()
SparseBlockMatrix
. Block numbers are used for fast access. If
the block does not belong to a SparseBlockMatrix, then -1 is returned.
getBlockNumber
in interface MatrixBlock
public void setBlockNumber(int num)
SparseBlockMatrix
. Use
of this method is reserved to maspack.matrix
.
setBlockNumber
in interface MatrixBlock
num
- number for this blockpublic void 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
.
mulAdd
in interface MatrixBlock
y
- accumulates resulting valuesyIdx
- starting index for accumulating valuesx
- supplies column vector valuesxIdx
- starting index for column vector valuespublic void 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
.
mulTransposeAdd
in interface MatrixBlock
y
- accumulates resulting valuesyIdx
- starting index for accumulating valuesx
- supplies row vector valuesxIdx
- starting index for row vector valuespublic void add(Matrix M)
add
in interface MatrixBlock
M
- matrix to addpublic void scaledAdd(double s, Matrix M)
scaledAdd
in interface MatrixBlock
s
- scaling factorM
- matrix to addpublic void sub(Matrix M)
sub
in interface MatrixBlock
M
- matrix to subtractpublic int 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.
getBlockCRSIndices
in interface MatrixBlock
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.
public void addNumNonZerosByRow(int[] offsets, int idx, Matrix.Partition part)
offsets
, starting
at the location specified by idx
.
addNumNonZerosByRow
in interface MatrixBlock
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.public 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.
getBlockCRSValues
in interface MatrixBlock
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.
public int getBlockCCSIndices(int[] rowIdxs, int rowOff, int[] offsets, Matrix.Partition part)
getBlockCCSIndices
in interface MatrixBlock
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.
public void addNumNonZerosByCol(int[] offsets, int idx, Matrix.Partition part)
offsets
, starting
at the location specified by idx
.
addNumNonZerosByCol
in interface MatrixBlock
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.public 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.
getBlockCCSValues
in interface MatrixBlock
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.
public boolean valueIsNonZero(int i, int j)
valueIsNonZero
in interface MatrixBlock
i
- row indexj
- column index
public Matrix2x2Block clone()
clone
in interface MatrixBlock
clone
in interface Clonable
clone
in class Matrix2dBase
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |