Class SingleIndex
- java.lang.Object
-
- org.apache.sysds.runtime.compress.colgroup.indexes.AColIndex
-
- org.apache.sysds.runtime.compress.colgroup.indexes.SingleIndex
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.sysds.runtime.compress.colgroup.indexes.IColIndex
IColIndex.ColIndexType, IColIndex.SliceResult
-
-
Constructor Summary
Constructors Constructor Description SingleIndex(int idx)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description doubleavgOfIndex()Get the average of this index.IColIndexcombine(IColIndex other)combine the indexes of this colIndex with another, it is expected that all calls to this contains unique indexes, and no copies of values.booleancontains(int i)Analyze if this column group contain the given column idbooleanequals(IColIndex other)longestimateInMemorySize()Get the in memory size of this object.static longestimateInMemorySizeStatic()intfindIndex(int i)Find the index of the value given return negative if non existing.intget(int i)Get the index at a specific location, Note that many of the underlying implementations does not throw exceptions on indexes that are completely wrong, so all implementations that use this index should always be well behaved.longgetExactSizeOnDisk()Get the exact size on disk to enable preallocation of the disk output buffer sizesint[]getReorderingIndex()If the columns are not in sorted incrementing order this method can be called to get the sorting index for this set of column indexes.booleanisContiguous()Get if these columns are contiguous, meaning all indexes are integers at increments of 1.booleanisSorted()Get if the Index is sorted.IIterateiterator()A Iterator of the indexes see the iterator interface for details.SingleIndexshift(int i)Return a new column index where the values are shifted by the specified amount.intsize()Get the size of the index aka, how many columns is containedIColIndex.SliceResultslice(int l, int u)Slice the range given.IColIndexsort()Sort the index and return a new object if there are modifications otherwise return this.StringtoString()voidwrite(DataOutput out)Write out the IO representation of this column index-
Methods inherited from class org.apache.sysds.runtime.compress.colgroup.indexes.AColIndex
contains, containsAny, containsStrict, decompressToDenseFromSparse, decompressVec, equals, hashCode
-
-
-
-
Method Detail
-
size
public int size()
Description copied from interface:IColIndexGet the size of the index aka, how many columns is contained- Returns:
- The size of the array
-
get
public int get(int i)
Description copied from interface:IColIndexGet the index at a specific location, Note that many of the underlying implementations does not throw exceptions on indexes that are completely wrong, so all implementations that use this index should always be well behaved.- Parameters:
i- The index to get- Returns:
- the column index at the index.
-
shift
public SingleIndex shift(int i)
Description copied from interface:IColIndexReturn a new column index where the values are shifted by the specified amount. It is returning a new instance of the index.- Parameters:
i- The amount to shift- Returns:
- the new instance of an index.
-
iterator
public IIterate iterator()
Description copied from interface:IColIndexA Iterator of the indexes see the iterator interface for details.- Returns:
- A iterator for the indexes contained.
-
write
public void write(DataOutput out) throws IOException
Description copied from interface:IColIndexWrite out the IO representation of this column index- Parameters:
out- The Output to write into- Throws:
IOException- IO exceptions in case of for instance not enough disk space
-
getExactSizeOnDisk
public long getExactSizeOnDisk()
Description copied from interface:IColIndexGet the exact size on disk to enable preallocation of the disk output buffer sizes- Returns:
- The exact disk representation size
-
estimateInMemorySize
public long estimateInMemorySize()
Description copied from interface:IColIndexGet the in memory size of this object.- Returns:
- The memory size of this object
-
estimateInMemorySizeStatic
public static long estimateInMemorySizeStatic()
-
findIndex
public int findIndex(int i)
Description copied from interface:IColIndexFind the index of the value given return negative if non existing.- Parameters:
i- the value to find inside the allocation- Returns:
- The index of the value.
-
slice
public IColIndex.SliceResult slice(int l, int u)
Description copied from interface:IColIndexSlice the range given. The slice result is an object containing the indexes in the original array to slice out and a new index for the sliced columns offset by l. Example: ArrayIndex(1,3,5).slice(2,6) returns SliceResult(1,3,ArrayIndex(1,3))- Parameters:
l- inclusive lower boundu- exclusive upper bound- Returns:
- A slice result
-
equals
public boolean equals(IColIndex other)
-
combine
public IColIndex combine(IColIndex other)
Description copied from interface:IColIndexcombine the indexes of this colIndex with another, it is expected that all calls to this contains unique indexes, and no copies of values.- Parameters:
other- The other array- Returns:
- The combined array
-
isContiguous
public boolean isContiguous()
Description copied from interface:IColIndexGet if these columns are contiguous, meaning all indexes are integers at increments of 1. ex: 1,2,3,4,5,6 is contiguous 1,3,4 is not.- Returns:
- If the Columns are contiguous.
-
getReorderingIndex
public int[] getReorderingIndex()
Description copied from interface:IColIndexIf the columns are not in sorted incrementing order this method can be called to get the sorting index for this set of column indexes. The returned list should be the mapping of elements for each column to where it should be after sorting.- Returns:
- A Reordered index.
-
isSorted
public boolean isSorted()
Description copied from interface:IColIndexGet if the Index is sorted.- Returns:
- If the index is sorted
-
sort
public IColIndex sort()
Description copied from interface:IColIndexSort the index and return a new object if there are modifications otherwise return this.- Returns:
- The sorted instance of this column index.
-
contains
public boolean contains(int i)
Description copied from interface:IColIndexAnalyze if this column group contain the given column id- Parameters:
i- id to search for- Returns:
- if it is contained
-
avgOfIndex
public double avgOfIndex()
Description copied from interface:IColIndexGet the average of this index. We use this to sort the priority que when combining equivalent costly groups- Returns:
- The average of the indexes.
-
-