Package org.apache.sysds.runtime.data

## Class SparseBlockFactory

- java.lang.Object
- - org.apache.sysds.runtime.data.SparseBlockFactory

    public abstract class SparseBlockFactory
    extends Object

### Constructor Summary

Constructors
`SparseBlockFactory()`

### Method Summary

All Methods Static Methods Concrete Methods
`static SparseBlock` `copySparseBlock​(SparseBlock.Type type, SparseBlock sblock, boolean forceCopy)`
`static SparseBlock` `createFromArray​(double[] valsDense, int nCol, int nnz)` Create a sparse block from an array.
`static SparseBlock` `createIdentityMatrix​(int nRowCol)`
`static SparseBlock` `createIdentityMatrixWithEmptyRow​(int nRowCol)`
`static SparseBlock` `createSparseBlock​(int rlen)`
`static SparseBlock` `createSparseBlock​(SparseBlock.Type type, int rlen)`
`static SparseBlock` `createSparseBlock​(SparseBlock.Type type, SparseRow row)`
`static long` `estimateSizeSparseInMemory​(SparseBlock.Type type, long nrows, long ncols, double sparsity)`
`static SparseBlock.Type` `getSparseBlockType​(SparseBlock sblock)`
`static boolean` `isSparseBlockType​(SparseBlock sblock, SparseBlock.Type type)`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### SparseBlockFactory

    public SparseBlockFactory()

### Method Detail

#### createSparseBlock

    public static SparseBlock createSparseBlock​(int rlen)

#### createSparseBlock

    public static SparseBlock createSparseBlock​(SparseBlock.Type type,
                                                int rlen)

#### createSparseBlock

    public static SparseBlock createSparseBlock​(SparseBlock.Type type,
                                                SparseRow row)

#### copySparseBlock

    public static SparseBlock copySparseBlock​(SparseBlock.Type type,
                                              SparseBlock sblock,
                                              boolean forceCopy)

#### isSparseBlockType

    public static boolean isSparseBlockType​(SparseBlock sblock,
                                            SparseBlock.Type type)

#### getSparseBlockType

    public static SparseBlock.Type getSparseBlockType​(SparseBlock sblock)

#### estimateSizeSparseInMemory

    public static long estimateSizeSparseInMemory​(SparseBlock.Type type,
                                                  long nrows,
                                                  long ncols,
                                                  double sparsity)

#### createIdentityMatrix

    public static SparseBlock createIdentityMatrix​(int nRowCol)

#### createIdentityMatrixWithEmptyRow

    public static SparseBlock createIdentityMatrixWithEmptyRow​(int nRowCol)

#### createFromArray

    public static SparseBlock createFromArray​(double[] valsDense,
                                              int nCol,
                                              int nnz)

Create a sparse block from an array. Note that the nnz count should be absolutely correct for this call to work.

Parameters:
  `valsDense` - a double array of values linearized.
  `nCol` - The number of columns in reach row.
  `nnz` - The number of non zero values.
Returns:
  A sparse block.