org.apache.sysds.runtime.compress.colgroup

## Class ColGroupSDCSingleZeros

- java.lang.Object
- - org.apache.sysds.runtime.compress.colgroup.AColGroup
  - - org.apache.sysds.runtime.compress.colgroup.ColGroupCompressed
    - - org.apache.sysds.runtime.compress.colgroup.ColGroupValue
      - - org.apache.sysds.runtime.compress.colgroup.ColGroupSDCSingleZeros

All Implemented Interfaces:
  Serializable, Cloneable

    public class ColGroupSDCSingleZeros
    extends ColGroupValue

Column group that sparsely encodes the dictionary values. The idea is that all values is encoded with indexes except the most common one. the most common one can be inferred by not being included in the indexes. If the values are very sparse then the most common one is zero. This column group is handy in cases where sparse unsafe operations is executed on very sparse columns. Then the zeros would be materialized in the group without any overhead.

See Also:
  Serialized Form

### Nested Class Summary

### Nested classes/interfaces inherited from class org.apache.sysds.runtime.compress.colgroup.AColGroup

`AColGroup.CompressionType`

### Method Summary

All Methods Instance Methods Concrete Methods
`AColGroup` `binaryRowOp(BinaryOperator op, double[] v, boolean sparseSafe, boolean left)` Perform a binary row operation.
`void` `countNonZerosPerRow(int[] rnnz, int rl, int ru)` Count the number of non-zeros per row
`long` `estimateInMemorySize()` Get the upper bound estimate of in memory allocation for the column group.
`double` `get(int r, int c)` Get the value at a global row/column position.
`org.apache.sysds.runtime.compress.colgroup.AColGroup.ColGroupType` `getColGroupType()` Internally get the specific type of ColGroup, this could be extracted from the object but that does not allow for nice switches in the code.
`AColGroup.CompressionType` `getCompType()` Obtain the compression type.
`int[]` `getCounts(int[] counts)`
`int[]` `getCounts(int rl, int ru, int[] counts)`
`long` `getExactSizeOnDisk()` Returns the exact serialized size of column group.
`int` `getIndexStructureHash()`
`Dictionary` `preAggregateThatDDCStructure(ColGroupDDC that, Dictionary ret)`
`Dictionary` `preAggregateThatSDCSingleStructure(ColGroupSDCSingle that, Dictionary ret, boolean preModified)`
`Dictionary` `preAggregateThatSDCSingleZerosStructure(ColGroupSDCSingleZeros that, Dictionary ret)`
`Dictionary` `preAggregateThatSDCStructure(ColGroupSDC that, Dictionary ret, boolean preModified)`
`Dictionary` `preAggregateThatSDCZerosStructure(ColGroupSDCZeros that, Dictionary ret)`
`void` `readFields(DataInput in)` Deserialize column group from data input.
`boolean` `sameIndexStructure(ColGroupCompressed that)`
`AColGroup` `scalarOperation(ScalarOperator op)` Perform the specified scalar operation directly on the compressed column group, without decompressing individual cells if possible.
`String` `toString()`
`void` `write(DataOutput out)` Serializes column group to data output.

### Methods inherited from class org.apache.sysds.runtime.compress.colgroup.ColGroupValue

`addMinMax, cleanupThreadLocalMemory, containsValue, copy, copyAndSet, copyAndSet, copyAndSet, copyAndSet, decompressToBlockSafe, decompressToBlockUnSafe, getCachedCounts, getCounts, getCounts, getDictionary, getIfCountsType, getNumberNonZeros, getNumValues, getValues, getValuesAsBlock, isDense, isLossy, leftMultByAColGroup, leftMultByMatrix, preAggregateThatIndexStructure, replace, rightMultByMatrix, setupThreadLocalMemory, tsmm, tsmm`

### Methods inherited from class org.apache.sysds.runtime.compress.colgroup.ColGroupCompressed

`getMax, getMin, getNumRows, unaryAggregateOperations, unaryAggregateOperations`

### Methods inherited from class org.apache.sysds.runtime.compress.colgroup.AColGroup

`decompressColumnToBlockUnSafe, decompressToBlockUnSafe, getColIndices, getNumCols, leftMultByMatrix, shiftColIndices, sliceColumn, sliceColumns`

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

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

### Method Detail

#### getCompType

    public AColGroup.CompressionType getCompType()

Description copied from class: `AColGroup`
Obtain the compression type.

Specified by:
  `getCompType` in class `AColGroup`
Returns:
  How the elements of the column group are compressed.

