Search in sources :

Example 31 with LongArrayList

use of it.unimi.dsi.fastutil.longs.LongArrayList in project presto by prestodb.

the class TestColumnIndexFilter method assertRows.

private static void assertRows(RowRanges ranges, long... expectedRows) {
    LongList actualList = new LongArrayList();
    ranges.iterator().forEachRemaining((long value) -> actualList.add(value));
    assertArrayEquals(Arrays.toString(expectedRows) + " != " + actualList, expectedRows, actualList.toLongArray());
}
Also used : LongArrayList(it.unimi.dsi.fastutil.longs.LongArrayList) LongList(it.unimi.dsi.fastutil.longs.LongList)

Example 32 with LongArrayList

use of it.unimi.dsi.fastutil.longs.LongArrayList in project symja_android_library by axkr.

the class DateTimeColumn method lag.

@Override
public DateTimeColumn lag(int n) {
    int srcPos = n >= 0 ? 0 : 0 - n;
    long[] dest = new long[size()];
    int destPos = n <= 0 ? 0 : n;
    int length = n >= 0 ? size() - n : size() + n;
    for (int i = 0; i < size(); i++) {
        dest[i] = DateTimeColumnType.missingValueIndicator();
    }
    System.arraycopy(data.toLongArray(), srcPos, dest, destPos, length);
    DateTimeColumn copy = emptyCopy(size());
    copy.data = new LongArrayList(dest);
    copy.setName(name() + " lag(" + n + ")");
    return copy;
}
Also used : LongArrayList(it.unimi.dsi.fastutil.longs.LongArrayList)

Example 33 with LongArrayList

use of it.unimi.dsi.fastutil.longs.LongArrayList in project druid by druid-io.

the class GenericIndexedWriter method initializeHeaderOutLong.

private void initializeHeaderOutLong() throws IOException {
    headerOutLong = new LongArrayList();
    try (final DataInputStream headerOutAsIntInput = new DataInputStream(headerOut.asInputStream())) {
        for (int i = 0; i < numWritten; i++) {
            int count = headerOutAsIntInput.readInt();
            headerOutLong.add(count);
        }
    }
}
Also used : LongArrayList(it.unimi.dsi.fastutil.longs.LongArrayList) DataInputStream(java.io.DataInputStream)

Example 34 with LongArrayList

use of it.unimi.dsi.fastutil.longs.LongArrayList in project angel by Tencent.

the class CooLongFloatMatrix method getRow.

@Override
public Vector getRow(int idx) {
    LongArrayList cols = new LongArrayList();
    FloatArrayList data = new FloatArrayList();
    for (int i = 0; i < rowIndices.length; i++) {
        if (rowIndices[i] == idx) {
            cols.add(colIndices[i]);
            data.add(values[i]);
        }
    }
    LongFloatSparseVectorStorage storage = new LongFloatSparseVectorStorage(shape[1], cols.toLongArray(), data.toFloatArray());
    return new LongFloatVector(getMatrixId(), idx, getClock(), shape[1], storage);
}
Also used : LongArrayList(it.unimi.dsi.fastutil.longs.LongArrayList) FloatArrayList(it.unimi.dsi.fastutil.floats.FloatArrayList) LongFloatVector(com.tencent.angel.ml.math2.vector.LongFloatVector) LongFloatSparseVectorStorage(com.tencent.angel.ml.math2.storage.LongFloatSparseVectorStorage)

Example 35 with LongArrayList

use of it.unimi.dsi.fastutil.longs.LongArrayList in project angel by Tencent.

the class CooLongFloatMatrix method getCol.

@Override
public Vector getCol(int idx) {
    LongArrayList cols = new LongArrayList();
    FloatArrayList data = new FloatArrayList();
    for (int i = 0; i < colIndices.length; i++) {
        if (colIndices[i] == idx) {
            cols.add(rowIndices[i]);
            data.add(values[i]);
        }
    }
    LongFloatSparseVectorStorage storage = new LongFloatSparseVectorStorage(shape[0], cols.toLongArray(), data.toFloatArray());
    return new LongFloatVector(getMatrixId(), 0, getClock(), shape[0], storage);
}
Also used : LongArrayList(it.unimi.dsi.fastutil.longs.LongArrayList) FloatArrayList(it.unimi.dsi.fastutil.floats.FloatArrayList) LongFloatVector(com.tencent.angel.ml.math2.vector.LongFloatVector) LongFloatSparseVectorStorage(com.tencent.angel.ml.math2.storage.LongFloatSparseVectorStorage)

Aggregations

LongArrayList (it.unimi.dsi.fastutil.longs.LongArrayList)37 IntArrayList (it.unimi.dsi.fastutil.ints.IntArrayList)5 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)4 IndexPartGetLongResult (com.tencent.angel.ml.matrix.psf.get.indexed.IndexPartGetLongResult)3 ServerLongAnyRow (com.tencent.angel.ps.storage.vector.ServerLongAnyRow)3 Long2ObjectMap (it.unimi.dsi.fastutil.longs.Long2ObjectMap)3 LongList (it.unimi.dsi.fastutil.longs.LongList)3 LongOpenHashSet (it.unimi.dsi.fastutil.longs.LongOpenHashSet)3 IOException (java.io.IOException)3 List (java.util.List)3 Block (com.facebook.presto.spi.block.Block)2 Type (com.facebook.presto.spi.type.Type)2 Supplier (com.google.common.base.Supplier)2 LongFloatSparseVectorStorage (com.tencent.angel.ml.math2.storage.LongFloatSparseVectorStorage)2 LongFloatVector (com.tencent.angel.ml.math2.vector.LongFloatVector)2 FloatArrayList (it.unimi.dsi.fastutil.floats.FloatArrayList)2 Map (java.util.Map)2 TreeMap (java.util.TreeMap)2 BinaryDecoder (co.cask.cdap.common.io.BinaryDecoder)1