use of java.util.stream.IntStream in project Gaffer by gchq.
the class GafferCollectorTest method shouldCollectToLimitedSortedSet.
@Test
public void shouldCollectToLimitedSortedSet() {
final IntStream stream = IntStream.range(0, 100);
final int limit = 50;
final boolean deduplicate = true;
final LimitedInMemorySortedIterable<Integer> result = stream.boxed().collect(toLimitedInMemorySortedIterable(Integer::compareTo, limit, deduplicate));
assertThat(result).hasSize(50);
}
use of java.util.stream.IntStream in project pyramid by cheng-li.
the class CRFLoss method updateEmpiricalCounts.
private void updateEmpiricalCounts() {
IntStream intStream;
if (isParallel) {
intStream = IntStream.range(0, numParameters).parallel();
} else {
intStream = IntStream.range(0, numParameters);
}
intStream.forEach(this::calEmpiricalCount);
}
use of java.util.stream.IntStream in project pyramid by cheng-li.
the class BlockwiseCD method updateEmpiricalCounts.
private void updateEmpiricalCounts() {
IntStream intStream;
if (isParallel) {
intStream = IntStream.range(0, numParameters).parallel();
} else {
intStream = IntStream.range(0, numParameters);
}
intStream.forEach(this::calEmpiricalCount);
}
use of java.util.stream.IntStream in project pyramid by cheng-li.
the class CMLCRFElasticNet method getValueForAllData.
// check
private double getValueForAllData() {
updateClassScoreMatrix();
updateAssignmentScoreMatrix();
IntStream intStream;
if (isParallel) {
intStream = IntStream.range(0, dataSet.getNumDataPoints()).parallel();
} else {
intStream = IntStream.range(0, dataSet.getNumDataPoints());
}
return intStream.mapToDouble(this::getValueForOneData).sum();
}
use of java.util.stream.IntStream in project pyramid by cheng-li.
the class CRFF1Loss method updateEmpiricalCounts.
private void updateEmpiricalCounts() {
IntStream intStream;
if (isParallel) {
intStream = IntStream.range(0, numParameters).parallel();
} else {
intStream = IntStream.range(0, numParameters);
}
intStream.forEach(this::calEmpiricalCount);
}
Aggregations