Package org.apache.sysds.runtime.data
Class DenseBlockLDRB
- java.lang.Object
-
- org.apache.sysds.runtime.data.DenseBlock
-
- org.apache.sysds.runtime.data.DenseBlockLDRB
-
- All Implemented Interfaces:
Serializable
,Block
- Direct Known Subclasses:
DenseBlockLBool
,DenseBlockLFP32
,DenseBlockLFP64
,DenseBlockLFP64DEDUP
,DenseBlockLInt32
,DenseBlockLInt64
,DenseBlockLString
public abstract class DenseBlockLDRB extends DenseBlock
Dense Large Row Blocks have multiple 1D arrays (blocks), which contain complete rows. Except the last block all blocks have the same size (size refers to the number of rows contained and space allocated).- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.sysds.runtime.data.DenseBlock
DenseBlock.Type
-
-
Field Summary
Fields Modifier and Type Field Description static int
MAX_ALLOC
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
blockSize()
Get the number of rows per block, except last one.int
blockSize(int bix)
Get the number of rows of the given block.long
countNonZeros()
Compute the number of non-zero values, which potentially makes a full pass over the underlying blocks.int
countNonZeros(int r)
Compute the number of non-zero values for the given row, which potentially makes a full pass over the underlying row.long
countNonZeros(int rl, int ru, int cl, int cu)
Compute the number of non-zero values, which potentially makes a full pass over the underlying blocks in the row range.int
index(int r)
Get the block index for a given row.boolean
isContiguous(int rl, int ru)
Indicates if the dense block has a single underlying block for the given row range.int
pos(int r)
Get the position for a given row within its associated block.int
pos(int[] ix)
Get the position for a given cell within the associated block.int
pos(int r, int c)
Get the position for a given row and column within the associated block.void
reset(int rlen, int[] odims, double v)
Resets the dense block by setting the given value.void
resetNoFill(int rlen, int[] odims)
DenseBlock
set(double v)
Set the given value for the entire dense block (fill).DenseBlock
set(int r, double[] v)
Copy the given vector into the given row.DenseBlock
set(int rl, int ru, int cl, int cu, double v)
Set the given value for an entire index range of the dense block (fill).DenseBlock
set(DenseBlock db)
Copy the given dense block.int
size(int bix)
Get the length of the given block.-
Methods inherited from class org.apache.sysds.runtime.data.DenseBlock
capacity, contains, contains, contains, equals, equals, estimateMemory, fill, fillBlock, fillRow, get, get, getCumODims, getDim, getLong, getNextIndexes, getString, incr, incr, isContiguous, isNumeric, isNumeric, numBlocks, numCols, numDims, numRows, reset, reset, reset, reset, reset, reset, resetNoFill, set, set, set, set, set, set, set, set, setDims, size, toString, values, valuesAt
-
-
-
-
Method Detail
-
blockSize
public int blockSize()
Description copied from class:DenseBlock
Get the number of rows per block, except last one.- Specified by:
blockSize
in classDenseBlock
- Returns:
- number of rows in block
-
blockSize
public int blockSize(int bix)
Description copied from class:DenseBlock
Get the number of rows of the given block.- Specified by:
blockSize
in classDenseBlock
- Parameters:
bix
- block index- Returns:
- number of rows in block
-
reset
public void reset(int rlen, int[] odims, double v)
Description copied from class:DenseBlock
Resets the dense block by setting the given value.- Specified by:
reset
in classDenseBlock
- Parameters:
rlen
- number of rowsodims
- other dimensionsv
- value
-
resetNoFill
public void resetNoFill(int rlen, int[] odims)
- Specified by:
resetNoFill
in classDenseBlock
-
pos
public int pos(int[] ix)
Description copied from class:DenseBlock
Get the position for a given cell within the associated block.- Specified by:
pos
in classDenseBlock
- Parameters:
ix
- cell indexes- Returns:
- block position
-
isContiguous
public boolean isContiguous(int rl, int ru)
Description copied from class:DenseBlock
Indicates if the dense block has a single underlying block for the given row range.- Specified by:
isContiguous
in classDenseBlock
- Parameters:
rl
- row lower indexru
- row upper index (inclusive)- Returns:
- true if single block in row range
-
size
public int size(int bix)
Description copied from class:DenseBlock
Get the length of the given block.- Specified by:
size
in classDenseBlock
- Parameters:
bix
- block index- Returns:
- length
-
index
public int index(int r)
Description copied from class:DenseBlock
Get the block index for a given row.- Specified by:
index
in classDenseBlock
- Parameters:
r
- row index- Returns:
- block index
-
pos
public int pos(int r)
Description copied from class:DenseBlock
Get the position for a given row within its associated block.- Specified by:
pos
in classDenseBlock
- Parameters:
r
- row index- Returns:
- block position
-
pos
public int pos(int r, int c)
Description copied from class:DenseBlock
Get the position for a given row and column within the associated block.- Specified by:
pos
in classDenseBlock
- Parameters:
r
- row indexc
- column index- Returns:
- block position
-
countNonZeros
public long countNonZeros()
Description copied from class:DenseBlock
Compute the number of non-zero values, which potentially makes a full pass over the underlying blocks.- Specified by:
countNonZeros
in classDenseBlock
- Returns:
- number of non-zeros
-
countNonZeros
public int countNonZeros(int r)
Description copied from class:DenseBlock
Compute the number of non-zero values for the given row, which potentially makes a full pass over the underlying row.- Specified by:
countNonZeros
in classDenseBlock
- Parameters:
r
- row index- Returns:
- number of non-zeros
-
countNonZeros
public long countNonZeros(int rl, int ru, int cl, int cu)
Description copied from class:DenseBlock
Compute the number of non-zero values, which potentially makes a full pass over the underlying blocks in the row range.- Specified by:
countNonZeros
in classDenseBlock
- Parameters:
rl
- row lower indexru
- row upper index (exclusive)cl
- column lower indexcu
- column upper index (exclusive)- Returns:
- number of non-zeros
-
set
public DenseBlock set(double v)
Description copied from class:DenseBlock
Set the given value for the entire dense block (fill).- Specified by:
set
in classDenseBlock
- Parameters:
v
- value- Returns:
- self
-
set
public DenseBlock set(int rl, int ru, int cl, int cu, double v)
Description copied from class:DenseBlock
Set the given value for an entire index range of the dense block (fill).- Specified by:
set
in classDenseBlock
- Parameters:
rl
- row lower indexru
- row upper index (exclusive)cl
- column lower indexcu
- column upper index (exclusive)v
- value- Returns:
- self
-
set
public DenseBlock set(int r, double[] v)
Description copied from class:DenseBlock
Copy the given vector into the given row.- Specified by:
set
in classDenseBlock
- Parameters:
r
- row indexv
- value vector- Returns:
- self
-
set
public DenseBlock set(DenseBlock db)
Description copied from class:DenseBlock
Copy the given dense block.- Specified by:
set
in classDenseBlock
- Parameters:
db
- dense block- Returns:
- self
-
-