public abstract class ADictionary extends Object
| Constructor and Description | 
|---|
| ADictionary() | 
| Modifier and Type | Method and Description | 
|---|---|
| abstract void | addMaxAndMin(double[] ret,
            int[] colIndexes)This method adds the max and min values contained in the dictionary to corresponding cells in the ret variable. | 
| abstract void | addToEntry(Dictionary d,
          int fr,
          int to,
          int nCol)Copies and adds the dictionary entry from this dictionary to the d dictionary | 
| abstract double | aggregate(double init,
         Builtin fn)Aggregate all the contained values, useful in value only computations where the operation is iterating through
 all values contained in the dictionary. | 
| abstract void | aggregateCols(double[] c,
             Builtin fn,
             int[] colIndexes)Aggregates the columns into the target double array provided. | 
| abstract double[] | aggregateTuples(Builtin fn,
               int nCol)Aggregate all entries in the rows. | 
| abstract ADictionary | apply(ScalarOperator op)Applies the scalar operation on the dictionary. | 
| ADictionary | applyBinaryRowOp(BinaryOperator op,
                double[] v,
                boolean sparseSafe,
                int[] colIndexes,
                boolean left)Apply binary row operation on this dictionary. | 
| abstract ADictionary | applyBinaryRowOpLeft(BinaryOperator op,
                    double[] v,
                    boolean sparseSafe,
                    int[] colIndexes)Apply binary row operation on this dictionary on the left side. | 
| abstract ADictionary | applyBinaryRowOpRight(BinaryOperator op,
                     double[] v,
                     boolean sparseSafe,
                     int[] colIndexes)Apply binary row operation on this dictionary on the right side. | 
| abstract ADictionary | applyScalarOp(ScalarOperator op,
             double newVal,
             int numCols)Applies the scalar operation on the dictionary. | 
| abstract ADictionary | clone()Returns a deep clone of the dictionary. | 
| abstract ADictionary | cloneAndExtend(int len)Clone the dictionary, and extend size of the dictionary by a given length | 
| abstract void | colSum(double[] c,
      int[] counts,
      int[] colIndexes,
      boolean square)Get the column sum of the values contained in the dictionary | 
| abstract double[] | colSum(int[] counts,
      int nCol)get the column sum of this dictionary only. | 
| abstract boolean | containsValue(double pattern)Detect if the dictionary contains a specific value. | 
| abstract MatrixBlockDictionary | getAsMatrixBlockDictionary(int nCol)Get this dictionary as a matrixBlock dictionary. | 
| abstract long | getExactSizeOnDisk()Calculate the space consumption if the dictionary is stored on disk. | 
| abstract long | getInMemorySize()Returns the memory usage of the dictionary. | 
| double[] | getMostCommonTuple(int[] counts,
                  int nCol)Get the most common tuple element contained in the dictionary
 
 returns null if that tuple is all zero values. | 
| abstract long | getNumberNonZeros(int[] counts,
                 int nCol)Calculate the number of non zeros in the dictionary. | 
| abstract int | getNumberOfValues(int ncol)Get the number of distinct tuples given that the column group has n columns | 
| abstract String | getString(int colIndexes)Get a string representation of the dictionary, that considers the layout of the data. | 
| abstract double[] | getTuple(int index,
        int nCol)Get the values contained in a specific tuple of the dictionary. | 
| abstract double | getValue(int i)Get Specific value contained in the dictionary at index. | 
| abstract double[] | getValues()Get all the values contained in the dictionary as a linearized double array. | 
| abstract boolean | isLossy()Specify if the Dictionary is lossy. | 
| abstract ADictionary | preaggValuesFromDense(int numVals,
                     int[] colIndexes,
                     int[] aggregateColumns,
                     double[] b,
                     int cut)Pre Aggregate values for right Matrix Multiplication. | 
| abstract ADictionary | reExpandColumns(int max)return a new Dictionary that have re expanded all values, based on the entries already contained. | 
| abstract ADictionary | replace(double pattern,
       double replace,
       int nCol,
       boolean safe)Make a copy of the values, and replace all values that match pattern with replacement value. | 
| abstract ADictionary | scaleTuples(int[] scaling,
           int nCol)Scale all tuples contained in the dictionary by the scaling factor given in the int list. | 
| abstract ADictionary | sliceOutColumnRange(int idxStart,
                   int idxEnd,
                   int previousNumberOfColumns)Modify the dictionary by removing columns not within the index range. | 
| abstract ADictionary | subtractTuple(double[] tuple)Allocate a new dictionary where the tuple given is subtracted from all tuples in the previous dictionary. | 
| abstract double | sum(int[] counts,
   int nCol)Get the sum of the values contained in the dictionary | 
| abstract double[] | sumAllRowsToDouble(boolean square,
                  int nrColumns)Method used as a pre-aggregate of each tuple in the dictionary, to single double values. | 
| abstract double | sumRow(int k,
      boolean square,
      int nrColumns)Sum the values at a specific row. | 
| abstract double | sumsq(int[] counts,
     int nCol)Get the square sum of the values contained in the dictionary | 
| abstract void | write(DataOutput out)Write the dictionary to a DataOutput. | 
public abstract double[] getValues()
public abstract double getValue(int i)
i - The index to extract the value frompublic abstract long getInMemorySize()
public abstract double aggregate(double init,
                                 Builtin fn)
