Search in sources :

Example 76 with IntStream

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);
}
Also used : IntStream(java.util.stream.IntStream) Test(org.junit.jupiter.api.Test)

Example 77 with IntStream

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);
}
Also used : IntStream(java.util.stream.IntStream)

Example 78 with IntStream

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);
}
Also used : IntStream(java.util.stream.IntStream)

Example 79 with IntStream

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();
}
Also used : IntStream(java.util.stream.IntStream)

Example 80 with IntStream

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);
}
Also used : IntStream(java.util.stream.IntStream)

Aggregations

IntStream (java.util.stream.IntStream)96 List (java.util.List)19 Test (org.junit.jupiter.api.Test)17 ArrayList (java.util.ArrayList)15 Stream (java.util.stream.Stream)12 Test (org.junit.Test)12 Arrays (java.util.Arrays)11 Map (java.util.Map)10 Collectors (java.util.stream.Collectors)9 Random (java.util.Random)7 DoubleStream (java.util.stream.DoubleStream)6 LongStream (java.util.stream.LongStream)6 Function (java.util.function.Function)5 Pattern (java.util.regex.Pattern)5 DecimalBoxFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.decimalBox.definition.DecimalBoxFieldDefinition)5 MultipleSubFormFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.multipleSubform.definition.MultipleSubFormFieldDefinition)5 SubFormFieldDefinition (org.kie.workbench.common.forms.fields.shared.fieldTypes.relations.subForm.definition.SubFormFieldDefinition)5 FieldDefinition (org.kie.workbench.common.forms.model.FieldDefinition)5 LayoutRow (org.uberfire.ext.layout.editor.api.editor.LayoutRow)5 LayoutTemplate (org.uberfire.ext.layout.editor.api.editor.LayoutTemplate)5