public class SparseBlockMCSR extends SparseBlock
SparseBlock.Type| Constructor and Description | 
|---|
SparseBlockMCSR(int rlen,
               int clen)  | 
SparseBlockMCSR(SparseBlock sblock)
Copy constructor sparse block abstraction. 
 | 
SparseBlockMCSR(SparseRow[] rows,
               boolean deep)
Copy constructor old sparse row representation. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
boolean | 
add(int r,
   int c,
   double v)
Add a value to a matrix cell (r,c). 
 | 
void | 
allocate(int r)
Allocate the underlying data structure holding non-zero values
 of row r if necessary. 
 | 
void | 
allocate(int r,
        int nnz)
Allocate the underlying data structure holding non-zero values
 of row r if necessary, w/ given size. 
 | 
void | 
allocate(int r,
        int ennz,
        int maxnnz)
Allocate the underlying data structure holding non-zero values
 of row r w/ the specified estimated nnz and max nnz. 
 | 
void | 
append(int r,
      int c,
      double v)
Append a value to the end of the physical representation. 
 | 
boolean | 
checkValidity(int rlen,
             int clen,
             long nnz,
             boolean strict)
Validate the correctness of the internal data structures of the different
 sparse block implementations. 
 | 
void | 
compact(int r)
Re-allocate physical row if physical size exceeds
 logical size plus resize factor. 
 | 
void | 
deleteIndexRange(int r,
                int cl,
                int cu)
Deletes all non-zero values of the given column range [cl,cu) in row r. 
 | 
static long | 
estimateSizeInMemory(long nrows,
                    long ncols,
                    double sparsity)
Get the estimated in-memory size of the sparse block in MCSR 
 with the given dimensions w/o accounting for overallocation. 
 | 
SparseRow | 
get(int r)
Get values of row r in the format of a sparse row. 
 | 
double | 
get(int r,
   int c)
Get value of matrix cell (r,c). 
 | 
SparseRow[] | 
getRows()
Helper function for MCSR -> {COO, CSR} 
 | 
int[] | 
indexes(int r)
Get the sorted array of column indexes of all non-zero entries in 
 row r. 
 | 
boolean | 
isAllocated(int r)
Indicates if the underlying data structure for a given row
 is already allocated. 
 | 
boolean | 
isContiguous()
Indicates if the underlying data structures returned by values 
 and indexes are contiguous arrays, which can be exploited for 
 more efficient operations. 
 | 
boolean | 
isEmpty(int r)
Get information if row r is empty, i.e., does not contain non-zero 
 values. 
 | 
boolean | 
isThreadSafe()
Indicates if the underlying implementation allows thread-safe row
 updates if concurrent threads update disjoint rows. 
 | 
int | 
numRows()
Get the number of rows in the sparse block. 
 | 
int | 
pos(int r)
Get the starting position of row r in the indexes/values arrays returned
 by indexes(r) and values(r). 
 | 
int | 
posFIndexGT(int r,
           int c)
Get position of first column index greater than column c in row r. 
 | 
int | 
posFIndexGTE(int r,
            int c)
Get position of first column index greater than or equal column c
 in row r. 
 | 
int | 
posFIndexLTE(int r,
            int c)
Get position of first column index lower than or equal column c 
 in row r. 
 | 
void | 
reset()
Clears the sparse block by deleting non-zero values. 
 | 
void | 
reset(int ennz,
     int maxnnz)
Clears the sparse block by deleting non-zero values. 
 | 
void | 
reset(int r,
     int ennz,
     int maxnnz)
Clears row r of the sparse block by deleting non-zero values. 
 | 
boolean | 
set(int r,
   int c,
   double v)
Set the value of a matrix cell (r,c). 
 | 
void | 
set(int r,
   SparseRow row,
   boolean deep)
Set the values of row r to the given sparse row. 
 | 
void | 
setIndexRange(int r,
             int cl,
             int cu,
             double[] v,
             int[] vix,
             int vpos,
             int vlen)
Sets a sparse array of non-zeros values and indexes into the column range [cl,cu) 
 in row r. 
 | 
void | 
setIndexRange(int r,
             int cl,
             int cu,
             double[] v,
             int vix,
             int vlen)
Sets a dense array of non-zeros values into the column range [cl,cu) 
 in row r. 
 | 
long | 
size()
Get the number of non-zero values in the sparse block. 
 | 
int | 
size(int r)
Get the number of non-zero values in row r. 
 | 
long | 
size(int rl,
    int ru)
Get the number of non-zeros values in the row range
 of [rl, ru). 
 | 
long | 
size(int rl,
    int ru,
    int cl,
    int cu)
Get the number of non-zeros values in the row and column
 range of [rl/cl, ru/cu); 
 | 
void | 
sort()
Sort all non-zero value/index pairs of the sparse block by row 
 and column index. 
 | 
void | 
sort(int r)
Sort all non-zero value/index pairs of row r column index. 
 | 
String | 
toString()  | 
double[] | 
values(int r)
Get the array of all non-zero entries in row r, sorted by their column
 indexes. 
 | 
