use of it.unimi.dsi.fastutil.shorts.ShortArrayList in project symja_android_library by axkr.
the class ShortColumn method top.
@Override
public ShortColumn top(int n) {
final ShortArrayList top = new ShortArrayList();
final short[] values = data.toShortArray();
ShortArrays.parallelQuickSort(values, ShortComparators.OPPOSITE_COMPARATOR);
for (int i = 0; i < n && i < values.length; i++) {
top.add(values[i]);
}
return new ShortColumn(name() + "[Top " + n + "]", top);
}
use of it.unimi.dsi.fastutil.shorts.ShortArrayList in project symja_android_library by axkr.
the class ShortColumn method lag.
@Override
public ShortColumn lag(int n) {
final int srcPos = n >= 0 ? 0 : 0 - n;
final short[] dest = new short[size()];
final int destPos = n <= 0 ? 0 : n;
final int length = n >= 0 ? size() - n : size() + n;
for (int i = 0; i < size(); i++) {
dest[i] = ShortColumnType.missingValueIndicator();
}
short[] array = data.toShortArray();
System.arraycopy(array, srcPos, dest, destPos, length);
return new ShortColumn(name() + " lag(" + n + ")", new ShortArrayList(dest));
}
use of it.unimi.dsi.fastutil.shorts.ShortArrayList in project symja_android_library by axkr.
the class ShortColumn method bottom.
@Override
public ShortColumn bottom(final int n) {
final ShortArrayList bottom = new ShortArrayList();
final short[] values = data.toShortArray();
ShortArrays.parallelQuickSort(values);
for (int i = 0; i < n && i < values.length; i++) {
bottom.add(values[i]);
}
return new ShortColumn(name() + "[Bottoms " + n + "]", bottom);
}
use of it.unimi.dsi.fastutil.shorts.ShortArrayList in project symja_android_library by axkr.
the class ShortDictionaryMap method sortDescending.
@Override
public void sortDescending() {
short[] elements = values.toShortArray();
ShortArrays.parallelQuickSort(elements, reverseDictionarySortComparator);
this.values = new ShortArrayList(elements);
}
use of it.unimi.dsi.fastutil.shorts.ShortArrayList in project symja_android_library by axkr.
the class ShortDictionaryMap method sortAscending.
@Override
public void sortAscending() {
short[] elements = values.toShortArray();
ShortArrays.parallelQuickSort(elements, dictionarySortComparator);
this.values = new ShortArrayList(elements);
}
Aggregations