class BlockMatrix extends DistributedMatrix with Logging
Represents a distributed matrix in blocks of local matrices.
- Annotations
- @Since("1.3.0")
- Alphabetic
- By Inheritance
- BlockMatrix
- Logging
- DistributedMatrix
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new BlockMatrix(blocks: RDD[((Int, Int), Matrix)], rowsPerBlock: Int, colsPerBlock: Int)
Alternate constructor for BlockMatrix without the input of the number of rows and columns.
Alternate constructor for BlockMatrix without the input of the number of rows and columns.
- blocks
The RDD of sub-matrix blocks ((blockRowIndex, blockColIndex), sub-matrix) that form this distributed matrix. If multiple blocks with the same index exist, the results for operations like add and multiply will be unpredictable.
- rowsPerBlock
Number of rows that make up each block. The blocks forming the final rows are not required to have the given number of rows
- colsPerBlock
Number of columns that make up each block. The blocks forming the final columns are not required to have the given number of columns
- Annotations
- @Since("1.3.0")
- new BlockMatrix(blocks: RDD[((Int, Int), Matrix)], rowsPerBlock: Int, colsPerBlock: Int, nRows: Long, nCols: Long)
- blocks
The RDD of sub-matrix blocks ((blockRowIndex, blockColIndex), sub-matrix) that form this distributed matrix. If multiple blocks with the same index exist, the results for operations like add and multiply will be unpredictable.
- rowsPerBlock
Number of rows that make up each block. The blocks forming the final rows are not required to have the given number of rows
- colsPerBlock
Number of columns that make up each block. The blocks forming the final columns are not required to have the given number of columns
- nRows
Number of rows of this matrix. If the supplied value is less than or equal to zero, the number of rows will be calculated when
numRows
is invoked.- nCols
Number of columns of this matrix. If the supplied value is less than or equal to zero, the number of columns will be calculated when
numCols
is invoked.
- Annotations
- @Since("1.3.0")
Type Members
- implicit class LogStringContext extends AnyRef
- Definition Classes
- Logging
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def add(other: BlockMatrix): BlockMatrix
Adds the given block matrix
other
tothis
block matrix:this + other
.Adds the given block matrix
other
tothis
block matrix:this + other
. The matrices must have the same size and matchingrowsPerBlock
andcolsPerBlock
values. If one of the blocks that are being added are instances ofSparseMatrix
, the resulting sub matrix will also be aSparseMatrix
, even if it is being added to aDenseMatrix
. If two dense matrices are added, the output will also be aDenseMatrix
.- Annotations
- @Since("1.3.0")
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- val blocks: RDD[((Int, Int), Matrix)]
- Annotations
- @Since("1.3.0")
- def cache(): BlockMatrix.this.type
Caches the underlying RDD.
Caches the underlying RDD.
- Annotations
- @Since("1.3.0")
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
- val colsPerBlock: Int
- Annotations
- @Since("1.3.0")
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def initializeLogIfNecessary(isInterpreter: Boolean, silent: Boolean): Boolean
- Attributes
- protected
- Definition Classes
- Logging
- def initializeLogIfNecessary(isInterpreter: Boolean): Unit
- Attributes
- protected
- Definition Classes
- Logging
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isTraceEnabled(): Boolean
- Attributes
- protected
- Definition Classes
- Logging
- def log: Logger
- Attributes
- protected
- Definition Classes
- Logging
- def logDebug(msg: => String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logDebug(entry: LogEntry, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logDebug(entry: LogEntry): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logDebug(msg: => String): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logError(msg: => String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logError(entry: LogEntry, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logError(entry: LogEntry): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logError(msg: => String): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logInfo(msg: => String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logInfo(entry: LogEntry, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logInfo(entry: LogEntry): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logInfo(msg: => String): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logName: String
- Attributes
- protected
- Definition Classes
- Logging
- def logTrace(msg: => String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logTrace(entry: LogEntry, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logTrace(entry: LogEntry): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logTrace(msg: => String): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logWarning(msg: => String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logWarning(entry: LogEntry, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logWarning(entry: LogEntry): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logWarning(msg: => String): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def multiply(other: BlockMatrix, numMidDimSplits: Int): BlockMatrix
Left multiplies this BlockMatrix to
other
, another BlockMatrix.Left multiplies this BlockMatrix to
other
, another BlockMatrix. ThecolsPerBlock
of this matrix must equal therowsPerBlock
ofother
. Ifother
containsSparseMatrix
, they will have to be converted to aDenseMatrix
. The output BlockMatrix will only consist of blocks ofDenseMatrix
. This may cause some performance issues until support for multiplying two sparse matrices is added. Blocks with duplicate indices will be added with each other.- other
Matrix
B
inA * B = C
- numMidDimSplits
Number of splits to cut on the middle dimension when doing multiplication. For example, when multiplying a Matrix
A
of sizem x n
with MatrixB
of sizen x k
, this parameter configures the parallelism to use when grouping the matrices. The parallelism will increase fromm x k
tom x k x numMidDimSplits
, which in some cases also reduces total shuffled data.
- Annotations
- @Since("2.2.0")
- def multiply(other: BlockMatrix): BlockMatrix
Left multiplies this BlockMatrix to
other
, another BlockMatrix.Left multiplies this BlockMatrix to
other
, another BlockMatrix. ThecolsPerBlock
of this matrix must equal therowsPerBlock
ofother
. Ifother
containsSparseMatrix
, they will have to be converted to aDenseMatrix
. The output BlockMatrix will only consist of blocks ofDenseMatrix
. This may cause some performance issues until support for multiplying two sparse matrices is added.- Annotations
- @Since("1.3.0")
- Note
The behavior of multiply has changed in 1.6.0.
multiply
used to throw an error when there were blocks with duplicate indices. Now, the blocks with duplicate indices will be added with each other.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- val numColBlocks: Int
- Annotations
- @Since("1.3.0")
- def numCols(): Long
Gets or computes the number of columns.
Gets or computes the number of columns.
- Definition Classes
- BlockMatrix → DistributedMatrix
- Annotations
- @Since("1.3.0")
- val numRowBlocks: Int
- Annotations
- @Since("1.3.0")
- def numRows(): Long
Gets or computes the number of rows.
Gets or computes the number of rows.
- Definition Classes
- BlockMatrix → DistributedMatrix
- Annotations
- @Since("1.3.0")
- def persist(storageLevel: StorageLevel): BlockMatrix.this.type
Persists the underlying RDD with the specified storage level.
Persists the underlying RDD with the specified storage level.
- Annotations
- @Since("1.3.0")
- val rowsPerBlock: Int
- Annotations
- @Since("1.3.0")
- def subtract(other: BlockMatrix): BlockMatrix
Subtracts the given block matrix
other
fromthis
block matrix:this - other
.Subtracts the given block matrix
other
fromthis
block matrix:this - other
. The matrices must have the same size and matchingrowsPerBlock
andcolsPerBlock
values. If one of the blocks that are being subtracted are instances ofSparseMatrix
, the resulting sub matrix will also be aSparseMatrix
, even if it is being subtracted from aDenseMatrix
. If two dense matrices are subtracted, the output will also be aDenseMatrix
.- Annotations
- @Since("2.0.0")
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toCoordinateMatrix(): CoordinateMatrix
Converts to CoordinateMatrix.
Converts to CoordinateMatrix.
- Annotations
- @Since("1.3.0")
- def toIndexedRowMatrix(): IndexedRowMatrix
Converts to IndexedRowMatrix.
Converts to IndexedRowMatrix. The number of columns must be within the integer range.
- Annotations
- @Since("1.3.0")
- def toLocalMatrix(): Matrix
Collect the distributed matrix on the driver as a
DenseMatrix
.Collect the distributed matrix on the driver as a
DenseMatrix
.- Annotations
- @Since("1.3.0")
- def toString(): String
- Definition Classes
- AnyRef → Any
- def transpose: BlockMatrix
Transpose this
BlockMatrix
.Transpose this
BlockMatrix
. Returns a newBlockMatrix
instance sharing the same underlying data. Is a lazy operation.- Annotations
- @Since("1.3.0")
- def validate(): Unit
Validates the block matrix info against the matrix data (
blocks
) and throws an exception if any error is found.Validates the block matrix info against the matrix data (
blocks
) and throws an exception if any error is found.- Annotations
- @Since("1.3.0")
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def withLogContext(context: HashMap[String, String])(body: => Unit): Unit
- Attributes
- protected
- Definition Classes
- Logging
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)