public abstract class AColGroup extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
AColGroup.CompressionType
Public super types of compression ColGroups supported
|
Modifier and Type | Method and Description |
---|---|
abstract AColGroup |
binaryRowOp(BinaryOperator op,
double[] v,
boolean sparseSafe,
boolean left)
Perform a binary row operation.
|
static double[] |
colSum(List<AColGroup> groups,
double[] res,
int nRows)
Compute the column sum of the given list of groups
|
abstract void |
computeColSums(double[] c,
int nRows)
Compute the column sum
|
abstract boolean |
containsValue(double pattern)
Detect if the column group contains a specific value.
|
abstract AColGroup |
copy()
Get a copy of this column group.
|
abstract void |
countNonZerosPerRow(int[] rnnz,
int rl,
int ru)
Count the number of non-zeros per row
|
void |
decompressToBlock(MatrixBlock target,
int rl,
int ru)
Decompress the contents of the column group without modifying nonZeroCount.
|
abstract void |
decompressToBlock(MatrixBlock target,
int rl,
int ru,
int offT)
Decompress the contents of the column group without counting non zeros
|
long |
estimateInMemorySize()
Get the upper bound estimate of in memory allocation for the column group.
|
abstract double |
get(int r,
int c)
Get the value at a global row/column position.
|
int[] |
getColIndices()
Obtain the offsets of the columns in the matrix block that make up the group
|
abstract AColGroup.CompressionType |
getCompType()
Obtain the compression type.
|
long |
getExactSizeOnDisk()
Returns the exact serialized size of column group.
|
abstract double |
getMax()
Short hand method for getting maximum value contained in this column group.
|
abstract double |
getMin()
Short hand method for getting minimum value contained in this column group.
|
abstract long |
getNumberNonZeros(int nRows)
Get the number of nonZeros contained in this column group.
|
int |
getNumCols()
Obtain the number of columns in this column group.
|
abstract int |
getNumValues()
Obtain number of distinct tuples in contained sets of values associated with this column group.
|
abstract double[] |
getValues()
Get all the values in the colGroup.
|
abstract MatrixBlock |
getValuesAsBlock()
Returns the ColGroup as a MatrixBlock.
|
abstract boolean |
isDense()
Is dense, signals that the entire column group is allocated an processed.
|
abstract boolean |
isLossy()
Is Lossy
|
abstract void |
leftMultByAColGroup(AColGroup lhs,
MatrixBlock result)
Left side matrix multiplication with a column group that is transposed.
|
void |
leftMultByMatrix(MatrixBlock matrix,
MatrixBlock result)
Left multiply with this column group
|
abstract void |
leftMultByMatrix(MatrixBlock matrix,
MatrixBlock result,
int rl,
int ru)
Left multiply with this column group.
|
void |
readFields(DataInput in)
Deserialize column group from data input.
|
abstract AColGroup |
replace(double pattern,
double replace)
Make a copy of the column group values, and replace all values that match pattern with replacement value.
|
abstract AColGroup |
rightMultByMatrix(MatrixBlock right)
Right matrix multiplication with this column group.
|
abstract AColGroup |
scalarOperation(ScalarOperator op)
Perform the specified scalar operation directly on the compressed column group, without decompressing individual
cells if possible.
|
void |
shiftColIndices(int offset)
Shift all column indexes contained by an offset.
|
AColGroup |
sliceColumn(int col)
Slice out a single column from the column group.
|
AColGroup |
sliceColumns(int cl,
int cu)
Slice out the columns within the range of cl and cu to remove the dictionary values related to these columns.
|
String |
toString() |
abstract void |
tsmm(MatrixBlock ret,
int nRows)
Do a transposed self matrix multiplication on the left side t(x) %*% x.
|
abstract void |
tsmmAColGroup(AColGroup other,
MatrixBlock result)
Matrix multiply with this other column group, but:
1.
|
abstract void |
unaryAggregateOperations(AggregateUnaryOperator op,
double[] c,
int nRows,
int rl,
int ru)
Unary Aggregate operator, since aggregate operators require new object output, the output becomes an uncompressed
matrix.
|
void |
write(DataOutput out)
Serializes column group to data output.
|
public final int[] getColIndices()
public final int getNumCols()
public final void shiftColIndices(int offset)
offset
- The offset to move all columnspublic long estimateInMemorySize()
public final 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 void write(DataOutput out) throws IOException
out
- data outputIOException
- if IOException occurspublic void readFields(DataInput in) throws IOException
in
- data inputIOException
- if IOException occurspublic long getExactSizeOnDisk()
public final void leftMultByMatrix(MatrixBlock matrix, MatrixBlock result)
matrix
- The matrix to multiply with on the leftresult
- The result to output the values into, always dense for the purpose of the column groups
parallelizingpublic final AColGroup sliceColumns(int cl, int cu)
cl
- The lower bound of the columns to selectcu
- The upper bound of the columns to select (not inclusive).public final AColGroup sliceColumn(int col)
col
- The column to slice, the column could potentially not be inside the column grouppublic static double[] colSum(List<AColGroup> groups, double[] res, int nRows)
groups
- The Groups to sumres
- The result to put the values intonRows
- The number of rows in the groupspublic abstract int getNumValues()
public abstract AColGroup.CompressionType getCompType()
public abstract void decompressToBlock(MatrixBlock target, int rl, int ru, int offT)
target
- a matrix block where the columns covered by this column group have not yet been filled in.rl
- row lowerru
- row upperoffT
- Offset into target to assign from, this allows us to decompress into smaller matrices.public abstract double get(int r, int c)
r
- rowc
- columnpublic abstract double[] getValues()
public abstract MatrixBlock getValuesAsBlock()
public abstract AColGroup rightMultByMatrix(MatrixBlock right)
right
- The matrixBlock on the right of this matrix multiplicationpublic abstract void tsmm(MatrixBlock ret, int nRows)
ret
- The return matrix block [numColumns x numColumns]nRows
- The number of rows in the column grouppublic abstract void leftMultByMatrix(MatrixBlock matrix, MatrixBlock result, int rl, int ru)
matrix
- The matrix to multiply with on the leftresult
- The result to output the values into, always dense for the purpose of the column groups
parallelizingrl
- The row to begin the multiplication from on the lhs matrixru
- The row to end the multiplication at on the lhs matrixpublic abstract void leftMultByAColGroup(AColGroup lhs, MatrixBlock result)
lhs
- The left hand side Column group to multiply with, the left hand side should be considered
transposed.result
- The result matrix to insert the result of the multiplication intopublic abstract void tsmmAColGroup(AColGroup other, MatrixBlock result)
other
- The other Column group to multiply withresult
- The result matrix to put the results intopublic abstract AColGroup scalarOperation(ScalarOperator op)
op
- operation to performpublic abstract AColGroup binaryRowOp(BinaryOperator op, double[] v, boolean sparseSafe, boolean left)
op
- The operation to executev
- 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 containedpublic abstract void unaryAggregateOperations(AggregateUnaryOperator op, double[] c, int nRows, int rl, int ru)
op
- The operator usedc
- The output matrix blocknRows
- The total number of rows in the Column Grouprl
- The Starting Row to do aggregation fromru
- The last Row to do aggregation to (not included)public abstract void countNonZerosPerRow(int[] rnnz, int rl, int ru)
rnnz
- non-zeros per rowrl
- row lower bound, inclusiveru
- row upper bound, exclusivepublic abstract boolean isLossy()
public abstract boolean isDense()
public abstract double getMin()
public abstract double getMax()
public abstract AColGroup copy()
public abstract boolean containsValue(double pattern)
pattern
- The value to look for.public abstract long getNumberNonZeros(int nRows)
nRows
- The number of rows in the column group, this is used for groups that does not contain information
about how many rows they have.public abstract AColGroup replace(double pattern, double replace)
pattern
- The value to look forreplace
- The value to replace the other value withpublic abstract void computeColSums(double[] c, int nRows)
c
- The array to add the column sum to.nRows
- The number of rows in the column group.Copyright © 2021 The Apache Software Foundation. All rights reserved.