public interface Matrix
extends scala.Serializable
Modifier and Type | Method and Description |
---|---|
double |
apply(int i,
int j)
Gets the (i, j)-th element.
|
breeze.linalg.Matrix<Object> |
asBreeze()
Converts to a breeze matrix.
|
scala.collection.Iterator<Vector> |
colIter()
Returns an iterator of column vectors.
|
Matrix |
compressed()
Returns a matrix in dense column major, dense row major, sparse row major, or sparse column
major format, whichever uses less storage.
|
Matrix |
compressedColMajor()
Returns a matrix in dense or sparse column major format, whichever uses less storage.
|
Matrix |
compressedRowMajor()
Returns a matrix in dense or sparse row major format, whichever uses less storage.
|
Matrix |
copy()
Get a deep copy of the matrix.
|
void |
foreachActive(scala.Function3<Object,Object,Object,scala.runtime.BoxedUnit> f)
Applies a function
f to all the active elements of dense and sparse matrix. |
long |
getDenseSizeInBytes()
Gets the size of the dense representation of this `Matrix`.
|
long |
getSizeInBytes()
Gets the current size in bytes of this `Matrix`.
|
long |
getSparseSizeInBytes(boolean colMajor)
Gets the size of the minimal sparse representation of this `Matrix`.
|
int |
index(int i,
int j)
Return the index for the (i, j)-th element in the backing array.
|
boolean |
isColMajor()
Indicates whether the values backing this matrix are arranged in column major order.
|
boolean |
isRowMajor()
Indicates whether the values backing this matrix are arranged in row major order.
|
boolean |
isTransposed()
Flag that keeps track whether the matrix is transposed or not.
|
Matrix |
map(scala.Function1<Object,Object> f)
Map the values of this matrix using a function.
|
DenseMatrix |
multiply(DenseMatrix y)
Convenience method for
Matrix -DenseMatrix multiplication. |
DenseVector |
multiply(DenseVector y)
Convenience method for
Matrix -DenseVector multiplication. |
DenseVector |
multiply(Vector y)
Convenience method for
Matrix -Vector multiplication. |
int |
numActives()
Find the number of values stored explicitly.
|
int |
numCols()
Number of columns.
|
int |
numNonzeros()
Find the number of non-zero active values.
|
int |
numRows()
Number of rows.
|
scala.collection.Iterator<Vector> |
rowIter()
Returns an iterator of row vectors.
|
double[] |
toArray()
Converts to a dense array in column major.
|
DenseMatrix |
toDense()
Converts this matrix to a dense matrix while maintaining the layout of the current matrix.
|
DenseMatrix |
toDenseColMajor()
Converts this matrix to a dense matrix in column major order.
|
DenseMatrix |
toDenseMatrix(boolean colMajor)
Converts this matrix to a dense matrix.
|
DenseMatrix |
toDenseRowMajor()
Converts this matrix to a dense matrix in row major order.
|
SparseMatrix |
toSparse()
Converts this matrix to a sparse matrix while maintaining the layout of the current matrix.
|
SparseMatrix |
toSparseColMajor()
Converts this matrix to a sparse matrix in column major order.
|
SparseMatrix |
toSparseMatrix(boolean colMajor)
Converts this matrix to a sparse matrix.
|
SparseMatrix |
toSparseRowMajor()
Converts this matrix to a sparse matrix in row major order.
|
String |
toString()
A human readable representation of the matrix
|
String |
toString(int maxLines,
int maxLineWidth)
A human readable representation of the matrix with maximum lines and width
|
Matrix |
transpose()
Transpose the Matrix.
|
Matrix |
update(scala.Function1<Object,Object> f)
Update all the values of this matrix using the function f.
|
void |
update(int i,
int j,
double v)
Update element at (i, j)
|
double apply(int i, int j)
breeze.linalg.Matrix<Object> asBreeze()
scala.collection.Iterator<Vector> colIter()
Matrix compressed()
Matrix compressedColMajor()
Matrix compressedRowMajor()
Matrix copy()
void foreachActive(scala.Function3<Object,Object,Object,scala.runtime.BoxedUnit> f)
f
to all the active elements of dense and sparse matrix. The ordering
of the elements are not defined.
f
- the function takes three parameters where the first two parameters are the row
and column indices respectively with the type Int
, and the final parameter is the
corresponding value in the matrix with type Double
.long getDenseSizeInBytes()
long getSizeInBytes()
long getSparseSizeInBytes(boolean colMajor)
int index(int i, int j)
boolean isColMajor()
boolean isRowMajor()
boolean isTransposed()
Matrix map(scala.Function1<Object,Object> f)
SparseMatrix
.f
- (undocumented)DenseMatrix multiply(DenseMatrix y)
Matrix
-DenseMatrix
multiplication.y
- (undocumented)DenseVector multiply(DenseVector y)
Matrix
-DenseVector
multiplication. For binary compatibility.y
- (undocumented)DenseVector multiply(Vector y)
Matrix
-Vector
multiplication.y
- (undocumented)int numActives()
int numCols()
int numNonzeros()
int numRows()
scala.collection.Iterator<Vector> rowIter()
double[] toArray()
DenseMatrix toDense()
DenseMatrix toDenseColMajor()
DenseMatrix toDenseMatrix(boolean colMajor)
colMajor
- Whether the values of the resulting dense matrix should be in column major
or row major order. If false
, resulting matrix will be row major.DenseMatrix toDenseRowMajor()
SparseMatrix toSparse()
SparseMatrix toSparseColMajor()
SparseMatrix toSparseMatrix(boolean colMajor)
colMajor
- Whether the values of the resulting sparse matrix should be in column major
or row major order. If false
, resulting matrix will be row major.SparseMatrix toSparseRowMajor()
String toString()
toString
in class Object
String toString(int maxLines, int maxLineWidth)
Matrix transpose()
Matrix
instance sharing the same underlying data.void update(int i, int j, double v)
Matrix update(scala.Function1<Object,Object> f)
SparseMatrix
.f
- (undocumented)