Class AMapToData

    • Method Detail

      • getUnique

        public final int getUnique()
        Get the number of unique values inside this map.
        Returns:
        the unique count.
      • setUnique

        public final void setUnique​(int nUnique)
        Set number of unique values. NOTE! The value should be representable inside the map. This requirement is not checked.
        Parameters:
        nUnique - the value to set.
      • getIndex

        public abstract int getIndex​(int n)
        Get the given index back as a integer
        Parameters:
        n - the index to get
        Returns:
        the value represented in that cell as integer
      • set

        public abstract void set​(int n,
                                 int v)
        Set the index to the value. NOTE! The value should be representable inside the map. This requirement is not checked.
        Parameters:
        n - index to set.
        v - the value to set it to.
      • setAndGet

        public abstract int setAndGet​(int n,
                                      int v)
        Set the index to the value and get the contained value after.
        Parameters:
        n - index to set.
        v - the value to set it to.
        Returns:
        v as encoded, note this value can be different that the one put in if the map is not able to represent the value
      • fill

        public abstract void fill​(int v)
        Fill the map with a given value. NOTE! The value should be representable inside the map. This requirement is not checked.
        Parameters:
        v - the value to fill
      • getUpperBoundValue

        public abstract int getUpperBoundValue()
        Get the maximum value that is possible to allocate inside this map.
        Returns:
        The maximum value.
      • getInMemorySize

        public abstract long getInMemorySize()
        Get the in memory size of this Mapping object.
        Returns:
        The size in Bytes.
      • getExactSizeOnDisk

        public abstract long getExactSizeOnDisk()
        Get the size of this Mapping object on disk.
        Returns:
        The on disk size in Bytes.
      • size

        public abstract int size()
        The size of the Mapping object, signaling how many value cells are stored in this mapping object.
        Returns:
        The length of the mapping object.
      • write

        public abstract void write​(DataOutput out)
                            throws IOException
        Serialize this object to the DataOutput given.
        Parameters:
        out - The object to serialize this object into.
        Throws:
        IOException - An IO exception if the Serialization fails.
      • replace

        public abstract void replace​(int v,
                                     int r)
        Replace v with r for all entries, NOTE! It is assumed that you call this correctly: - with two distinct values that is representable inside the given AMapToData.
        Parameters:
        v - The value to replace
        r - The value to put instead
      • preAggregateDense

        public final void preAggregateDense​(MatrixBlock m,
                                            double[] preAV,
                                            int rl,
                                            int ru,
                                            int cl,
                                            int cu)
        Pre aggregate a dense matrix m into pre, subject to only including a row segment and column segment.
        Parameters:
        m - The dense matrix values to preaggregate
        preAV - The preAggregate double array populate with the summed values of m
        rl - The row start in m
        ru - The row end in m
        cl - The column start in m
        cu - The column end in m
      • preAggregateDense

        public final void preAggregateDense​(MatrixBlock m,
                                            double[] preAV,
                                            int rl,
                                            int ru,
                                            int cl,
                                            int cu,
                                            AOffset indexes)
        PreAggregate a Dense Matrix at index offsets.
        Parameters:
        m - The DenseBlock to preAggregate
        preAV - The target double array to put the preAggregate into
        rl - The row to start at
        ru - The row to end at (not inclusive)
        cl - The column in m to start from
        cu - The column in m to end at (not inclusive)
        indexes - The Offset Indexes to iterate through
      • preAggregateSparse

        public final void preAggregateSparse​(SparseBlock sb,
                                             double[] preAV,
                                             int rl,
                                             int ru,
                                             AOffset indexes)
        PreAggregate the SparseBlock in the range of rows given.
        Parameters:
        sb - The SparseBlock to preAggregate
        preAV - The target double array to put the preAggregate into
        rl - The row to start at
        ru - The row to end at (not inclusive)
        indexes - The Offset Indexes to iterate through
      • preAggregateSparse

        public final void preAggregateSparse​(SparseBlock sb,
                                             double[] preAV,
                                             int rl,
                                             int ru)
        PreAggregate the sparseblock in the range of rows given.
        Parameters:
        sb - Sparse block to preAggregate from
        preAV - Pre aggregate target
        rl - row index in sb
        ru - upper row index in sp (not inclusive)
      • getCounts

        public final int[] getCounts()
        Get the number of counts of each unique value contained in this map. Note that in the case the mapping is shorter than number of rows the counts sum to the number of mapped values not the number of rows.
        Returns:
        The counts
      • getCounts

        public abstract int[] getCounts​(int[] counts)
        Get the number of counts of each unique value contained in this map. Note that in the case the mapping is shorter than number of rows the counts sum to the number of mapped values not the number of rows.
        Parameters:
        counts - The object to return.
        Returns:
        The counts
      • preAggregateDDC_DDC

        public final void preAggregateDDC_DDC​(AMapToData tm,
                                              ADictionary td,
                                              Dictionary ret,
                                              int nCol)
        PreAggregate into dictionary with two sides of DDC.
        Parameters:
        tm - Map of other side
        td - Dictionary to take values from (other side dictionary)
        ret - The output dictionary to aggregate into
        nCol - The number of columns
      • preAggregateDDC_SDCZ

        public final void preAggregateDDC_SDCZ​(AMapToData tm,
                                               ADictionary td,
                                               AOffset tof,
                                               Dictionary ret,
                                               int nCol)
        PreAggregate into SDCZero dictionary from DDC dictionary.
        Parameters:
        tm - Map of other side
        td - Dictionary to take values from (other side dictionary)
        tof - The offset index structure of the SDC side
        ret - The output dictionary to aggregate into
        nCol - The number of columns in output and td dictionary
      • preAggregateDDC_SDCZSingleCol

        public void preAggregateDDC_SDCZSingleCol​(AMapToData tm,
                                                  double[] td,
                                                  AOffset tof,
                                                  double[] v)
      • preAggregateDDC_SDCZMultiCol

        public void preAggregateDDC_SDCZMultiCol​(AMapToData tm,
                                                 ADictionary td,
                                                 AOffset tof,
                                                 double[] v,
                                                 int nCol)
      • preAggregateSDCZ_DDC

        public final void preAggregateSDCZ_DDC​(AMapToData tm,
                                               ADictionary td,
                                               AOffset of,
                                               Dictionary ret,
                                               int nCol)
        PreAggregate into DDC dictionary from SDCZero dictionary.
        Parameters:
        tm - Map of other side
        td - Dictionary to take values from (other side dictionary)
        of - Offsets of the SDC to look into DDC
        ret - The output dictionary to aggregate into
        nCol - The number of columns in output and td dictionary
      • preAggregateRLE_DDC

        public void preAggregateRLE_DDC​(int[] ptr,
                                        char[] data,
                                        ADictionary td,
                                        Dictionary ret,
                                        int nCol)
      • preAggregateDDC_RLE

        public void preAggregateDDC_RLE​(int[] ptr,
                                        char[] data,
                                        ADictionary td,
                                        Dictionary ret,
                                        int nCol)
      • copy

        public void copy​(AMapToData d)
        Copy the values in this map into another mapping object. NOTE! All contained vales should be representable inside the map given. This requirement is not checked.
        Parameters:
        d - Map to copy all values into.
      • copyInt

        public abstract void copyInt​(int[] d)
      • copyBit

        public abstract void copyBit​(BitSet d)
      • getMax

        public int getMax()
      • resize

        public abstract AMapToData resize​(int unique)
      • countRuns

        public abstract int countRuns()
        Count the number of runs inside the map.
        Returns:
        The number of runs
      • countRuns

        public int countRuns​(AOffset off)
        Count the number of runs inside the map, but sparse with offsets.
        Parameters:
        off - The sparse offsets to consider counting the runs from.
        Returns:
        count of runs.
      • slice

        public abstract AMapToData slice​(int l,
                                         int u)
        Slice out the range from lower to upper from this map toData.
        Parameters:
        l - Low value to slice from
        u - high value to slice to (not inclusive)
        Returns:
        A new map containing only the values from the range.