org.apache.sysds.runtime.compress.colgroup

## Class ColGroupEmpty

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

- All Implemented Interfaces:
    Serializable

      public class ColGroupEmpty
      extends ColGroupCompressed

  See Also:
    Serialized Form

- - ### Nested Class Summary

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

      `AColGroup.CompressionType`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ColGroupEmpty(int[] colIndices, int numRows)` Constructs an Constant Colum Group, that contains only one tuple, with the given value.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addMinMax(double[] ret)`
    `AColGroup` | `binaryRowOp(BinaryOperator op, double[] v, boolean sparseSafe, boolean left)` Perform a binary row operation.
    `boolean` | `containsValue(double pattern)` Detect if the column group contains a specific value.
    `AColGroup` | `copy()` Get a copy of this column group.
    `void` | `countNonZerosPerRow(int[] rnnz, int rl, int ru)` Count the number of non-zeros per row
    `void` | `decompressToBlockSafe(MatrixBlock target, int rl, int ru, int offT)` Decompress the contents of this column group into the specified full matrix block while managing the number of non zeros.
    `void` | `decompressToBlockUnSafe(MatrixBlock target, int rl, int ru, int offT)` Decompress the contents of the columngroup unsafely, meaning that it does not count nonzero values.
    `static ColGroupEmpty` | `generate(int nCol, int nRow)`
    `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.
    `long` | `getNumberNonZeros()` Get the number of nonZeros contained in this column group.
    `int` | `getNumValues()` Obtain number of distinct tuples in contained sets of values associated with this column group.
    `double[]` | `getValues()` Get all the values in the colGroup.
    `MatrixBlock` | `getValuesAsBlock()` Returns the ColGroup as a MatrixBlock.
    `boolean` | `isDense()` Is dense, signals that the entire column group is allocated an processed.
    `boolean` | `isLossy()` Is Lossy
    `void` | `leftMultByAColGroup(AColGroup lhs, MatrixBlock c)` Left side matrix multiplication with a column group that is transposed.
    `void` | `leftMultByMatrix(MatrixBlock a, MatrixBlock c, int rl, int ru)` Left multiply with this column group.
    `AColGroup` | `replace(double pattern, double replace)` Make a copy of the column group values, and replace all values that match pattern with replacement value.
    `AColGroup` | `rightMultByMatrix(MatrixBlock right)` Right matrix multiplication with this column group.
    `AColGroup` | `scalarOperation(ScalarOperator op)` Perform the specified scalar operation directly on the compressed column group, without decompressing individual cells if possible.
    `void` | `tsmm(MatrixBlock ret)` Do a transposed self matrix multiplication on the left side t(x) %*% x.

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

      `estimateInMemorySize, getMax, getMin, getNumRows, toString, unaryAggregateOperations, unaryAggregateOperations`

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

      `decompressColumnToBlockUnSafe, decompressToBlockUnSafe, getColIndices, getExactSizeOnDisk, getNumCols, leftMultByMatrix, readFields, shiftColIndices, sliceColumn, sliceColumns, write`

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

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

- - ### Constructor Detail

    - #### ColGroupEmpty

          public ColGroupEmpty(int[] colIndices,
                               int numRows)

      Constructs an Constant Colum Group, that contains only one tuple, with the given value.
      Parameters:
        `colIndices` - The Colum indexes for the column group.
        `numRows` - The number of rows contained in the group.

  - ### Method Detail

    - #### generate

          public static ColGroupEmpty generate(int nCol,
                                               int nRow)

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

    - #### decompressToBlockSafe

          public void decompressToBlockSafe(MatrixBlock target,
                                            int rl,
                                            int ru,
                                            int offT)

      Description copied from class: `AColGroup`
      Decompress the contents of this column group into the specified full matrix block while managing the number of non zeros.
      Specified by:
        `decompressToBlockSafe` in class `AColGroup`
      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
        `offT` - Offset into target to assign from

    - #### decompressToBlockUnSafe

          public void decompressToBlockUnSafe(MatrixBlock target,
                                              int rl,
                                              int ru,
                                              int offT)

      Description copied from class: `AColGroup`
      Decompress the contents of the columngroup unsafely, meaning that it does not count nonzero values.
      Specified by:
        `decompressToBlockUnSafe` in class `AColGroup`
      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
        `offT` - Offset into target to assign from

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

    - #### leftMultByMatrix

          public void leftMultByMatrix(MatrixBlock a,
                                       MatrixBlock c,
                                       int rl,
                                       int ru)

      Description copied from class: `AColGroup`
      Left multiply with this column group.
      Specified by:
        `leftMultByMatrix` in class `AColGroup`
      Parameters:
        `a` - The matrix to multiply with on the left
        `c` - The result to output the values into, always dense for the purpose of the column groups parallelizing
        `rl` - The row to begin the multiplication from on the lhs matrix
        `ru` - The row to end the multiplication at on the lhs matrix

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

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

    - #### getNumValues

          public int getNumValues()

      Description copied from class: `AColGroup`
      Obtain number of distinct tuples in contained sets of values associated with this column group. If the column group is uncompressed the number or rows is returned.
      Specified by:
        `getNumValues` in class `AColGroup`
      Returns:
        the number of distinct sets of values associated with the bitmaps in this column group

    - #### getValues

          public double[] getValues()

      Description copied from class: `AColGroup`
      Get all the values in the colGroup. Note that this is only the stored values not the way they are stored. Making the output a list of values used in that colGroup not the actual full column.
      Specified by:
        `getValues` in class `ColGroupCompressed`
      Returns:
        a double list of values.

    - #### addMinMax

          public void addMinMax(double[] ret)

      Specified by:
        `addMinMax` in class `ColGroupCompressed`

    - #### isLossy

          public boolean isLossy()

      Description copied from class: `AColGroup`
      Is Lossy
      Specified by:
        `isLossy` in class `ColGroupCompressed`
      Returns:
        returns if the ColGroup is compressed in a lossy manner.

    - #### getValuesAsBlock

          public MatrixBlock getValuesAsBlock()

      Description copied from class: `AColGroup`
      Returns the ColGroup as a MatrixBlock. Used as a fall back solution in case a operation is not supported. Use in connection to getIfCountsType to get if the values are repeated.
      Specified by:
        `getValuesAsBlock` in class `AColGroup`
      Returns:
        Matrix Block of the contained Values. Possibly contained in groups.

    - #### tsmm

          public void tsmm(MatrixBlock ret)

      Description copied from class: `AColGroup`
      Do a transposed self matrix multiplication on the left side t(x) %*% x. but only with this column group. This gives better performance since there is no need to iterate through all the rows of the matrix, but the execution can be limited to its number of distinct values. Note it only calculate the upper triangle
      Specified by:
        `tsmm` in class `AColGroup`
      Parameters:
        `ret` - The return matrix block [numColumns x numColumns]

    - #### leftMultByAColGroup

          public void leftMultByAColGroup(AColGroup lhs,
                                          MatrixBlock c)

      Description copied from class: `AColGroup`
      Left side matrix multiplication with a column group that is transposed.
      Specified by:
        `leftMultByAColGroup` in class `AColGroup`
      Parameters:
        `lhs` - The left hand side Column group to multiply with, the left hand side should be considered transposed.
        `c` - The result matrix to insert the result of the multiplication into

    - #### isDense

          public boolean isDense()

      Description copied from class: `AColGroup`
      Is dense, signals that the entire column group is allocated an processed. This is useful in Row wise min and max for instance, to avoid having to scan through each row to look for empty rows. an example where it is true is DDC, Const and Uncompressed. examples where false is OLE and RLE.
      Specified by:
        `isDense` in class `AColGroup`
      Returns:
        returns if the colGroup is allocated in a dense fashion.

    - #### copy

          public AColGroup copy()

      Description copied from class: `AColGroup`
      Get a copy of this column group. Depending on which column group is copied it is a deep or shallow copy. If the primitives for the underlying column groups is Immutable then only shallow copies is performed.
      Specified by:
        `copy` in class `AColGroup`
      Returns:
        Get a copy of this column group.

    - #### containsValue

          public boolean containsValue(double pattern)

      Description copied from class: `AColGroup`
      Detect if the column group contains a specific value.
      Specified by:
        `containsValue` in class `AColGroup`
      Parameters:
        `pattern` - The value to look for.
      Returns:
        boolean saying true if the value is contained.

    - #### getNumberNonZeros

          public long getNumberNonZeros()

      Description copied from class: `AColGroup`
      Get the number of nonZeros contained in this column group.
      Specified by:
        `getNumberNonZeros` in class `AColGroup`
      Returns:
        The nnz.

    - #### rightMultByMatrix

          public AColGroup rightMultByMatrix(MatrixBlock right)

      Description copied from class: `AColGroup`
      Right matrix multiplication with this column group.
      Specified by:
        `rightMultByMatrix` in class `AColGroup`
      Parameters:
        `right` - The matrixBlock on the right of this matrix multiplication
      Returns:
        The new Column Group that is the result of the matrix multiplication.

    - #### replace

          public AColGroup replace(double pattern,
                                   double replace)

      Description copied from class: `AColGroup`
      Make a copy of the column group values, and replace all values that match pattern with replacement value.
      Specified by:
        `replace` in class `AColGroup`
      Parameters:
        `pattern` - The value to look for
        `replace` - The value to replace the other value with
      Returns:
        A new Column Group, reusing the index structure but with new values.

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