public abstract class AbstractCompressedMatrixBlock extends MatrixBlock
MatrixBlock.SparsityEstimate
MatrixValue.CellIndex
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 and Description |
---|
AbstractCompressedMatrixBlock()
Constructor for building an empty Compressed Matrix block object.
|
AbstractCompressedMatrixBlock(int rl,
int cl,
boolean sparse)
Main constructor for building a block from scratch.
|
AbstractCompressedMatrixBlock(MatrixBlock that)
"Copy" constructor to populate this compressed block with the uncompressed contents of a conventional block.
|
Modifier and Type | Method and Description |
---|---|
MatrixBlock |
aggregateBinaryOperations(MatrixIndexes m1Index,
MatrixBlock m1Value,
MatrixIndexes m2Index,
MatrixBlock m2Value,
MatrixBlock result,
AggregateBinaryOperator op) |
MatrixBlock |
aggregateTernaryOperations(MatrixBlock m1,
MatrixBlock m2,
MatrixBlock m3,
MatrixBlock ret,
AggregateTernaryOperator op,
boolean inCP) |
MatrixBlock |
append(MatrixBlock that,
MatrixBlock ret,
boolean cbind) |
void |
append(MatrixValue v2,
ArrayList<IndexedMatrixValue> outlist,
int blen,
boolean cbind,
boolean m2IsLast,
int nextNCol) |
MatrixBlock |
binaryOperations(BinaryOperator op,
MatrixValue thatValue,
MatrixValue result) |
MatrixBlock |
binaryOperationsInPlace(BinaryOperator op,
MatrixValue thatValue) |
CM_COV_Object |
cmOperations(CMOperator op) |
CM_COV_Object |
cmOperations(CMOperator op,
MatrixBlock weights) |
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)
D = ctable(A,B,W)
this <- A; that <- B; that2 <- W; result <- D
(i1,j1,v1) from input1 (this)
(i1,j1,v2) from input2 (that)
(i1,j1,w) from input3 (that2)
|
void |
ctableOperations(Operator op,
MatrixValue that,
MatrixValue that2,
CTableMap resultMap,
MatrixBlock resultBlock) |
MatrixBlock |
ctableSeqOperations(MatrixValue that,
double scalar,
MatrixBlock resultBlock)
D = ctable(seq,A,w)
this <- seq; thatMatrix <- A; thatScalar <- w; result <- D
(i1,j1,v1) from input1 (this)
(i1,j1,v2) from input2 (that)
(w) from scalar_input3 (scalarThat2)
|
abstract MatrixBlock |
decompress() |
static long |
estimateOriginalSizeInMemory(int nrows,
int ncols,
double sparsity) |
MatrixBlock |
groupedAggOperations(MatrixValue tgt,
MatrixValue wghts,
MatrixValue ret,
int ngroups,
Operator op)
Invocation from CP instructions.
|
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) |
boolean |
isEmptyBlock(boolean safe) |
boolean |
isShallowSerialize()
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 |
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.
|
MatrixBlock |
leftIndexingOperations(MatrixBlock rhsMatrix,
int rl,
int ru,
int cl,
int cu,
MatrixBlock ret,
MatrixObject.UpdateType update) |
MatrixBlock |
leftIndexingOperations(ScalarObject scalar,
int rl,
int cl,
MatrixBlock ret,
MatrixObject.UpdateType update)
Explicitly allow left indexing for scalars.
|
void |
permutationMatrixMultOperations(MatrixValue m2Val,
MatrixValue out1Val,
MatrixValue out2Val) |
void |
permutationMatrixMultOperations(MatrixValue m2Val,
MatrixValue out1Val,
MatrixValue out2Val,
int k) |
MatrixBlock |
quaternaryOperations(QuaternaryOperator qop,
MatrixBlock um,
MatrixBlock vm,
MatrixBlock wm,
MatrixBlock out) |
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.
|
MatrixBlock |
removeEmptyOperations(MatrixBlock ret,
boolean rows,
boolean emptyReturn) |
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) |
MatrixBlock |
rexpandOperations(MatrixBlock ret,
double max,
boolean rows,
boolean cast,
boolean ignore,
int k) |
MatrixBlock |
seqOperationsInPlace(double from,
double to,
double incr) |
void |
slice(ArrayList<IndexedMatrixValue> outlist,
IndexRange range,
int rowCut,
int colCut,
int blen,
int boundaryRlen,
int boundaryClen) |
MatrixBlock |
slice(int rl,
int ru,
int cl,
int cu,
boolean deep,
CacheBlock ret)
Method to perform rightIndex operation for a given lower and upper bounds in row and column dimensions.
|
MatrixBlock |
sortOperations(MatrixValue weights,
MatrixBlock result) |
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.
|
MatrixBlock |
uaggouterchainOperations(MatrixBlock mbLeft,
MatrixBlock mbRight,
MatrixBlock mbOut,
BinaryOperator bOp,
AggregateUnaryOperator uaggOp) |
MatrixBlock |
unaryOperations(UnaryOperator op,
MatrixValue result) |
MatrixBlock |
zeroOutOperations(MatrixValue result,
IndexRange range,
boolean complementary) |
aggregateBinaryOperations, aggregateUnaryOperations, aggregateUnaryOperations, allocateAndResetSparseBlock, allocateBlock, allocateBlockAsync, allocateDenseBlock, allocateDenseBlock, allocateDenseBlockUnsafe, allocateSparseRowsBlock, allocateSparseRowsBlock, append, append, appendRow, appendRow, appendRowToSparse, appendToSparse, appendToSparse, appendValue, chainMatrixMultOperations, chainMatrixMultOperations, checkNaN, checkNonZeros, checkSparseRows, checkSparseRows, cleanupBlock, compactEmptyBlock, compareTo, computeIQMCorrection, containsValue, copy, copy, copy, copyShallow, dropLastRowsOrColumns, equals, estimateSizeDenseInMemory, estimateSizeInMemory, estimateSizeInMemory, estimateSizeOnDisk, estimateSizeOnDisk, estimateSizeSparseInMemory, estimateSizeSparseInMemory, estimateSparsityOnAggBinary, evalSparseFormatInMemory, evalSparseFormatInMemory, evalSparseFormatInMemory, evalSparseFormatOnDisk, evalSparseFormatOnDisk, examSparsity, examSparsity, extractTriangular, getDataCharacteristics, getDenseBlock, getDenseBlockValues, getExactSerializedSize, getExactSizeOnDisk, getInMemorySize, getLength, getNonZeros, getNumColumns, getNumRows, getSparseBlock, getSparseBlockIterator, getSparseBlockIterator, getSparsity, getValue, getValueDenseUnsafe, hashCode, init, init, interQuartileMean, isAllocated, isEmpty, isEmptyBlock, isInSparseFormat, isSparsePermutationMatrix, isThreadSafe, isThreadSafe, isUltraSparse, isUltraSparse, isVector, leftIndexingOperations, max, mean, median, merge, merge, merge, merge, min, minNonZero, naryOperations, pickValue, pickValue, pickValues, prod, quickGetValue, quickSetValue, randOperations, randOperations, randOperations, randOperations, readExternal, readFields, recomputeNonZeros, recomputeNonZeros, recomputeNonZeros, reset, reset, reset, reset, reset, reset, sampleOperations, scalarOperations, seqOperations, setNonZeros, setNumColumns, setNumRows, setSparseBlock, setValue, slice, slice, slice, sortSparseRows, sortSparseRows, sparseToDense, sum, sumSq, sumWeightForQuantile, toString, transposeSelfMatrixMultOperations, transposeSelfMatrixMultOperations, write, writeExternal
public AbstractCompressedMatrixBlock()
public AbstractCompressedMatrixBlock(int rl, int cl, boolean sparse)
rl
- number of rows in the blockcl
- number of columnssparse
- true if the UNCOMPRESSED representation of the block should be sparsepublic AbstractCompressedMatrixBlock(MatrixBlock that)
that
- matrix blockpublic abstract MatrixBlock decompress()
public boolean isEmptyBlock(boolean safe)
isEmptyBlock
in class MatrixBlock
public static long estimateOriginalSizeInMemory(int nrows, int ncols, double sparsity)
public MatrixBlock unaryOperations(UnaryOperator op, MatrixValue result)
unaryOperations
in class MatrixBlock
public MatrixBlock binaryOperations(BinaryOperator op, MatrixValue thatValue, MatrixValue result)
binaryOperations
in class MatrixBlock
public MatrixBlock binaryOperationsInPlace(BinaryOperator op, MatrixValue thatValue)
binaryOperationsInPlace
in class MatrixBlock
public void incrementalAggregate(AggregateOperator aggOp, MatrixValue correction, MatrixValue newWithCorrection, boolean deep)
incrementalAggregate
in class MatrixBlock
public void incrementalAggregate(AggregateOperator aggOp, MatrixValue newWithCorrection)
incrementalAggregate
in class MatrixBlock
public MatrixBlock reorgOperations(ReorgOperator op, MatrixValue ret, int startRow, int startColumn, int length)
reorgOperations
in class MatrixBlock
public MatrixBlock append(MatrixBlock that, MatrixBlock ret, boolean cbind)
append
in class MatrixBlock
public void append(MatrixValue v2, ArrayList<IndexedMatrixValue> outlist, int blen, boolean cbind, boolean m2IsLast, int nextNCol)
append
in class MatrixBlock
public void permutationMatrixMultOperations(MatrixValue m2Val, MatrixValue out1Val, MatrixValue out2Val)
permutationMatrixMultOperations
in class MatrixBlock
public void permutationMatrixMultOperations(MatrixValue m2Val, MatrixValue out1Val, MatrixValue out2Val, int k)
permutationMatrixMultOperations
in class MatrixBlock
public MatrixBlock leftIndexingOperations(MatrixBlock rhsMatrix, int rl, int ru, int cl, int cu, MatrixBlock ret, MatrixObject.UpdateType update)
leftIndexingOperations
in class MatrixBlock
public MatrixBlock leftIndexingOperations(ScalarObject scalar, int rl, int cl, MatrixBlock ret, MatrixObject.UpdateType update)
MatrixBlock
leftIndexingOperations
in class MatrixBlock
scalar
- scalar objectrl
- row lowercl
- column lowerret
- ?update
- ?public MatrixBlock slice(int rl, int ru, int cl, int cu, boolean deep, CacheBlock ret)
MatrixBlock
slice
in class MatrixBlock
rl
- row lowerru
- row uppercl
- column lowercu
- column upperdeep
- should perform deep copyret
- output matrix blockpublic void slice(ArrayList<IndexedMatrixValue> outlist, IndexRange range, int rowCut, int colCut, int blen, int boundaryRlen, int boundaryClen)
slice
in class MatrixBlock
public MatrixBlock zeroOutOperations(MatrixValue result, IndexRange range, boolean complementary)
zeroOutOperations
in class MatrixBlock
public CM_COV_Object cmOperations(CMOperator op)
cmOperations
in class MatrixBlock
public CM_COV_Object cmOperations(CMOperator op, MatrixBlock weights)
cmOperations
in class MatrixBlock
public CM_COV_Object covOperations(COVOperator op, MatrixBlock that)
covOperations
in class MatrixBlock
public CM_COV_Object covOperations(COVOperator op, MatrixBlock that, MatrixBlock weights)
covOperations
in class MatrixBlock
public MatrixBlock sortOperations(MatrixValue weights, MatrixBlock result)
sortOperations
in class MatrixBlock
public MatrixBlock aggregateBinaryOperations(MatrixIndexes m1Index, MatrixBlock m1Value, MatrixIndexes m2Index, MatrixBlock m2Value, MatrixBlock result, AggregateBinaryOperator op)
aggregateBinaryOperations
in class MatrixBlock
public MatrixBlock aggregateTernaryOperations(MatrixBlock m1, MatrixBlock m2, MatrixBlock m3, MatrixBlock ret, AggregateTernaryOperator op, boolean inCP)
aggregateTernaryOperations
in class MatrixBlock
public MatrixBlock uaggouterchainOperations(MatrixBlock mbLeft, MatrixBlock mbRight, MatrixBlock mbOut, BinaryOperator bOp, AggregateUnaryOperator uaggOp)
uaggouterchainOperations
in class MatrixBlock
public MatrixBlock groupedAggOperations(MatrixValue tgt, MatrixValue wghts, MatrixValue ret, int ngroups, Operator op)
MatrixBlock
groupedAggOperations
in class MatrixBlock
tgt
- ?wghts
- ?ret
- ?ngroups
- ?op
- operatorpublic MatrixBlock groupedAggOperations(MatrixValue tgt, MatrixValue wghts, MatrixValue ret, int ngroups, Operator op, int k)
groupedAggOperations
in class MatrixBlock
public MatrixBlock removeEmptyOperations(MatrixBlock ret, boolean rows, boolean emptyReturn, MatrixBlock select)
removeEmptyOperations
in class MatrixBlock
public MatrixBlock removeEmptyOperations(MatrixBlock ret, boolean rows, boolean emptyReturn)
removeEmptyOperations
in class MatrixBlock
public MatrixBlock rexpandOperations(MatrixBlock ret, double max, boolean rows, boolean cast, boolean ignore, int k)
rexpandOperations
in class MatrixBlock
public MatrixBlock replaceOperations(MatrixValue result, double pattern, double replacement)
replaceOperations
in class MatrixBlock
public void ctableOperations(Operator op, double scalar, MatrixValue that, CTableMap resultMap, MatrixBlock resultBlock)
MatrixBlock
ctableOperations
in class MatrixBlock
public void ctableOperations(Operator op, double scalar, double scalar2, CTableMap resultMap, MatrixBlock resultBlock)
MatrixBlock
ctableOperations
in class MatrixBlock
public void ctableOperations(Operator op, MatrixIndexes ix1, double scalar, boolean left, int brlen, CTableMap resultMap, MatrixBlock resultBlock)
MatrixBlock
ctableOperations
in class MatrixBlock
public void ctableOperations(Operator op, MatrixValue that, double scalar, boolean ignoreZeros, CTableMap resultMap, MatrixBlock resultBlock)
MatrixBlock
ctableOperations
in class MatrixBlock
public MatrixBlock ctableSeqOperations(MatrixValue that, double scalar, MatrixBlock resultBlock)
MatrixBlock
ctableSeqOperations
in class MatrixBlock
that
- matrix valuescalar
- scalar doubleresultBlock
- result matrix blockpublic void ctableOperations(Operator op, MatrixValue that, MatrixValue that2, CTableMap resultMap)
MatrixBlock
ctableOperations
in class MatrixBlock
op
- operatorthat
- matrix value 1that2
- matrix value 2resultMap
- table mappublic void ctableOperations(Operator op, MatrixValue that, MatrixValue that2, CTableMap resultMap, MatrixBlock resultBlock)
ctableOperations
in class MatrixBlock
public MatrixBlock ternaryOperations(TernaryOperator op, MatrixBlock m2, MatrixBlock m3, MatrixBlock ret)
ternaryOperations
in class MatrixBlock
public MatrixBlock quaternaryOperations(QuaternaryOperator qop, MatrixBlock um, MatrixBlock vm, MatrixBlock wm, MatrixBlock out)
quaternaryOperations
in class MatrixBlock
public MatrixBlock quaternaryOperations(QuaternaryOperator qop, MatrixBlock um, MatrixBlock vm, MatrixBlock wm, MatrixBlock out, int k)
quaternaryOperations
in class MatrixBlock
public MatrixBlock randOperationsInPlace(RandomMatrixGenerator rgen, org.apache.commons.math3.random.Well1024a bigrand, long bSeed)
MatrixBlock
bigrand
is passed so that block-level
seeds are generated internally. In case of MR, it generates a single
block for given block-level seed bSeed
.
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).randOperationsInPlace
in class MatrixBlock
rgen
- random matrix generatorbigrand
- ?bSeed
- seed valuepublic MatrixBlock randOperationsInPlace(RandomMatrixGenerator rgen, org.apache.commons.math3.random.Well1024a bigrand, long bSeed, int k)
MatrixBlock
bigrand
is passed so that block-level
seeds are generated internally. In case of MR, it generates a single
block for given block-level seed bSeed
.
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).randOperationsInPlace
in class MatrixBlock
rgen
- random matrix generatorbigrand
- ?bSeed
- seed valuek
- ?public MatrixBlock seqOperationsInPlace(double from, double to, double incr)
seqOperationsInPlace
in class MatrixBlock
public boolean isShallowSerialize()
CacheBlock
isShallowSerialize
in interface CacheBlock
isShallowSerialize
in class MatrixBlock
public boolean isShallowSerialize(boolean inclConvert)
CacheBlock
isShallowSerialize
in interface CacheBlock
isShallowSerialize
in class MatrixBlock
inclConvert
- if true report blocks as shallow serialize that are
currently not amenable but can be brought into an amenable form
via toShallowSerializeBlock
.public void toShallowSerializeBlock()
CacheBlock
toShallowSerializeBlock
in interface CacheBlock
toShallowSerializeBlock
in class MatrixBlock
Copyright © 2020 The Apache Software Foundation. All rights reserved.