public abstract class DenseBlock extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
DenseBlock.Type |
Modifier and Type | Method and Description |
---|---|
abstract int |
blockSize()
Get the number of rows per block, except last one.
|
abstract int |
blockSize(int bix)
Get the number of rows of the given block.
|
abstract long |
capacity()
Get the total length of allocated blocks.
|
abstract long |
countNonZeros()
Compute the number of non-zero values, which potentially
makes a full pass over the underlying blocks.
|
abstract 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.
|
abstract 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.
|
static double |
estimateMemory(long nrows,
long ncols) |
abstract double |
get(int[] ix)
Get the value of a given cell
|
abstract double |
get(int r,
int c)
Get the value for a given row and column.
|
int |
getCumODims(int i)
Get the ith cumulative dimensions size of the dense block, without row.
|
int |
getDim(int i)
Get the ith dimensions size of the dense block.
|
abstract long |
getLong(int[] ix)
Get the value of a given cell as long
|
void |
getNextIndexes(int[] ix)
Calculates the next index array.
|
abstract String |
getString(int[] ix)
Get the value of a given cell as a String
|
abstract void |
incr(int r,
int c)
Increments the given value for a given row and column.
|
abstract void |
incr(int r,
int c,
double delta)
Increments the given value for a given row and column
by delta.
|
abstract int |
index(int r)
Get the block index for a given row.
|
abstract boolean |
isContiguous()
Indicates if the dense block has a single
underlying block, i.e., if numBlocks==1.
|
abstract boolean |
isContiguous(int rl,
int ru)
Indicates if the dense block has a single
underlying block for the given row range.
|
abstract boolean |
isNumeric()
Indicates if the dense block is numeric.
|
abstract int |
numBlocks()
Get the number of allocated blocks.
|
int |
numDims()
Get the number of dimensions.
|
int |
numRows()
Get the number of rows.
|
abstract int |
pos(int r)
Get the position for a given row within
its associated block.
|
abstract int |
pos(int[] ix)
Get the position for a given cell
within the associated block.
|
abstract int |
pos(int r,
int c)
Get the position for a given row and column
within the associated block.
|
void |
reset()
Resets the dense block by deleting non-zero values.
|
void |
reset(int[] dims)
Resets the dense block by deleting non-zero values.
|
void |
reset(int[] dims,
double v)
Resets the dense block by deleting non-zeros.
|
void |
reset(int rlen,
int clen)
Resets the dense block by deleting non-zeros.
|
void |
reset(int rlen,
int[] odims)
Resets the dense block by deleting non-zeros.
|
abstract void |
reset(int rlen,
int[] odims,
double v)
Resets the dense block by setting the given value.
|
void |
reset(int rlen,
int clen,
double v)
Resets the dense block by setting the given value.
|
abstract DenseBlock |
set(DenseBlock db)
Copy the given dense block.
|
abstract DenseBlock |
set(double v)
Set the given value for the entire dense block (fill).
|
abstract DenseBlock |
set(int[] ix,
double v)
Set the specified cell to the given value.
|
abstract DenseBlock |
set(int[] ix,
long v)
Set the specified cell to the given value.
|
abstract DenseBlock |
set(int[] ix,
String v)
Set the specified cell to the given value.
|
abstract DenseBlock |
set(int r,
double[] v)
Copy the given vector into the given row.
|
abstract DenseBlock |
set(int r,
int c,
double v)
Set the given value for a given row and column.
|
DenseBlock |
set(int rl,
int ru,
int cl,
int cu,
DenseBlock db)
Copy the given dense block into the specified
index range.
|
abstract 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(int r,
KahanObject kbuff)
Copy the given kahan object sum and correction
into the given row.
|
DenseBlock |
set(KahanObject kbuff)
Copy the given kahan object sum and correction.
|
DenseBlock |
set(String s)
Set the given string for the entire dense block (fill).
|
void |
setDims(int[] dims)
Set the dimensions of the dense MatrixBlock.
|
long |
size()
Get the length of the dense block as the product
of all dimensions.
|
abstract int |
size(int bix)
Get the length of the given block.
|
String |
toString() |
abstract double[] |
values(int r)
Get the allocated block for the given row.
|
abstract double[] |
valuesAt(int bix)
Get an allocated block.
|
public final int getDim(int i)
i
- the number of dimension to getpublic final int getCumODims(int i)
i
- the number of the cumulative dimension to get (0 equals the second dimension!)public final void reset()
public final void reset(int[] dims)
dims
- length and size of dimensions.public final void reset(int[] dims, double v)
dims
- lenth and size of dimensionsv
- valuepublic final void reset(int rlen, int clen)
rlen
- number of rowsclen
- number of columnspublic final void reset(int rlen, int[] odims)
rlen
- number of rowsodims
- offsets of other dimensionspublic final void reset(int rlen, int clen, double v)
rlen
- number of rowsclen
- number of columnsv
- valuepublic abstract void reset(int rlen, int[] odims, double v)
rlen
- number of rowsodims
- other dimensionsv
- valuepublic static double estimateMemory(long nrows, long ncols)
public void setDims(int[] dims)
dims
- The dimensions to set, first dimension is rows, second cols.public final int numRows()
public final int numDims()
public abstract int numBlocks()
public abstract int blockSize()
public abstract int blockSize(int bix)
bix
- block indexpublic abstract boolean isNumeric()
public abstract boolean isContiguous()
public abstract boolean isContiguous(int rl, int ru)
rl
- row lower indexru
- row upper index (inclusive)public final long size()
public abstract int size(int bix)
bix
- block indexpublic abstract long capacity()
public abstract long countNonZeros()
public abstract int countNonZeros(int r)
r
- row indexpublic abstract long countNonZeros(int rl, int ru, int cl, int cu)
rl
- row lower indexru
- row upper index (exclusive)cl
- column lower indexcu
- column upper index (exclusive)public abstract double[] values(int r)
r
- row indexpublic abstract double[] valuesAt(int bix)
bix
- block indexpublic abstract int index(int r)
r
- row indexpublic abstract int pos(int r)
r
- row indexpublic abstract int pos(int r, int c)
r
- row indexc
- column indexpublic abstract int pos(int[] ix)
ix
- cell indexespublic abstract void incr(int r, int c)
r
- row indexc
- column indexpublic abstract void incr(int r, int c, double delta)
r
- row indexc
- column indexdelta
- increment valuepublic abstract DenseBlock set(double v)
v
- valuepublic DenseBlock set(String s)
s
- stringpublic abstract DenseBlock set(int rl, int ru, int cl, int cu, double v)
rl
- row lower indexru
- row upper index (exclusive)cl
- column lower indexcu
- column upper index (exclusive)v
- valuepublic abstract DenseBlock set(int r, int c, double v)
r
- row indexc
- column indexv
- valuepublic abstract DenseBlock set(int r, double[] v)
r
- row indexv
- value vectorpublic abstract DenseBlock set(DenseBlock db)
db
- dense blockpublic DenseBlock set(int rl, int ru, int cl, int cu, DenseBlock db)
rl
- row lower indexru
- row upper index (exclusive)cl
- column lower indexcu
- column upper index (exclusive)db
- dense blockpublic void getNextIndexes(int[] ix)
ix
- the index array which will be incremented to the next index arraypublic DenseBlock set(KahanObject kbuff)
kbuff
- kahan objectpublic abstract DenseBlock set(int[] ix, double v)
ix
- cell indexesv
- valuepublic abstract DenseBlock set(int[] ix, long v)
ix
- cell indexesv
- valuepublic abstract DenseBlock set(int[] ix, String v)
ix
- cell indexesv
- value as Stringpublic DenseBlock set(int r, KahanObject kbuff)
r
- row indexkbuff
- kahan objectpublic abstract double get(int r, int c)
r
- row indexc
- column indexpublic abstract double get(int[] ix)
ix
- cell indexespublic abstract String getString(int[] ix)
ix
- cell indexespublic abstract long getLong(int[] ix)
ix
- cell indexesCopyright © 2021 The Apache Software Foundation. All rights reserved.