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.Type
DEFAULT_SPARSEBLOCK
static double
SPARSITY_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 BasicTensorBlock
aggregateUnaryOperations(AggregateUnaryOperator op, BasicTensorBlock result)
Aggregate a unary operation on this tensor.BasicTensorBlock
allocateBlock()
BasicTensorBlock
allocateDenseBlock()
boolean
allocateDenseBlock(boolean clearNNZ)
boolean
allocateSparseBlock()
boolean
allocateSparseBlock(boolean clearNNZ)
void
copy(int[] lower, int[] upper, BasicTensorBlock src)
Copy a part of anotherBasicTensorBlock
void
copy(BasicTensorBlock that)
BasicTensorBlock
copyShallow(BasicTensorBlock that)
Object
get(int[] ix)
double
get(int r, int c)
DenseBlock
getDenseBlock()
int
getDim(int i)
int[]
getDims()
long
getLength()
long
getNonZeros()
int
getNumColumns()
int
getNumDims()
int
getNumRows()
SparseBlock
getSparseBlock()
Types.ValueType
getValueType()
void
incrementalAggregate(AggregateOperator aggOp, BasicTensorBlock partialResult)
boolean
isAllocated()
boolean
isEmpty(boolean safe)
boolean
isSparse()
long
recomputeNonZeros()
Recomputes and materializes the number of non-zero values of the entire basic tensor block.void
reset()
void
reset(int[] dims)
void
reset(int[] dims, boolean sp)
void
reset(int[] dims, boolean sp, long estnnz)
void
reset(int[] dims, long estnnz)
void
set(double v)
void
set(int[] ix, Object v)
void
set(int r, int c, double v)
void
set(Object v)
void
set(BasicTensorBlock other)
void
set(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)
-
-