#### getColGroupType

    public org.apache.sysds.runtime.compress.colgroup.AColGroup.ColGroupType getColGroupType()

Description copied from class: `AColGroup`
Internally get the specific type of ColGroup, this could be extracted from the object but that does not allow for nice switches in the code.

Returns:
  ColGroupType of the object.

#### get

    public double get(int r,
                      int c)

Description copied from class: `AColGroup`
Get the value at a global row/column position.

Specified by:
  `get` in class `AColGroup`
Parameters:
  `r` - row
  `c` - column
Returns:
  value at the row/column position

#### countNonZerosPerRow

    public void countNonZerosPerRow(int[] rnnz,
                                    int rl,
                                    int ru)

Description copied from class: `AColGroup`
Count the number of non-zeros per row

Specified by:
  `countNonZerosPerRow` in class `AColGroup`
Parameters:
  `rnnz` - non-zeros per row
  `rl` - row lower bound, inclusive
  `ru` - row upper bound, exclusive

#### getCounts

    public int[] getCounts(int[] counts)

Specified by:
  `getCounts` in class `ColGroupValue`

#### getCounts

    public int[] getCounts(int rl,
                           int ru,
                           int[] counts)

Specified by:
  `getCounts` in class `ColGroupValue`

#### estimateInMemorySize

    public long estimateInMemorySize()

Description copied from class: `AColGroup`
Get the upper bound estimate of in memory allocation for the column group.

Overrides:
  `estimateInMemorySize` in class `ColGroupValue`
Returns:
  an upper bound on the number of bytes used to store this ColGroup in memory.

#### scalarOperation

    public AColGroup scalarOperation(ScalarOperator op)

Description copied from class: `AColGroup`
Perform the specified scalar operation directly on the compressed column group, without decompressing individual cells if possible.

Specified by:
  `scalarOperation` in class `AColGroup`
Parameters:
  `op` - operation to perform
Returns:
  version of this column group with the operation applied

#### binaryRowOp

    public AColGroup binaryRowOp(BinaryOperator op,
                                 double[] v,
                                 boolean sparseSafe,
                                 boolean left)

Description copied from class: `AColGroup`
Perform a binary row operation.

Specified by:
  `binaryRowOp` in class `AColGroup`
Parameters:
  `op` - The operation to execute
  `v` - The vector of values to apply, should be same length as dictionary length.
  `sparseSafe` - True if the operation return 0 on all instances of values in v -- op(v[?], 0)
  `left` - Specifies if the operation is executed on the left or right side of the values contained.
Returns:
  A updated column group with the new values.

#### write

    public void write(DataOutput out)
               throws IOException

Description copied from class: `AColGroup`
Serializes column group to data output.

Overrides:
  `write` in class `ColGroupValue`
Parameters:
  `out` - data output
Throws:
  `IOException` - if IOException occurs

#### readFields

    public void readFields(DataInput in)
                    throws IOException

Description copied from class: `AColGroup`
Deserialize column group from data input.

Overrides:
  `readFields` in class `ColGroupValue`
Parameters:
  `in` - data input
Throws:
  `IOException` - if IOException occurs

#### getExactSizeOnDisk

    public long getExactSizeOnDisk()

Description copied from class: `AColGroup`
Returns the exact serialized size of column group. This can be used for example for buffer preallocation.

Overrides:
  `getExactSizeOnDisk` in class `ColGroupValue`
Returns:
  exact serialized size for column group

#### sameIndexStructure

    public boolean sameIndexStructure(ColGroupCompressed that)

#### getIndexStructureHash

    public int getIndexStructureHash()

#### toString

    public String toString()

Overrides:
  `toString` in class `ColGroupValue`

#### preAggregateThatDDCStructure

    public Dictionary preAggregateThatDDCStructure(ColGroupDDC that,
                                                   Dictionary ret)

#### preAggregateThatSDCStructure

    public Dictionary preAggregateThatSDCStructure(ColGroupSDC that,
                                                   Dictionary ret,
                                                   boolean preModified)

#### preAggregateThatSDCZerosStructure

    public Dictionary preAggregateThatSDCZerosStructure(ColGroupSDCZeros that,
                                                        Dictionary ret)

#### preAggregateThatSDCSingleZerosStructure

    public Dictionary preAggregateThatSDCSingleZerosStructure(ColGroupSDCSingleZeros that,
                                                              Dictionary ret)

#### preAggregateThatSDCSingleStructure

    public Dictionary preAggregateThatSDCSingleStructure(ColGroupSDCSingle that,
                                                         Dictionary ret,
                                                         boolean preModified)