Class AMapToData
- java.lang.Object
- 
- org.apache.sysds.runtime.compress.colgroup.mapping.AMapToData
 
- 
- All Implemented Interfaces:
- Serializable
 
 public abstract class AMapToData extends Object implements Serializable This Class's job is to link into the dictionary entries for column groups. Column groups - DDC use this to map to map directly to the dictionary - SDC use this in collaboration with the offsets to only point to dictionary entries for non default values.- See Also:
- Serialized Form
 
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcopy(AMapToData d)Copy the values in this map into another mapping object.abstract voidcopyBit(BitSet d)abstract voidcopyInt(int[] d)abstract voidfill(int v)Fill the map with a given value.int[]getCounts(int[] counts)Get the number of counts of each unique value contained in this map.abstract longgetExactSizeOnDisk()Get the size of this Mapping object on disk.abstract intgetIndex(int n)Get the given index back as a integerabstract longgetInMemorySize()Get the in memory size of this Mapping object.intgetMax()abstract MapToFactory.MAP_TYPEgetType()intgetUnique()Get the number of unique values inside this map.abstract intgetUpperBoundValue()Get the maximum value that is possible to allocate inside this map.voidpreAggregateDDC_DDC(AMapToData tm, ADictionary td, Dictionary ret, int nCol)PreAggregate into dictionary with two sides of DDC.voidpreAggregateDDC_SDCZ(AMapToData tm, ADictionary td, AOffset tof, Dictionary ret, int nCol)PreAggregate into SDCZero dictionary from DDC dictionary.voidpreAggregateDDC_SDCZMultiCol(AMapToData tm, ADictionary td, AOffset tof, double[] v, int nCol)voidpreAggregateDDC_SDCZSingleCol(AMapToData tm, double[] td, AOffset tof, double[] v)voidpreAggregateDense(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.voidpreAggregateDense(MatrixBlock m, double[] preAV, int rl, int ru, int cl, int cu, AOffset indexes)PreAggregate a Dense Matrix at index offsets.voidpreAggregateSDCZ_DDC(AMapToData tm, ADictionary td, AOffset of, Dictionary ret, int nCol)PreAggregate into DDC dictionary from SDCZero dictionary.voidpreAggregateSDCZ_SDCZ(AMapToData tm, ADictionary td, AOffset tof, AOffset of, Dictionary ret, int nCol)voidpreAggregateSparse(SparseBlock sb, double[] preAV, int rl, int ru)PreAggregate the sparseblock in the range of rows given.voidpreAggregateSparse(SparseBlock sb, double[] preAV, int rl, int ru, AOffset indexes)PreAggregate the SparseBlock in the range of rows given.abstract voidreplace(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.abstract AMapToDataresize(int unique)abstract voidset(int n, int v)Set the index to the value.abstract intsetAndGet(int n, int v)Set the index to the value and get the contained value after.voidsetUnique(int nUnique)Set number of unique values.abstract intsize()The size of the Mapping object, signaling how many value cells are stored in this mapping object.StringtoString()abstract voidwrite(DataOutput out)Serialize this object to the DataOutput given.
 
- 
- 
- 
Method Detail- 
getUniquepublic final int getUnique() Get the number of unique values inside this map.- Returns:
- the unique count.
 
 - 
setUniquepublic 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.
 
 - 
getIndexpublic 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
 
 - 
setpublic 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.
 
 - 
setAndGetpublic 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
 
 - 
fillpublic 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
 
 - 
getUpperBoundValuepublic abstract int getUpperBoundValue() Get the maximum value that is possible to allocate inside this map.- Returns:
- The maximum value.
 
 - 
getInMemorySizepublic abstract long getInMemorySize() Get the in memory size of this Mapping object.- Returns:
- The size in Bytes.
 
 - 
getExactSizeOnDiskpublic abstract long getExactSizeOnDisk() Get the size of this Mapping object on disk.- Returns:
- The on disk size in Bytes.
 
 - 
sizepublic 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.
 
 - 
writepublic 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.
 
 - 
replacepublic 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
 
 - 
getTypepublic abstract MapToFactory.MAP_TYPE getType() 
 - 
preAggregateDensepublic 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
 
 - 
preAggregateDensepublic 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
 
 - 
preAggregateSparsepublic 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
 
 - 
preAggregateSparsepublic 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)
 
 - 
getCountspublic final 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_DDCpublic 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_SDCZpublic 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_SDCZSingleColpublic void preAggregateDDC_SDCZSingleCol(AMapToData tm, double[] td, AOffset tof, double[] v) 
 - 
preAggregateDDC_SDCZMultiColpublic void preAggregateDDC_SDCZMultiCol(AMapToData tm, ADictionary td, AOffset tof, double[] v, int nCol) 
 - 
preAggregateSDCZ_DDCpublic 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
 
 - 
preAggregateSDCZ_SDCZpublic final void preAggregateSDCZ_SDCZ(AMapToData tm, ADictionary td, AOffset tof, AOffset of, Dictionary ret, int nCol) 
 - 
copypublic 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.
 
 - 
copyIntpublic abstract void copyInt(int[] d) 
 - 
copyBitpublic abstract void copyBit(BitSet d) 
 - 
getMaxpublic int getMax() 
 - 
resizepublic abstract AMapToData resize(int unique) 
 
- 
 
-