Class AOffset
java.lang.Object
org.apache.sysds.runtime.compress.colgroup.offset.AOffset
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
AOffsetByte,OffsetChar,OffsetEmpty,OffsetSingle,OffsetTwo
Offset list encoder abstract class.
It is assumed that the input is in sorted order, all values are positive and there are no duplicates.
The no duplicate is important since 0 values are exploited to encode an offset of max representable value + 1. This gives the ability to encode data, where the offsets are greater than the available highest value that can be represented size.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classOffset slice info containing the start and end index an offset that contains the slice, and an new AOffset containing only the sliced elementsstatic final class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAppend the offsets from that other offset to the offsets in this.appendN(AOffsetsGroup[] g, int s) Append a list of offsets together in order.voidcacheIterator(AIterator it, int row) Cache a iterator in use, note that there is no check for if the iterator is correctly positioned at the given rowvoidvoidbooleanbooleanabstract longRemember to include the ordinal of the type of offset list.abstract longGet the in memory size of the Offset objectabstract AIteratorGet an iterator of the offsets while also maintaining the data index pointer.getIterator(int row) Get an iterator that is pointing at a specific offset.abstract intGet the length of the underlying array.abstract AOffsetIteratorGet an OffsetIterator of current offsets not maintaining the data index.abstract intGet the offset to the first indexabstract intGet the offset to the last valueabstract intgetSize()Get the number of contained elements, This method iterate the entire offset list, so it is not constant lookup.abstract AOffsetmoveIndex(int m) Move the index start x cellsfinal voidpreAggregateDenseMap(DenseBlock db, double[] preAV, int rl, int ru, int cl, int cu, int nVal, AMapToData data) Pre aggregate the specified row and block range from a dense MatrixBlock to prepare for compressed multiplication.final voidpreAggSparseMap(SparseBlock sb, double[] preAV, int rl, int ru, int nVal, AMapToData data) removeEmptyRows(boolean[] selectV, int rOut) reverse(int numRows) Reverse the locations of the offsets such that the inverse offsets are returned.slice(int l, int u) Slice the offsets based on the specified rangetoString()voidverify(int size) Verify that the contained AOffset is a certain size, and not bigger when iterating though it.abstract voidwrite(DataOutput out) Write the offsets to disk.
-
Constructor Details
-
AOffset
public AOffset()
-
-
Method Details
-
getIterator
Get an iterator of the offsets while also maintaining the data index pointer.- Returns:
- AIterator that iterate through index and dictionary offset values.
-
getOffsetIterator
Get an OffsetIterator of current offsets not maintaining the data index.- Returns:
- AIterator that iterator through the delta offsets.
-
getIterator
Get an iterator that is pointing at a specific offset.- Parameters:
row- The row requested.- Returns:
- AIterator that iterate through index and dictionary offset values.
-
constructSkipList
public void constructSkipList() -
clearSkipList
public void clearSkipList() -
cacheIterator
Cache a iterator in use, note that there is no check for if the iterator is correctly positioned at the given row- Parameters:
it- The Iterator to cacherow- The row index to cache the iterator as.
-
write
Write the offsets to disk. If you implement another remember to write the ordinal of the new type to disk as well and add it to the OffsetFactory.- Parameters:
out- The output to write to- Throws:
IOException- Exception that happens if the IO fails to write.
-
getOffsetToFirst
public abstract int getOffsetToFirst()Get the offset to the first index- Returns:
- The first index offset
-
getOffsetToLast
public abstract int getOffsetToLast()Get the offset to the last value- Returns:
- The last values offset
-
getInMemorySize
public abstract long getInMemorySize()Get the in memory size of the Offset object- Returns:
- In memory size as a long.
-
getExactSizeOnDisk
public abstract long getExactSizeOnDisk()Remember to include the ordinal of the type of offset list.- Returns:
- the size on disk as a long.
-
getSize
public abstract int getSize()Get the number of contained elements, This method iterate the entire offset list, so it is not constant lookup.- Returns:
- The number of indexes.
-
preAggregateDenseMap
public final void preAggregateDenseMap(DenseBlock db, double[] preAV, int rl, int ru, int cl, int cu, int nVal, AMapToData data) Pre aggregate the specified row and block range from a dense MatrixBlock to prepare for compressed multiplication.- Parameters:
db- The DenseBlock to extract values from.preAV- The pre aggregate row linearized double array to put the values into.rl- The row lower to start from (this is referring to the left matrix of the multiplication)ru- The row upper to end at (not inclusive) (this is referring to the left matrix of the multiplication)cl- The column lower to start at (this is referring to the right matrix of the multiplication)cu- The column upper to end at (not inclusive) (this is referring to the right matrix of the multiplication)nVal- The number of distinct values in the PreAV indicating number of columns in the Pre aggregatedata- The mapping to column positions in the preAV
-
preAggSparseMap
public final void preAggSparseMap(SparseBlock sb, double[] preAV, int rl, int ru, int nVal, AMapToData data) -
equals
-
equals
-
moveIndex
Move the index start x cells- Parameters:
m- The amount to move- Returns:
- The moved index.
-
getLength
public abstract int getLength()Get the length of the underlying array. This does not reflect the number of contained elements, since some of the elements can be skips.- Returns:
- The length of the underlying arrays
-
slice
Slice the offsets based on the specified range- Parameters:
l- inclusive lower boundu- exclusive upper bound- Returns:
- The slice info containing the new slice.
-
append
Append the offsets from that other offset to the offsets in this.- Parameters:
t- That offset/s- The total length encoded in this offset.- Returns:
- this offsets followed by thats offsets.
-
appendN
Append a list of offsets together in order.- Parameters:
g- The offsets to append together (note fist entry is equal to this)s- The standard size of each g (except last, but that does not matter)- Returns:
- The combined offsets.
-
verify
public void verify(int size) Verify that the contained AOffset is a certain size, and not bigger when iterating though it.- Parameters:
size- The max correct size.
-
toString
-
reverse
Reverse the locations of the offsets such that the inverse offsets are returned. This means that for instance if the current offsets were 1, 3 and 5 in a 5 long list, we return 0, 2 and 4.- Parameters:
numRows- The total number of rows to be contained, This should be greater or equal to last.- Returns:
- The reverse offsets.
-
removeEmptyRows
-