org.apache.sysds.runtime.compress.colgroup

## Class ColGroupOffset

- java.lang.Object
- - org.apache.sysds.runtime.compress.colgroup.ColGroup
  - - org.apache.sysds.runtime.compress.colgroup.ColGroupValue
    - - org.apache.sysds.runtime.compress.colgroup.ColGroupOffset

- All Implemented Interfaces:
    Serializable
  Direct Known Subclasses:
    ColGroupOLE, ColGroupRLE

      public abstract class ColGroupOffset
      extends ColGroupValue

  Base class for column groups encoded with various types of bitmap encoding. NOTES: * OLE: separate storage segment length and bitmaps led to a 30% improvement but not applied because more difficult to support both data layouts at the same time (distributed/local as well as w/ and w/o low-level opt)
  See Also:
    Serialized Form

- - ### Nested Class Summary

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

      `ColGroup.CompressionType`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `decompressToBlock(MatrixBlock target, int colpos)` Decompress to block.
    `void` | `decompressToBlock(MatrixBlock target, int[] colIndexTargets)` Decompress the contents of this column group into uncompressed packed columns
    `void` | `decompressToBlock(MatrixBlock target, int rl, int ru)` Decompress the contents of this column group into the specified full matrix block.
    `long` | `estimateInMemorySize()` Note: Must be overridden by child classes to account for additional data and metadata
    `double` | `get(int r, int c)` Get the value at a global row/column position.
    `int[]` | `getBitmapOffsets()`
    `char[]` | `getBitmaps()`
    `long` | `getExactSizeOnDisk()` Returns the exact serialized size of column group.
    `abstract Iterator<Integer>` | `getIterator(int k)`
    `Iterator<IJV>` | `getIterator(int rl, int ru, boolean inclZeros, boolean rowMajor)` Create a column group iterator for a row index range.
    `abstract Iterator<Integer>` | `getIterator(int k, int rl, int ru)`
    `boolean` | `hasZeros()`
    `void` | `readFields(DataInput in)` Deserialize column group from data input.
    `String` | `toString()`
    `void` | `write(DataOutput out)` Serializes column group to data output.

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

      `cleanupThreadLocalMemory, getByteValues, getCounts, getCounts, getCounts, getCounts, getIfCountsType, getNumValues, getValues, getValuesAsBlock, isLossy, setupThreadLocalMemory, unaryAggregateOperations, unaryAggregateOperations`

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

      `countNonZerosPerRow, getColIndex, getColIndices, getCompType, getNumCols, getNumRows, getRowIterator, leftMultByMatrix, leftMultByRowVector, leftMultByRowVector, rightMultByMatrix, rightMultByVector, scalarOperation, shiftColIndices`

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

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

- - ### Method Detail

    - #### estimateInMemorySize

          public long estimateInMemorySize()

      Description copied from class: `ColGroup`
      Note: Must be overridden by child classes to account for additional data and metadata
      Specified by:
        `estimateInMemorySize` in class `ColGroup`
      Returns:
        an upper bound on the number of bytes used to store this ColGroup in memory.

    - #### decompressToBlock

          public void decompressToBlock(MatrixBlock target,
                                        int rl,
                                        int ru)

      Description copied from class: `ColGroup`
      Decompress the contents of this column group into the specified full matrix block.
      Specified by:
        `decompressToBlock` in class `ColGroup`
      Parameters:
        `target` - a matrix block where the columns covered by this column group have not yet been filled in.
        `rl` - row lower
        `ru` - row upper

    - #### decompressToBlock

          public void decompressToBlock(MatrixBlock target,
                                        int[] colIndexTargets)

      Description copied from class: `ColGroup`
      Decompress the contents of this column group into uncompressed packed columns
      Specified by:
        `decompressToBlock` in class `ColGroup`
      Parameters:
        `target` - a dense matrix block. The block must have enough space to hold the contents of this column group.
        `colIndexTargets` - array that maps column indices in the original matrix block to columns of target.

    - #### decompressToBlock

          public void decompressToBlock(MatrixBlock target,
                                        int colpos)

      Description copied from class: `ColGroup`
      Decompress to block.
      Specified by:
        `decompressToBlock` in class `ColGroup`
      Parameters:
        `target` - dense output vector
        `colpos` - column to decompress, error if larger or equal numCols

    - #### get

          public double get(int r,
                            int c)

      Description copied from class: `ColGroup`
      Get the value at a global row/column position.
      Specified by:
        `get` in class `ColGroup`
      Parameters:
        `r` - row
        `c` - column
      Returns:
        value at the row/column position

    - #### getBitmaps

          public char[] getBitmaps()

    - #### getBitmapOffsets

          public int[] getBitmapOffsets()

    - #### hasZeros

          public boolean hasZeros()

    - #### readFields

          public void readFields(DataInput in)
                          throws IOException

      Description copied from class: `ColGroup`
      Deserialize column group from data input.
      Overrides:
        `readFields` in class `ColGroupValue`
      Parameters:
        `in` - data input
      Throws:
        `IOException` - if IOException occurs

    - #### write

          public void write(DataOutput out)
                     throws IOException

      Description copied from class: `ColGroup`
      Serializes column group to data output.
      Overrides:
        `write` in class `ColGroupValue`
      Parameters:
        `out` - data output
      Throws:
        `IOException` - if IOException occurs

    - #### getExactSizeOnDisk

          public long getExactSizeOnDisk()

      Description copied from class: `ColGroup`
      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

    - #### getIterator

          public Iterator<IJV> getIterator(int rl,
                                           int ru,
                                           boolean inclZeros,
                                           boolean rowMajor)

      Description copied from class: `ColGroup`
      Create a column group iterator for a row index range.
      Specified by:
        `getIterator` in class `ColGroup`
      Parameters:
        `rl` - row lower index, inclusive
        `ru` - row upper index, exclusive
        `inclZeros` - include zero values into scope of iterator
        `rowMajor` - use a row major iteration order
      Returns:
        an iterator instance

    - #### getIterator

          public abstract Iterator<Integer> getIterator(int k)

      Parameters:
        `k` - index of value tuple with associated bitmap
      Returns:
        an iterator over the row offsets in this bitmap

    - #### getIterator

          public abstract Iterator<Integer> getIterator(int k,
                                                        int rl,
                                                        int ru)

      Parameters:
        `k` - index of value tuple with associated bitmap
        `rl` - row lower index, inclusive
        `ru` - row upper index, exclusive
      Returns:
        an iterator over the row offsets in this bitmap

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `ColGroupValue`

Copyright © 2020 The Apache Software Foundation. All rights reserved.