Package org.apache.sysds.runtime.data
Class BasicTensorBlock
java.lang.Object
org.apache.sysds.runtime.data.BasicTensorBlock
- All Implemented Interfaces:
Serializable
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBasicTensorBlock(double val) BasicTensorBlock(int[] dims, Types.ValueType vt, double val) BasicTensorBlock(Types.ValueType vt, int[] dims) BasicTensorBlock(Types.ValueType vt, int[] dims, boolean sp) BasicTensorBlock(Types.ValueType vt, int[] dims, boolean sp, long estnnz) -
Method Summary
Modifier and TypeMethodDescriptionAggregate a unary operation on this tensor.booleanallocateDenseBlock(boolean clearNNZ) booleanbooleanallocateSparseBlock(boolean clearNNZ) voidcopy(int[] lower, int[] upper, BasicTensorBlock src) Copy a part of anotherBasicTensorBlockvoidcopy(BasicTensorBlock that) copyShallow(BasicTensorBlock that) get(int[] ix) doubleget(int r, int c) intgetDim(int i) int[]getDims()longlongintintintvoidincrementalAggregate(AggregateOperator aggOp, BasicTensorBlock partialResult) booleanbooleanisEmpty(boolean safe) booleanisSparse()longRecomputes and materializes the number of non-zero values of the entire basic tensor block.voidreset()voidreset(int[] dims) voidreset(int[] dims, boolean sp) voidreset(int[] dims, boolean sp, long estnnz) voidreset(int[] dims, long estnnz) voidset(double v) voidvoidset(int r, int c, double v) voidvoidset(BasicTensorBlock other) voidset(MatrixBlock other)
-
Field Details
-
SPARSITY_TURN_POINT
public static final double SPARSITY_TURN_POINT- See Also:
-
DEFAULT_SPARSEBLOCK
-
-
Constructor Details
-
BasicTensorBlock
public BasicTensorBlock() -
BasicTensorBlock
-
BasicTensorBlock
-
BasicTensorBlock
-
BasicTensorBlock
-
BasicTensorBlock
public BasicTensorBlock(double val) -
BasicTensorBlock
-
-
Method Details
-
getLength
public long getLength() -
reset
public void reset() -
reset
public void reset(int[] dims) -
reset
public void reset(int[] dims, long estnnz) -
reset
public void reset(int[] dims, boolean sp) -
reset
public void reset(int[] dims, boolean sp, long estnnz) -
recomputeNonZeros
public long recomputeNonZeros()Recomputes and materializes the number of non-zero values of the entire basic tensor block.- Returns:
- number of non-zeros
-
isAllocated
public boolean isAllocated() -
allocateDenseBlock
-
allocateBlock
-
allocateDenseBlock
public boolean allocateDenseBlock(boolean clearNNZ) -
allocateSparseBlock
public boolean allocateSparseBlock() -
allocateSparseBlock
public boolean allocateSparseBlock(boolean clearNNZ) -
getValueType
-
getNonZeros
public long getNonZeros() -
getNumRows
public int getNumRows() -
getNumColumns
public int getNumColumns() -
getNumDims
public int getNumDims() -
getDim
public int getDim(int i) -
getDims
public int[] getDims() -
isSparse
public boolean isSparse() -
isEmpty
public boolean isEmpty(boolean safe) -
getDenseBlock
-
getSparseBlock
-
get
-
get
public double get(int r, int c) -
set
-
set
public void set(int r, int c, double v) -
set
public void set(double v) -
set
-
set
-
set
-
copy
-
copyShallow
-
copy
Copy a part of anotherBasicTensorBlock- Parameters:
lower- lower index of elements to copy (inclusive)upper- upper index of elements to copy (exclusive)src- sourceBasicTensorBlock
-
aggregateUnaryOperations
public BasicTensorBlock aggregateUnaryOperations(AggregateUnaryOperator op, BasicTensorBlock result) Aggregate a unary operation on this tensor.- Parameters:
op- the operation to applyresult- the result tensor- Returns:
- the result tensor
-
incrementalAggregate
-