Package org.apache.sysds.runtime.data
Class BasicTensorBlock
- java.lang.Object
-
- org.apache.sysds.runtime.data.BasicTensorBlock
-
- All Implemented Interfaces:
Serializable
public class BasicTensorBlock extends Object implements Serializable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static SparseBlock.TypeDEFAULT_SPARSEBLOCKstatic doubleSPARSITY_TURN_POINT
-
Constructor Summary
Constructors Constructor Description BasicTensorBlock()BasicTensorBlock(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)BasicTensorBlock(BasicTensorBlock that)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BasicTensorBlockaggregateUnaryOperations(AggregateUnaryOperator op, BasicTensorBlock result)Aggregate a unary operation on this tensor.BasicTensorBlockallocateBlock()BasicTensorBlockallocateDenseBlock()booleanallocateDenseBlock(boolean clearNNZ)booleanallocateSparseBlock()booleanallocateSparseBlock(boolean clearNNZ)voidcopy(int[] lower, int[] upper, BasicTensorBlock src)Copy a part of anotherBasicTensorBlockvoidcopy(BasicTensorBlock that)BasicTensorBlockcopyShallow(BasicTensorBlock that)Objectget(int[] ix)doubleget(int r, int c)DenseBlockgetDenseBlock()intgetDim(int i)int[]getDims()longgetLength()longgetNonZeros()intgetNumColumns()intgetNumDims()intgetNumRows()SparseBlockgetSparseBlock()Types.ValueTypegetValueType()voidincrementalAggregate(AggregateOperator aggOp, BasicTensorBlock partialResult)booleanisAllocated()booleanisEmpty(boolean safe)booleanisSparse()longrecomputeNonZeros()Recomputes 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)voidset(int[] ix, Object v)voidset(int r, int c, double v)voidset(Object v)voidset(BasicTensorBlock other)voidset(MatrixBlock other)
-
-
-
Field Detail
-
SPARSITY_TURN_POINT
public static final double SPARSITY_TURN_POINT
- See Also:
- Constant Field Values
-
DEFAULT_SPARSEBLOCK
public static final SparseBlock.Type DEFAULT_SPARSEBLOCK
-
-
Constructor Detail
-
BasicTensorBlock
public BasicTensorBlock()
-
BasicTensorBlock
public BasicTensorBlock(Types.ValueType vt, int[] dims)
-
BasicTensorBlock
public BasicTensorBlock(Types.ValueType vt, int[] dims, boolean sp)
-
BasicTensorBlock
public BasicTensorBlock(Types.ValueType vt, int[] dims, boolean sp, long estnnz)
-
BasicTensorBlock
public BasicTensorBlock(BasicTensorBlock that)
-
BasicTensorBlock
public BasicTensorBlock(double val)
-
BasicTensorBlock
public BasicTensorBlock(int[] dims, Types.ValueType vt, double val)
-
-
Method Detail
-
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
public BasicTensorBlock allocateDenseBlock()
-
allocateBlock
public BasicTensorBlock allocateBlock()
-
allocateDenseBlock
public boolean allocateDenseBlock(boolean clearNNZ)
-
allocateSparseBlock
public boolean allocateSparseBlock()
-
allocateSparseBlock
public boolean allocateSparseBlock(boolean clearNNZ)
-
getValueType
public Types.ValueType 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
public DenseBlock getDenseBlock()
-
getSparseBlock
public SparseBlock getSparseBlock()
-
get
public Object get(int[] ix)
-
get
public double get(int r, int c)
-
set
public void set(int[] ix, Object v)
-
set
public void set(int r, int c, double v)
-
set
public void set(double v)
-
set
public void set(Object v)
-
set
public void set(BasicTensorBlock other)
-
set
public void set(MatrixBlock other)
-
copy
public void copy(BasicTensorBlock that)
-
copyShallow
public BasicTensorBlock copyShallow(BasicTensorBlock that)
-
copy
public void copy(int[] lower, int[] upper, BasicTensorBlock src)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
public void incrementalAggregate(AggregateOperator aggOp, BasicTensorBlock partialResult)
-
-