init - The initial Value, in cases such as Max value, this could be -infinityfn - The Function to apply to valuespublic abstract double[] aggregateTuples(Builtin fn, int nCol)
fn - The aggregate functionnCol - The number of columns contained in the dictionary.public abstract ADictionary apply(ScalarOperator op)
op - The operator to apply to the dictionary values.public abstract ADictionary applyScalarOp(ScalarOperator op, double newVal, int numCols)
op - The operator to apply to the dictionary values.newVal - The value to append to the dictionary.numCols - The number of columns stored in the dictionary.public ADictionary applyBinaryRowOp(BinaryOperator op, double[] v, boolean sparseSafe, int[] colIndexes, boolean left)
op - The operation to this dictionaryv - The values to use on the left hand side.sparseSafe - boolean specifying if the operation is safe, and therefore dont need to allocate an extended
                   dictionarycolIndexes - The column indexes to consider inside v.left - A Boolean specifying if the operation is done on the left or right side of the dictionary.public abstract ADictionary applyBinaryRowOpLeft(BinaryOperator op, double[] v, boolean sparseSafe, int[] colIndexes)
op - The operation to this dictionaryv - The values to use on the left hand side.sparseSafe - boolean specifying if the operation is safe, and therefore dont need to allocate an extended
                   dictionarycolIndexes - The column indexes to consider inside v.public abstract ADictionary applyBinaryRowOpRight(BinaryOperator op, double[] v, boolean sparseSafe, int[] colIndexes)
op - The operation to this dictionaryv - The values to use on the right hand side.sparseSafe - boolean specifying if the operation is safe, and therefore dont need to allocate an extended
                   dictionarycolIndexes - The column indexes to consider inside v.public abstract ADictionary clone()
public abstract ADictionary cloneAndExtend(int len)
len - The length to extend the dictionary, it is assumed this value is positive.public abstract void aggregateCols(double[] c,
                                   Builtin fn,
                                   int[] colIndexes)
c - The target double array, this contains the full number of columns, therefore the colIndexes for
                   this specific dictionary is needed.fn - The function to apply to individual columnscolIndexes - The mapping to the target columns from the individual columnspublic abstract void write(DataOutput out) throws IOException
out - the output sink to write the dictionary to.IOException - if the sink fails.public abstract long getExactSizeOnDisk()
public abstract boolean isLossy()
public abstract int getNumberOfValues(int ncol)
ncol - The number of Columns in the ColumnGroup.public abstract double[] sumAllRowsToDouble(boolean square,
                                            int nrColumns)
square - If each entry should be squared.nrColumns - The number of columns in the ColGroup to know how to get the values from the dictionary.public abstract double sumRow(int k,
                              boolean square,
                              int nrColumns)
k - The row index to sumsquare - If each entry should be squared.nrColumns - The number of columnspublic abstract double[] colSum(int[] counts,
                                int nCol)
counts - the counts of the values containednCol - The number of columns contained in each tuple.public abstract void colSum(double[] c,
                            int[] counts,
                            int[] colIndexes,
                            boolean square)
c - The output array allocated to contain all column groups output.counts - The counts of the individual tuples.colIndexes - The columns indexes of the parent column group, this indicate where to put the column sum into
                   the c output.square - Specify if the values should be squaredpublic abstract double sum(int[] counts,
                           int nCol)
counts - The counts of the individual tuplesnCol - The number of columns containedpublic abstract double sumsq(int[] counts,
                             int nCol)
counts - The counts of the individual tuplesnCol - The number of columns containedpublic abstract String getString(int colIndexes)
colIndexes - The number of columns in the dictionary.public abstract void addMaxAndMin(double[] ret,
                                  int[] colIndexes)
ret - The double array that contains all columns min and max.colIndexes - The column indexes contained in this dictionary.public abstract ADictionary sliceOutColumnRange(int idxStart, int idxEnd, int previousNumberOfColumns)
idxStart - The column index to start at.idxEnd - The column index to end at (not inclusive)previousNumberOfColumns - The number of columns contained in the dictionary.public abstract ADictionary reExpandColumns(int max)
max - The number of output columns possible.public abstract boolean containsValue(double pattern)
pattern - The value to search forpublic abstract long getNumberNonZeros(int[] counts,
                                       int nCol)
counts - The counts of each dictionary entrynCol - The number of columns in this dictionarypublic abstract void addToEntry(Dictionary d, int fr, int to, int nCol)
d - the target dictionaryfr - the from indexto - the to indexnCol - the number of columnspublic double[] getMostCommonTuple(int[] counts,
                                   int nCol)
counts - The counts of the individual tuples contained, managed by the column group.nCol - The number of columns contained in this dictionarypublic abstract double[] getTuple(int index,
                                  int nCol)
index - The index where the values are locatednCol - The number of columns contained in this dictionarypublic abstract ADictionary subtractTuple(double[] tuple)
tuple - a double list representing a tuple, it is given that the tuple with is the same as this
              dictionaries.public abstract MatrixBlockDictionary getAsMatrixBlockDictionary(int nCol)
nCol - The number of columns contained in this column group.public abstract ADictionary scaleTuples(int[] scaling, int nCol)
scaling - The ammout to multiply the given tuples withnCol - The number of columns contained in this column group.public abstract ADictionary preaggValuesFromDense(int numVals, int[] colIndexes, int[] aggregateColumns, double[] b, int cut)
numVals - The number of values contained in this dictionarycolIndexes - The column indexes that is associated with the parent column groupaggregateColumns - The column to aggregate, this is preprocessed, to find remove consideration for empty
                         columnsb - The values in the right hand side matrixcut - The number of columns in b.public abstract ADictionary replace(double pattern, double replace, int nCol, boolean safe)
pattern - The value to look forreplace - The value to replace the other value withnCol - The number of columns contained in the dictionary.safe - Specify if the operation require consideration of adding a new tuple. This happens if the
                dictionary have allocated the last zero tuple or not.Copyright © 2021 The Apache Software Foundation. All rights reserved.