Class CompressedMatrixBlock
- java.lang.Object
-
- org.apache.sysds.runtime.matrix.data.MatrixValue
-
- org.apache.sysds.runtime.matrix.data.MatrixBlock
-
- org.apache.sysds.runtime.compress.CompressedMatrixBlock
-
- All Implemented Interfaces:
Externalizable
,Serializable
,Comparable
,org.apache.hadoop.io.Writable
,org.apache.hadoop.io.WritableComparable
,CacheBlock<MatrixBlock>
public class CompressedMatrixBlock extends MatrixBlock
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.sysds.runtime.matrix.data.MatrixValue
MatrixValue.CellIndex
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
debug
Debugging flag for Compressed Matrices-
Fields inherited from class org.apache.sysds.runtime.matrix.data.MatrixBlock
CONVERT_MCSR_TO_CSR_ON_DEEP_SERIALIZE, DEFAULT_INPLACE_SPARSEBLOCK, DEFAULT_SPARSEBLOCK, HEADER_SIZE, MAX_SHALLOW_SERIALIZE_OVERHEAD, SPARSITY_TURN_POINT, ULTRA_SPARSE_BLOCK_NNZ, ULTRA_SPARSITY_TURN_POINT, ULTRA_SPARSITY_TURN_POINT2
-
-
Constructor Summary
Constructors Constructor Description CompressedMatrixBlock()
CompressedMatrixBlock(int rl, int cl)
Main constructor for building a block from scratch.CompressedMatrixBlock(int rl, int cl, long nnz, boolean overlapping, List<AColGroup> groups)
Direct constructor with everything.CompressedMatrixBlock(CompressedMatrixBlock that)
Copy constructor taking that CompressedMatrixBlock and populate this new compressedMatrixBlock with pointers to the same columnGroups.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MatrixBlock
aggregateBinaryOperations(MatrixBlock m1, MatrixBlock m2, MatrixBlock ret, AggregateBinaryOperator op)
MatrixBlock
aggregateBinaryOperations(MatrixBlock m1, MatrixBlock m2, MatrixBlock ret, AggregateBinaryOperator op, boolean transposeLeft, boolean transposeRight)
MatrixBlock
aggregateUnaryOperations(AggregateUnaryOperator op, MatrixValue result, int blen, MatrixIndexes indexesIn, boolean inCP)
void
allocateAndResetSparseBlock(boolean clearNNZ, SparseBlock.Type stype)
Future<MatrixBlock>
allocateBlockAsync()
void
allocateColGroup(AColGroup cg)
Allocate the given column group and remove all references to old column groups.void
allocateColGroupList(List<AColGroup> colGroups)
Replace the column groups in this CompressedMatrixBlock with the given column groupsboolean
allocateDenseBlock(boolean clearNNZ)
boolean
allocateSparseRowsBlock(boolean clearNNZ)
MatrixBlock
append(MatrixBlock[] that, MatrixBlock ret, boolean cbind)
Append that list of matrixes to this matrix.void
append(MatrixValue v2, ArrayList<IndexedMatrixValue> outlist, int blen, boolean cbind, boolean m2IsLast, int nextNCol)
void
appendRow(int r, SparseRow row, boolean deep)
void
appendRowToSparse(SparseBlock dest, MatrixBlock src, int i, int rowoffset, int coloffset, boolean deep)
void
appendValue(int r, int c, double v)
Append value is only used when values are appended at the end of each row for the sparse representationvoid
appendValuePlain(int r, int c, double v)
static long
baseSizeInMemory()
MatrixBlock
binaryOperations(BinaryOperator op, MatrixValue thatValue, MatrixValue result)
MatrixBlock
binaryOperationsInPlace(BinaryOperator op, MatrixValue thatValue)
MatrixBlock
binaryOperationsLeft(BinaryOperator op, MatrixValue thatValue, MatrixValue result)
MatrixBlock
chainMatrixMultOperations(MatrixBlock v, MatrixBlock w, MatrixBlock out, MapMultChain.ChainType ctype, int k)
void
clearCounts()
void
clearSoftReferenceToDecompressed()
CM_COV_Object
cmOperations(CMOperator op)
CM_COV_Object
cmOperations(CMOperator op, MatrixBlock weights)
MatrixBlock
colSum()
Wrapper method for single threaded reduceall-colSum of a matrix.void
compactEmptyBlock()
Free unnecessarily allocated empty block.boolean
containsValue(double pattern)
boolean
containsValue(double pattern, int k)
void
copy(int rl, int ru, int cl, int cu, MatrixBlock src, boolean awareDestNZ)
In-place copy of matrix src into the index range of the existing current matrix.void
copy(MatrixValue thatValue)
Copy that MatrixValue into this MatrixValue.void
copy(MatrixValue thatValue, boolean sp)
Copy that MatrixValue into this MatrixValue.MatrixBlock
copyShallow(MatrixBlock that)
CM_COV_Object
covOperations(COVOperator op, MatrixBlock that)
CM_COV_Object
covOperations(COVOperator op, MatrixBlock that, MatrixBlock weights)
void
ctableOperations(Operator op, double scalar, double scalar2, CTableMap resultMap, MatrixBlock resultBlock)
D = ctable(A,v2,w) this <- A; scalar_that <- v2; scalar_that2 <- w; result <- D (i1,j1,v1) from input1 (this) (v2) from sclar_input2 (scalarThat) (w) from scalar_input3 (scalarThat2)void
ctableOperations(Operator op, double scalar, MatrixValue that, CTableMap resultMap, MatrixBlock resultBlock)
D = ctable(A,v2,W) this <- A; scalarThat <- v2; that2 <- W; result <- D (i1,j1,v1) from input1 (this) (v2) from sclar_input2 (scalarThat) (i3,j3,w) from input3 (that2)void
ctableOperations(Operator op, MatrixIndexes ix1, double scalar, boolean left, int brlen, CTableMap resultMap, MatrixBlock resultBlock)
Specific ctable case of ctable(seq(...),X), where X is the only matrix input.void
ctableOperations(Operator op, MatrixValue that, double scalar, boolean ignoreZeros, CTableMap resultMap, MatrixBlock resultBlock)
D = ctable(A,B,w) this <- A; that <- B; scalar_that2 <- w; result <- D (i1,j1,v1) from input1 (this) (i1,j1,v2) from input2 (that) (w) from scalar_input3 (scalarThat2) NOTE: This method supports both vectors and matrices.void
ctableOperations(Operator op, MatrixValue that, MatrixValue that2, CTableMap resultMap, MatrixBlock resultBlock)
MatrixBlock
ctableSeqOperations(MatrixValue thatMatrix, double thatScalar, MatrixBlock resultBlock, boolean updateClen)
MatrixBlock
decompress()
Decompress block into a MatrixBlockMatrixBlock
decompress(int k)
Decompress block into a MatrixBlockvoid
denseToSparse(boolean allowCSR, int k)
void
dropLastRowsOrColumns(Types.CorrectionLocationType correctionLocation)
long
estimateCompressedSizeInMemory()
Obtain an upper bound on the memory used to store the compressed block.long
estimateSizeInMemory()
long
estimateSizeOnDisk()
boolean
evalSparseFormatInMemory()
Evaluates if this matrix block should be in sparse format in memory.boolean
evalSparseFormatOnDisk()
Evaluates if this matrix block should be in sparse format on disk.void
examSparsity(boolean allowCSR, int k)
Evaluates if this matrix block should be in sparse format in memory.MatrixBlock
extractTriangular(MatrixBlock ret, boolean lower, boolean diag, boolean values)
double
get(int r, int c)
MatrixBlock
getCachedDecompressed()
Get the cached decompressed matrix (if it exists otherwise null).AColGroup
getColGroupForColumn(int id)
Get the column group allocated and associated with a specific column Id; There is some search involved in this since we do not know where to look for the column and which Column group contains the value.List<AColGroup>
getColGroups()
Get the column groups of this CompressedMatrixBlockDenseBlock
getDenseBlock()
double[]
getDenseBlockValues()
long
getExactSizeOnDisk()
NOTE: The used estimates must be kept consistent with the respective write functions.long
getInMemorySize()
Get the in-memory size in bytes of the cache block.SoftReference<MatrixBlock>
getSoftReferenceToDecompressed()
SparseBlock
getSparseBlock()
Iterator<IJV>
getSparseBlockIterator()
Iterator<IJV>
getSparseBlockIterator(int rl, int ru)
MatrixBlock
getUncompressed()
MatrixBlock
getUncompressed(String operation)
MatrixBlock
getUncompressed(String operation, int k)
static MatrixBlock
getUncompressed(MatrixValue mVal)
static MatrixBlock
getUncompressed(MatrixValue mVal, String message)
static MatrixBlock
getUncompressed(MatrixValue mVal, String message, int k)
MatrixBlock
groupedAggOperations(MatrixValue tgt, MatrixValue wghts, MatrixValue ret, int ngroups, Operator op, int k)
void
incrementalAggregate(AggregateOperator aggOp, MatrixValue newWithCorrection)
void
incrementalAggregate(AggregateOperator aggOp, MatrixValue correction, MatrixValue newWithCorrection, boolean deep)
void
init(double[][] arr, int r, int c)
NOTE: This method is designed only for dense representation.void
init(double[] arr, int r, int c)
NOTE: This method is designed only for dense representation.double
interQuartileMean()
boolean
isAllocated()
boolean
isEmptyBlock(boolean safe)
Get if this MatrixBlock is an empty block.boolean
isInSparseFormat()
Returns the current representation (true for sparse).boolean
isOverlapping()
boolean
isShallowSerialize(boolean inclConvert)
Indicates if the cache block is subject to shallow serialized, which is generally true if in-memory size and serialized size are almost identical allowing to avoid unnecessary deep serialize.boolean
isSparsePermutationMatrix()
boolean
isThreadSafe()
Indicates if concurrent modifications of disjoint rows are thread-safe.boolean
isUltraSparse()
boolean
isUltraSparse(boolean checkNnz)
MatrixBlock
leftIndexingOperations(ScalarObject scalar, int rl, int cl, MatrixBlock ret, MatrixObject.UpdateType update)
Explicitly allow left indexing for scalars.MatrixBlock
leftIndexingOperations(MatrixBlock rhsMatrix, int rl, int ru, int cl, int cu, MatrixBlock ret, MatrixObject.UpdateType update)
double
max()
Wrapper method for reduceall-max of a matrix.double
mean()
Wrapper method for reduceall-mean of a matrix.MatrixBlock
merge(MatrixBlock that, boolean appendOnly, boolean par, boolean deep)
double
min()
Wrapper method for reduceall-min of a matrix.double
minNonZero()
Utility function for computing the min non-zero value.void
permutationMatrixMultOperations(MatrixValue m2Val, MatrixValue out1Val, MatrixValue out2Val, int k)
double
pickValue(double quantile, boolean average)
MatrixBlock
pickValues(MatrixValue quantiles, MatrixValue ret)
double
prod()
Wrapper method for reduceall-product of a matrix.void
putInto(MatrixBlock target, int rowOffset, int colOffset, boolean sparseCopyShallow)
Method for copying this matrix into a target matrix.MatrixBlock
quaternaryOperations(QuaternaryOperator qop, MatrixBlock um, MatrixBlock vm, MatrixBlock wm, MatrixBlock out, int k)
MatrixBlock
randOperationsInPlace(RandomMatrixGenerator rgen, org.apache.commons.math3.random.Well1024a bigrand, long bSeed)
Function to generate a matrix of random numbers.MatrixBlock
randOperationsInPlace(RandomMatrixGenerator rgen, org.apache.commons.math3.random.Well1024a bigrand, long bSeed, int k)
Function to generate a matrix of random numbers.static CompressedMatrixBlock
read(DataInput in)
void
readExternal(ObjectInput is)
Redirects the default java serialization via externalizable to our default hadoop writable serialization for efficient broadcast/rdd de-serialization.void
readFields(DataInput in)
long
recomputeNonZeros()
Recomputes and materializes the number of non-zero values of the entire matrix block.long
recomputeNonZeros(int rl, int ru)
Recomputes the number of non-zero values of a specified range of the matrix block.long
recomputeNonZeros(int rl, int ru, int cl, int cu)
Recomputes the number of non-zero values of a specified range of the matrix block.MatrixBlock
removeEmptyOperations(MatrixBlock ret, boolean rows, boolean emptyReturn, MatrixBlock select)
MatrixBlock
reorgOperations(ReorgOperator op, MatrixValue ret, int startRow, int startColumn, int length)
MatrixBlock
replaceOperations(MatrixValue result, double pattern, double replacement)
void
reset(int rl, int cl, boolean sp, long estnnz, double val)
Internal canonical reset of dense and sparse matrix blocks.MatrixBlock
rexpandOperations(MatrixBlock ret, double max, boolean rows, boolean cast, boolean ignore, int k)
MatrixBlock
scalarOperations(ScalarOperator sop, MatrixValue result)
MatrixBlock
seqOperationsInPlace(double from, double to, double incr)
void
set(int r, int c, double v)
void
setDenseBlock(DenseBlock dblock)
void
setOverlapping(boolean overlapping)
void
setSparseBlock(SparseBlock sblock)
MatrixBlock
slice(int rl, int ru, int cl, int cu, boolean deep, MatrixBlock ret)
Slice a sub block out of the current block and write into the given output block.void
slice(ArrayList<IndexedMatrixValue> outlist, IndexRange range, int rowCut, int colCut, int blen, int boundaryRlen, int boundaryClen)
Slice out up to 4 matrixBlocks that are separated by the row and col Cuts.MatrixBlock
sortOperations(MatrixValue weights, MatrixBlock result)
void
sortSparseRows()
Sorts all existing sparse rows by column indexes.void
sortSparseRows(int rl, int ru)
Sorts all existing sparse rows in range [rl,ru) by column indexes.void
sparseToDense(int k)
CompressedMatrixBlock
squash(int k)
double
sum()
Wrapper method for reduceall-sum of a matrix.double
sumSq()
Wrapper method for reduceall-sumSq of a matrix.double
sumWeightForQuantile()
In a given two column matrix, the second column denotes weights.MatrixBlock
ternaryOperations(TernaryOperator op, MatrixBlock m2, MatrixBlock m3, MatrixBlock ret)
void
toShallowSerializeBlock()
Converts a cache block that is not shallow serializable into a form that is shallow serializable.String
toString()
MatrixBlock
transposeSelfMatrixMultOperations(MatrixBlock out, MMTSJ.MMTSJType tstype, int k)
MatrixBlock
uaggouterchainOperations(MatrixBlock mbLeft, MatrixBlock mbRight, MatrixBlock mbOut, BinaryOperator bOp, AggregateUnaryOperator uaggOp)
MatrixBlock
unaryOperations(UnaryOperator op, MatrixValue result)
void
write(DataOutput out)
void
writeExternal(ObjectOutput os)
Redirects the default java serialization via externalizable to our default hadoop writable serialization for efficient broadcast/rdd serialization.MatrixBlock
zeroOutOperations(MatrixValue result, IndexRange range)
-
Methods inherited from class org.apache.sysds.runtime.matrix.data.MatrixBlock
aggregateBinaryOperations, aggregateTernaryOperations, allocateBlock, allocateDenseBlock, allocateDenseBlock, allocateDenseBlockUnsafe, allocateSparseRowsBlock, append, append, append, append, append, appendRow, appendToSparse, binaryOperations, chainMatrixMultOperations, checkCMOperations, checkDimensionsForAppend, checkNonZeros, checkSparseRows, checkSparseRows, cleanupBlock, colMax, colMax, colMin, colMin, compareTo, computeIQMCorrection, containsVector, ctableOperations, ctableSeqOperations, denseToSparse, denseToSparse, equals, equals, estimateSizeDenseInMemory, estimateSizeDenseInMemory, estimateSizeInMemory, estimateSizeInMemory, estimateSizeInMemory, estimateSizeOnDisk, estimateSizeSparseInMemory, estimateSizeSparseInMemory, estimateSizeSparseInMemory, estimateSizeSparseInMemory, estimateSizeSparseInMemory, evalSparseFormatInMemory, evalSparseFormatInMemory, evalSparseFormatInMemory, evalSparseFormatInMemory, evalSparseFormatOnDisk, examSparsity, examSparsity, examSparsity, fill, getDataCharacteristics, getDouble, getDoubleNaN, getExactSerializedSize, getHeaderSize, getLength, getNonZeros, getNumColumns, getNumRows, getSparsity, getString, groupedAggOperations, hashCode, isEmpty, isEmptyBlock, isShallowSerialize, isThreadSafe, leftIndexingOperations, max, mean, median, merge, merge, min, naryOperations, permutationMatrixMultOperations, pickValue, quaternaryOperations, randOperations, randOperations, randOperations, randOperations, randOperations, rbind, recomputeNonZeros, removeEmptyOperations, reset, reset, reset, reset, reset, reset, reset, rowSum, rowSum, sampleOperations, seqOperations, setAllNonZeros, setNonZeros, setNumColumns, setNumRows, setRow, slice, slice, slice, slice, slice, slice, sortOperations, sortOperations, sortOperations, sparseToDense, sum, ternaryOperationCheck, transposeSelfMatrixMultOperations, unaryOperations
-
Methods inherited from class org.apache.sysds.runtime.matrix.data.MatrixValue
aggregateUnaryOperations
-
-
-
-
Constructor Detail
-
CompressedMatrixBlock
public CompressedMatrixBlock()
-
CompressedMatrixBlock
public CompressedMatrixBlock(int rl, int cl)
Main constructor for building a block from scratch. Use with caution, since it constructs an empty matrix block with nothing inside.- Parameters:
rl
- number of rows in the blockcl
- number of columns
-
CompressedMatrixBlock
public CompressedMatrixBlock(CompressedMatrixBlock that)
Copy constructor taking that CompressedMatrixBlock and populate this new compressedMatrixBlock with pointers to the same columnGroups.- Parameters:
that
- CompressedMatrixBlock to copy values from
-
CompressedMatrixBlock
public CompressedMatrixBlock(int rl, int cl, long nnz, boolean overlapping, List<AColGroup> groups)
Direct constructor with everything.- Parameters:
rl
- Number of rows in the blockcl
- Number of columnsnnz
- Number of non zerosoverlapping
- If the matrix is overlappinggroups
- The list of column groups
-
-
Method Detail
-
reset
public void reset(int rl, int cl, boolean sp, long estnnz, double val)
Description copied from class:MatrixBlock
Internal canonical reset of dense and sparse matrix blocks.- Overrides:
reset
in classMatrixBlock
- Parameters:
rl
- number of rowscl
- number of columnssp
- sparse representationestnnz
- estimated number of non-zerosval
- initialization value
-
allocateColGroup
public void allocateColGroup(AColGroup cg)
Allocate the given column group and remove all references to old column groups. This is done by simply allocating a ned _colGroups list and adding the given column group- Parameters:
cg
- The column group to use after.
-
allocateColGroupList
public void allocateColGroupList(List<AColGroup> colGroups)
Replace the column groups in this CompressedMatrixBlock with the given column groups- Parameters:
colGroups
- new ColGroups in the MatrixBlock
-
getColGroups
public List<AColGroup> getColGroups()
Get the column groups of this CompressedMatrixBlock- Returns:
- the column groups
-
decompress
public MatrixBlock decompress()
Decompress block into a MatrixBlock- Returns:
- a new uncompressed matrix block containing the contents of this block
-
getColGroupForColumn
public AColGroup getColGroupForColumn(int id)
Get the column group allocated and associated with a specific column Id; There is some search involved in this since we do not know where to look for the column and which Column group contains the value.- Parameters:
id
- The column id or number we try to find- Returns:
- The column group for that column
-
decompress
public MatrixBlock decompress(int k)
Decompress block into a MatrixBlock- Parameters:
k
- degree of parallelism- Returns:
- a new uncompressed matrix block containing the contents of this block
-
putInto
public void putInto(MatrixBlock target, int rowOffset, int colOffset, boolean sparseCopyShallow)
Description copied from class:MatrixBlock
Method for copying this matrix into a target matrix. Note that this method does not maintain number of non zero values. The method should output into the allocated block type of the target, therefore before any calls an appropriate block must be allocated. CSR sparse format is not supported. If allocating into a sparse matrix MCSR block the rows have to be sorted afterwards with a call to target.sortSparseRows()- Overrides:
putInto
in classMatrixBlock
- Parameters:
target
- Target MatrixBlock, that can be allocated dense or sparserowOffset
- The Row offset to allocate into.colOffset
- The column offset to allocate into.sparseCopyShallow
- If the output is sparse, and shallow copy of rows is allowed from this block
-
getCachedDecompressed
public MatrixBlock getCachedDecompressed()
Get the cached decompressed matrix (if it exists otherwise null). This in practice means that if some other instruction have materialized the decompressed version it can be accessed though this method with a guarantee that it did not go through the entire decompression phase.- Returns:
- The cached decompressed matrix, if it does not exist return null
-
squash
public CompressedMatrixBlock squash(int k)
-
recomputeNonZeros
public long recomputeNonZeros()
Description copied from class:MatrixBlock
Recomputes and materializes the number of non-zero values of the entire matrix block.- Overrides:
recomputeNonZeros
in classMatrixBlock
- Returns:
- number of non-zeros
-
recomputeNonZeros
public long recomputeNonZeros(int rl, int ru)
Description copied from class:MatrixBlock
Recomputes the number of non-zero values of a specified range of the matrix block. NOTE: This call does not materialize the compute result in any form.- Overrides:
recomputeNonZeros
in classMatrixBlock
- Parameters:
rl
- row lower index, 0-based, inclusiveru
- row upper index, 0-based, inclusive- Returns:
- the number of non-zero values
-
recomputeNonZeros
public long recomputeNonZeros(int rl, int ru, int cl, int cu)
Description copied from class:MatrixBlock
Recomputes the number of non-zero values of a specified range of the matrix block. NOTE: This call does not materialize the compute result in any form.- Overrides:
recomputeNonZeros
in classMatrixBlock
- Parameters:
rl
- row lower index, 0-based, inclusiveru
- row upper index, 0-based, inclusivecl
- column lower index, 0-based, inclusivecu
- column upper index, 0-based, inclusive- Returns:
- the number of non-zero values
-
getInMemorySize
public long getInMemorySize()
Description copied from interface:CacheBlock
Get the in-memory size in bytes of the cache block.- Specified by:
getInMemorySize
in interfaceCacheBlock<MatrixBlock>
- Overrides:
getInMemorySize
in classMatrixBlock
- Returns:
- in-memory size in bytes of cache block
-
estimateSizeInMemory
public long estimateSizeInMemory()
- Overrides:
estimateSizeInMemory
in classMatrixBlock
-
estimateCompressedSizeInMemory
public long estimateCompressedSizeInMemory()
Obtain an upper bound on the memory used to store the compressed block.- Returns:
- an upper bound on the memory used to store this compressed block considering class overhead.
-
baseSizeInMemory
public static long baseSizeInMemory()
-
get
public double get(int r, int c)
- Overrides:
get
in classMatrixBlock
-
getExactSizeOnDisk
public long getExactSizeOnDisk()
Description copied from class:MatrixBlock
NOTE: The used estimates must be kept consistent with the respective write functions.- Overrides:
getExactSizeOnDisk
in classMatrixBlock
- Returns:
- exact size on disk
-
estimateSizeOnDisk
public long estimateSizeOnDisk()
- Overrides:
estimateSizeOnDisk
in classMatrixBlock
-
readFields
public void readFields(DataInput in) throws IOException
- Specified by:
readFields
in interfaceorg.apache.hadoop.io.Writable
- Overrides:
readFields
in classMatrixBlock
- Throws:
IOException
-
read
public static CompressedMatrixBlock read(DataInput in) throws IOException
- Throws:
IOException
-
write
public void write(DataOutput out) throws IOException
- Specified by:
write
in interfaceorg.apache.hadoop.io.Writable
- Overrides:
write
in classMatrixBlock
- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput is) throws IOException
Redirects the default java serialization via externalizable to our default hadoop writable serialization for efficient broadcast/rdd de-serialization.- Specified by:
readExternal
in interfaceExternalizable
- Overrides:
readExternal
in classMatrixBlock
- Parameters:
is
- object input- Throws:
IOException
- if IOException occurs
-
writeExternal
public void writeExternal(ObjectOutput os) throws IOException
Redirects the default java serialization via externalizable to our default hadoop writable serialization for efficient broadcast/rdd serialization.- Specified by:
writeExternal
in interfaceExternalizable
- Overrides:
writeExternal
in classMatrixBlock
- Parameters:
os
- object output- Throws:
IOException
- if IOException occurs
-
scalarOperations
public MatrixBlock scalarOperations(ScalarOperator sop, MatrixValue result)
- Overrides:
scalarOperations
in classMatrixBlock
-
binaryOperations
public MatrixBlock binaryOperations(BinaryOperator op, MatrixValue thatValue, MatrixValue result)
- Overrides:
binaryOperations
in classMatrixBlock
-
binaryOperationsLeft
public MatrixBlock binaryOperationsLeft(BinaryOperator op, MatrixValue thatValue, MatrixValue result)
-
append
public MatrixBlock append(MatrixBlock[] that, MatrixBlock ret, boolean cbind)
Description copied from class:MatrixBlock
Append that list of matrixes to this matrix. cbind true makes the matrix "wider" while cbind false make it "taller"- Overrides:
append
in classMatrixBlock
- Parameters:
that
- a list of matrices to append in orderret
- the output matrix to modify, (is also returned)cbind
- if binding on columns or rows- Returns:
- the ret MatrixBlock object with the appended result
-
append
public void append(MatrixValue v2, ArrayList<IndexedMatrixValue> outlist, int blen, boolean cbind, boolean m2IsLast, int nextNCol)
- Overrides:
append
in classMatrixBlock
-
chainMatrixMultOperations
public MatrixBlock chainMatrixMultOperations(MatrixBlock v, MatrixBlock w, MatrixBlock out, MapMultChain.ChainType ctype, int k)
- Overrides:
chainMatrixMultOperations
in classMatrixBlock
-
aggregateBinaryOperations
public MatrixBlock aggregateBinaryOperations(MatrixBlock m1, MatrixBlock m2, MatrixBlock ret, AggregateBinaryOperator op)
- Overrides:
aggregateBinaryOperations
in classMatrixBlock
-
aggregateBinaryOperations
public MatrixBlock aggregateBinaryOperations(MatrixBlock m1, MatrixBlock m2, MatrixBlock ret, AggregateBinaryOperator op, boolean transposeLeft, boolean transposeRight)
-
aggregateUnaryOperations
public MatrixBlock aggregateUnaryOperations(AggregateUnaryOperator op, MatrixValue result, int blen, MatrixIndexes indexesIn, boolean inCP)
- Overrides:
aggregateUnaryOperations
in classMatrixBlock
-
transposeSelfMatrixMultOperations
public MatrixBlock transposeSelfMatrixMultOperations(MatrixBlock out, MMTSJ.MMTSJType tstype, int k)
- Overrides:
transposeSelfMatrixMultOperations
in classMatrixBlock
-
replaceOperations
public MatrixBlock replaceOperations(MatrixValue result, double pattern, double replacement)
- Overrides:
replaceOperations
in classMatrixBlock
-
reorgOperations
public MatrixBlock reorgOperations(ReorgOperator op, MatrixValue ret, int startRow, int startColumn, int length)
- Overrides:
reorgOperations
in classMatrixBlock
-
isOverlapping
public boolean isOverlapping()
-
setOverlapping
public void setOverlapping(boolean overlapping)
-
slice
public MatrixBlock slice(int rl, int ru, int cl, int cu, boolean deep, MatrixBlock ret)
Description copied from interface:CacheBlock
Slice a sub block out of the current block and write into the given output block. This method returns the passed instance if not null.- Specified by:
slice
in interfaceCacheBlock<MatrixBlock>
- Overrides:
slice
in classMatrixBlock
- Parameters:
rl
- row lowerru
- row upper inclusivecl
- column lowercu
- column upper inclusivedeep
- enforce deep-copyret
- cache block- Returns:
- sub-block of cache block
-
slice
public void slice(ArrayList<IndexedMatrixValue> outlist, IndexRange range, int rowCut, int colCut, int blen, int boundaryRlen, int boundaryClen)
Description copied from class:MatrixValue
Slice out up to 4 matrixBlocks that are separated by the row and col Cuts. This is used in the context of spark execution to distributed sliced out matrix blocks of correct block size.- Overrides:
slice
in classMatrixBlock
- Parameters:
outlist
- The output matrix blocks that is extracted from the matrixrange
- An index range containing overlapping information.rowCut
- The row to cut and split the matrix.colCut
- The column to cut ans split the matrix.blen
- The Block size of the output matrices.boundaryRlen
- The row length of the edge case matrix block, used for the final blocks that does not have enough rows to construct a full block.boundaryClen
- The col length of the edge case matrix block, used for the final blocks that does not have enough cols to construct a full block.
-
unaryOperations
public MatrixBlock unaryOperations(UnaryOperator op, MatrixValue result)
- Overrides:
unaryOperations
in classMatrixBlock
-
containsValue
public boolean containsValue(double pattern)
- Overrides:
containsValue
in classMatrixBlock
-
containsValue
public boolean containsValue(double pattern, int k)
- Overrides:
containsValue
in classMatrixBlock
-
max
public double max()
Description copied from class:MatrixBlock
Wrapper method for reduceall-max of a matrix.- Overrides:
max
in classMatrixBlock
- Returns:
- the maximum value of all values in the matrix
-
min
public double min()
Description copied from class:MatrixBlock
Wrapper method for reduceall-min of a matrix.- Overrides:
min
in classMatrixBlock
- Returns:
- the minimum value of all values in the matrix
-
sum
public double sum()
Description copied from class:MatrixBlock
Wrapper method for reduceall-sum of a matrix.- Overrides:
sum
in classMatrixBlock
- Returns:
- Sum of the values in the matrix.
-
colSum
public MatrixBlock colSum()
Description copied from class:MatrixBlock
Wrapper method for single threaded reduceall-colSum of a matrix.- Overrides:
colSum
in classMatrixBlock
- Returns:
- A new MatrixBlock containing the column sums of this matrix.
-
sumSq
public double sumSq()
Description copied from class:MatrixBlock
Wrapper method for reduceall-sumSq of a matrix.- Overrides:
sumSq
in classMatrixBlock
- Returns:
- Sum of the squared values in the matrix.
-
prod
public double prod()
Description copied from class:MatrixBlock
Wrapper method for reduceall-product of a matrix.- Overrides:
prod
in classMatrixBlock
- Returns:
- the product sum of the matrix content
-
mean
public double mean()
Description copied from class:MatrixBlock
Wrapper method for reduceall-mean of a matrix.- Overrides:
mean
in classMatrixBlock
- Returns:
- the mean value of all values in the matrix
-
rexpandOperations
public MatrixBlock rexpandOperations(MatrixBlock ret, double max, boolean rows, boolean cast, boolean ignore, int k)
- Overrides:
rexpandOperations
in classMatrixBlock
-
isEmptyBlock
public boolean isEmptyBlock(boolean safe)
Description copied from class:MatrixBlock
Get if this MatrixBlock is an empty block. The call can potentially tricker a recomputation of non zeros if the non-zero count is unknown.- Overrides:
isEmptyBlock
in classMatrixBlock
- Parameters:
safe
- True if we want to ensure the count non zeros if the nnz is unknown.- Returns:
- If the block is empty.
-
binaryOperationsInPlace
public MatrixBlock binaryOperationsInPlace(BinaryOperator op, MatrixValue thatValue)
- Overrides:
binaryOperationsInPlace
in classMatrixBlock
-
incrementalAggregate
public void incrementalAggregate(AggregateOperator aggOp, MatrixValue correction, MatrixValue newWithCorrection, boolean deep)
- Overrides:
incrementalAggregate
in classMatrixBlock
-
incrementalAggregate
public void incrementalAggregate(AggregateOperator aggOp, MatrixValue newWithCorrection)
- Overrides:
incrementalAggregate
in classMatrixBlock
-
permutationMatrixMultOperations
public void permutationMatrixMultOperations(MatrixValue m2Val, MatrixValue out1Val, MatrixValue out2Val, int k)
- Overrides:
permutationMatrixMultOperations
in classMatrixBlock
-
leftIndexingOperations
public MatrixBlock leftIndexingOperations(MatrixBlock rhsMatrix, int rl, int ru, int cl, int cu, MatrixBlock ret, MatrixObject.UpdateType update)
- Overrides:
leftIndexingOperations
in classMatrixBlock
-
leftIndexingOperations
public MatrixBlock leftIndexingOperations(ScalarObject scalar, int rl, int cl, MatrixBlock ret, MatrixObject.UpdateType update)
Description copied from class:MatrixBlock
Explicitly allow left indexing for scalars. Note: This operation is now 0-based. * Operations to be performed: 1) result=this; 2) result[row,column] = scalar.getDoubleValue();- Overrides:
leftIndexingOperations
in classMatrixBlock
- Parameters:
scalar
- scalar objectrl
- row lowercl
- column lowerret
- ?update
- ?- Returns:
- matrix block
-
zeroOutOperations
public MatrixBlock zeroOutOperations(MatrixValue result, IndexRange range)
- Overrides:
zeroOutOperations
in classMatrixBlock
-
cmOperations
public CM_COV_Object cmOperations(CMOperator op)
- Overrides:
cmOperations
in classMatrixBlock
-
cmOperations
public CM_COV_Object cmOperations(CMOperator op, MatrixBlock weights)
- Overrides:
cmOperations
in classMatrixBlock
-
covOperations
public CM_COV_Object covOperations(COVOperator op, MatrixBlock that)
- Overrides:
covOperations
in classMatrixBlock
-
covOperations
public CM_COV_Object covOperations(COVOperator op, MatrixBlock that, MatrixBlock weights)
- Overrides:
covOperations
in classMatrixBlock
-
sortOperations
public MatrixBlock sortOperations(MatrixValue weights, MatrixBlock result)
- Overrides:
sortOperations
in classMatrixBlock
-
uaggouterchainOperations
public MatrixBlock uaggouterchainOperations(MatrixBlock mbLeft, MatrixBlock mbRight, MatrixBlock mbOut, BinaryOperator bOp, AggregateUnaryOperator uaggOp)
- Overrides:
uaggouterchainOperations
in classMatrixBlock
-
groupedAggOperations
public MatrixBlock groupedAggOperations(MatrixValue tgt, MatrixValue wghts, MatrixValue ret, int ngroups, Operator op, int k)
- Overrides:
groupedAggOperations
in classMatrixBlock
-
removeEmptyOperations
public MatrixBlock removeEmptyOperations(MatrixBlock ret, boolean rows, boolean emptyReturn, MatrixBlock select)
- Overrides:
removeEmptyOperations
in classMatrixBlock
-
ctableOperations
public void ctableOperations(Operator op, double scalar, MatrixValue that, CTableMap resultMap, MatrixBlock resultBlock)
Description copied from class:MatrixBlock
D = ctable(A,v2,W) this <- A; scalarThat <- v2; that2 <- W; result <- D (i1,j1,v1) from input1 (this) (v2) from sclar_input2 (scalarThat) (i3,j3,w) from input3 (that2)- Overrides:
ctableOperations
in classMatrixBlock
-
ctableOperations
public void ctableOperations(Operator op, double scalar, double scalar2, CTableMap resultMap, MatrixBlock resultBlock)
Description copied from class:MatrixBlock
D = ctable(A,v2,w) this <- A; scalar_that <- v2; scalar_that2 <- w; result <- D (i1,j1,v1) from input1 (this) (v2) from sclar_input2 (scalarThat) (w) from scalar_input3 (scalarThat2)- Overrides:
ctableOperations
in classMatrixBlock
-
ctableOperations
public void ctableOperations(Operator op, MatrixIndexes ix1, double scalar, boolean left, int brlen, CTableMap resultMap, MatrixBlock resultBlock)
Description copied from class:MatrixBlock
Specific ctable case of ctable(seq(...),X), where X is the only matrix input. The 'left' input parameter specifies if the seq appeared on the left, otherwise it appeared on the right.- Overrides:
ctableOperations
in classMatrixBlock
-
ctableOperations
public void ctableOperations(Operator op, MatrixValue that, double scalar, boolean ignoreZeros, CTableMap resultMap, MatrixBlock resultBlock)
Description copied from class:MatrixBlock
D = ctable(A,B,w) this <- A; that <- B; scalar_that2 <- w; result <- D (i1,j1,v1) from input1 (this) (i1,j1,v2) from input2 (that) (w) from scalar_input3 (scalarThat2) NOTE: This method supports both vectors and matrices. In case of matrices and ignoreZeros=true we can also use a sparse-safe implementation- Overrides:
ctableOperations
in classMatrixBlock
-
ctableSeqOperations
public MatrixBlock ctableSeqOperations(MatrixValue thatMatrix, double thatScalar, MatrixBlock resultBlock, boolean updateClen)
- Overrides:
ctableSeqOperations
in classMatrixBlock
- Parameters:
thatMatrix
- matrix valuethatScalar
- scalar doubleresultBlock
- result matrix blockupdateClen
- when this matrix already has the desired number of columns updateClen can be set to false- Returns:
- result matrix block
-
ctableOperations
public void ctableOperations(Operator op, MatrixValue that, MatrixValue that2, CTableMap resultMap, MatrixBlock resultBlock)
- Overrides:
ctableOperations
in classMatrixBlock
-
ternaryOperations
public MatrixBlock ternaryOperations(TernaryOperator op, MatrixBlock m2, MatrixBlock m3, MatrixBlock ret)
- Overrides:
ternaryOperations
in classMatrixBlock
-
quaternaryOperations
public MatrixBlock quaternaryOperations(QuaternaryOperator qop, MatrixBlock um, MatrixBlock vm, MatrixBlock wm, MatrixBlock out, int k)
- Overrides:
quaternaryOperations
in classMatrixBlock
-
randOperationsInPlace
public MatrixBlock randOperationsInPlace(RandomMatrixGenerator rgen, org.apache.commons.math3.random.Well1024a bigrand, long bSeed)
Description copied from class:MatrixBlock
Function to generate a matrix of random numbers. This is invoked both from CP as well as from MR. In case of CP, it generates an entire matrix block-by-block. Abigrand
is passed so that block-level seeds are generated internally. In case of MR, it generates a single block for given block-level seedbSeed
. When pdf="uniform", cell values are drawn from uniform distribution in range[min,max]
. When pdf="normal", cell values are drawn from standard normal distribution N(0,1). The range of generated values will always be (-Inf,+Inf).- Overrides:
randOperationsInPlace
in classMatrixBlock
- Parameters:
rgen
- random matrix generatorbigrand
- ?bSeed
- seed value- Returns:
- matrix block
-
randOperationsInPlace
public MatrixBlock randOperationsInPlace(RandomMatrixGenerator rgen, org.apache.commons.math3.random.Well1024a bigrand, long bSeed, int k)
Description copied from class:MatrixBlock
Function to generate a matrix of random numbers. This is invoked both from CP as well as from MR. In case of CP, it generates an entire matrix block-by-block. Abigrand
is passed so that block-level seeds are generated internally. In case of MR, it generates a single block for given block-level seedbSeed
. When pdf="uniform", cell values are drawn from uniform distribution in range[min,max]
. When pdf="normal", cell values are drawn from standard normal distribution N(0,1). The range of generated values will always be (-Inf,+Inf).- Overrides:
randOperationsInPlace
in classMatrixBlock
- Parameters:
rgen
- random matrix generatorbigrand
- ?bSeed
- seed valuek
- ?- Returns:
- matrix block
-
seqOperationsInPlace
public MatrixBlock seqOperationsInPlace(double from, double to, double incr)
- Overrides:
seqOperationsInPlace
in classMatrixBlock
-
getUncompressed
public static MatrixBlock getUncompressed(MatrixValue mVal)
-
getUncompressed
public static MatrixBlock getUncompressed(MatrixValue mVal, String message)
-
getUncompressed
public static MatrixBlock getUncompressed(MatrixValue mVal, String message, int k)
-
getUncompressed
public MatrixBlock getUncompressed()
-
getUncompressed
public MatrixBlock getUncompressed(String operation)
-
getUncompressed
public MatrixBlock getUncompressed(String operation, int k)
-
isShallowSerialize
public boolean isShallowSerialize(boolean inclConvert)
Description copied from interface:CacheBlock
Indicates if the cache block is subject to shallow serialized, which is generally true if in-memory size and serialized size are almost identical allowing to avoid unnecessary deep serialize.- Specified by:
isShallowSerialize
in interfaceCacheBlock<MatrixBlock>
- Overrides:
isShallowSerialize
in classMatrixBlock
- Parameters:
inclConvert
- if true report blocks as shallow serialize that are currently not amenable but can be brought into an amenable form viatoShallowSerializeBlock
.- Returns:
- true if shallow serialized
-
toShallowSerializeBlock
public void toShallowSerializeBlock()
Description copied from interface:CacheBlock
Converts a cache block that is not shallow serializable into a form that is shallow serializable. This methods has no affect if the given cache block is not amenable.- Specified by:
toShallowSerializeBlock
in interfaceCacheBlock<MatrixBlock>
- Overrides:
toShallowSerializeBlock
in classMatrixBlock
-
copy
public void copy(MatrixValue thatValue)
Description copied from class:MatrixValue
Copy that MatrixValue into this MatrixValue. If the MatrixValue is a MatrixBlock evaluate the sparsity of the original matrix, and copy into either a sparse or a dense matrix.- Overrides:
copy
in classMatrixBlock
- Parameters:
thatValue
- object to copy the values into.
-
copy
public void copy(MatrixValue thatValue, boolean sp)
Description copied from class:MatrixValue
Copy that MatrixValue into this MatrixValue. But select sparse destination block depending on boolean parameter.- Overrides:
copy
in classMatrixBlock
- Parameters:
thatValue
- object to copy the values into.sp
- boolean specifying if output should be forced sparse or dense. (only applicable if the 'that' is a MatrixBlock)
-
copyShallow
public MatrixBlock copyShallow(MatrixBlock that)
- Overrides:
copyShallow
in classMatrixBlock
-
copy
public void copy(int rl, int ru, int cl, int cu, MatrixBlock src, boolean awareDestNZ)
Description copied from class:MatrixBlock
In-place copy of matrix src into the index range of the existing current matrix. Note that removal of existing nnz in the index range and nnz maintenance is only done if 'awareDestNZ=true',- Overrides:
copy
in classMatrixBlock
- Parameters:
rl
- row lower index, 0-basedru
- row upper index, 0-based, inclusivecl
- column lower index, 0-basedcu
- column upper index, 0-based, inclusivesrc
- matrix blockawareDestNZ
- true, forces (1) to remove existing non-zeros in the index range of the destination if not present in src and (2) to internally maintain nnz false, assume empty index range in destination and do not maintain nnz (the invoker is responsible to recompute nnz after all copies are done)
-
getSoftReferenceToDecompressed
public SoftReference<MatrixBlock> getSoftReferenceToDecompressed()
-
clearSoftReferenceToDecompressed
public void clearSoftReferenceToDecompressed()
-
clearCounts
public void clearCounts()
-
getDenseBlock
public DenseBlock getDenseBlock()
- Overrides:
getDenseBlock
in classMatrixBlock
-
setDenseBlock
public void setDenseBlock(DenseBlock dblock)
- Overrides:
setDenseBlock
in classMatrixBlock
-
getDenseBlockValues
public double[] getDenseBlockValues()
- Overrides:
getDenseBlockValues
in classMatrixBlock
-
getSparseBlock
public SparseBlock getSparseBlock()
- Overrides:
getSparseBlock
in classMatrixBlock
-
setSparseBlock
public void setSparseBlock(SparseBlock sblock)
- Overrides:
setSparseBlock
in classMatrixBlock
-
getSparseBlockIterator
public Iterator<IJV> getSparseBlockIterator()
- Overrides:
getSparseBlockIterator
in classMatrixBlock
-
getSparseBlockIterator
public Iterator<IJV> getSparseBlockIterator(int rl, int ru)
- Overrides:
getSparseBlockIterator
in classMatrixBlock
-
set
public void set(int r, int c, double v)
- Overrides:
set
in classMatrixBlock
-
appendValue
public void appendValue(int r, int c, double v)
Description copied from class:MatrixBlock
Append value is only used when values are appended at the end of each row for the sparse representation
This can only be called, when the caller knows the access pattern of the block- Overrides:
appendValue
in classMatrixBlock
- Parameters:
r
- rowc
- columnv
- value
-
appendValuePlain
public void appendValuePlain(int r, int c, double v)
- Overrides:
appendValuePlain
in classMatrixBlock
-
appendRow
public void appendRow(int r, SparseRow row, boolean deep)
- Overrides:
appendRow
in classMatrixBlock
-
appendRowToSparse
public void appendRowToSparse(SparseBlock dest, MatrixBlock src, int i, int rowoffset, int coloffset, boolean deep)
- Overrides:
appendRowToSparse
in classMatrixBlock
-
sortSparseRows
public void sortSparseRows()
Description copied from class:MatrixBlock
Sorts all existing sparse rows by column indexes.- Overrides:
sortSparseRows
in classMatrixBlock
-
sortSparseRows
public void sortSparseRows(int rl, int ru)
Description copied from class:MatrixBlock
Sorts all existing sparse rows in range [rl,ru) by column indexes.- Overrides:
sortSparseRows
in classMatrixBlock
- Parameters:
rl
- row lower bound, inclusiveru
- row upper bound, exclusive
-
minNonZero
public double minNonZero()
Description copied from class:MatrixBlock
Utility function for computing the min non-zero value.- Overrides:
minNonZero
in classMatrixBlock
- Returns:
- minimum non-zero value
-
isInSparseFormat
public boolean isInSparseFormat()
Description copied from class:MatrixBlock
Returns the current representation (true for sparse).- Overrides:
isInSparseFormat
in classMatrixBlock
- Returns:
- true if sparse
-
isUltraSparse
public boolean isUltraSparse()
- Overrides:
isUltraSparse
in classMatrixBlock
-
isUltraSparse
public boolean isUltraSparse(boolean checkNnz)
- Overrides:
isUltraSparse
in classMatrixBlock
-
isSparsePermutationMatrix
public boolean isSparsePermutationMatrix()
- Overrides:
isSparsePermutationMatrix
in classMatrixBlock
-
evalSparseFormatInMemory
public boolean evalSparseFormatInMemory()
Description copied from class:MatrixBlock
Evaluates if this matrix block should be in sparse format in memory. Note that this call does not change the representation - for this please call examSparsity.- Overrides:
evalSparseFormatInMemory
in classMatrixBlock
- Returns:
- true if matrix block should be in sparse format in memory
-
evalSparseFormatOnDisk
public boolean evalSparseFormatOnDisk()
Description copied from class:MatrixBlock
Evaluates if this matrix block should be in sparse format on disk. This applies to any serialized matrix representation, i.e., when writing to in-memory buffer pool pages or writing to local fs or hdfs.- Overrides:
evalSparseFormatOnDisk
in classMatrixBlock
- Returns:
- true if matrix block should be in sparse format on disk
-
examSparsity
public void examSparsity(boolean allowCSR, int k)
Description copied from class:MatrixBlock
Evaluates if this matrix block should be in sparse format in memory. Depending on the current representation, the state of the matrix block is changed to the right representation if necessary. Note that this consumes for the time of execution memory for both representations.- Overrides:
examSparsity
in classMatrixBlock
- Parameters:
allowCSR
- allow CSR format on dense to sparse conversionk
- parallelization degree
-
sparseToDense
public void sparseToDense(int k)
- Overrides:
sparseToDense
in classMatrixBlock
-
denseToSparse
public void denseToSparse(boolean allowCSR, int k)
- Overrides:
denseToSparse
in classMatrixBlock
-
merge
public MatrixBlock merge(MatrixBlock that, boolean appendOnly, boolean par, boolean deep)
- Overrides:
merge
in classMatrixBlock
-
compactEmptyBlock
public void compactEmptyBlock()
Description copied from interface:CacheBlock
Free unnecessarily allocated empty block.- Specified by:
compactEmptyBlock
in interfaceCacheBlock<MatrixBlock>
- Overrides:
compactEmptyBlock
in classMatrixBlock
-
dropLastRowsOrColumns
public void dropLastRowsOrColumns(Types.CorrectionLocationType correctionLocation)
- Overrides:
dropLastRowsOrColumns
in classMatrixBlock
-
interQuartileMean
public double interQuartileMean()
- Overrides:
interQuartileMean
in classMatrixBlock
-
pickValues
public MatrixBlock pickValues(MatrixValue quantiles, MatrixValue ret)
- Overrides:
pickValues
in classMatrixBlock
-
pickValue
public double pickValue(double quantile, boolean average)
- Overrides:
pickValue
in classMatrixBlock
-
sumWeightForQuantile
public double sumWeightForQuantile()
Description copied from class:MatrixBlock
In a given two column matrix, the second column denotes weights. This function computes the total weight- Overrides:
sumWeightForQuantile
in classMatrixBlock
- Returns:
- sum weight for quantile
-
extractTriangular
public MatrixBlock extractTriangular(MatrixBlock ret, boolean lower, boolean diag, boolean values)
- Overrides:
extractTriangular
in classMatrixBlock
-
isThreadSafe
public boolean isThreadSafe()
Description copied from class:MatrixBlock
Indicates if concurrent modifications of disjoint rows are thread-safe.- Overrides:
isThreadSafe
in classMatrixBlock
- Returns:
- true if thread-safe
-
init
public void init(double[][] arr, int r, int c)
Description copied from class:MatrixBlock
NOTE: This method is designed only for dense representation.- Overrides:
init
in classMatrixBlock
- Parameters:
arr
- 2d double array matrixr
- number of rowsc
- number of columns
-
init
public void init(double[] arr, int r, int c)
Description copied from class:MatrixBlock
NOTE: This method is designed only for dense representation.- Overrides:
init
in classMatrixBlock
- Parameters:
arr
- double array matrixr
- number of rowsc
- number of columns
-
isAllocated
public boolean isAllocated()
- Overrides:
isAllocated
in classMatrixBlock
-
allocateBlockAsync
public Future<MatrixBlock> allocateBlockAsync()
- Overrides:
allocateBlockAsync
in classMatrixBlock
-
allocateDenseBlock
public boolean allocateDenseBlock(boolean clearNNZ)
- Overrides:
allocateDenseBlock
in classMatrixBlock
-
allocateSparseRowsBlock
public boolean allocateSparseRowsBlock(boolean clearNNZ)
- Overrides:
allocateSparseRowsBlock
in classMatrixBlock
-
allocateAndResetSparseBlock
public void allocateAndResetSparseBlock(boolean clearNNZ, SparseBlock.Type stype)
- Overrides:
allocateAndResetSparseBlock
in classMatrixBlock
-
toString
public String toString()
- Overrides:
toString
in classMatrixBlock
-
-