|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectno.uib.cipr.matrix.AbstractMatrix
no.uib.cipr.matrix.sparse.LinkedSparseMatrix
public class LinkedSparseMatrix
A Linked List (with shortcuts to important nodes) implementation of an
n x m
Matrix with z
elements that has a typical
O(z / m)
insertion / lookup cost and an iterator that traverses
columns then rows: a good fit for unstructured sparse matrices. A secondary
link maintains fast transpose iteration.
1 instance (8 bytes), 2 int (16 bytes), 2 ref (16 bytes), 1 double (8 bytes) = 48 bytes
per matrix element, plus 8 x numcol + 8 x numrow bytes
s for the
cache) are slightly higher than structured sparse matrix storage. Note that
on 32 bit JVMs, or on 64 bit JVMs with CompressedOops enabled, references and ints only cost 4 bytes each,
bringing the cost to 28 bytes per element.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface no.uib.cipr.matrix.Matrix |
---|
Matrix.Norm |
Field Summary |
---|
Fields inherited from class no.uib.cipr.matrix.AbstractMatrix |
---|
numColumns, numRows |
Constructor Summary | |
---|---|
LinkedSparseMatrix(int numRows,
int numColumns)
|
|
LinkedSparseMatrix(Matrix A)
|
|
LinkedSparseMatrix(MatrixVectorReader r)
|
Method Summary | |
---|---|
Matrix |
copy()
Creates a deep copy of the matrix |
double |
get(int row,
int column)
Returns A(row,column) |
Iterator<MatrixEntry> |
iterator()
|
Matrix |
multAdd(double alpha,
Matrix B,
Matrix C)
C = alpha*A*B + C |
Vector |
multAdd(double alpha,
Vector x,
Vector y)
y = alpha*A*x + y |
Matrix |
scale(double alpha)
A = alpha*A |
void |
set(int row,
int column,
double value)
A(row,column) = value |
Matrix |
transABmultAdd(double alpha,
Matrix B,
Matrix C)
C = alpha*AT*BT + C |
Matrix |
transAmultAdd(double alpha,
Matrix B,
Matrix C)
C = alpha*AT*B + C |
Matrix |
transBmultAdd(double alpha,
Matrix B,
Matrix C)
C = alpha*A*BT + C |
Vector |
transMultAdd(double alpha,
Vector x,
Vector y)
y = alpha*AT*x + y |
Matrix |
transpose()
Transposes the matrix in-place. |
Matrix |
zero()
Zeros all the entries in the matrix, while preserving any underlying structure. |
Methods inherited from class no.uib.cipr.matrix.AbstractMatrix |
---|
add, add, add, check, checkMultAdd, checkMultAdd, checkRank1, checkRank1, checkRank2, checkRank2, checkSize, checkSolve, checkSolve, checkTransABmultAdd, checkTransAmultAdd, checkTransBmultAdd, checkTransMultAdd, checkTranspose, checkTranspose, checkTransRank1, checkTransRank2, isSquare, max, max, mult, mult, mult, mult, multAdd, multAdd, norm, norm1, normF, normInf, numColumns, numRows, rank1, rank1, rank1, rank1, rank1, rank1, rank2, rank2, rank2, rank2, set, set, solve, solve, toString, transABmult, transABmult, transABmultAdd, transAmult, transAmult, transAmultAdd, transBmult, transBmult, transBmultAdd, transMult, transMult, transMultAdd, transpose, transRank1, transRank1, transRank2, transRank2, transSolve, transSolve |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public LinkedSparseMatrix(int numRows, int numColumns)
public LinkedSparseMatrix(Matrix A)
public LinkedSparseMatrix(MatrixVectorReader r) throws IOException
IOException
Method Detail |
---|
public Matrix zero()
Matrix
zero
in interface Matrix
zero
in class AbstractMatrix
public double get(int row, int column)
Matrix
A(row,column)
get
in interface Matrix
get
in class AbstractMatrix
public void set(int row, int column, double value)
Matrix
A(row,column) = value
set
in interface Matrix
set
in class AbstractMatrix
public Iterator<MatrixEntry> iterator()
iterator
in interface Iterable<MatrixEntry>
iterator
in class AbstractMatrix
public Matrix scale(double alpha)
Matrix
A = alpha*A
scale
in interface Matrix
scale
in class AbstractMatrix
public Matrix copy()
Matrix
copy
in interface Matrix
copy
in class AbstractMatrix
public Matrix transpose()
Matrix
transpose
in interface Matrix
transpose
in class AbstractMatrix
public Vector multAdd(double alpha, Vector x, Vector y)
Matrix
y = alpha*A*x + y
multAdd
in interface Matrix
multAdd
in class AbstractMatrix
x
- Vector of size A.numColumns()
y
- Vector of size A.numRows()
public Vector transMultAdd(double alpha, Vector x, Vector y)
Matrix
y = alpha*AT*x + y
transMultAdd
in interface Matrix
transMultAdd
in class AbstractMatrix
x
- Vector of size A.numRows()
y
- Vector of size A.numColumns()
public Matrix multAdd(double alpha, Matrix B, Matrix C)
Matrix
C = alpha*A*B + C
multAdd
in interface Matrix
multAdd
in class AbstractMatrix
B
- Matrix such that B.numRows() == A.numColumns()
and B.numColumns() == C.numColumns()
C
- Matrix such that C.numRows() == A.numRows()
and
B.numColumns() == C.numColumns()
public Matrix transBmultAdd(double alpha, Matrix B, Matrix C)
Matrix
C = alpha*A*BT + C
transBmultAdd
in interface Matrix
transBmultAdd
in class AbstractMatrix
B
- Matrix such that B.numRows() == A.numRows()
and
B.numColumns() == C.numColumns()
C
- Matrix such that C.numRows() == A.numColumns()
and B.numColumns() == C.numColumns()
public Matrix transAmultAdd(double alpha, Matrix B, Matrix C)
Matrix
C = alpha*AT*B + C
transAmultAdd
in interface Matrix
transAmultAdd
in class AbstractMatrix
B
- Matrix such that B.numRows() == A.numRows()
and
B.numColumns() == C.numColumns()
C
- Matrix such that C.numRows() == A.numColumns()
and B.numColumns() == C.numColumns()
public Matrix transABmultAdd(double alpha, Matrix B, Matrix C)
Matrix
C = alpha*AT*BT + C
transABmultAdd
in interface Matrix
transABmultAdd
in class AbstractMatrix
B
- Matrix such that B.numColumns() == A.numRows()
and B.numRows() == C.numColumns()
C
- Matrix such that C.numRows() == A.numColumns()
and B.numRows() == C.numColumns()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |