public class SparseMatrix extends Object implements Matrix, scala.Serializable
More details concerning the compressed sparse column (CSC) representation can be found [http://en.wikipedia.org/wiki/Sparse_matrix#Compressed_sparse_column_.28CSC_or_CCS.29].
Constructor and Description |
---|
SparseMatrix(int numRows,
int numCols,
int[] rowIndices,
int[] colPtrs,
double[] data) |
Modifier and Type | Method and Description |
---|---|
double |
apply(int row,
int col)
Element wise access function
|
int[] |
colPtrs() |
SparseMatrix |
copy()
Copies the matrix instance
|
double[] |
data() |
boolean |
equals(Object obj) |
static SparseMatrix |
fromCOO(int numRows,
int numCols,
scala.collection.Iterable<scala.Tuple3<Object,Object,Object>> entries)
Constructs a sparse matrix from a coordinate list (COO) representation where each entry
is stored as a tuple of (rowIndex, columnIndex, value).
|
static SparseMatrix |
fromCOO(int numRows,
int numCols,
scala.collection.Seq<scala.Tuple3<Object,Object,Object>> entries)
Constructs a sparse matrix from a coordinate list (COO) representation where each entry
is stored as a tuple of (rowIndex, columnIndex, value).
|
static SparseMatrix |
fromCOO(int numRows,
int numCols,
scala.Tuple3<Object,Object,Object> entry)
Convenience method to convert a single tuple with an integer value into a SparseMatrix.
|
int |
hashCode() |
int |
numCols()
Number of columns
|
int |
numRows()
Number of rows
|
int[] |
rowIndices() |
DenseMatrix |
toDenseMatrix() |
String |
toString() |
void |
update(int row,
int col,
double value)
Element wise update function
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
equalsMatrix
public SparseMatrix(int numRows, int numCols, int[] rowIndices, int[] colPtrs, double[] data)
public static SparseMatrix fromCOO(int numRows, int numCols, scala.collection.Seq<scala.Tuple3<Object,Object,Object>> entries)
numRows
- numCols
- entries
- public static SparseMatrix fromCOO(int numRows, int numCols, scala.collection.Iterable<scala.Tuple3<Object,Object,Object>> entries)
numRows
- numCols
- entries
- public static SparseMatrix fromCOO(int numRows, int numCols, scala.Tuple3<Object,Object,Object> entry)
numRows
- numCols
- entry
- public int numRows()
Matrix
public int numCols()
Matrix
public int[] rowIndices()
public int[] colPtrs()
public double[] data()
public double apply(int row, int col)
public DenseMatrix toDenseMatrix()
public void update(int row, int col, double value)
public SparseMatrix copy()
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.