Package org.apache.sysds.runtime.compress.colgroup.dictionary

## Class ADictionary

- java.lang.Object
- - org.apache.sysds.runtime.compress.colgroup.dictionary.ADictionary

All Implemented Interfaces:
  `Serializable`, `IDictionary`

Direct Known Subclasses:
  `Dictionary`, `IdentityDictionary`, `MatrixBlockDictionary`, `QDictionary`

    public abstract class ADictionary
    extends Object
    implements IDictionary, Serializable

This dictionary class aims to encapsulate the storage and operations over unique tuple values of a column group.

See Also:
  Serialized Form

### 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
`ADictionary()`

### Method Summary

All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
`CM_COV_Object` `centralMoment​(ValueFunction fn, int[] counts, int nRows)` Central moment function to calculate the central moment of this column group.
`CM_COV_Object` `centralMomentWithDefault​(ValueFunction fn, int[] counts, double def, int nRows)` Central moment function to calculate the central moment of this column group with a default offset on all missing tuples.
`CM_COV_Object` `centralMomentWithReference​(ValueFunction fn, int[] counts, double reference, int nRows)` Central moment function to calculate the central moment of this column group with a reference offset on each tuple.
`abstract IDictionary` `clone()` Returns a deep clone of the dictionary.
`static void` `correctNan​(double[] res, IColIndex colIndexes)` Correct Nan Values in an result.
`static String` `doubleToString​(double v)` Make a double into a string, if the double is a whole number then return it without decimal points
`boolean` `equals​(double[] v)` Indicate if this object is equal to the given array of doubles.
`boolean` `equals​(Object o)` Indicate if this object is equal to another this takes into part sematic equivalence

### Methods inherited from class java.lang.Object

`getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.apache.sysds.runtime.compress.colgroup.dictionary.IDictionary

`addToEntry, addToEntry, addToEntryVectorized, aggregate, aggregateCols, aggregateColsWithReference, aggregateRows, aggregateRowsWithDefault, aggregateRowsWithReference, aggregateWithReference, applyScalarOp, applyScalarOpAndAppend, applyScalarOpWithReference, applyUnaryOp, applyUnaryOpAndAppend, applyUnaryOpWithReference, binOpLeft, binOpLeftAndAppend, binOpLeftWithReference, binOpRight, binOpRight, binOpRightAndAppend, binOpRightWithReference, cbind, centralMoment, centralMomentWithDefault, centralMomentWithReference, colProduct, colProductWithReference, colSum, colSumSq, colSumSqWithReference, containsValue, containsValueWithReference, equals, getDictType, getExactSizeOnDisk, getInMemorySize, getMBDict, getNumberNonZeros, getNumberNonZerosWithReference, getNumberOfValues, getSparsity, getString, getValue, getValue, getValues, MMDict, MMDictDense, MMDictScaling, MMDictScalingDense, MMDictScalingSparse, MMDictSparse, multiplyScalar, preaggValuesFromDense, product, productAllRowsToDouble, productAllRowsToDoubleWithDefault, productAllRowsToDoubleWithReference, productWithDefault, productWithReference, reorder, replace, replaceWithReference, rexpandCols, rexpandColsWithReference, scaleTuples, sliceOutColumnRange, subtractTuple, sum, sumAllRowsToDouble, sumAllRowsToDoubleSq, sumAllRowsToDoubleSqWithDefault, sumAllRowsToDoubleSqWithReference, sumAllRowsToDoubleWithDefault, sumAllRowsToDoubleWithReference, sumSq, sumSqWithReference, TSMMToUpperTriangle, TSMMToUpperTriangleDense, TSMMToUpperTriangleDenseScaling, TSMMToUpperTriangleScaling, TSMMToUpperTriangleSparse, TSMMToUpperTriangleSparseScaling, TSMMWithScaling, write`

### Constructor Detail

#### ADictionary

    public ADictionary()

### Method Detail

#### clone

    public abstract IDictionary clone()

Description copied from interface: `IDictionary`
Returns a deep clone of the dictionary.

Specified by:
  `clone` in interface `IDictionary`
Returns:
  A deep clone

#### centralMoment

    public final CM_COV_Object centralMoment​(ValueFunction fn,
                                             int[] counts,
                                             int nRows)

Description copied from interface: `IDictionary`
Central moment function to calculate the central moment of this column group. MUST be on a single column dictionary.

Specified by:
  `centralMoment` in interface `IDictionary`
Parameters:
  `fn` - The value function to apply
  `counts` - The weight of individual tuples
  `nRows` - The number of rows in total of the column group
Returns:
  The central moment Object

#### centralMomentWithDefault

    public final CM_COV_Object centralMomentWithDefault​(ValueFunction fn,
                                                        int[] counts,
                                                        double def,
                                                        int nRows)

Description copied from interface: `IDictionary`
Central moment function to calculate the central moment of this column group with a default offset on all missing tuples. MUST be on a single column dictionary.

Specified by:
  `centralMomentWithDefault` in interface `IDictionary`
Parameters:
  `fn` - The value function to apply
  `counts` - The weight of individual tuples
  `def` - The default values to offset the tuples with
  `nRows` - The number of rows in total of the column group
Returns:
  The central moment Object

#### centralMomentWithReference

    public final CM_COV_Object centralMomentWithReference​(ValueFunction fn,
                                                          int[] counts,
                                                          double reference,
                                                          int nRows)

Description copied from interface: `IDictionary`
Central moment function to calculate the central moment of this column group with a reference offset on each tuple. MUST be on a single column dictionary.

Specified by:
  `centralMomentWithReference` in interface `IDictionary`
Parameters:
  `fn` - The value function to apply
  `counts` - The weight of individual tuples
  `reference` - The reference values to offset the tuples with
  `nRows` - The number of rows in total of the column group
Returns:
  The central moment Object

#### equals

    public final boolean equals​(Object o)

Description copied from interface: `IDictionary`
Indicate if this object is equal to another this takes into part sematic equivalence

Specified by:
  `equals` in interface `IDictionary`
Overrides:
  `equals` in class `Object`
Parameters:
  `o` - The other object
Returns:
  If they are equal

#### equals

    public final boolean equals​(double[] v)

Description copied from interface: `IDictionary`
Indicate if this object is equal to the given array of doubles.

Specified by:
  `equals` in interface `IDictionary`
Parameters:
  `v` - The list of double values
Returns:
  If they are equal to this.

#### doubleToString

    public static String doubleToString​(double v)

Make a double into a string, if the double is a whole number then return it without decimal points

Parameters:
  `v` - The value
Returns:
  The string

#### correctNan

    public static void correctNan​(double[] res,
                                  IColIndex colIndexes)

Correct Nan Values in an result. If there are any NaN values in the given Res then they are replaced with 0.

Parameters:
  `res` - The array to correct
  `colIndexes` - The column indexes.