Matrix (Spark 3.5.5 JavaDoc) (original) (raw)
Modifier and Type
Method and Description
double
[apply](../../../../../org/apache/spark/ml/linalg/Matrix.html#apply-int-int-)(int i, int j)
Gets the (i, j)-th element.
breeze.linalg.Matrix<Object>
[asBreeze](../../../../../org/apache/spark/ml/linalg/Matrix.html#asBreeze--)()
Converts to a breeze matrix.
scala.collection.Iterator<[Vector](../../../../../org/apache/spark/ml/linalg/Vector.html "interface in org.apache.spark.ml.linalg")>
[colIter](../../../../../org/apache/spark/ml/linalg/Matrix.html#colIter--)()
Returns an iterator of column vectors.
[Matrix](../../../../../org/apache/spark/ml/linalg/Matrix.html "interface in org.apache.spark.ml.linalg")
[compressed](../../../../../org/apache/spark/ml/linalg/Matrix.html#compressed--)()
Returns a matrix in dense column major, dense row major, sparse row major, or sparse column major format, whichever uses less storage.
[Matrix](../../../../../org/apache/spark/ml/linalg/Matrix.html "interface in org.apache.spark.ml.linalg")
[compressedColMajor](../../../../../org/apache/spark/ml/linalg/Matrix.html#compressedColMajor--)()
Returns a matrix in dense or sparse column major format, whichever uses less storage.
[Matrix](../../../../../org/apache/spark/ml/linalg/Matrix.html "interface in org.apache.spark.ml.linalg")
[compressedRowMajor](../../../../../org/apache/spark/ml/linalg/Matrix.html#compressedRowMajor--)()
Returns a matrix in dense or sparse row major format, whichever uses less storage.
[Matrix](../../../../../org/apache/spark/ml/linalg/Matrix.html "interface in org.apache.spark.ml.linalg")
[copy](../../../../../org/apache/spark/ml/linalg/Matrix.html#copy--)()
Get a deep copy of the matrix.
void
[foreachActive](../../../../../org/apache/spark/ml/linalg/Matrix.html#foreachActive-scala.Function3-)(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](../../../../../org/apache/spark/ml/linalg/Matrix.html#getDenseSizeInBytes--)()
Gets the size of the dense representation of this `Matrix`.
long
[getSizeInBytes](../../../../../org/apache/spark/ml/linalg/Matrix.html#getSizeInBytes--)()
Gets the current size in bytes of this `Matrix`.
long
[getSparseSizeInBytes](../../../../../org/apache/spark/ml/linalg/Matrix.html#getSparseSizeInBytes-boolean-)(boolean colMajor)
Gets the size of the minimal sparse representation of this `Matrix`.
int
[index](../../../../../org/apache/spark/ml/linalg/Matrix.html#index-int-int-)(int i, int j)
Return the index for the (i, j)-th element in the backing array.
boolean
[isColMajor](../../../../../org/apache/spark/ml/linalg/Matrix.html#isColMajor--)()
Indicates whether the values backing this matrix are arranged in column major order.
boolean
[isRowMajor](../../../../../org/apache/spark/ml/linalg/Matrix.html#isRowMajor--)()
Indicates whether the values backing this matrix are arranged in row major order.
boolean
[isTransposed](../../../../../org/apache/spark/ml/linalg/Matrix.html#isTransposed--)()
Flag that keeps track whether the matrix is transposed or not.
[Matrix](../../../../../org/apache/spark/ml/linalg/Matrix.html "interface in org.apache.spark.ml.linalg")
[map](../../../../../org/apache/spark/ml/linalg/Matrix.html#map-scala.Function1-)(scala.Function1<Object,Object> f)
Map the values of this matrix using a function.
[DenseMatrix](../../../../../org/apache/spark/ml/linalg/DenseMatrix.html "class in org.apache.spark.ml.linalg")
[multiply](../../../../../org/apache/spark/ml/linalg/Matrix.html#multiply-org.apache.spark.ml.linalg.DenseMatrix-)([DenseMatrix](../../../../../org/apache/spark/ml/linalg/DenseMatrix.html "class in org.apache.spark.ml.linalg") y)
Convenience method for Matrix
-DenseMatrix
multiplication.
[DenseVector](../../../../../org/apache/spark/ml/linalg/DenseVector.html "class in org.apache.spark.ml.linalg")
[multiply](../../../../../org/apache/spark/ml/linalg/Matrix.html#multiply-org.apache.spark.ml.linalg.DenseVector-)([DenseVector](../../../../../org/apache/spark/ml/linalg/DenseVector.html "class in org.apache.spark.ml.linalg") y)
Convenience method for Matrix
-DenseVector
multiplication.
[DenseVector](../../../../../org/apache/spark/ml/linalg/DenseVector.html "class in org.apache.spark.ml.linalg")
[multiply](../../../../../org/apache/spark/ml/linalg/Matrix.html#multiply-org.apache.spark.ml.linalg.Vector-)([Vector](../../../../../org/apache/spark/ml/linalg/Vector.html "interface in org.apache.spark.ml.linalg") y)
Convenience method for Matrix
-Vector
multiplication.
int
[numActives](../../../../../org/apache/spark/ml/linalg/Matrix.html#numActives--)()
Find the number of values stored explicitly.
int
[numCols](../../../../../org/apache/spark/ml/linalg/Matrix.html#numCols--)()
Number of columns.
int
[numNonzeros](../../../../../org/apache/spark/ml/linalg/Matrix.html#numNonzeros--)()
Find the number of non-zero active values.
int
[numRows](../../../../../org/apache/spark/ml/linalg/Matrix.html#numRows--)()
Number of rows.
scala.collection.Iterator<[Vector](../../../../../org/apache/spark/ml/linalg/Vector.html "interface in org.apache.spark.ml.linalg")>
[rowIter](../../../../../org/apache/spark/ml/linalg/Matrix.html#rowIter--)()
Returns an iterator of row vectors.
double[]
[toArray](../../../../../org/apache/spark/ml/linalg/Matrix.html#toArray--)()
Converts to a dense array in column major.
[DenseMatrix](../../../../../org/apache/spark/ml/linalg/DenseMatrix.html "class in org.apache.spark.ml.linalg")
[toDense](../../../../../org/apache/spark/ml/linalg/Matrix.html#toDense--)()
Converts this matrix to a dense matrix while maintaining the layout of the current matrix.
[DenseMatrix](../../../../../org/apache/spark/ml/linalg/DenseMatrix.html "class in org.apache.spark.ml.linalg")
[toDenseColMajor](../../../../../org/apache/spark/ml/linalg/Matrix.html#toDenseColMajor--)()
Converts this matrix to a dense matrix in column major order.
[DenseMatrix](../../../../../org/apache/spark/ml/linalg/DenseMatrix.html "class in org.apache.spark.ml.linalg")
[toDenseMatrix](../../../../../org/apache/spark/ml/linalg/Matrix.html#toDenseMatrix-boolean-)(boolean colMajor)
Converts this matrix to a dense matrix.
[DenseMatrix](../../../../../org/apache/spark/ml/linalg/DenseMatrix.html "class in org.apache.spark.ml.linalg")
[toDenseRowMajor](../../../../../org/apache/spark/ml/linalg/Matrix.html#toDenseRowMajor--)()
Converts this matrix to a dense matrix in row major order.
[SparseMatrix](../../../../../org/apache/spark/ml/linalg/SparseMatrix.html "class in org.apache.spark.ml.linalg")
[toSparse](../../../../../org/apache/spark/ml/linalg/Matrix.html#toSparse--)()
Converts this matrix to a sparse matrix while maintaining the layout of the current matrix.
[SparseMatrix](../../../../../org/apache/spark/ml/linalg/SparseMatrix.html "class in org.apache.spark.ml.linalg")
[toSparseColMajor](../../../../../org/apache/spark/ml/linalg/Matrix.html#toSparseColMajor--)()
Converts this matrix to a sparse matrix in column major order.
[SparseMatrix](../../../../../org/apache/spark/ml/linalg/SparseMatrix.html "class in org.apache.spark.ml.linalg")
[toSparseMatrix](../../../../../org/apache/spark/ml/linalg/Matrix.html#toSparseMatrix-boolean-)(boolean colMajor)
Converts this matrix to a sparse matrix.
[SparseMatrix](../../../../../org/apache/spark/ml/linalg/SparseMatrix.html "class in org.apache.spark.ml.linalg")
[toSparseRowMajor](../../../../../org/apache/spark/ml/linalg/Matrix.html#toSparseRowMajor--)()
Converts this matrix to a sparse matrix in row major order.
String
[toString](../../../../../org/apache/spark/ml/linalg/Matrix.html#toString--)()
A human readable representation of the matrix
String
[toString](../../../../../org/apache/spark/ml/linalg/Matrix.html#toString-int-int-)(int maxLines, int maxLineWidth)
A human readable representation of the matrix with maximum lines and width
[Matrix](../../../../../org/apache/spark/ml/linalg/Matrix.html "interface in org.apache.spark.ml.linalg")
[transpose](../../../../../org/apache/spark/ml/linalg/Matrix.html#transpose--)()
Transpose the Matrix.
[Matrix](../../../../../org/apache/spark/ml/linalg/Matrix.html "interface in org.apache.spark.ml.linalg")
[update](../../../../../org/apache/spark/ml/linalg/Matrix.html#update-scala.Function1-)(scala.Function1<Object,Object> f)
Update all the values of this matrix using the function f.
void
[update](../../../../../org/apache/spark/ml/linalg/Matrix.html#update-int-int-double-)(int i, int j, double v)
Update element at (i, j)