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
Base class for all column selection readers.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ReaderColumnSelectioncreateDeltaReader(MatrixBlock rawBlock, IColIndex colIndices, boolean transposed) Create a reader of the matrix block that computes delta values (current row - previous row) on-the-fly.static ReaderColumnSelectioncreateDeltaReader(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.static ReaderColumnSelectioncreateQuantizedReader(MatrixBlock rawBlock, IColIndex colIndices, boolean transposed, double[] scaleFactors) Create a reader of the matrix block that directly reads quantized values using scale factors.static ReaderColumnSelectioncreateQuantizedReader(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.static ReaderColumnSelectioncreateReader(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.static ReaderColumnSelectioncreateReader(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.intGet the current row index that the reader is at.final DblArraynextRow()Gets the next row, null when no more rows.
-
Method Details
-
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 thoughcolIndices- The column indexes to extract and insert into the double arraytransposed- 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 thoughcolIndices- The column indexes to extract and insert into the double arraytransposed- If the raw block should be treated as transposedscaleFactors- 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 thoughcolIndices- The column indexes to extract and insert into the double arraytransposed- If the raw block should be treated as transposedrl- The row to start atru- 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 thoughcolIndices- The column indexes to extract and insert into the double arraytransposed- If the raw block should be treated as transposedrl- The row to start atru- 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 thoughcolIndices- The column indexes to extract and insert into the double arraytransposed- 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 thoughcolIndices- The column indexes to extract and insert into the double arraytransposed- If the raw block should be treated as transposedrl- The row to start atru- The row to end at (not inclusive)- Returns:
- A delta reader of the columns specified
-