public class DenseBlockDRB extends DenseBlock
DenseBlock.Type
Constructor and Description |
---|
DenseBlockDRB(double[] data,
int rlen,
int clen) |
DenseBlockDRB(int rlen,
int clen) |
Modifier and Type | Method and 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 |
capacity()
Get the total length of allocated blocks.
|
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.
|
double |
get(int r,
int c)
Get the value for a given row and column.
|
void |
incr(int r,
int c)
Increments the given value for a given row and column.
|
void |
incr(int r,
int c,
double delta)
Increments the given value for a given row and column
by delta.
|
int |
index(int r)
Get the block index for a given row.
|
boolean |
isContiguous()
Indicates if the dense block has a single
underlying block, i.e., if numBlocks==1.
|
boolean |
isContiguous(int rl,
int ru)
Indicates if the dense block has a single
underlying block for the given row range.
|
int |
numBlocks()
Get the number of allocated blocks.
|
int |
numRows()
Get the number of rows.
|
int |
pos(int r)
Get the position for a given row within
its associated block.
|
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 rlen,
int clen)
Resets the dense block by deleting non-zero values.
|
void |
reset(int rlen,
int clen,
double v)
Resets the dense block by setting the given value.
|
DenseBlock |
set(DenseBlock db)
Copy the given dense block.
|
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 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.
|
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).
|
long |
size()
Get the length of the dense block as the product
of row and column dimensions.
|
int |
size(int bix)
Get the length of the given block.
|
String |
toString() |
double[][] |
values()
Get the allocated blocks.
|
double[] |
values(int r)
Get the allocated block for the given row.
|
double[] |
valuesAt(int bix)
Get an allocated block.
|
set, set
public DenseBlockDRB(int rlen, int clen)
public DenseBlockDRB(double[] data, int rlen, int clen)
public void reset()
DenseBlock
reset
in class DenseBlock
public void reset(int rlen, int clen)
DenseBlock
reset
in class DenseBlock
rlen
- number of rowsclen
- number of columnspublic void reset(int rlen, int clen, double v)
DenseBlock
reset
in class DenseBlock
rlen
- number of rowsclen
- number of columnsv
- valuepublic int numRows()
DenseBlock
numRows
in class DenseBlock
public int numBlocks()
DenseBlock
numBlocks
in class DenseBlock
public int blockSize()
DenseBlock
blockSize
in class DenseBlock
public int blockSize(int bix)
DenseBlock
blockSize
in class DenseBlock
bix
- block indexpublic boolean isContiguous()
DenseBlock
isContiguous
in class DenseBlock
public boolean isContiguous(int rl, int ru)
DenseBlock
isContiguous
in class DenseBlock
rl
- row lower indexru
- row upper index (inclusive)public long size()
DenseBlock
size
in class DenseBlock
public int size(int bix)
DenseBlock
size
in class DenseBlock
bix
- block indexpublic long capacity()
DenseBlock
capacity
in class DenseBlock
public long countNonZeros()
DenseBlock
countNonZeros
in class DenseBlock
public int countNonZeros(int r)
DenseBlock
countNonZeros
in class DenseBlock
r
- row indexpublic long countNonZeros(int rl, int ru, int cl, int cu)
DenseBlock
countNonZeros
in class DenseBlock
rl
- row lower indexru
- row upper index (exclusive)cl
- column lower indexcu
- column upper index (exclusive)public double[][] values()
DenseBlock
values
in class DenseBlock
public double[] values(int r)
DenseBlock
values
in class DenseBlock
r
- row indexpublic double[] valuesAt(int bix)
DenseBlock
valuesAt
in class DenseBlock
bix
- block indexpublic int index(int r)
DenseBlock
index
in class DenseBlock
r
- row indexpublic int pos(int r)
DenseBlock
pos
in class DenseBlock
r
- row indexpublic int pos(int r, int c)
DenseBlock
pos
in class DenseBlock
r
- row indexc
- column indexpublic void incr(int r, int c)
DenseBlock
incr
in class DenseBlock
r
- row indexc
- column indexpublic void incr(int r, int c, double delta)
DenseBlock
incr
in class DenseBlock
r
- row indexc
- column indexdelta
- increment valuepublic DenseBlock set(double v)
DenseBlock
set
in class DenseBlock
v
- valuepublic DenseBlock set(int rl, int ru, int cl, int cu, double v)
DenseBlock
set
in class DenseBlock
rl
- row lower indexru
- row upper index (exclusive)cl
- column lower indexcu
- column upper index (exclusive)v
- valuepublic DenseBlock set(int r, int c, double v)
DenseBlock
set
in class DenseBlock
r
- row indexc
- column indexv
- valuepublic DenseBlock set(DenseBlock db)
DenseBlock
set
in class DenseBlock
db
- dense blockpublic DenseBlock set(int rl, int ru, int cl, int cu, DenseBlock db)
DenseBlock
set
in class DenseBlock
rl
- row lower indexru
- row upper index (exclusive)cl
- column lower indexcu
- column upper index (exclusive)db
- dense blockpublic DenseBlock set(int r, double[] v)
DenseBlock
set
in class DenseBlock
r
- row indexv
- value vectorpublic double get(int r, int c)
DenseBlock
get
in class DenseBlock
r
- row indexc
- column indexpublic String toString()
toString
in class DenseBlock
Copyright © 2018 The Apache Software Foundation. All rights reserved.