Search in sources :

Example 1 with ShortArrayList

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);
}
Also used : ShortArrayList(it.unimi.dsi.fastutil.shorts.ShortArrayList)

Example 2 with ShortArrayList

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));
}
Also used : ShortArrayList(it.unimi.dsi.fastutil.shorts.ShortArrayList)

Example 3 with ShortArrayList

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);
}
Also used : ShortArrayList(it.unimi.dsi.fastutil.shorts.ShortArrayList)

Example 4 with ShortArrayList

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);
}
Also used : ShortArrayList(it.unimi.dsi.fastutil.shorts.ShortArrayList)

Example 5 with ShortArrayList

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);
}
Also used : ShortArrayList(it.unimi.dsi.fastutil.shorts.ShortArrayList)

Aggregations

ShortArrayList (it.unimi.dsi.fastutil.shorts.ShortArrayList)5