Class DeltaDictionary
java.lang.Object
org.apache.sysds.runtime.compress.colgroup.dictionary.ADictionary
org.apache.sysds.runtime.compress.colgroup.dictionary.DeltaDictionary
- All Implemented Interfaces:
Serializable,IDictionary
This dictionary class is a specialization for the DeltaDDCColgroup. Here the adjustments for operations for the delta
encoded values are implemented.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.sysds.runtime.compress.colgroup.dictionary.IDictionary
IDictionary.DictType -
Field Summary
Fields inherited from interface org.apache.sysds.runtime.compress.colgroup.dictionary.IDictionary
LOG -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAllocate a new dictionary and applies the scalar operation on each cell of to then return the new dictionary.clone()Returns a deep clone of the dictionary.booleanIndicate if the other dictionary is equal to this.Get the dictionary type this dictionary is.longCalculate the space consumption if the dictionary is stored on disk.longReturns the memory usage of the dictionary.longgetNumberNonZeros(int[] counts, int nCol) Calculate the number of non zeros in the dictionary.intgetNumberOfColumns(int nrow) Get the number of columns in this dictionary, provided you know the number of values, or rows.intgetNumberOfValues(int ncol) Get the number of distinct tuples given that the column group has n columnsgetString(int colIndexes) Get a string representation of the dictionary, that considers the layout of the data.doublegetValue(int i, int col, int nCol) Get Specific value contain in dictionary at index.double[]Get all the values contained in the dictionary as a linearized double array.static DeltaDictionarysliceColumns(IntArrayList selectedColumns, int nCol) Slice out the selected columns given of this encoded group.int[]sort()Sort the values of this dictionary via an index of how the values mapped previously.voidwrite(DataOutput out) Write the dictionary to a DataOutput.Methods inherited from class org.apache.sysds.runtime.compress.colgroup.dictionary.ADictionary
addToEntry, addToEntry, addToEntryVectorized, aggregate, aggregateCols, aggregateColsWithReference, aggregateRows, aggregateRowsWithDefault, aggregateRowsWithReference, aggregateWithReference, append, applyScalarOpAndAppend, applyScalarOpWithReference, applyUnaryOp, applyUnaryOpAndAppend, applyUnaryOpWithReference, binOpLeft, binOpLeftAndAppend, binOpLeftWithReference, binOpRight, binOpRight, binOpRightAndAppend, binOpRightWithReference, cbind, centralMoment, centralMoment, centralMomentWithDefault, centralMomentWithDefault, centralMomentWithReference, centralMomentWithReference, colProduct, colProductWithReference, colSum, colSumSq, colSumSqWithReference, containsValue, containsValueWithReference, correctNan, countNNZZeroColumns, equals, equals, getMBDict, getMBDict, getNumberNonZerosWithReference, getRow, getSparsity, getValue, MMDict, MMDictDense, MMDictScaling, MMDictScalingDense, MMDictScalingSparse, MMDictSparse, multiplyScalar, preaggValuesFromDense, product, productAllRowsToDouble, productAllRowsToDoubleWithDefault, productAllRowsToDoubleWithReference, productWithDefault, productWithReference, putDense, putSparse, reorder, replace, replaceWithReference, rexpandCols, rexpandColsWithReference, rightMMPreAggSparse, scaleTuples, sliceOutColumnRange, subtractTuple, sum, sumAllRowsToDouble, sumAllRowsToDoubleSq, sumAllRowsToDoubleSqWithDefault, sumAllRowsToDoubleSqWithReference, sumAllRowsToDoubleWithDefault, sumAllRowsToDoubleWithReference, sumSq, sumSqWithReference, TSMMToUpperTriangle, TSMMToUpperTriangleDense, TSMMToUpperTriangleDenseScaling, TSMMToUpperTriangleScaling, TSMMToUpperTriangleSparse, TSMMToUpperTriangleSparseScaling, TSMMWithScaling
-
Constructor Details
-
DeltaDictionary
public DeltaDictionary(double[] values, int numCols)
-
-
Method Details
-
getValues
public double[] getValues()Description copied from interface:IDictionaryGet all the values contained in the dictionary as a linearized double array.- Specified by:
getValuesin interfaceIDictionary- Overrides:
getValuesin classADictionary- Returns:
- linearized double array
-
getValue
public double getValue(int i, int col, int nCol) Description copied from interface:IDictionaryGet Specific value contain in dictionary at index.- Specified by:
getValuein interfaceIDictionary- Overrides:
getValuein classADictionary- Parameters:
i- Row targetcol- Col targetnCol- nCol in dictionary- Returns:
- value
-
applyScalarOp
Description copied from interface:IDictionaryAllocate a new dictionary and applies the scalar operation on each cell of to then return the new dictionary.- Specified by:
applyScalarOpin interfaceIDictionary- Overrides:
applyScalarOpin classADictionary- Parameters:
op- The operator.- Returns:
- The new dictionary to return.
-
getInMemorySize
public long getInMemorySize()Description copied from interface:IDictionaryReturns the memory usage of the dictionary.- Returns:
- a long value in number of bytes for the dictionary.
-
write
Description copied from interface:IDictionaryWrite the dictionary to a DataOutput.- Parameters:
out- the output sink to write the dictionary to.- Throws:
IOException- if the sink fails.
-
read
- Throws:
IOException
-
getExactSizeOnDisk
public long getExactSizeOnDisk()Description copied from interface:IDictionaryCalculate the space consumption if the dictionary is stored on disk.- Returns:
- the long count of bytes to store the dictionary.
-
getDictType
Description copied from interface:IDictionaryGet the dictionary type this dictionary is.- Returns:
- The Dictionary type this is.
-
getNumberOfValues
public int getNumberOfValues(int ncol) Description copied from interface:IDictionaryGet the number of distinct tuples given that the column group has n columns- Parameters:
ncol- The number of Columns in the ColumnGroup.- Returns:
- the number of value tuples contained in the dictionary.
-
getNumberOfColumns
public int getNumberOfColumns(int nrow) Description copied from interface:IDictionaryGet the number of columns in this dictionary, provided you know the number of values, or rows.- Parameters:
nrow- The number of rows/values known inside this dictionary- Returns:
- The number of columns
-
getString
Description copied from interface:IDictionaryGet a string representation of the dictionary, that considers the layout of the data.- Parameters:
colIndexes- The number of columns in the dictionary.- Returns:
- A string that is nicer to print.
-
getNumberNonZeros
public long getNumberNonZeros(int[] counts, int nCol) Description copied from interface:IDictionaryCalculate the number of non zeros in the dictionary. The number of non zeros should be scaled with the counts given. This gives the exact number of non zero values in the parent column group.- Parameters:
counts- The counts of each dictionary entrynCol- The number of columns in this dictionary- Returns:
- The nonZero count
-
equals
Description copied from interface:IDictionaryIndicate if the other dictionary is equal to this.- Parameters:
o- The other object- Returns:
- If it is equal
-
clone
Description copied from interface:IDictionaryReturns a deep clone of the dictionary.- Specified by:
clonein interfaceIDictionary- Specified by:
clonein classADictionary- Returns:
- A deep clone
-
sliceColumns
Description copied from interface:IDictionarySlice out the selected columns given of this encoded group.- Parameters:
selectedColumns- The columns to slice out and return as a new matrix.nCol- The number of columns in this dictionary.- Returns:
- The returned matrix
-
sort
public int[] sort()Description copied from interface:IDictionarySort the values of this dictionary via an index of how the values mapped previously. In practice this design means we can reuse the previous dictionary for the resulting column group- Returns:
- The sorted index.
-