public class MatrixBlock extends MatrixValue implements org.apache.sysml.runtime.controlprogram.caching.CacheBlock, Externalizable
Modifier and Type | Class and Description |
---|---|
static class |
MatrixBlock.BlockType |
static class |
MatrixBlock.SparsityEstimate |
MatrixValue.CellIndex
Modifier and Type | Field and Description |
---|---|
protected int |
clen |
static boolean |
CONVERT_MCSR_TO_CSR_ON_DEEP_SERIALIZE |
static SparseBlock.Type |
DEFAULT_INPLACE_SPARSEBLOCK |
static SparseBlock.Type |
DEFAULT_SPARSEBLOCK |
protected double[] |
denseBlock |
protected boolean |
diag |
protected int |
estimatedNNzsPerRow |
static int |
HEADER_SIZE |
static double |
MAX_SHALLOW_SERIALIZE_OVERHEAD |
protected long |
nonZeros |
protected int |
numGroups |
protected int |
rlen |
protected boolean |
sparse |
protected SparseBlock |
sparseBlock |
static double |
SPARSITY_TURN_POINT |
static double |
ULTRA_SPARSITY_TURN_POINT |
Constructor and Description |
---|
MatrixBlock() |
MatrixBlock(int rl,
int cl,
boolean sp) |
MatrixBlock(int rl,
int cl,
boolean sp,
long estnnz) |
MatrixBlock(int rl,
int cl,
long estnnz) |
MatrixBlock(int rl,
int cl,
long nnz,
SparseBlock sblock)
Constructs a sparse
MatrixBlock with a given instance of a SparseBlock |
MatrixBlock(MatrixBlock that) |
MatrixBlock(MatrixBlock that,
SparseBlock.Type stype,
boolean deep) |
Modifier and Type | Method and Description |
---|---|
MatrixValue |
aggregateBinaryOperations(MatrixIndexes m1Index,
MatrixValue m1Value,
MatrixIndexes m2Index,
MatrixValue m2Value,
MatrixValue result,
org.apache.sysml.runtime.matrix.operators.AggregateBinaryOperator op) |
MatrixValue |
aggregateBinaryOperations(MatrixValue m1Value,
MatrixValue m2Value,
MatrixValue result,
org.apache.sysml.runtime.matrix.operators.AggregateBinaryOperator op) |
MatrixBlock |
aggregateTernaryOperations(MatrixBlock m1,
MatrixBlock m2,
MatrixBlock m3,
MatrixBlock ret,
org.apache.sysml.runtime.matrix.operators.AggregateTernaryOperator op,
boolean inCP) |
MatrixValue |
aggregateUnaryOperations(org.apache.sysml.runtime.matrix.operators.AggregateUnaryOperator op,
MatrixValue result,
int blockingFactorRow,
int blockingFactorCol,
MatrixIndexes indexesIn) |
MatrixValue |
aggregateUnaryOperations(org.apache.sysml.runtime.matrix.operators.AggregateUnaryOperator op,
MatrixValue result,
int blockingFactorRow,
int blockingFactorCol,
MatrixIndexes indexesIn,
boolean inCP) |
void |
allocateAndResetSparseRowsBlock(boolean clearNNZ,
SparseBlock.Type stype) |
MatrixBlock |
allocateBlock() |
MatrixBlock |
allocateDenseBlock() |
void |
allocateDenseBlock(boolean clearNNZ) |
void |
allocateDenseBlockUnsafe(int rl,
int cl)
This should be called only in the read and write functions for CP
This function should be called before calling any setValueDenseUnsafe()
|
void |
allocateSparseRowsBlock() |
void |
allocateSparseRowsBlock(boolean clearNNZ) |
MatrixBlock |
appendOperations(MatrixBlock[] that,
MatrixBlock ret,
boolean cbind) |
MatrixBlock |
appendOperations(MatrixBlock that,
MatrixBlock ret) |
MatrixBlock |
appendOperations(MatrixBlock that,
MatrixBlock ret,
boolean cbind) |
void |
appendOperations(MatrixValue v2,
ArrayList<org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue> outlist,
int blockRowFactor,
int blockColFactor,
boolean cbind,
boolean m2IsLast,
int nextNCol) |
void |
appendRow(int r,
SparseRow row) |
void |
appendRow(int r,
SparseRow row,
boolean deep) |
void |
appendToSparse(MatrixBlock that,
int rowoffset,
int coloffset) |
void |
appendToSparse(MatrixBlock that,
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 representation
This can only be called, when the caller knows the access pattern of the block
|
MatrixValue |
binaryOperations(org.apache.sysml.runtime.matrix.operators.BinaryOperator op,
MatrixValue thatValue,
MatrixValue result) |
void |
binaryOperationsInPlace(org.apache.sysml.runtime.matrix.operators.BinaryOperator op,
MatrixValue thatValue) |
MatrixBlock |
chainMatrixMultOperations(MatrixBlock v,
MatrixBlock w,
MatrixBlock out,
org.apache.sysml.lops.MapMultChain.ChainType ctype) |
MatrixBlock |
chainMatrixMultOperations(MatrixBlock v,
MatrixBlock w,
MatrixBlock out,
org.apache.sysml.lops.MapMultChain.ChainType ctype,
int k) |
void |
checkNonZeros()
Basic debugging primitive to check correctness of nnz.
|
void |
checkSparseRows()
Basic debugging primitive to check sparse block column ordering.
|
void |
cleanupBlock(boolean dense,
boolean sparse)
Allows to cleanup all previously allocated sparserows or denseblocks.
|
org.apache.sysml.runtime.instructions.cp.CM_COV_Object |
cmOperations(org.apache.sysml.runtime.matrix.operators.CMOperator op) |
org.apache.sysml.runtime.instructions.cp.CM_COV_Object |
cmOperations(org.apache.sysml.runtime.matrix.operators.CMOperator op,
MatrixBlock weights) |
void |
compactEmptyBlock()
Free unnecessarily allocated empty block.
|
int |
compareTo(Object arg0) |
static double |
computeIQMCorrection(double sum,
double sum_wt,
double q25Part,
double q25Val,
double q75Part,
double q75Val) |
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) |
void |
copy(MatrixValue thatValue,
boolean sp) |
MatrixBlock |
copyShallow(MatrixBlock that) |
org.apache.sysml.runtime.instructions.cp.CM_COV_Object |
covOperations(org.apache.sysml.runtime.matrix.operators.COVOperator op,
MatrixBlock that) |
org.apache.sysml.runtime.instructions.cp.CM_COV_Object |
covOperations(org.apache.sysml.runtime.matrix.operators.COVOperator op,
MatrixBlock that,
MatrixBlock weights) |
void |
dropLastRowsOrColumns(org.apache.sysml.lops.PartialAggregate.CorrectionLocationType correctionLocation) |
boolean |
equals(Object arg0) |
static long |
estimateSizeDenseInMemory(long nrows,
long ncols) |
long |
estimateSizeInMemory() |
static long |
estimateSizeInMemory(long nrows,
long ncols,
double sparsity) |
long |
estimateSizeOnDisk() |
static long |
estimateSizeOnDisk(long nrows,
long ncols,
long nnz) |
static long |
estimateSizeSparseInMemory(long nrows,
long ncols,
double sparsity) |
static long |
estimateSizeSparseInMemory(long nrows,
long ncols,
double sparsity,
SparseBlock.Type stype) |
static MatrixBlock.SparsityEstimate |
estimateSparsityOnAggBinary(MatrixBlock m1,
MatrixBlock m2,
org.apache.sysml.runtime.matrix.operators.AggregateBinaryOperator op) |
boolean |
evalSparseFormatInMemory()
Evaluates if this matrix block should be in sparse format in
memory.
|
static boolean |
evalSparseFormatInMemory(long nrows,
long ncols,
long nnz)
Evaluates if a matrix block with the given characteristics should be in sparse format
in memory.
|
boolean |
evalSparseFormatOnDisk()
Evaluates if this matrix block should be in sparse format on
disk.
|
static boolean |
evalSparseFormatOnDisk(long nrows,
long ncols,
long nnz)
Evaluates if a matrix block with the given characteristics should be in sparse format
on disk (or in any other serialized representation).
|
void |
examSparsity() |
void |
examSparsity(String opcode)
Evaluates if this matrix block should be in sparse format in
memory.
|
double[] |
getDenseBlock() |
long |
getExactSerializedSize()
Get the exact serialized size in bytes of the cache block.
|
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.
|
long |
getNonZeros() |
int |
getNumColumns() |
int |
getNumRows() |
SparseBlock |
getSparseBlock() |
Iterator<IJV> |
getSparseBlockIterator() |
Iterator<IJV> |
getSparseBlockIterator(int rl,
int ru) |
double |
getSparsity() |
double |
getValue(int r,
int c) |
double |
getValueDenseUnsafe(int r,
int c) |
double |
getValueSparseUnsafe(int r,
int c) |
MatrixBlock |
groupedAggOperations(MatrixValue tgt,
MatrixValue wghts,
MatrixValue ret,
int ngroups,
org.apache.sysml.runtime.matrix.operators.Operator op)
Invocation from CP instructions.
|
MatrixBlock |
groupedAggOperations(MatrixValue tgt,
MatrixValue wghts,
MatrixValue ret,
int ngroups,
org.apache.sysml.runtime.matrix.operators.Operator op,
int k) |
int |
hashCode() |
void |
incrementalAggregate(org.apache.sysml.runtime.matrix.operators.AggregateOperator aggOp,
MatrixValue newWithCorrection) |
void |
incrementalAggregate(org.apache.sysml.runtime.matrix.operators.AggregateOperator aggOp,
MatrixValue correction,
MatrixValue newWithCorrection) |
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 |
isDiag() |
boolean |
isEmpty() |
boolean |
isEmptyBlock() |
boolean |
isEmptyBlock(boolean safe) |
boolean |
isInSparseFormat()
Returns the current representation (true for sparse).
|
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.
|
boolean |
isThreadSafe()
Indicates if concurrent modifications of disjoint rows are thread-safe.
|
static boolean |
isThreadSafe(boolean sparse)
Indicates if concurrent modifications of disjoint rows are thread-safe.
|
boolean |
isUltraSparse() |
boolean |
isUltraSparse(boolean checkNnz) |
boolean |
isUltraSparsePermutationMatrix() |
boolean |
isVector() |
MatrixBlock |
leftIndexingOperations(MatrixBlock rhsMatrix,
org.apache.sysml.runtime.util.IndexRange ixrange,
MatrixBlock ret,
org.apache.sysml.runtime.controlprogram.caching.MatrixObject.UpdateType update) |
MatrixBlock |
leftIndexingOperations(MatrixBlock rhsMatrix,
org.apache.sysml.runtime.util.IndexRange ixrange,
MatrixBlock ret,
org.apache.sysml.runtime.controlprogram.caching.MatrixObject.UpdateType update,
String opcode) |
MatrixBlock |
leftIndexingOperations(MatrixBlock rhsMatrix,
int rl,
int ru,
int cl,
int cu,
MatrixBlock ret,
org.apache.sysml.runtime.controlprogram.caching.MatrixObject.UpdateType update) |
MatrixBlock |
leftIndexingOperations(MatrixBlock rhsMatrix,
int rl,
int ru,
int cl,
int cu,
MatrixBlock ret,
org.apache.sysml.runtime.controlprogram.caching.MatrixObject.UpdateType update,
String opcode) |
MatrixBlock |
leftIndexingOperations(org.apache.sysml.runtime.instructions.cp.ScalarObject scalar,
int rl,
int cl,
MatrixBlock ret,
org.apache.sysml.runtime.controlprogram.caching.MatrixObject.UpdateType update)
Explicitly allow left indexing for scalars.
|
double |
max()
Wrapper method for reduceall-max of a matrix.
|
double |
median() |
void |
merge(org.apache.sysml.runtime.controlprogram.caching.CacheBlock that,
boolean appendOnly)
Merge the given block into the current block.
|
void |
merge(MatrixBlock that,
boolean appendOnly)
Merge disjoint: merges all non-zero values of the given input into the current
matrix block.
|
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) |
void |
permutationMatrixMultOperations(MatrixValue m2Val,
MatrixValue out1Val,
MatrixValue out2Val,
int k) |
double |
pickValue(double quantile) |
double |
pickValue(double quantile,
boolean average) |
MatrixValue |
pickValues(MatrixValue quantiles,
MatrixValue ret) |
void |
print() |
MatrixValue |
quaternaryOperations(org.apache.sysml.runtime.matrix.operators.QuaternaryOperator qop,
MatrixValue um,
MatrixValue vm,
MatrixValue wm,
MatrixValue out) |
MatrixValue |
quaternaryOperations(org.apache.sysml.runtime.matrix.operators.QuaternaryOperator qop,
MatrixValue um,
MatrixValue vm,
MatrixValue wm,
MatrixValue out,
int k) |
double |
quickGetValue(int r,
int c) |
void |
quickSetValue(int r,
int c,
double v) |
static MatrixBlock |
randOperations(int rows,
int cols,
double sparsity,
double min,
double max,
String pdf,
long seed)
Function to generate the random matrix with specified dimensions (block sizes are not specified).
|
static MatrixBlock |
randOperations(int rows,
int cols,
double sparsity,
double min,
double max,
String pdf,
long seed,
int k)
Function to generate the random matrix with specified dimensions (block sizes are not specified).
|
static MatrixBlock |
randOperations(RandomMatrixGenerator rgen,
long seed)
Function to generate the random matrix with specified dimensions and block dimensions.
|
static MatrixBlock |
randOperations(RandomMatrixGenerator rgen,
long seed,
int k)
Function to generate the random matrix with specified dimensions and block dimensions.
|
MatrixBlock |
randOperationsInPlace(RandomMatrixGenerator rgen,
LongStream nnzInBlock,
org.apache.commons.math3.random.Well1024a bigrand,
long bSeed)
Function to generate a matrix of random numbers.
|
MatrixBlock |
randOperationsInPlace(RandomMatrixGenerator rgen,
LongStream nnzInBlock,
org.apache.commons.math3.random.Well1024a bigrand,
long bSeed,
int k)
Function to generate a matrix of random numbers.
|
void |
readExternal(ObjectInput is)
Redirects the default java serialization via externalizable to our default
hadoop writable serialization for efficient broadcast/rdd deserialization.
|
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) |
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.
|
long |
recomputeNonZeros(String opcode) |
MatrixBlock |
removeEmptyOperations(MatrixBlock ret,
boolean rows) |
MatrixBlock |
removeEmptyOperations(MatrixBlock ret,
boolean rows,
MatrixBlock select) |
MatrixValue |
reorgOperations(org.apache.sysml.runtime.matrix.operators.ReorgOperator op,
MatrixValue ret,
int startRow,
int startColumn,
int length) |
MatrixValue |
replaceOperations(MatrixValue result,
double pattern,
double replacement) |
void |
reset() |
void |
reset(int rl,
int cl) |
void |
reset(int rl,
int cl,
boolean sp) |
void |
reset(int rl,
int cl,
boolean sp,
long estnnz) |
void |
reset(int rl,
int cl,
double val) |
void |
reset(int rl,
int cl,
long estnnz) |
MatrixBlock |
rexpandOperations(MatrixBlock ret,
double max,
boolean rows,
boolean cast,
boolean ignore,
int k) |
static MatrixBlock |
sampleOperations(long range,
int size,
boolean replace,
long seed) |
MatrixValue |
scalarOperations(org.apache.sysml.runtime.matrix.operators.ScalarOperator op,
MatrixValue result) |
static MatrixBlock |
seqOperations(double from,
double to,
double incr)
Method to generate a sequence according to the given parameters.
|
MatrixBlock |
seqOperationsInPlace(double from,
double to,
double incr) |
void |
setDiag() |
long |
setNonZeros(long nnz) |
void |
setNumColumns(int c) |
void |
setNumRows(int r)
NOTE: setNumRows() and setNumColumns() are used only in ternaryInstruction (for contingency tables)
and pmm for meta corrections.
|
void |
setValue(int r,
int c,
double v) |
void |
setValueDenseUnsafe(int r,
int c,
double v)
This can be only called when you know you have properly allocated spaces for a dense representation
and r and c are in the the range of the dimension
Note: this function won't keep track of the nozeros
|
void |
sliceOperations(ArrayList<org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue> outlist,
org.apache.sysml.runtime.util.IndexRange range,
int rowCut,
int colCut,
int normalBlockRowFactor,
int normalBlockColFactor,
int boundaryRlen,
int boundaryClen) |
MatrixBlock |
sliceOperations(org.apache.sysml.runtime.util.IndexRange ixrange,
MatrixBlock ret) |
MatrixBlock |
sliceOperations(int rl,
int ru,
int cl,
int cu,
boolean deep,
org.apache.sysml.runtime.controlprogram.caching.CacheBlock ret)
Method to perform rightIndex operation for a given lower and upper bounds in row and column dimensions.
|
MatrixBlock |
sliceOperations(int rl,
int ru,
int cl,
int cu,
org.apache.sysml.runtime.controlprogram.caching.CacheBlock ret)
Slice a sub block out of the current block and write into the given output block.
|
MatrixValue |
sortOperations(MatrixValue weights,
MatrixValue 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() |
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.
|
void |
ternaryOperations(org.apache.sysml.runtime.matrix.operators.Operator op,
double scalarThat,
double scalarThat2,
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 |
ternaryOperations(org.apache.sysml.runtime.matrix.operators.Operator op,
double scalarThat,
MatrixValue that2Val,
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 |
ternaryOperations(org.apache.sysml.runtime.matrix.operators.Operator op,
MatrixIndexes ix1,
double scalarThat,
boolean left,
int brlen,
CTableMap resultMap,
MatrixBlock resultBlock)
Specific ctable case of ctable(seq(...),X), where X is the only
matrix input.
|
void |
ternaryOperations(org.apache.sysml.runtime.matrix.operators.Operator op,
MatrixValue thatVal,
double scalarThat2,
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 |
ternaryOperations(org.apache.sysml.runtime.matrix.operators.Operator op,
MatrixValue thatMatrix,
double thatScalar,
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)
|
void |
ternaryOperations(org.apache.sysml.runtime.matrix.operators.Operator op,
MatrixValue thatVal,
MatrixValue that2Val,
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 |
ternaryOperations(org.apache.sysml.runtime.matrix.operators.Operator op,
MatrixValue thatVal,
MatrixValue that2Val,
CTableMap resultMap,
MatrixBlock resultBlock) |
void |
toShallowSerializeBlock()
Converts a cache block that is not shallow serializable into
a form that is shallow serializable.
|
String |
toString() |
MatrixBlock |
transposeSelfMatrixMultOperations(MatrixBlock out,
org.apache.sysml.lops.MMTSJ.MMTSJType tstype) |
MatrixBlock |
transposeSelfMatrixMultOperations(MatrixBlock out,
org.apache.sysml.lops.MMTSJ.MMTSJType tstype,
int k) |
MatrixBlock |
uaggouterchainOperations(MatrixBlock mbLeft,
MatrixBlock mbRight,
MatrixBlock mbOut,
org.apache.sysml.runtime.matrix.operators.BinaryOperator bOp,
org.apache.sysml.runtime.matrix.operators.AggregateUnaryOperator uaggOp) |
MatrixValue |
unaryOperations(org.apache.sysml.runtime.matrix.operators.UnaryOperator op,
MatrixValue result) |
void |
unaryOperationsInPlace(org.apache.sysml.runtime.matrix.operators.UnaryOperator op) |
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.
|
MatrixValue |
zeroOutOperations(MatrixValue result,
org.apache.sysml.runtime.util.IndexRange range,
boolean complementary) |
public static final double SPARSITY_TURN_POINT
public static final double ULTRA_SPARSITY_TURN_POINT
public static final SparseBlock.Type DEFAULT_SPARSEBLOCK
public static final SparseBlock.Type DEFAULT_INPLACE_SPARSEBLOCK
public static final double MAX_SHALLOW_SERIALIZE_OVERHEAD
public static final boolean CONVERT_MCSR_TO_CSR_ON_DEEP_SERIALIZE
public static final int HEADER_SIZE
protected int rlen
protected int clen
protected boolean sparse
protected long nonZeros
protected double[] denseBlock
protected SparseBlock sparseBlock
protected int estimatedNNzsPerRow
protected int numGroups
protected boolean diag
public MatrixBlock()
public MatrixBlock(int rl, int cl, boolean sp)
public MatrixBlock(int rl, int cl, long estnnz)
public MatrixBlock(int rl, int cl, boolean sp, long estnnz)
public MatrixBlock(MatrixBlock that)
public MatrixBlock(int rl, int cl, long nnz, SparseBlock sblock)
MatrixBlock
with a given instance of a SparseBlock
rl
- number of rowscl
- number of columnsnnz
- number of non zeroessblock
- sparse blockpublic MatrixBlock(MatrixBlock that, SparseBlock.Type stype, boolean deep)
public void reset()
reset
in class MatrixValue
public void reset(int rl, int cl)
reset
in class MatrixValue
public void reset(int rl, int cl, long estnnz)
public void reset(int rl, int cl, boolean sp)
reset
in class MatrixValue
public void reset(int rl, int cl, boolean sp, long estnnz)
reset
in class MatrixValue
public void reset(int rl, int cl, double val)
reset
in class MatrixValue
public void init(double[][] arr, int r, int c) throws DMLRuntimeException
arr
- 2d double array matrixr
- number of rowsc
- number of columnsDMLRuntimeException
- if DMLRuntimeException occurspublic void init(double[] arr, int r, int c) throws DMLRuntimeException
arr
- double array matrixr
- number of rowsc
- number of columnsDMLRuntimeException
- if DMLRuntimeException occurspublic boolean isAllocated()
public MatrixBlock allocateDenseBlock()
public MatrixBlock allocateBlock()
public void allocateDenseBlock(boolean clearNNZ)
public void allocateSparseRowsBlock()
public void allocateSparseRowsBlock(boolean clearNNZ)
public void allocateAndResetSparseRowsBlock(boolean clearNNZ, SparseBlock.Type stype)
public void allocateDenseBlockUnsafe(int rl, int cl) throws DMLRuntimeException
rl
- number of rowscl
- number of columnsDMLRuntimeException
- if DMLRuntimeException occurspublic void cleanupBlock(boolean dense, boolean sparse)
dense
- if true, set dense block to nullsparse
- if true, set sparse block to nullpublic int getNumRows()
getNumRows
in interface org.apache.sysml.runtime.controlprogram.caching.CacheBlock
getNumRows
in class MatrixValue
public void setNumRows(int r)
r
- number of rowspublic int getNumColumns()
getNumColumns
in interface org.apache.sysml.runtime.controlprogram.caching.CacheBlock
getNumColumns
in class MatrixValue
public void setNumColumns(int c)
public long getNonZeros()
getNonZeros
in class MatrixValue
public long setNonZeros(long nnz)
public double getSparsity()
public boolean isVector()
public boolean isEmpty()
isEmpty
in class MatrixValue
public boolean isEmptyBlock()
public boolean isEmptyBlock(boolean safe)
public void setDiag()
public boolean isDiag()
public double[] getDenseBlock()
public SparseBlock getSparseBlock()
public double getValue(int r, int c)
getValue
in class MatrixValue
public void setValue(int r, int c, double v)
setValue
in class MatrixValue
public double quickGetValue(int r, int c)
public void quickSetValue(int r, int c, double v)
public double getValueDenseUnsafe(int r, int c)
public void setValueDenseUnsafe(int r, int c, double v)
r
- rowc
- columnv
- valuepublic double getValueSparseUnsafe(int r, int c)
public void appendValue(int r, int c, double v)
r
- rowc
- columnv
- valuepublic void appendRow(int r, SparseRow row)
public void appendRow(int r, SparseRow row, boolean deep)
public void appendToSparse(MatrixBlock that, int rowoffset, int coloffset)
public void appendToSparse(MatrixBlock that, int rowoffset, int coloffset, boolean deep)
public void sortSparseRows()
public void sortSparseRows(int rl, int ru)
rl
- row lower bound, inclusiveru
- row upper bound, exclusivepublic double minNonZero() throws DMLRuntimeException
DMLRuntimeException
- if DMLRuntimeException occurspublic double min() throws DMLRuntimeException
DMLRuntimeException
- if DMLRuntimeException occurspublic double max() throws DMLRuntimeException
DMLRuntimeException
- if DMLRuntimeException occurspublic double sum() throws DMLRuntimeException
DMLRuntimeException
- if DMLRuntimeException occurspublic double sumSq() throws DMLRuntimeException
DMLRuntimeException
- if DMLRuntimeException occurspublic boolean isInSparseFormat()
isInSparseFormat
in class MatrixValue
public boolean isUltraSparse()
public boolean isUltraSparse(boolean checkNnz)
public boolean isUltraSparsePermutationMatrix()
public boolean evalSparseFormatInMemory()
public boolean evalSparseFormatOnDisk()
public void examSparsity() throws DMLRuntimeException
DMLRuntimeException
public void examSparsity(String opcode) throws DMLRuntimeException
opcode
- extended opcodeDMLRuntimeException
- if DMLRuntimeException occurspublic static boolean evalSparseFormatInMemory(long nrows, long ncols, long nnz)
nrows
- number of rowsncols
- number of columnsnnz
- number of non-zerospublic static boolean evalSparseFormatOnDisk(long nrows, long ncols, long nnz)
nrows
- number of rowsncols
- number of columnsnnz
- number of non-zerospublic void sparseToDense() throws DMLRuntimeException
DMLRuntimeException
public long recomputeNonZeros()
public long recomputeNonZeros(String opcode)
public long recomputeNonZeros(int rl, int ru)
public long recomputeNonZeros(int rl, int ru, int cl, int cu)
rl
- row lower index, 0-based, inclusiveru
- row upper index, 0-based, inclusivecl
- column lower index, 0-based, inclusivecu
- column upper index, 0-based, inclusivepublic void checkNonZeros()
public void checkSparseRows()
public void copy(MatrixValue thatValue)
copy
in class MatrixValue
public void copy(MatrixValue thatValue, boolean sp)
copy
in class MatrixValue
public MatrixBlock copyShallow(MatrixBlock that)
public void copy(int rl, int ru, int cl, int cu, MatrixBlock src, boolean awareDestNZ) throws DMLRuntimeException
rl
- row lower index, 0-basedru
- row upper index, 0-basedcl
- column lower index, 0-basedcu
- column upper index, 0-basedsrc
- 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)DMLRuntimeException
- if DMLRuntimeException occurspublic void merge(org.apache.sysml.runtime.controlprogram.caching.CacheBlock that, boolean appendOnly) throws DMLRuntimeException
org.apache.sysml.runtime.controlprogram.caching.CacheBlock
merge
in interface org.apache.sysml.runtime.controlprogram.caching.CacheBlock
that
- cache blockappendOnly
- ?DMLRuntimeException
- if DMLRuntimeException occurspublic void merge(MatrixBlock that, boolean appendOnly) throws DMLRuntimeException
that
- matrix blockappendOnly
- ?DMLRuntimeException
- if DMLRuntimeException occurspublic void readFields(DataInput in) throws IOException
readFields
in interface org.apache.hadoop.io.Writable
IOException
public void write(DataOutput out) throws IOException
write
in interface org.apache.hadoop.io.Writable
IOException
public void readExternal(ObjectInput is) throws IOException
readExternal
in interface Externalizable
is
- object inputIOException
- if IOException occurspublic void writeExternal(ObjectOutput os) throws IOException
writeExternal
in interface Externalizable
os
- object outputIOException
- if IOException occurspublic long getExactSizeOnDisk()
public long estimateSizeInMemory()
public static long estimateSizeInMemory(long nrows, long ncols, double sparsity)
public static long estimateSizeDenseInMemory(long nrows, long ncols)
public static long estimateSizeSparseInMemory(long nrows, long ncols, double sparsity)
public static long estimateSizeSparseInMemory(long nrows, long ncols, double sparsity, SparseBlock.Type stype)
public long estimateSizeOnDisk()
public static long estimateSizeOnDisk(long nrows, long ncols, long nnz)
public static MatrixBlock.SparsityEstimate estimateSparsityOnAggBinary(MatrixBlock m1, MatrixBlock m2, org.apache.sysml.runtime.matrix.operators.AggregateBinaryOperator op)
public long getInMemorySize()
org.apache.sysml.runtime.controlprogram.caching.CacheBlock
getInMemorySize
in interface org.apache.sysml.runtime.controlprogram.caching.CacheBlock
public long getExactSerializedSize()
org.apache.sysml.runtime.controlprogram.caching.CacheBlock
getExactSerializedSize
in interface org.apache.sysml.runtime.controlprogram.caching.CacheBlock
public boolean isShallowSerialize()
org.apache.sysml.runtime.controlprogram.caching.CacheBlock
isShallowSerialize
in interface org.apache.sysml.runtime.controlprogram.caching.CacheBlock
public boolean isShallowSerialize(boolean inclConvert)
org.apache.sysml.runtime.controlprogram.caching.CacheBlock
isShallowSerialize
in interface org.apache.sysml.runtime.controlprogram.caching.CacheBlock
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()
org.apache.sysml.runtime.controlprogram.caching.CacheBlock
toShallowSerializeBlock
in interface org.apache.sysml.runtime.controlprogram.caching.CacheBlock
public void compactEmptyBlock()
org.apache.sysml.runtime.controlprogram.caching.CacheBlock
compactEmptyBlock
in interface org.apache.sysml.runtime.controlprogram.caching.CacheBlock
public MatrixValue scalarOperations(org.apache.sysml.runtime.matrix.operators.ScalarOperator op, MatrixValue result) throws DMLRuntimeException
scalarOperations
in class MatrixValue
DMLRuntimeException
public MatrixValue unaryOperations(org.apache.sysml.runtime.matrix.operators.UnaryOperator op, MatrixValue result) throws DMLRuntimeException
unaryOperations
in class MatrixValue
DMLRuntimeException
public void unaryOperationsInPlace(org.apache.sysml.runtime.matrix.operators.UnaryOperator op) throws DMLRuntimeException
unaryOperationsInPlace
in class MatrixValue
DMLRuntimeException
public MatrixValue binaryOperations(org.apache.sysml.runtime.matrix.operators.BinaryOperator op, MatrixValue thatValue, MatrixValue result) throws DMLRuntimeException
binaryOperations
in class MatrixValue
DMLRuntimeException
public void binaryOperationsInPlace(org.apache.sysml.runtime.matrix.operators.BinaryOperator op, MatrixValue thatValue) throws DMLRuntimeException
binaryOperationsInPlace
in class MatrixValue
DMLRuntimeException
public void incrementalAggregate(org.apache.sysml.runtime.matrix.operators.AggregateOperator aggOp, MatrixValue correction, MatrixValue newWithCorrection) throws DMLRuntimeException
incrementalAggregate
in class MatrixValue
DMLRuntimeException
public void incrementalAggregate(org.apache.sysml.runtime.matrix.operators.AggregateOperator aggOp, MatrixValue newWithCorrection) throws DMLRuntimeException
incrementalAggregate
in class MatrixValue
DMLRuntimeException
public MatrixValue reorgOperations(org.apache.sysml.runtime.matrix.operators.ReorgOperator op, MatrixValue ret, int startRow, int startColumn, int length) throws DMLRuntimeException
reorgOperations
in class MatrixValue
DMLRuntimeException
public MatrixBlock appendOperations(MatrixBlock that, MatrixBlock ret) throws DMLRuntimeException
DMLRuntimeException
public MatrixBlock appendOperations(MatrixBlock that, MatrixBlock ret, boolean cbind) throws DMLRuntimeException
DMLRuntimeException
public MatrixBlock appendOperations(MatrixBlock[] that, MatrixBlock ret, boolean cbind) throws DMLRuntimeException
DMLRuntimeException
public MatrixBlock transposeSelfMatrixMultOperations(MatrixBlock out, org.apache.sysml.lops.MMTSJ.MMTSJType tstype) throws DMLRuntimeException
DMLRuntimeException
public MatrixBlock transposeSelfMatrixMultOperations(MatrixBlock out, org.apache.sysml.lops.MMTSJ.MMTSJType tstype, int k) throws DMLRuntimeException
DMLRuntimeException
public MatrixBlock chainMatrixMultOperations(MatrixBlock v, MatrixBlock w, MatrixBlock out, org.apache.sysml.lops.MapMultChain.ChainType ctype) throws DMLRuntimeException
DMLRuntimeException
public MatrixBlock chainMatrixMultOperations(MatrixBlock v, MatrixBlock w, MatrixBlock out, org.apache.sysml.lops.MapMultChain.ChainType ctype, int k) throws DMLRuntimeException
DMLRuntimeException
public void permutationMatrixMultOperations(MatrixValue m2Val, MatrixValue out1Val, MatrixValue out2Val) throws DMLRuntimeException
DMLRuntimeException
public void permutationMatrixMultOperations(MatrixValue m2Val, MatrixValue out1Val, MatrixValue out2Val, int k) throws DMLRuntimeException
DMLRuntimeException
public final MatrixBlock leftIndexingOperations(MatrixBlock rhsMatrix, org.apache.sysml.runtime.util.IndexRange ixrange, MatrixBlock ret, org.apache.sysml.runtime.controlprogram.caching.MatrixObject.UpdateType update) throws DMLRuntimeException
DMLRuntimeException
public final MatrixBlock leftIndexingOperations(MatrixBlock rhsMatrix, org.apache.sysml.runtime.util.IndexRange ixrange, MatrixBlock ret, org.apache.sysml.runtime.controlprogram.caching.MatrixObject.UpdateType update, String opcode) throws DMLRuntimeException
DMLRuntimeException
public MatrixBlock leftIndexingOperations(MatrixBlock rhsMatrix, int rl, int ru, int cl, int cu, MatrixBlock ret, org.apache.sysml.runtime.controlprogram.caching.MatrixObject.UpdateType update) throws DMLRuntimeException
DMLRuntimeException
public MatrixBlock leftIndexingOperations(MatrixBlock rhsMatrix, int rl, int ru, int cl, int cu, MatrixBlock ret, org.apache.sysml.runtime.controlprogram.caching.MatrixObject.UpdateType update, String opcode) throws DMLRuntimeException
DMLRuntimeException
public MatrixBlock leftIndexingOperations(org.apache.sysml.runtime.instructions.cp.ScalarObject scalar, int rl, int cl, MatrixBlock ret, org.apache.sysml.runtime.controlprogram.caching.MatrixObject.UpdateType update) throws DMLRuntimeException
scalar
- scalar objectrl
- row lowercl
- column lowerret
- ?update
- ?DMLRuntimeException
- if DMLRuntimeException occurspublic MatrixBlock sliceOperations(org.apache.sysml.runtime.util.IndexRange ixrange, MatrixBlock ret) throws DMLRuntimeException
DMLRuntimeException
public MatrixBlock sliceOperations(int rl, int ru, int cl, int cu, org.apache.sysml.runtime.controlprogram.caching.CacheBlock ret) throws DMLRuntimeException
org.apache.sysml.runtime.controlprogram.caching.CacheBlock
sliceOperations
in interface org.apache.sysml.runtime.controlprogram.caching.CacheBlock
rl
- row lowerru
- row uppercl
- column lowercu
- column upperret
- cache blockDMLRuntimeException
- if DMLRuntimeException occurspublic MatrixBlock sliceOperations(int rl, int ru, int cl, int cu, boolean deep, org.apache.sysml.runtime.controlprogram.caching.CacheBlock ret) throws DMLRuntimeException
rl
- row lowerru
- row uppercl
- column lowercu
- column upperdeep
- should perform deep copyret
- output matrix blockDMLRuntimeException
- if DMLRuntimeException occurspublic void sliceOperations(ArrayList<org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue> outlist, org.apache.sysml.runtime.util.IndexRange range, int rowCut, int colCut, int normalBlockRowFactor, int normalBlockColFactor, int boundaryRlen, int boundaryClen)
sliceOperations
in class MatrixValue
public void appendOperations(MatrixValue v2, ArrayList<org.apache.sysml.runtime.matrix.mapred.IndexedMatrixValue> outlist, int blockRowFactor, int blockColFactor, boolean cbind, boolean m2IsLast, int nextNCol) throws DMLRuntimeException
appendOperations
in class MatrixValue
DMLRuntimeException
public MatrixValue zeroOutOperations(MatrixValue result, org.apache.sysml.runtime.util.IndexRange range, boolean complementary) throws DMLRuntimeException
zeroOutOperations
in class MatrixValue
DMLRuntimeException
public MatrixValue aggregateUnaryOperations(org.apache.sysml.runtime.matrix.operators.AggregateUnaryOperator op, MatrixValue result, int blockingFactorRow, int blockingFactorCol, MatrixIndexes indexesIn) throws DMLRuntimeException
aggregateUnaryOperations
in class MatrixValue
DMLRuntimeException
public MatrixValue aggregateUnaryOperations(org.apache.sysml.runtime.matrix.operators.AggregateUnaryOperator op, MatrixValue result, int blockingFactorRow, int blockingFactorCol, MatrixIndexes indexesIn, boolean inCP) throws DMLRuntimeException
aggregateUnaryOperations
in class MatrixValue
DMLRuntimeException
public void dropLastRowsOrColumns(org.apache.sysml.lops.PartialAggregate.CorrectionLocationType correctionLocation)
public org.apache.sysml.runtime.instructions.cp.CM_COV_Object cmOperations(org.apache.sysml.runtime.matrix.operators.CMOperator op) throws DMLRuntimeException
DMLRuntimeException
public org.apache.sysml.runtime.instructions.cp.CM_COV_Object cmOperations(org.apache.sysml.runtime.matrix.operators.CMOperator op, MatrixBlock weights) throws DMLRuntimeException
DMLRuntimeException
public org.apache.sysml.runtime.instructions.cp.CM_COV_Object covOperations(org.apache.sysml.runtime.matrix.operators.COVOperator op, MatrixBlock that) throws DMLRuntimeException
DMLRuntimeException
public org.apache.sysml.runtime.instructions.cp.CM_COV_Object covOperations(org.apache.sysml.runtime.matrix.operators.COVOperator op, MatrixBlock that, MatrixBlock weights) throws DMLRuntimeException
DMLRuntimeException
public MatrixValue sortOperations(MatrixValue weights, MatrixValue result) throws DMLRuntimeException
DMLRuntimeException
public double interQuartileMean() throws DMLRuntimeException
DMLRuntimeException
public static double computeIQMCorrection(double sum, double sum_wt, double q25Part, double q25Val, double q75Part, double q75Val)
public MatrixValue pickValues(MatrixValue quantiles, MatrixValue ret) throws DMLRuntimeException
DMLRuntimeException
public double median() throws DMLRuntimeException
DMLRuntimeException
public double pickValue(double quantile) throws DMLRuntimeException
DMLRuntimeException
public double pickValue(double quantile, boolean average) throws DMLRuntimeException
DMLRuntimeException
public double sumWeightForQuantile() throws DMLRuntimeException
DMLRuntimeException
- on errorpublic MatrixValue aggregateBinaryOperations(MatrixIndexes m1Index, MatrixValue m1Value, MatrixIndexes m2Index, MatrixValue m2Value, MatrixValue result, org.apache.sysml.runtime.matrix.operators.AggregateBinaryOperator op) throws DMLRuntimeException
aggregateBinaryOperations
in class MatrixValue
DMLRuntimeException
public MatrixValue aggregateBinaryOperations(MatrixValue m1Value, MatrixValue m2Value, MatrixValue result, org.apache.sysml.runtime.matrix.operators.AggregateBinaryOperator op) throws DMLRuntimeException
aggregateBinaryOperations
in class MatrixValue
DMLRuntimeException
public MatrixBlock aggregateTernaryOperations(MatrixBlock m1, MatrixBlock m2, MatrixBlock m3, MatrixBlock ret, org.apache.sysml.runtime.matrix.operators.AggregateTernaryOperator op, boolean inCP) throws DMLRuntimeException
DMLRuntimeException
public MatrixBlock uaggouterchainOperations(MatrixBlock mbLeft, MatrixBlock mbRight, MatrixBlock mbOut, org.apache.sysml.runtime.matrix.operators.BinaryOperator bOp, org.apache.sysml.runtime.matrix.operators.AggregateUnaryOperator uaggOp) throws DMLRuntimeException
DMLRuntimeException
public MatrixBlock groupedAggOperations(MatrixValue tgt, MatrixValue wghts, MatrixValue ret, int ngroups, org.apache.sysml.runtime.matrix.operators.Operator op) throws DMLRuntimeException
tgt
- ?wghts
- ?ret
- ?ngroups
- ?op
- operatorDMLRuntimeException
- if DMLRuntimeException occurspublic MatrixBlock groupedAggOperations(MatrixValue tgt, MatrixValue wghts, MatrixValue ret, int ngroups, org.apache.sysml.runtime.matrix.operators.Operator op, int k) throws DMLRuntimeException
DMLRuntimeException
public MatrixBlock removeEmptyOperations(MatrixBlock ret, boolean rows, MatrixBlock select) throws DMLRuntimeException
DMLRuntimeException
public MatrixBlock removeEmptyOperations(MatrixBlock ret, boolean rows) throws DMLRuntimeException
DMLRuntimeException
public MatrixBlock rexpandOperations(MatrixBlock ret, double max, boolean rows, boolean cast, boolean ignore, int k) throws DMLRuntimeException
DMLRuntimeException
public MatrixValue replaceOperations(MatrixValue result, double pattern, double replacement) throws DMLRuntimeException
replaceOperations
in class MatrixValue
DMLRuntimeException
public void ternaryOperations(org.apache.sysml.runtime.matrix.operators.Operator op, double scalarThat, MatrixValue that2Val, CTableMap resultMap, MatrixBlock resultBlock) throws DMLRuntimeException
ternaryOperations
in class MatrixValue
DMLRuntimeException
public void ternaryOperations(org.apache.sysml.runtime.matrix.operators.Operator op, double scalarThat, double scalarThat2, CTableMap resultMap, MatrixBlock resultBlock) throws DMLRuntimeException
ternaryOperations
in class MatrixValue
DMLRuntimeException
public void ternaryOperations(org.apache.sysml.runtime.matrix.operators.Operator op, MatrixIndexes ix1, double scalarThat, boolean left, int brlen, CTableMap resultMap, MatrixBlock resultBlock) throws DMLRuntimeException
ternaryOperations
in class MatrixValue
DMLRuntimeException
public void ternaryOperations(org.apache.sysml.runtime.matrix.operators.Operator op, MatrixValue thatVal, double scalarThat2, boolean ignoreZeros, CTableMap resultMap, MatrixBlock resultBlock) throws DMLRuntimeException
ternaryOperations
in class MatrixValue
DMLRuntimeException
public void ternaryOperations(org.apache.sysml.runtime.matrix.operators.Operator op, MatrixValue thatMatrix, double thatScalar, MatrixBlock resultBlock) throws DMLRuntimeException
op
- operatorthatMatrix
- matrix valuethatScalar
- scalar doubleresultBlock
- result matrix blockDMLRuntimeException
- if DMLRuntimeException occurspublic void ternaryOperations(org.apache.sysml.runtime.matrix.operators.Operator op, MatrixValue thatVal, MatrixValue that2Val, CTableMap resultMap) throws DMLRuntimeException
op
- operatorthatVal
- matrix value 1that2Val
- matrix value 2resultMap
- table mapDMLRuntimeException
- if DMLRuntimeException occurspublic void ternaryOperations(org.apache.sysml.runtime.matrix.operators.Operator op, MatrixValue thatVal, MatrixValue that2Val, CTableMap resultMap, MatrixBlock resultBlock) throws DMLRuntimeException
ternaryOperations
in class MatrixValue
DMLRuntimeException
public MatrixValue quaternaryOperations(org.apache.sysml.runtime.matrix.operators.QuaternaryOperator qop, MatrixValue um, MatrixValue vm, MatrixValue wm, MatrixValue out) throws DMLRuntimeException
quaternaryOperations
in class MatrixValue
DMLRuntimeException
public MatrixValue quaternaryOperations(org.apache.sysml.runtime.matrix.operators.QuaternaryOperator qop, MatrixValue um, MatrixValue vm, MatrixValue wm, MatrixValue out, int k) throws DMLRuntimeException
DMLRuntimeException
public static MatrixBlock randOperations(int rows, int cols, double sparsity, double min, double max, String pdf, long seed) throws DMLRuntimeException
rows
- number of rowscols
- number of columnssparsity
- sparsity as a percentagemin
- minimum valuemax
- maximum valuepdf
- pdfseed
- random seedDMLRuntimeException
- if DMLRuntimeException occurspublic static MatrixBlock randOperations(int rows, int cols, double sparsity, double min, double max, String pdf, long seed, int k) throws DMLRuntimeException
rows
- number of rowscols
- number of columnssparsity
- sparsity as a percentagemin
- minimum valuemax
- maximum valuepdf
- pdfseed
- random seedk
- ?DMLRuntimeException
- if DMLRuntimeException occurspublic static MatrixBlock randOperations(RandomMatrixGenerator rgen, long seed) throws DMLRuntimeException
rgen
- random matrix generatorseed
- seed valueDMLRuntimeException
- if DMLRuntimeException occurspublic static MatrixBlock randOperations(RandomMatrixGenerator rgen, long seed, int k) throws DMLRuntimeException
rgen
- random matrix generatorseed
- seed valuek
- ?DMLRuntimeException
- if DMLRuntimeException occurspublic MatrixBlock randOperationsInPlace(RandomMatrixGenerator rgen, LongStream nnzInBlock, org.apache.commons.math3.random.Well1024a bigrand, long bSeed) throws DMLRuntimeException
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).rgen
- random matrix generatornnzInBlock
- number of nonzeros in blockbigrand
- ?bSeed
- seed valueDMLRuntimeException
- if DMLRuntimeException occurspublic MatrixBlock randOperationsInPlace(RandomMatrixGenerator rgen, LongStream nnzInBlock, org.apache.commons.math3.random.Well1024a bigrand, long bSeed, int k) throws DMLRuntimeException
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).rgen
- random matrix generatornnzInBlock
- number of nonzeros in blockbigrand
- ?bSeed
- seed valuek
- ?DMLRuntimeException
- if DMLRuntimeException occurspublic static MatrixBlock seqOperations(double from, double to, double incr) throws DMLRuntimeException
from
and to
must be
included in the generated sequence i.e., [from,to] both inclusive. Note
that, to
is included only if (to-from) is perfectly
divisible by incr
.
For example, seq(0,1,0.5) generates (0.0 0.5 1.0)
whereas seq(0,1,0.6) generates (0.0 0.6) but not (0.0 0.6 1.0)from
- ?to
- ?incr
- ?DMLRuntimeException
- if DMLRuntimeException occurspublic MatrixBlock seqOperationsInPlace(double from, double to, double incr) throws DMLRuntimeException
DMLRuntimeException
public static MatrixBlock sampleOperations(long range, int size, boolean replace, long seed) throws DMLRuntimeException
DMLRuntimeException
public boolean isThreadSafe()
public static boolean isThreadSafe(boolean sparse)
sparse
- true if sparsepublic void print()
public int compareTo(Object arg0)
compareTo
in interface Comparable
Copyright © 2017 The Apache Software Foundation. All rights reserved.