Class ReaderColumnSelection

java.lang.Object
org.apache.sysds.runtime.compress.readers.ReaderColumnSelection
Direct Known Subclasses:
ReaderColumnSelectionDenseMultiBlock, ReaderColumnSelectionDenseMultiBlockDelta, ReaderColumnSelectionDenseMultiBlockTransposed, ReaderColumnSelectionDenseSingleBlock, ReaderColumnSelectionDenseSingleBlockDelta, ReaderColumnSelectionDenseSingleBlockQuantized, ReaderColumnSelectionDenseSingleBlockTransposed, ReaderColumnSelectionEmpty, ReaderColumnSelectionSparse, ReaderColumnSelectionSparseDelta, ReaderColumnSelectionSparseTransposed

public abstract class ReaderColumnSelection extends Object
Base class for all column selection readers.
  • Method Details

    • nextRow

      public final DblArray nextRow()
      Gets the next row, null when no more rows.
      Returns:
      next row
    • getCurrentRowIndex

      public int getCurrentRowIndex()
      Get the current row index that the reader is at.
      Returns:
      The row index
    • createReader

      public static ReaderColumnSelection createReader(MatrixBlock rawBlock, IColIndex colIndices, boolean transposed)
      Create a reader of the matrix block that is able to iterate though all the rows and return as dense double arrays. Note the reader reuse the return, therefore if needed for something please copy the returned rows.
      Parameters:
      rawBlock - The block to iterate though
      colIndices - The column indexes to extract and insert into the double array
      transposed - If the raw block should be treated as transposed
      Returns:
      A reader of the columns specified
    • createQuantizedReader

      public static ReaderColumnSelection createQuantizedReader(MatrixBlock rawBlock, IColIndex colIndices, boolean transposed, double[] scaleFactors)
      Create a reader of the matrix block that directly reads quantized values using scale factors. Note the reader reuse the return, therefore if needed for something please copy the returned rows.
      Parameters:
      rawBlock - The block to iterate though
      colIndices - The column indexes to extract and insert into the double array
      transposed - If the raw block should be treated as transposed
      scaleFactors - An array of scale factors applied. - If row-wise scaling is used, this should be an array where each value corresponds to a row. - If a single scalar is provided, it is applied uniformly to the entire matrix.
      Returns:
      A reader of the columns specified
    • createReader

      public static ReaderColumnSelection createReader(MatrixBlock rawBlock, IColIndex colIndices, boolean transposed, int rl, int ru)
      Create a reader of the matrix block that is able to iterate though all the rows and return as dense double arrays. Note the reader reuse the return, therefore if needed for something please copy the returned rows.
      Parameters:
      rawBlock - The block to iterate though
      colIndices - The column indexes to extract and insert into the double array
      transposed - If the raw block should be treated as transposed
      rl - The row to start at
      ru - The row to end at (not inclusive)
      Returns:
      A reader of the columns specified
    • createQuantizedReader

      public static ReaderColumnSelection createQuantizedReader(MatrixBlock rawBlock, IColIndex colIndices, boolean transposed, int rl, int ru, double[] scaleFactors)
      Create a reader of the matrix block that directly reads quantized values using scale factors. Note the reader reuse the return, therefore if needed for something please copy the returned rows.
      Parameters:
      rawBlock - The block to iterate though
      colIndices - The column indexes to extract and insert into the double array
      transposed - If the raw block should be treated as transposed
      rl - The row to start at
      ru - The row to end at (not inclusive)
      scaleFactors - An array of scale factors applied. - If row-wise scaling is used, this should be an array where each value corresponds to a row. - If a single scalar is provided, it is applied uniformly to the entire matrix.
      Returns:
      A reader of the columns specified
    • createDeltaReader

      public static ReaderColumnSelection createDeltaReader(MatrixBlock rawBlock, IColIndex colIndices, boolean transposed)
      Create a reader of the matrix block that computes delta values (current row - previous row) on-the-fly. Note the reader reuse the return, therefore if needed for something please copy the returned rows. The first row is returned as-is (no delta computation).
      Parameters:
      rawBlock - The block to iterate though
      colIndices - The column indexes to extract and insert into the double array
      transposed - If the raw block should be treated as transposed
      Returns:
      A delta reader of the columns specified
    • createDeltaReader

      public static ReaderColumnSelection createDeltaReader(MatrixBlock rawBlock, IColIndex colIndices, boolean transposed, int rl, int ru)
      Create a reader of the matrix block that computes delta values (current row - previous row) on-the-fly. Note the reader reuse the return, therefore if needed for something please copy the returned rows. The first row is returned as-is (no delta computation).
      Parameters:
      rawBlock - The block to iterate though
      colIndices - The column indexes to extract and insert into the double array
      transposed - If the raw block should be treated as transposed
      rl - The row to start at
      ru - The row to end at (not inclusive)
      Returns:
      A delta reader of the columns specified