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
Constructor
Description
`SparseBlockFactory()`

## Method Summary

Modifier and Type
Method
Description
`static SparseBlock`
`copySparseBlock(SparseBlock.Type type, SparseBlock sblock, boolean forceCopy)`
`static SparseBlock`
`copySparseBlock(SparseBlock.Type type, SparseBlock sblock, boolean forceCopy, int clen)`
`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 boolean`
`isSparseBlockType(SparseBlock sblock, SparseBlock.Type type)`

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

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

## Constructor Details

### SparseBlockFactory

public SparseBlockFactory()

## Method Details

### 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)

### copySparseBlock

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

### isSparseBlockType

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

### 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.