public class SparseBlockCSR extends SparseBlock
SparseBlock.Type| Constructor and Description | 
|---|
SparseBlockCSR(int rlen)  | 
SparseBlockCSR(int[] rowPtr,
              int[] colInd,
              double[] values,
              int nnz)  | 
SparseBlockCSR(int rlen,
              int capacity)  | 
SparseBlockCSR(int rows,
              int[] rowInd,
              int[] colInd,
              double[] values)
Copy constructor for COO representation 
 | 
SparseBlockCSR(int rlen,
              int capacity,
              int size)  | 
SparseBlockCSR(int rows,
              int nnz,
              int[] colInd)
Copy constructor for given array of column indexes, which
 identifies rows by position and implies values of 1. 
 | 
SparseBlockCSR(SparseBlock sblock)
Copy constructor sparse block abstraction. 
 | 
SparseBlockCSR(SparseRow[] rows,
              int nnz)
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 CSR 
 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). 
 | 
int[] | 
indexes()
Get raw access to underlying array of column indices
 For use in GPU code 
 | 
int[] | 
indexes(int r)
Get the sorted array of column indexes of all non-zero entries in 
 row r. 
 | 
void | 
initSparse(int rlen,
          int nnz,
          DataInput in)
Initializes the CSR sparse block from an ordered input
 stream of sparse rows (rownnz, jv-pairs*). 
 | 
void | 
initUltraSparse(int nnz,
               DataInput in)
Initializes the CSR sparse block from an ordered input
 stream of ultra-sparse ijv triples. 
 | 
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. 
 | 
int[] | 
rowPointers()
Get raw access to underlying array of row pointers
 For use in GPU code 
 | 
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. 
 | 
void | 
setIndexRange(int rl,
             int ru,
             int cl,
             int cu,
             double[] v,
             int vix,
             int vlen)
Inserts a sorted row-major array of non-zero values into the row and column 
 range [rl,ru) and [cl,cu). 
 | 
void | 
setIndexRange(int rl,
             int ru,
             int cl,
             int cu,
             SparseBlock sb)
Inserts a sparse block into the row and column range [rl,ru) and [cl,cu). 
 | 
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()
Get raw access to underlying array of values
 For use in GPU code 
 | 
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 SparseBlockCSR(int rlen)
public SparseBlockCSR(int rlen,
                      int capacity)
public SparseBlockCSR(int rlen,
                      int capacity,
                      int size)
public SparseBlockCSR(int[] rowPtr,
                      int[] colInd,
                      double[] values,
                      int nnz)
public SparseBlockCSR(SparseBlock sblock)
sblock - sparse block to copypublic SparseBlockCSR(SparseRow[] rows, int nnz)
rows - array of sparse rowsnnz - number of non-zeroespublic SparseBlockCSR(int rows,
                      int[] rowInd,
                      int[] colInd,
                      double[] values)
rows - number of rowsrowInd - row indicescolInd - column indicesvalues - non zero valuespublic SparseBlockCSR(int rows,
                      int nnz,
                      int[] colInd)
rows - number of rowsnnz - number of non-zeroscolInd - column indexespublic void initUltraSparse(int nnz,
                            DataInput in)
                     throws IOException
nnz - number of non-zeros to readin - data input stream of ijv triples, ordered by ijIOException - if deserialization error occurspublic void initSparse(int rlen,
                       int nnz,
                       DataInput in)
                throws IOException
rlen - number of rowsnnz - number of non-zeros to readin - data input stream of sparse rows, ordered by iIOException - if deserialization error occurspublic static long estimateSizeInMemory(long nrows,
                                        long ncols,
                                        double sparsity)
nrows - number of rowsncols - number of columnssparsity - sparsity ratiopublic int[] rowPointers()
public int[] indexes()
public double[] values()
public 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 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 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 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 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 setIndexRange(int rl,
                          int ru,
                          int cl,
                          int cu,
                          double[] v,
                          int vix,
                          int vlen)
rl - lower row index, starting at 0, inclusiveru - upper row index, starting at 0, exclusivecl - lower column index, starting at 0, inclusivecu - upper column index, starting at 0, exclusivev - right-hand-side dense blockvix - right-hand-side dense block indexvlen - right-hand-side dense block value lengthpublic void setIndexRange(int rl,
                          int ru,
                          int cl,
                          int cu,
                          SparseBlock sb)
rl - lower row index, starting at 0, inclusiveru - upper row index, starting at 0, exclusivecl - lower column index, starting at 0, inclusivecu - upper column index, starting at 0, exclusivesb - right-hand-side sparse blockpublic 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 SparseBlockpublic 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 propertiesCopyright © 2021 The Apache Software Foundation. All rights reserved.