use of it.unimi.dsi.fastutil.doubles.DoubleArrayList in project pinot by linkedin.
the class PercentileMVAggregationFunction method aggregate.
@Override
public void aggregate(int length, @Nonnull AggregationResultHolder aggregationResultHolder, @Nonnull BlockValSet... blockValSets) {
double[][] valuesArray = blockValSets[0].getDoubleValuesMV();
DoubleArrayList doubleArrayList = aggregationResultHolder.getResult();
if (doubleArrayList == null) {
doubleArrayList = new DoubleArrayList();
aggregationResultHolder.setValue(doubleArrayList);
}
for (int i = 0; i < length; i++) {
for (double value : valuesArray[i]) {
doubleArrayList.add(value);
}
}
}
use of it.unimi.dsi.fastutil.doubles.DoubleArrayList in project pinot by linkedin.
the class PercentileAggregationFunction method aggregateGroupByMV.
@Override
public void aggregateGroupByMV(int length, @Nonnull int[][] groupKeysArray, @Nonnull GroupByResultHolder groupByResultHolder, @Nonnull BlockValSet... blockValSets) {
double[] valueArray = blockValSets[0].getDoubleValuesSV();
for (int i = 0; i < length; i++) {
double value = valueArray[i];
for (int groupKey : groupKeysArray[i]) {
DoubleArrayList doubleArrayList = groupByResultHolder.getResult(groupKey);
if (doubleArrayList == null) {
doubleArrayList = new DoubleArrayList();
groupByResultHolder.setValueForKey(groupKey, doubleArrayList);
}
doubleArrayList.add(value);
}
}
}
use of it.unimi.dsi.fastutil.doubles.DoubleArrayList in project pinot by linkedin.
the class PercentileAggregationFunction method aggregate.
@Override
public void aggregate(int length, @Nonnull AggregationResultHolder aggregationResultHolder, @Nonnull BlockValSet... blockValSets) {
double[] valueArray = blockValSets[0].getDoubleValuesSV();
DoubleArrayList doubleArrayList = aggregationResultHolder.getResult();
if (doubleArrayList == null) {
doubleArrayList = new DoubleArrayList();
aggregationResultHolder.setValue(doubleArrayList);
}
for (int i = 0; i < length; i++) {
doubleArrayList.add(valueArray[i]);
}
}
use of it.unimi.dsi.fastutil.doubles.DoubleArrayList in project pinot by linkedin.
the class ObjectCustomSerDeTest method testDoubleArrayList.
/**
* Test for ser/de of {@link DoubleArrayList}.
*/
@Test
public void testDoubleArrayList() throws IOException {
for (int i = 0; i < NUM_ITERATIONS; i++) {
int size = RANDOM.nextInt(100);
DoubleArrayList expected = new DoubleArrayList(size);
for (int j = 0; j < size; j++) {
expected.add(RANDOM.nextDouble());
}
byte[] bytes = ObjectCustomSerDe.serialize(expected);
DoubleArrayList actual = ObjectCustomSerDe.deserialize(bytes, ObjectType.DoubleArrayList);
Assert.assertEquals(actual, expected, ERROR_MESSAGE);
}
}
use of it.unimi.dsi.fastutil.doubles.DoubleArrayList in project angel by Tencent.
the class CooLongDoubleMatrix method getRow.
@Override
public Vector getRow(int idx) {
LongArrayList cols = new LongArrayList();
DoubleArrayList data = new DoubleArrayList();
for (int i = 0; i < rowIndices.length; i++) {
if (rowIndices[i] == idx) {
cols.add(colIndices[i]);
data.add(values[i]);
}
}
LongDoubleSparseVectorStorage storage = new LongDoubleSparseVectorStorage(shape[1], cols.toLongArray(), data.toDoubleArray());
return new LongDoubleVector(getMatrixId(), idx, getClock(), shape[1], storage);
}
Aggregations