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

# Class MapToChar

java.lang.Object
org.apache.sysds.runtime.compress.colgroup.mapping.AMapToData
org.apache.sysds.runtime.compress.colgroup.mapping.MapToChar

All Implemented Interfaces:
  `Serializable`

public class MapToChar extends AMapToData

See Also:
  - Serialized Form

## Constructor Summary

Constructors
Constructor
Description
`MapToChar(int unique, char[] data)`
`MapToChar(int unique, int size)`

## Method Summary

Modifier and Type
Method
Description
`AMapToData`
`append(AMapToData t)`
`AMapToData`
`appendN(IMapToDataGroup[] d)`
`void`
`copyInt(int[] d, int start, int end)`
`int`
`countRuns()`
Count the number of runs inside the map.
`void`
`decompressToRange(double[] c, int rl, int ru, int offR, double[] values)`
`void`
`decompressToRangeNoOff(double[] c, int rl, int ru, double[] values)`
`void`
`decompressToRangeOff(double[] c, int rl, int ru, int offR, double[] values)`
`boolean`
`equals(AMapToData e)`
Indicate if the given encoding is equivalent to this encoding
`void`
`fill(int v)`
Fill the map with a given value.
`int[]`
`getCounts(int[] ret)`
Get the number of counts of each unique value contained in this map.
`long`
`getExactSizeOnDisk()`
Get the size of this Mapping object on disk.
`int`
`getIndex(int n)`
Get the given index back as a integer
`long`
`getInMemorySize()`
Get the in memory size of this Mapping object.
`static long`
`getInMemorySize(int dataLength)`
`MapToFactory.MAP_TYPE`
`getType()`
`int`
`getUpperBoundValue()`
Get the maximum value that is possible to allocate inside this map.
`void`
`lmSparseMatrixRow(SparseBlock sb, int r, DenseBlock db, IColIndex colIndexes, IDictionary dict)`
`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.
`AMapToData`
`resize(int unique)`
Reallocate the map, to a smaller instance if applicable.
`void`
`set(int n, int v)`
Set the index to the value.
`void`
`set(int l, int u, int off, AMapToData tm)`
set a range of values from another map.
`int`
`setAndGet(int n, int v)`
Set the index to the value and get the contained value after.
`int`
`size()`
The size of the Mapping object, signaling how many value cells are stored in this mapping object.
`AMapToData`
`slice(int l, int u)`
Slice out the range from lower to upper from this map toData.
`AMapToData[]`
`splitReshapeDDCPushDown(int multiplier, ExecutorService pool)`
`void`
`write(DataOutput out)`
Serialize this object to the DataOutput given.

### Methods inherited from class org.apache.sysds.runtime.compress.colgroup.mapping.AMapToData

`copy, copyBit, copyInt, countRuns, equals, getCounts, getMax, getUnique, preAggregateDDC_DDC, preAggregateDDC_RLE, preAggregateDDC_SDCZ, preAggregateDDC_SDCZMultiCol, preAggregateDDC_SDCZSingleCol, preAggregateDense, preAggregateDense, preAggregateRLE_DDC, preAggregateSDCZ_DDC, preAggregateSDCZ_SDCZ, preAggregateSparse, preAggregateSparse, removeEmpty, removeEmpty, set, setUnique, splitReshapeDDC, toString, verify`

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

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

## Constructor Details

### MapToChar

public MapToChar(int unique, int size)

### MapToChar

public MapToChar(int unique, char[] data)

## Method Details

### getType

public MapToFactory.MAP_TYPE getType()

Specified by:
  `getType` in class `AMapToData`

### getIndex

public int getIndex(int n)
Description copied from class: `AMapToData`
Get the given index back as a integer

Specified by:
  `getIndex` in class `AMapToData`
Parameters:
  `n` - the index to get
Returns:
  the value represented in that cell as integer

### fill

public void fill(int v)
Description copied from class: `AMapToData`
Fill the map with a given value. NOTE! The value should be representable inside the map. This requirement is not checked.

Specified by:
  `fill` in class `AMapToData`
Parameters:
  `v` - the value to fill

### getInMemorySize

public long getInMemorySize()
Description copied from class: `AMapToData`
Get the in memory size of this Mapping object.

Specified by:
  `getInMemorySize` in class `AMapToData`
Returns:
  The size in Bytes.

### getInMemorySize

public static long getInMemorySize(int dataLength)

### getExactSizeOnDisk

public long getExactSizeOnDisk()
Description copied from class: `AMapToData`
Get the size of this Mapping object on disk.

Specified by:
  `getExactSizeOnDisk` in class `AMapToData`
Returns:
  The on disk size in Bytes.

### set

public void set(int n, int v)
Description copied from class: `AMapToData`
Set the index to the value. NOTE! The value should be representable inside the map. This requirement is not checked.

Specified by:
  `set` in class `AMapToData`
Parameters:
  `n` - index to set.
  `v` - the value to set it to.

### set

public void set(int l, int u, int off, AMapToData tm)
Description copied from class: `AMapToData`
set a range of values from another map. The given tm must only contain supported values, and it is not verified.

Specified by:
  `set` in class `AMapToData`
Parameters:
  `l` - lower bound
  `u` - upper bound (not inclusive)
  `off` - offset to take values from tm
  `tm` - the other map to copy values from

### setAndGet

public int setAndGet(int n, int v)
Description copied from class: `AMapToData`
Set the index to the value and get the contained value after.

Specified by:
  `setAndGet` in class `AMapToData`
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

### size

public int size()
Description copied from class: `AMapToData`
The size of the Mapping object, signaling how many value cells are stored in this mapping object.

Specified by:
  `size` in class `AMapToData`
Returns:
  The length of the mapping object.

### replace

public void replace(int v, int r)
Description copied from class: `AMapToData`
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.

Specified by:
  `replace` in class `AMapToData`
Parameters:
  `v` - The value to replace
  `r` - The value to put instead

### write

public void write(DataOutput out) throws IOException
Description copied from class: `AMapToData`
Serialize this object to the DataOutput given.

Specified by:
  `write` in class `AMapToData`
Parameters:
  `out` - The object to serialize this object into.
Throws:
  `IOException` - An IO exception if the Serialization fails.

### getUpperBoundValue

public int getUpperBoundValue()
Description copied from class: `AMapToData`
Get the maximum value that is possible to allocate inside this map.

Specified by:
  `getUpperBoundValue` in class `AMapToData`
Returns:
  The maximum value.

### copyInt

public void copyInt(int[] d, int start, int end)

Specified by:
  `copyInt` in class `AMapToData`

### getCounts

public int[] getCounts(int[] ret)
Description copied from class: `AMapToData`
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.

Specified by:
  `getCounts` in class `AMapToData`
Parameters:
  `ret` - The object to return.
Returns:
  The counts

### resize

public AMapToData resize(int unique)
Description copied from class: `AMapToData`
Reallocate the map, to a smaller instance if applicable. Note it does not change the length of the array, just the datatype. Note that it returns the input if the input is the smallest representation that fits, otherwise it will return something that is smaller.

Specified by:
  `resize` in class `AMapToData`
Parameters:
  `unique` - The number of tuples that should be supported in the resulting map
Returns:
  The returned hopefully reduced map.

### countRuns

public int countRuns()
Description copied from class: `AMapToData`
Count the number of runs inside the map.

Specified by:
  `countRuns` in class `AMapToData`
Returns:
  The number of runs

### slice

public AMapToData slice(int l, int u)
Description copied from class: `AMapToData`
Slice out the range from lower to upper from this map toData.

Specified by:
  `slice` in class `AMapToData`
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.

### append

public AMapToData append(AMapToData t)

Specified by:
  `append` in class `AMapToData`

### appendN

public AMapToData appendN(IMapToDataGroup[] d)

Specified by:
  `appendN` in class `AMapToData`

### equals

public boolean equals(AMapToData e)
Description copied from class: `AMapToData`
Indicate if the given encoding is equivalent to this encoding

Specified by:
  `equals` in class `AMapToData`
Parameters:
  `e` - The other encoding to be compared with this
Returns:
  If the encoding is equivalent

### lmSparseMatrixRow

public void lmSparseMatrixRow(SparseBlock sb, int r, DenseBlock db, IColIndex colIndexes, IDictionary dict)

Overrides:
  `lmSparseMatrixRow` in class `AMapToData`

### decompressToRange

public void decompressToRange(double[] c, int rl, int ru, int offR, double[] values)

Overrides:
  `decompressToRange` in class `AMapToData`

### decompressToRangeOff

public void decompressToRangeOff(double[] c, int rl, int ru, int offR, double[] values)

### decompressToRangeNoOff

public void decompressToRangeNoOff(double[] c, int rl, int ru, double[] values)

### splitReshapeDDCPushDown

public AMapToData[] splitReshapeDDCPushDown(int multiplier, ExecutorService pool) throws Exception

Overrides:
  `splitReshapeDDCPushDown` in class `AMapToData`
Throws:
  `Exception`