public class SparseMatrix extends Object implements Matrix
1.0 0.0 4.0
0.0 3.0 5.0
2.0 0.0 6.0
is stored as values: [1.0, 2.0, 3.0, 4.0, 5.0, 6.0],
rowIndices=[0, 2, 1, 0, 1, 2], colPointers=[0, 2, 3, 6].
| Constructor and Description |
|---|
SparseMatrix(int numRows,
int numCols,
int[] colPtrs,
int[] rowIndices,
double[] values) |
| Modifier and Type | Method and Description |
|---|---|
double |
apply(int i,
int j)
Gets the (i, j)-th element.
|
int[] |
colPtrs() |
SparseMatrix |
copy()
Get a deep copy of the matrix.
|
int |
index(int i,
int j)
Return the index for the (i, j)-th element in the backing array.
|
int |
numCols()
Number of columns.
|
int |
numRows()
Number of rows.
|
int[] |
rowIndices() |
double[] |
toArray()
Converts to a dense array in column major.
|
breeze.linalg.Matrix<Object> |
toBreeze()
Converts to a breeze matrix.
|
void |
update(int i,
int j,
double v)
Update element at (i, j)
|
double[] |
values() |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitmultiply, multiply, toString, transposeMultiply, transposeMultiplypublic SparseMatrix(int numRows,
int numCols,
int[] colPtrs,
int[] rowIndices,
double[] values)
public int numRows()
Matrixpublic int numCols()
Matrixpublic int[] colPtrs()
public int[] rowIndices()
public double[] values()
public double[] toArray()
Matrixpublic breeze.linalg.Matrix<Object> toBreeze()
Matrixpublic double apply(int i,
int j)
Matrixpublic int index(int i,
int j)
Matrixpublic void update(int i,
int j,
double v)
Matrixpublic SparseMatrix copy()
Matrix