Interface IDictionary

    • Field Detail

      • LOG

        static final org.apache.commons.logging.Log LOG
    • Method Detail

      • getValues

        double[] getValues()
        Get all the values contained in the dictionary as a linearized double array.
        Returns:
        linearized double array
      • getValue

        double getValue​(int i)
        Get Specific value contained in the dictionary at index.
        Parameters:
        i - The index to extract the value from
        Returns:
        The value contained at the index
      • getValue

        double getValue​(int r,
                        int col,
                        int nCol)
        Get Specific value contain in dictionary at index.
        Parameters:
        r - Row target
        col - Col target
        nCol - nCol in dictionary
        Returns:
        value
      • getInMemorySize

        long getInMemorySize()
        Returns the memory usage of the dictionary.
        Returns:
        a long value in number of bytes for the dictionary.
      • aggregate

        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.
        Parameters:
        init - The initial Value, in cases such as Max value, this could be -infinity
        fn - The Function to apply to values
        Returns:
        The aggregated value as a double.
      • aggregateWithReference

        double aggregateWithReference​(double init,
                                      Builtin fn,
                                      double[] reference,
                                      boolean def)
        Aggregate all the contained values, with a reference offset.
        Parameters:
        init - The initial value, in cases such as Max value this could be -infinity.
        fn - The function to apply to the values
        reference - The reference offset to each value in the dictionary
        def - If the reference should be treated as an instance of only as reference
        Returns:
        The aggregated value as a double.
      • aggregateRows

        double[] aggregateRows​(Builtin fn,
                               int nCol)
        Aggregate all entries in the rows.
        Parameters:
        fn - The aggregate function
        nCol - The number of columns contained in the dictionary.
        Returns:
        Aggregates for this dictionary tuples.
      • aggregateRowsWithDefault

        double[] aggregateRowsWithDefault​(Builtin fn,
                                          double[] defaultTuple)
        Aggregate all entries in the rows of the dictionary with a extra cell in the end that contains the aggregate of the given defaultTuple.
        Parameters:
        fn - The aggregate function
        defaultTuple - The default tuple to aggregate in last cell
        Returns:
        Aggregates for this dictionary tuples.
      • aggregateRowsWithReference

        double[] aggregateRowsWithReference​(Builtin fn,
                                            double[] reference)
        Aggregate all entries in the rows with an offset value reference added.
        Parameters:
        fn - The aggregate function
        reference - The reference offset to each value in the dictionary
        Returns:
        Aggregates for this dictionary tuples.
      • aggregateCols

        void aggregateCols​(double[] c,
                           Builtin fn,
                           IColIndex colIndexes)
        Aggregates the columns into the target double array provided.
        Parameters:
        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 columns
        colIndexes - The mapping to the target columns from the individual columns
      • aggregateColsWithReference

        void aggregateColsWithReference​(double[] c,
                                        Builtin fn,
                                        IColIndex colIndexes,
                                        double[] reference,
                                        boolean def)
        Aggregates the columns into the target double array provided.
        Parameters:
        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 columns
        colIndexes - The mapping to the target columns from the individual columns
        reference - The reference offset values to add to each cell.
        def - If the reference should be treated as a tuple as well
      • applyScalarOp

        IDictionary applyScalarOp​(ScalarOperator op)
        Allocate a new dictionary and applies the scalar operation on each cell of to then return the new dictionary.
        Parameters:
        op - The operator.
        Returns:
        The new dictionary to return.
      • applyScalarOpAndAppend

        IDictionary applyScalarOpAndAppend​(ScalarOperator op,
                                           double v0,
                                           int nCol)
        Allocate a new dictionary with one extra row and applies the scalar operation on each cell of to then return the new dictionary.
        Parameters:
        op - The operator
        v0 - The new value to put into each cell in the new row
        nCol - The number of columns in the dictionary
        Returns:
        The new dictionary to return.
      • applyUnaryOp

        IDictionary applyUnaryOp​(UnaryOperator op)
        Allocate a new dictionary and apply the unary operator on each cell.
        Parameters:
        op - The operator.
        Returns:
        The new dictionary to return.
      • applyUnaryOpAndAppend

        IDictionary applyUnaryOpAndAppend​(UnaryOperator op,
                                          double v0,
                                          int nCol)
        Allocate a new dictionary with one extra row and apply the unary operator on each cell.
        Parameters:
        op - The operator.
        v0 - The new value to put into each cell in the new row
        nCol - The number of columns in the dictionary
        Returns:
        The new dictionary to return.
      • applyScalarOpWithReference

        IDictionary applyScalarOpWithReference​(ScalarOperator op,
                                               double[] reference,
                                               double[] newReference)
        Allocate a new dictionary and apply the scalar operation on each cell to then return a new dictionary. outValues[j] = op(this.values[j] + reference[i]) - newReference[i]
        Parameters:
        op - The operator to apply to each cell.
        reference - The reference value to add before the operator.
        newReference - The reference value to subtract after the operator.
        Returns:
        A New Dictionary.
      • applyUnaryOpWithReference

        IDictionary applyUnaryOpWithReference​(UnaryOperator op,
                                              double[] reference,
                                              double[] newReference)
        Allocate a new dictionary and apply the scalar operation on each cell to then return a new dictionary. outValues[j] = op(this.values[j] + reference[i]) - newReference[i]
        Parameters:
        op - The unary operator to apply to each cell.
        reference - The reference value to add before the operator.
        newReference - The reference value to subtract after the operator.
        Returns:
        A New Dictionary.
      • binOpLeft

        IDictionary binOpLeft​(BinaryOperator op,
                              double[] v,
                              IColIndex colIndexes)
        Apply binary row operation on the left side
        Parameters:
        op - The operation to this dictionary
        v - The values to use on the left hand side.
        colIndexes - The column indexes to consider inside v.
        Returns:
        A new dictionary containing the updated values.
      • binOpLeftAndAppend

        IDictionary binOpLeftAndAppend​(BinaryOperator op,
                                       double[] v,
                                       IColIndex colIndexes)
        Apply binary row operation on the left side with one extra row evaluating with zeros.
        Parameters:
        op - The operation to this dictionary
        v - The values to use on the left hand side.
        colIndexes - The column indexes to consider inside v.
        Returns:
        A new dictionary containing the updated values.
      • binOpLeftWithReference

        IDictionary binOpLeftWithReference​(BinaryOperator op,
                                           double[] v,
                                           IColIndex colIndexes,
                                           double[] reference,
                                           double[] newReference)
        Apply the binary operator such that each value is offset by the reference before application. Then put the result into the new dictionary, but offset it by the new reference. outValues[j] = op(v[colIndexes[i]], this.values[j] + reference[i]) - newReference[i]
        Parameters:
        op - The operation to apply on the dictionary values.
        v - The values to use on the left side of the operator.
        colIndexes - The column indexes to use.
        reference - The reference value to add before operator.
        newReference - The reference value to subtract after operator.
        Returns:
        A new dictionary.
      • binOpRight

        IDictionary binOpRight​(BinaryOperator op,
                               double[] v,
                               IColIndex colIndexes)
        Apply binary row operation on the right side.
        Parameters:
        op - The operation to this dictionary
        v - The values to use on the right hand side.
        colIndexes - The column indexes to consider inside v.
        Returns:
        A new dictionary containing the updated values.
      • binOpRightAndAppend

        IDictionary binOpRightAndAppend​(BinaryOperator op,
                                        double[] v,
                                        IColIndex colIndexes)
        Apply binary row operation on the right side with one extra row evaluating with zeros.
        Parameters:
        op - The operation to this dictionary
        v - The values to use on the right hand side.
        colIndexes - The column indexes to consider inside v.
        Returns:
        A new dictionary containing the updated values.
      • binOpRight

        IDictionary binOpRight​(BinaryOperator op,
                               double[] v)
        Apply binary row operation on the right side as with no columns to extract from v.
        Parameters:
        op - The operation to this dictionary
        v - The values to apply on the dictionary (same number of cols as the dictionary)
        Returns:
        A new dictionary containing the updated values.
      • binOpRightWithReference

        IDictionary binOpRightWithReference​(BinaryOperator op,
                                            double[] v,
                                            IColIndex colIndexes,
                                            double[] reference,
                                            double[] newReference)
        Apply the binary operator such that each value is offset by the reference before application. Then put the result into the new dictionary, but offset it by the new reference. outValues[j] = op(this.values[j] + reference[i], v[colIndexes[i]]) - newReference[i]
        Parameters:
        op - The operation to apply on the dictionary values.
        v - The values to use on the right side of the operator.
        colIndexes - The column indexes to use.
        reference - The reference value to add before operator.
        newReference - The reference value to subtract after operator.
        Returns:
        A new dictionary.
      • clone

        IDictionary clone()
        Returns a deep clone of the dictionary.
        Returns:
        A deep clone
      • write

        void write​(DataOutput out)
            throws IOException
        Write the dictionary to a DataOutput.
        Parameters:
        out - the output sink to write the dictionary to.
        Throws:
        IOException - if the sink fails.
      • getExactSizeOnDisk

        long getExactSizeOnDisk()
        Calculate the space consumption if the dictionary is stored on disk.
        Returns:
        the long count of bytes to store the dictionary.
      • getDictType

        IDictionary.DictType getDictType()
        Get the dictionary type this dictionary is.
        Returns:
        The Dictionary type this is.
      • getNumberOfValues

        int getNumberOfValues​(int ncol)
        Get 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.
      • sumAllRowsToDouble

        double[] sumAllRowsToDouble​(int nrColumns)
        Method used as a pre-aggregate of each tuple in the dictionary, to single double values. Note if the number of columns is one the actual dictionaries values are simply returned.
        Parameters:
        nrColumns - The number of columns in the ColGroup to know how to get the values from the dictionary.
        Returns:
        a double array containing the row sums from this dictionary.
      • sumAllRowsToDoubleWithDefault

        double[] sumAllRowsToDoubleWithDefault​(double[] defaultTuple)
        Do exactly the same as the sumAllRowsToDouble but also sum the array given to a extra index in the end of the array.
        Parameters:
        defaultTuple - The default row to sum in the end index returned.
        Returns:
        a double array containing the row sums from this dictionary.
      • sumAllRowsToDoubleWithReference

        double[] sumAllRowsToDoubleWithReference​(double[] reference)
        Method used as a pre-aggregate of each tuple in the dictionary, to single double values with a reference.
        Parameters:
        reference - The reference values to add to each cell.
        Returns:
        a double array containing the row sums from this dictionary.
      • sumAllRowsToDoubleSq

        double[] sumAllRowsToDoubleSq​(int nrColumns)
        Method used as a pre-aggregate of each tuple in the dictionary, to single double values. Note if the number of columns is one the actual dictionaries values are simply returned.
        Parameters:
        nrColumns - The number of columns in the ColGroup to know how to get the values from the dictionary.
        Returns:
        a double array containing the row sums from this dictionary.
      • sumAllRowsToDoubleSqWithDefault

        double[] sumAllRowsToDoubleSqWithDefault​(double[] defaultTuple)
        Method used as a pre-aggregate of each tuple in the dictionary, to single double values. But adds another cell to the return with an extra value that is the sum of the given defaultTuple.
        Parameters:
        defaultTuple - The default row to sum in the end index returned.
        Returns:
        a double array containing the row sums from this dictionary.
      • sumAllRowsToDoubleSqWithReference

        double[] sumAllRowsToDoubleSqWithReference​(double[] reference)
        Method used as a pre-aggregate of each tuple in the dictionary, to single double values.
        Parameters:
        reference - The reference values to add to each cell.
        Returns:
        a double array containing the row sums from this dictionary.
      • productAllRowsToDouble

        double[] productAllRowsToDouble​(int nrColumns)
        Method to product all rows to a column vector.
        Parameters:
        nrColumns - The number of columns in the ColGroup to know how to get the values from the dictionary.
        Returns:
        A row product
      • productAllRowsToDoubleWithDefault

        double[] productAllRowsToDoubleWithDefault​(double[] defaultTuple)
        Method to product all rows to a column vector with a default value added in the end.
        Parameters:
        defaultTuple - The default row that aggregate to last cell
        Returns:
        A row product
      • productAllRowsToDoubleWithReference

        double[] productAllRowsToDoubleWithReference​(double[] reference)
        Method to product all rows to a column vector with a reference values added to all cells, and a reference product in the end
        Parameters:
        reference - The reference row
        Returns:
        A row product
      • colSum

        void colSum​(double[] c,
                    int[] counts,
                    IColIndex colIndexes)
        Get the column sum of the values contained in the dictionary
        Parameters:
        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.
      • colSumSq

        void colSumSq​(double[] c,
                      int[] counts,
                      IColIndex colIndexes)
        Get the column sum of the values contained in the dictionary
        Parameters:
        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.
      • colSumSqWithReference

        void colSumSqWithReference​(double[] c,
                                   int[] counts,
                                   IColIndex colIndexes,
                                   double[] reference)
        Get the column sum of the values contained in the dictionary with an offset reference value added to each cell.
        Parameters:
        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.
        reference - The reference values to add to each cell.
      • sum

        double sum​(int[] counts,
                   int nCol)
        Get the sum of the values contained in the dictionary
        Parameters:
        counts - The counts of the individual tuples
        nCol - The number of columns contained
        Returns:
        The sum scaled by the counts provided.
      • sumSq

        double sumSq​(int[] counts,
                     int nCol)
        Get the square sum of the values contained in the dictionary
        Parameters:
        counts - The counts of the individual tuples
        nCol - The number of columns contained
        Returns:
        The square sum scaled by the counts provided.
      • sumSqWithReference

        double sumSqWithReference​(int[] counts,
                                  double[] reference)
        Get the square sum of the values contained in the dictionary with a reference offset on each value.
        Parameters:
        counts - The counts of the individual tuples
        reference - The reference value
        Returns:
        The square sum scaled by the counts and reference.
      • getString

        String getString​(int colIndexes)
        Get 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.
      • sliceOutColumnRange

        IDictionary sliceOutColumnRange​(int idxStart,
                                        int idxEnd,
                                        int previousNumberOfColumns)
        Modify the dictionary by removing columns not within the index range.
        Parameters:
        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.
        Returns:
        A dictionary containing the sliced out columns values only.
      • containsValue

        boolean containsValue​(double pattern)
        Detect if the dictionary contains a specific value.
        Parameters:
        pattern - The value to search for
        Returns:
        true if the value is contained else false.
      • containsValueWithReference

        boolean containsValueWithReference​(double pattern,
                                           double[] reference)
        Detect if the dictionary contains a specific value with reference offset.
        Parameters:
        pattern - The pattern/ value to search for
        reference - The reference double array.
        Returns:
        true if the value is contained else false.
      • getNumberNonZeros

        long getNumberNonZeros​(int[] counts,
                               int nCol)
        Calculate 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 entry
        nCol - The number of columns in this dictionary
        Returns:
        The nonZero count
      • getNumberNonZerosWithReference

        long getNumberNonZerosWithReference​(int[] counts,
                                            double[] reference,
                                            int nRows)
        Calculate the number of non zeros in the dictionary. Each value in the dictionary should be added to the reference value. The number of non zeros should be scaled with the given counts.
        Parameters:
        counts - The Counts of each dict entry.
        reference - The reference vector.
        nRows - The number of rows in the input.
        Returns:
        The NonZero Count.
      • addToEntry

        void addToEntry​(double[] v,
                        int fr,
                        int to,
                        int nCol)
        Adds the dictionary entry from this dictionary to the d dictionary
        Parameters:
        v - The target dictionary (dense double array)
        fr - The from index is the tuple index to copy from.
        to - The to index is the row index to copy into.
        nCol - The number of columns in both cases
      • addToEntry

        void addToEntry​(double[] v,
                        int fr,
                        int to,
                        int nCol,
                        int rep)
        Adds the dictionary entry from this dictionary to the v dictionary rep times.
        Parameters:
        v - The target dictionary (dense double array)
        fr - The from index is the tuple index to copy from.
        to - The to index is the row index to copy into.
        nCol - The number of columns in both cases
        rep - The number of repetitions to apply (simply multiply do not loop)
      • addToEntryVectorized

        void addToEntryVectorized​(double[] v,
                                  int f1,
                                  int f2,
                                  int f3,
                                  int f4,
                                  int f5,
                                  int f6,
                                  int f7,
                                  int f8,
                                  int t1,
                                  int t2,
                                  int t3,
                                  int t4,
                                  int t5,
                                  int t6,
                                  int t7,
                                  int t8,
                                  int nCol)
        Vectorized add to entry, this call helps with a bit of locality for the cache.
        Parameters:
        v - The target dictionary (dense double array)
        f1 - From index 1
        f2 - From index 2
        f3 - From index 3
        f4 - From index 4
        f5 - From index 5
        f6 - From index 6
        f7 - From index 7
        f8 - From index 8
        t1 - To index 1
        t2 - To index 2
        t3 - To index 3
        t4 - To index 4
        t5 - To index 5
        t6 - To index 6
        t7 - To index 7
        t8 - To index 8
        nCol - Number of columns in the dictionary
      • subtractTuple

        IDictionary subtractTuple​(double[] tuple)
        Allocate a new dictionary where the tuple given is subtracted from all tuples in the previous dictionary.
        Parameters:
        tuple - a double list representing a tuple, it is given that the tuple with is the same as this dictionaries.
        Returns:
        a new instance of dictionary with the tuple subtracted.
      • getMBDict

        MatrixBlockDictionary getMBDict​(int nCol)
        Get this dictionary as a MatrixBlock dictionary. This allows us to use optimized kernels coded elsewhere in the system, such as matrix multiplication. Return null if the matrix is empty.
        Parameters:
        nCol - The number of columns contained in this column group.
        Returns:
        A Dictionary containing a MatrixBlock.
      • scaleTuples

        IDictionary scaleTuples​(int[] scaling,
                                int nCol)
        Scale all tuples contained in the dictionary by the scaling factor given in the int list.
        Parameters:
        scaling - The amount to multiply the given tuples with
        nCol - The number of columns contained in this column group.
        Returns:
        A New dictionary (since we don't want to modify the underlying dictionary)
      • preaggValuesFromDense

        IDictionary preaggValuesFromDense​(int numVals,
                                          IColIndex colIndexes,
                                          IColIndex aggregateColumns,
                                          double[] b,
                                          int cut)
        Pre Aggregate values for Right Matrix Multiplication.
        Parameters:
        numVals - The number of values contained in this dictionary
        colIndexes - The column indexes that is associated with the parent column group
        aggregateColumns - The column to aggregate, this is preprocessed, to find remove consideration for empty columns
        b - The values in the right hand side matrix
        cut - The number of columns in b.
        Returns:
        A new dictionary with the pre aggregated values.
      • replace

        IDictionary replace​(double pattern,
                            double replace,
                            int nCol)
        Make a copy of the values, and replace all values that match pattern with replacement value. If needed add a new column index.
        Parameters:
        pattern - The value to look for
        replace - The value to replace the other value with
        nCol - The number of columns contained in the dictionary.
        Returns:
        A new Column Group, reusing the index structure but with new values.
      • replaceWithReference

        IDictionary replaceWithReference​(double pattern,
                                         double replace,
                                         double[] reference)
        Make a copy of the values, and replace all values that match pattern with replacement value. If needed add a new column index. With reference such that each value in the dict is considered offset by the values contained in the reference.
        Parameters:
        pattern - The value to look for
        replace - The value to replace the other value with
        reference - The reference tuple to add to all entries when replacing
        Returns:
        A new Column Group, reusing the index structure but with new values.
      • product

        void product​(double[] ret,
                     int[] counts,
                     int nCol)
        Calculate the product of the dictionary weighted by counts.
        Parameters:
        ret - The result dense double array (containing one value)
        counts - The count of individual tuples
        nCol - Number of columns in the dictionary.
      • productWithDefault

        void productWithDefault​(double[] ret,
                                int[] counts,
                                double[] def,
                                int defCount)
        Calculate the product of the dictionary weighted by counts with a default value added .
        Parameters:
        ret - The result dense double array (containing one value)
        counts - The count of individual tuples
        def - The default tuple
        defCount - The count of the default tuple
      • productWithReference

        void productWithReference​(double[] ret,
                                  int[] counts,
                                  double[] reference,
                                  int refCount)
        Calculate the product of the dictionary weighted by counts and offset by reference
        Parameters:
        ret - The result dense double array (containing one value)
        counts - The counts of each entry in the dictionary
        reference - The reference value.
        refCount - The number of occurrences of the ref value.
      • colProduct

        void colProduct​(double[] res,
                        int[] counts,
                        IColIndex colIndexes)
        Calculate the column product of the dictionary weighted by counts.
        Parameters:
        res - The result vector to put the result into
        counts - The weighted count of individual tuples
        colIndexes - The column indexes.
      • colProductWithReference

        void colProductWithReference​(double[] res,
                                     int[] counts,
                                     IColIndex colIndexes,
                                     double[] reference)
        Calculate the column product of the dictionary weighted by counts.
        Parameters:
        res - The result vector to put the result into
        counts - The weighted count of individual tuples
        colIndexes - The column indexes.
        reference - The reference value.
      • centralMoment

        CM_COV_Object centralMoment​(ValueFunction fn,
                                    int[] counts,
                                    int nRows)
        Central moment function to calculate the central moment of this column group. MUST be on a single column dictionary.
        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
      • centralMoment

        CM_COV_Object centralMoment​(CM_COV_Object ret,
                                    ValueFunction fn,
                                    int[] counts,
                                    int nRows)
        Central moment function to calculate the central moment of this column group. MUST be on a single column dictionary.
        Parameters:
        ret - The Central Moment object to be modified and returned
        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

        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. MUST be on a single column dictionary.
        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
      • centralMomentWithDefault

        CM_COV_Object centralMomentWithDefault​(CM_COV_Object ret,
                                               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. MUST be on a single column dictionary.
        Parameters:
        ret - The Central Moment object to be modified and returned
        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

        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. MUST be on a single column dictionary.
        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
      • centralMomentWithReference

        CM_COV_Object centralMomentWithReference​(CM_COV_Object ret,
                                                 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. MUST be on a single column dictionary.
        Parameters:
        ret - The Central Moment object to be modified and returned
        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
      • rexpandCols

        IDictionary rexpandCols​(int max,
                                boolean ignore,
                                boolean cast,
                                int nCol)
        Rexpand the dictionary (one hot encode)
        Parameters:
        max - the tuple width of the output
        ignore - If we should ignore zero and negative values
        cast - If we should cast all double values to whole integer values
        nCol - The number of columns in the dictionary already (should be 1)
        Returns:
        A new dictionary
      • rexpandColsWithReference

        IDictionary rexpandColsWithReference​(int max,
                                             boolean ignore,
                                             boolean cast,
                                             int reference)
        Rexpand the dictionary (one hot encode)
        Parameters:
        max - the tuple width of the output
        ignore - If we should ignore zero and negative values
        cast - If we should cast all double values to whole integer values
        reference - A reference value to add to all tuples before expanding
        Returns:
        A new dictionary
      • getSparsity

        double getSparsity()
        Get the sparsity of the dictionary.
        Returns:
        a sparsity between 0 and 1
      • multiplyScalar

        void multiplyScalar​(double v,
                            double[] ret,
                            int off,
                            int dictIdx,
                            IColIndex cols)
        Multiply the v value with the dictionary entry at dictIdx and add it to the ret matrix at the columns specified in the int array.
        Parameters:
        v - Value to multiply
        ret - Output dense double array location
        off - Offset into the ret array that the "row" output starts at
        dictIdx - The dictionary entry to multiply.
        cols - The columns to multiply into of the output.
      • TSMMWithScaling

        void TSMMWithScaling​(int[] counts,
                             IColIndex rows,
                             IColIndex cols,
                             MatrixBlock ret)
        Transpose self matrix multiplication with a scaling factor on each pair of values.
        Parameters:
        counts - The scaling factor
        rows - The row indexes
        cols - The col indexes
        ret - The output matrix block
      • MMDict

        void MMDict​(IDictionary right,
                    IColIndex rowsLeft,
                    IColIndex colsRight,
                    MatrixBlock result)
        Matrix multiplication of dictionaries Note the left is this, and it is transposed
        Parameters:
        right - Right hand side of multiplication
        rowsLeft - Offset rows on the left
        colsRight - Offset cols on the right
        result - The output matrix block
      • MMDictScaling

        void MMDictScaling​(IDictionary right,
                           IColIndex rowsLeft,
                           IColIndex colsRight,
                           MatrixBlock result,
                           int[] scaling)
        Matrix multiplication of dictionaries Note the left is this, and it is transposed
        Parameters:
        right - Right hand side of multiplication
        rowsLeft - Offset rows on the left
        colsRight - Offset cols on the right
        result - The output matrix block
        scaling - The scaling
      • MMDictDense

        void MMDictDense​(double[] left,
                         IColIndex rowsLeft,
                         IColIndex colsRight,
                         MatrixBlock result)
        Matrix multiplication of dictionaries left side dense and transposed right side is this.
        Parameters:
        left - Dense left side
        rowsLeft - Offset rows on the left
        colsRight - Offset cols on the right
        result - The output matrix block
      • MMDictScalingDense

        void MMDictScalingDense​(double[] left,
                                IColIndex rowsLeft,
                                IColIndex colsRight,
                                MatrixBlock result,
                                int[] scaling)
        Matrix multiplication of dictionaries left side dense and transposed right side is this.
        Parameters:
        left - Dense left side
        rowsLeft - Offset rows on the left
        colsRight - Offset cols on the right
        result - The output matrix block
        scaling - The scaling
      • MMDictSparse

        void MMDictSparse​(SparseBlock left,
                          IColIndex rowsLeft,
                          IColIndex colsRight,
                          MatrixBlock result)
        Matrix multiplication of dictionaries left side sparse and transposed right side is this.
        Parameters:
        left - Sparse left side
        rowsLeft - Offset rows on the left
        colsRight - Offset cols on the right
        result - The output matrix block
      • MMDictScalingSparse

        void MMDictScalingSparse​(SparseBlock left,
                                 IColIndex rowsLeft,
                                 IColIndex colsRight,
                                 MatrixBlock result,
                                 int[] scaling)
        Matrix multiplication of dictionaries left side sparse and transposed right side is this.
        Parameters:
        left - Sparse left side
        rowsLeft - Offset rows on the left
        colsRight - Offset cols on the right
        result - The output matrix block
        scaling - The scaling
      • TSMMToUpperTriangle

        void TSMMToUpperTriangle​(IDictionary right,
                                 IColIndex rowsLeft,
                                 IColIndex colsRight,
                                 MatrixBlock result)
        Matrix multiplication but allocate output in upper triangle and twice if on diagonal, note this is left
        Parameters:
        right - Right side
        rowsLeft - Offset rows on the left
        colsRight - Offset cols on the right
        result - The output matrix block
      • TSMMToUpperTriangleDense

        void TSMMToUpperTriangleDense​(double[] left,
                                      IColIndex rowsLeft,
                                      IColIndex colsRight,
                                      MatrixBlock result)
        Matrix multiplication but allocate output in upper triangle and twice if on diagonal, note this is right
        Parameters:
        left - Dense left side
        rowsLeft - Offset rows on the left
        colsRight - Offset cols on the right
        result - The output matrix block
      • TSMMToUpperTriangleSparse

        void TSMMToUpperTriangleSparse​(SparseBlock left,
                                       IColIndex rowsLeft,
                                       IColIndex colsRight,
                                       MatrixBlock result)
        Matrix multiplication but allocate output in upper triangle and twice if on diagonal, note this is right
        Parameters:
        left - Sparse left side
        rowsLeft - Offset rows on the left
        colsRight - Offset cols on the right
        result - The output matrix block
      • TSMMToUpperTriangleScaling

        void TSMMToUpperTriangleScaling​(IDictionary right,
                                        IColIndex rowsLeft,
                                        IColIndex colsRight,
                                        int[] scale,
                                        MatrixBlock result)
        Matrix multiplication but allocate output in upper triangle and twice if on diagonal, note this is left
        Parameters:
        right - Right side
        rowsLeft - Offset rows on the left
        colsRight - Offset cols on the right
        scale - Scale factor
        result - The output matrix block
      • TSMMToUpperTriangleDenseScaling

        void TSMMToUpperTriangleDenseScaling​(double[] left,
                                             IColIndex rowsLeft,
                                             IColIndex colsRight,
                                             int[] scale,
                                             MatrixBlock result)
        Matrix multiplication but allocate output in upper triangle and twice if on diagonal, note this is right
        Parameters:
        left - Dense left side
        rowsLeft - Offset rows on the left
        colsRight - Offset cols on the right
        scale - Scale factor
        result - The output matrix block
      • TSMMToUpperTriangleSparseScaling

        void TSMMToUpperTriangleSparseScaling​(SparseBlock left,
                                              IColIndex rowsLeft,
                                              IColIndex colsRight,
                                              int[] scale,
                                              MatrixBlock result)
        Matrix multiplication but allocate output in upper triangle and twice if on diagonal, note this is right
        Parameters:
        left - Sparse left side
        rowsLeft - Offset rows on the left
        colsRight - Offset cols on the right
        scale - Scale factor
        result - The output matrix block
      • cbind

        IDictionary cbind​(IDictionary that,
                          int nCol)
        Cbind this dictionary with that dictionary
        Parameters:
        that - the right hand side dictionary to cbind
        nCol - the right hand side number of columns
        Returns:
        The combined dictionary
      • equals

        boolean equals​(Object o)
        Indicate if this object is equal to another this takes into part sematic equivalence
        Overrides:
        equals in class Object
        Parameters:
        o - The other object
        Returns:
        If they are equal
      • equals

        boolean equals​(double[] v)
        Indicate if this object is equal to the given array of doubles.
        Parameters:
        v - The list of double values
        Returns:
        If they are equal to this.
      • equals

        boolean equals​(IDictionary o)
        Indicate if the other dictionary is equal to this.
        Parameters:
        o - The other object
        Returns:
        If it is equal
      • reorder

        IDictionary reorder​(int[] reorder)
        Reorder the elements in the dictionary based on the reorder specification given.
        Parameters:
        reorder - The order to move to.
        Returns:
        A new Dictionary that is reordered.s