getIterator, getIterator, getIterator, isAligned, isAlignedpublic SparseBlockMCSR(SparseBlock sblock)
sblock - sparse block to copypublic SparseBlockMCSR(SparseRow[] rows, boolean deep)
rows - array of sparse rowsdeep - if true, deep copypublic SparseBlockMCSR(int rlen,
                       int clen)
public static long estimateSizeInMemory(long nrows,
                                        long ncols,
                                        double sparsity)
nrows - number of rowsncols - number of columnssparsity - sparsity ratiopublic void allocate(int r)
SparseBlockallocate in class SparseBlockr - row indexpublic void allocate(int r,
                     int nnz)
SparseBlockallocate in class SparseBlockr - row indexnnz - number of non-zerospublic void allocate(int r,
                     int ennz,
                     int maxnnz)
SparseBlockallocate in class SparseBlockr - row indexennz - estimated non-zerosmaxnnz - max non-zerospublic void compact(int r)
SparseBlockcompact in class SparseBlockr - row indexpublic int numRows()
SparseBlocknumRows in class SparseBlockpublic boolean isThreadSafe()
SparseBlockisThreadSafe in class SparseBlockpublic boolean isContiguous()
SparseBlockisContiguous in class SparseBlockpublic boolean isAllocated(int r)
SparseBlockisAllocated in class SparseBlockr - row indexpublic boolean checkValidity(int rlen,
                             int clen,
                             long nnz,
                             boolean strict)
SparseBlockcheckValidity in class SparseBlockrlen - number of rowsclen - number of columnsnnz - number of non zerosstrict - enforce optional propertiespublic void reset()
SparseBlockreset in class SparseBlockpublic void reset(int ennz,
                  int maxnnz)
SparseBlockreset in class SparseBlockennz - estimated non-zerosmaxnnz - max non-zerospublic void reset(int r,
                  int ennz,
                  int maxnnz)
SparseBlockreset in class SparseBlockr - row indexennz - estimated non-zerosmaxnnz - max non-zerospublic long size()
SparseBlocksize in class SparseBlockpublic int size(int r)
SparseBlocksize in class SparseBlockr - row index starting at 0public long size(int rl,
                 int ru)
SparseBlocksize in class SparseBlockrl - row lower indexru - row upper indexpublic long size(int rl,
                 int ru,
                 int cl,
                 int cu)
SparseBlocksize in class SparseBlockrl - row lower indexru - row upper indexcl - column lower indexcu - column upper indexpublic boolean isEmpty(int r)
SparseBlockisEmpty in class SparseBlockr - row index starting at 0public int[] indexes(int r)
SparseBlockindexes in class SparseBlockr - row index starting at 0public double[] values(int r)
SparseBlockvalues in class SparseBlockr - row index starting at 0public int pos(int r)
SparseBlockpos in class SparseBlockr - row index starting at 0public boolean set(int r,
                   int c,
                   double v)
SparseBlockset in class SparseBlockr - row index starting at 0c - column index starting at 0v - zero or non-zero valuepublic void set(int r,
                SparseRow row,
                boolean deep)
SparseBlockset in class SparseBlockr - row index starting at 0row - sparse rowdeep - indicator to create deep copy of sparse rowpublic boolean add(int r,
                   int c,
                   double v)
SparseBlockadd in class SparseBlockr - row index starting at 0c - column index starting at 0v - zero or non-zero valuepublic void append(int r,
                   int c,
                   double v)
SparseBlockappend in class SparseBlockr - row index starting at 0c - column index starting at 0v - zero or non-zero valuepublic void setIndexRange(int r,
                          int cl,
                          int cu,
                          double[] v,
                          int vix,
                          int vlen)
SparseBlocksetIndexRange in class SparseBlockr - row index starting at 0cl - lower column index starting at 0cu - upper column index starting at 0v - value arrayvix - start index in value arrayvlen - number of relevant valuespublic void setIndexRange(int r,
                          int cl,
                          int cu,
                          double[] v,
                          int[] vix,
                          int vpos,
                          int vlen)
SparseBlocksetIndexRange in class SparseBlockr - row index starting at 0cl - lower column index starting at 0cu - upper column index starting at 0v - value arrayvix - column index arrayvpos - start index in value and index arraysvlen - number of relevant valuespublic void deleteIndexRange(int r,
                             int cl,
                             int cu)
SparseBlockdeleteIndexRange in class SparseBlockr - row index starting at 0cl - lower column index starting at 0cu - upper column index starting at 0public void sort()
SparseBlocksort in class SparseBlockpublic void sort(int r)
SparseBlocksort in class SparseBlockr - row index starting at 0public double get(int r,
                  int c)
SparseBlockget in class SparseBlockr - row index starting at 0c - column index starting at 0public SparseRow get(int r)
SparseBlockget in class SparseBlockr - row index starting at 0public int posFIndexLTE(int r,
                        int c)
SparseBlockposFIndexLTE in class SparseBlockr - row index starting at 0c - column index starting at 0public int posFIndexGTE(int r,
                        int c)
SparseBlockposFIndexGTE in class SparseBlockr - row index starting at 0c - column index starting at 0public int posFIndexGT(int r,
                       int c)
SparseBlockposFIndexGT in class SparseBlockr - row index starting at 0c - column index starting at 0public String toString()
toString in class SparseBlockCopyright © 2021 The Apache Software Foundation. All rights reserved.