public abstract class ColGroup extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
protected class |
ColGroup.ColGroupRowIterator
Base class for column group row iterators.
|
static class |
ColGroup.CompressionType |
Modifier and Type | Field and Description |
---|---|
protected int[] |
_colIndexes
Offsets of the columns that make up the column group.
|
protected int |
_numRows
Number of rows in the matrix, for use by child classes.
|
Modifier | Constructor and Description |
---|---|
protected |
ColGroup(int[] colIndices,
int numRows)
Main constructor.
|
protected |
ColGroup(List<Integer> colIndicesList,
int numRows)
Convenience constructor for converting indices to a more compact format.
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
countNonZerosPerRow(int[] rnnz,
int rl,
int ru)
Count the number of non-zeros per row
|
abstract void |
decompressToBlock(MatrixBlock target,
int colpos)
Decompress to block.
|
abstract void |
decompressToBlock(MatrixBlock target,
int[] colIndexTargets)
Decompress the contents of this column group into uncompressed packed
columns
|
abstract 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
|
abstract double |
get(int r,
int c)
Get the value at a global row/column position.
|
int |
getColIndex(int colNum)
Obtain a column index value.
|
int[] |
getColIndices()
Obtain the offsets of the columns in the matrix block that make up the group
|
abstract ColGroup.CompressionType |
getCompType()
Obtain the compression type.
|
abstract long |
getExactSizeOnDisk()
Returns the exact serialized size of column group.
|
abstract Iterator<IJV> |
getIterator(int rl,
int ru,
boolean inclZeros,
boolean rowMajor)
Create a column group iterator for a row index range.
|
int |
getNumCols()
Obtain the number of columns in this column group.
|
int |
getNumRows() |
abstract ColGroup.ColGroupRowIterator |
getRowIterator(int rl,
int ru)
Create a dense row iterator for a row index range.
|
abstract void |
leftMultByRowVector(MatrixBlock vector,
MatrixBlock result)
Multiply the slice of the matrix that this column group represents by a
row vector on the left (the original column vector is assumed to be
transposed already i.e.
|
abstract void |
readFields(DataInput in)
Deserializes column group from data input.
|
void |
readFields(DataInput in,
boolean skipDict)
Deserializes column group from data input.
|
abstract void |
rightMultByVector(MatrixBlock vector,
MatrixBlock result,
int rl,
int ru)
Multiply the slice of the matrix that this column group represents by a
vector on the right.
|
abstract ColGroup |
scalarOperation(org.apache.sysml.runtime.matrix.operators.ScalarOperator op)
Perform the specified scalar operation directly on the compressed column
group, without decompressing individual cells if possible.
|
void |
shiftColIndices(int offset) |
abstract void |
unaryAggregateOperations(org.apache.sysml.runtime.matrix.operators.AggregateUnaryOperator op,
MatrixBlock result) |
abstract void |
write(DataOutput out)
Serializes column group to data output.
|
void |
write(DataOutput out,
boolean skipDict)
Serializes column group to data output.
|
protected int[] _colIndexes
protected int _numRows
protected ColGroup(int[] colIndices, int numRows)
colIndices
- offsets of the columns in the matrix block that make up the
groupnumRows
- total number of rows in the parent blockpublic int[] getColIndices()
public int getColIndex(int colNum)
colNum
- column numberpublic int getNumRows()
public int getNumCols()
public abstract ColGroup.CompressionType getCompType()
public void shiftColIndices(int offset)
public long estimateInMemorySize()
public abstract void decompressToBlock(MatrixBlock target, int rl, int ru)
target
- a matrix block where the columns covered by this column group
have not yet been filled in.rl
- row lowerru
- row upperpublic abstract void decompressToBlock(MatrixBlock target, int[] colIndexTargets)
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.public abstract void decompressToBlock(MatrixBlock target, int colpos)
target
- dense output vectorcolpos
- column to decompress, error if larger or equal numColspublic abstract void write(DataOutput out) throws IOException
out
- data outputIOException
- if IOException occurspublic void write(DataOutput out, boolean skipDict) throws IOException
out
- data outputskipDict
- skip shared dictionaryIOException
- if IOException occurspublic abstract void readFields(DataInput in) throws IOException
in
- data inputIOException
- if IOException occurspublic void readFields(DataInput in, boolean skipDict) throws IOException
in
- data inputskipDict
- skip shared dictionaryIOException
- if IOException occurspublic abstract long getExactSizeOnDisk()
public abstract double get(int r, int c)
r
- rowc
- columnpublic abstract void rightMultByVector(MatrixBlock vector, MatrixBlock result, int rl, int ru)
vector
- vector to multiply by (tall vector)result
- accumulator for holding the resultrl
- row lowerru
- row upper
if the internal SystemML code that performs the
multiplication experiences an errorpublic abstract void leftMultByRowVector(MatrixBlock vector, MatrixBlock result)
vector
- row vectorresult
- matrix block resultpublic abstract ColGroup scalarOperation(org.apache.sysml.runtime.matrix.operators.ScalarOperator op)
op
- operation to performpublic abstract void unaryAggregateOperations(org.apache.sysml.runtime.matrix.operators.AggregateUnaryOperator op, MatrixBlock result)
public abstract Iterator<IJV> getIterator(int rl, int ru, boolean inclZeros, boolean rowMajor)
rl
- row lower index, inclusiveru
- row upper index, exclusiveinclZeros
- include zero values into scope of iteratorrowMajor
- use a row major iteration orderpublic abstract ColGroup.ColGroupRowIterator getRowIterator(int rl, int ru)
rl
- row lower index, inclusiveru
- row upper index, exclusiveprotected abstract void countNonZerosPerRow(int[] rnnz, int rl, int ru)
rnnz
- non-zeros per rowrl
- row lower bound, inclusiveru
- row upper bound, exclusiveCopyright © 2018 The Apache Software Foundation. All rights reserved.