Java Code Examples for java.util.concurrent.atomic.DoubleAdder#doubleValue()

The following examples show how to use java.util.concurrent.atomic.DoubleAdder#doubleValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Serial.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
static void testDoubleAdder() {
    DoubleAdder a = new DoubleAdder();
    a.add(20.1d);
    DoubleAdder result = echo(a);
    if (result.doubleValue() != a.doubleValue())
        throw new RuntimeException("Unexpected doubleValue");

    checkSerialClassName(a, "java.util.concurrent.atomic.DoubleAdder$SerializationProxy");
}
 
Example 2
Source File: Serial.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
static void testDoubleAdder() {
    DoubleAdder a = new DoubleAdder();
    a.add(20.1d);
    DoubleAdder result = echo(a);
    if (result.doubleValue() != a.doubleValue())
        throw new RuntimeException("Unexpected doubleValue");

    checkSerialClassName(a, "java.util.concurrent.atomic.DoubleAdder$SerializationProxy");
}
 
Example 3
Source File: Serial.java    From native-obfuscator with GNU General Public License v3.0 5 votes vote down vote up
static void testDoubleAdder() {
    DoubleAdder a = new DoubleAdder();
    a.add(20.1d);
    DoubleAdder result = echo(a);
    if (result.doubleValue() != a.doubleValue())
        throw new RuntimeException("Unexpected doubleValue");

    checkSerialClassName(a, "java.util.concurrent.atomic.DoubleAdder$SerializationProxy");
}
 
Example 4
Source File: Serial.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
static void testDoubleAdder() {
    DoubleAdder a = new DoubleAdder();
    a.add(20.1d);
    DoubleAdder result = echo(a);
    if (result.doubleValue() != a.doubleValue())
        throw new RuntimeException("Unexpected doubleValue");

    checkSerialClassName(a, "java.util.concurrent.atomic.DoubleAdder$SerializationProxy");
}
 
Example 5
Source File: Serial.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
static void testDoubleAdder() {
    DoubleAdder a = new DoubleAdder();
    a.add(20.1d);
    DoubleAdder result = echo(a);
    if (result.doubleValue() != a.doubleValue())
        throw new RuntimeException("Unexpected doubleValue");

    checkSerialClassName(a, "java.util.concurrent.atomic.DoubleAdder$SerializationProxy");
}
 
Example 6
Source File: Serial.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
static void testDoubleAdder() {
    DoubleAdder a = new DoubleAdder();
    a.add(20.1d);
    DoubleAdder result = echo(a);
    if (result.doubleValue() != a.doubleValue())
        throw new RuntimeException("Unexpected doubleValue");

    checkSerialClassName(a, "java.util.concurrent.atomic.DoubleAdder$SerializationProxy");
}
 
Example 7
Source File: Serial.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
static void testDoubleAdder() {
    DoubleAdder a = new DoubleAdder();
    a.add(20.1d);
    DoubleAdder result = echo(a);
    if (result.doubleValue() != a.doubleValue())
        throw new RuntimeException("Unexpected doubleValue");

    checkSerialClassName(a, "java.util.concurrent.atomic.DoubleAdder$SerializationProxy");
}
 
Example 8
Source File: Serial.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
static void testDoubleAdder() {
    DoubleAdder a = new DoubleAdder();
    a.add(20.1d);
    DoubleAdder result = echo(a);
    if (result.doubleValue() != a.doubleValue())
        throw new RuntimeException("Unexpected doubleValue");

    checkSerialClassName(a, "java.util.concurrent.atomic.DoubleAdder$SerializationProxy");
}
 
Example 9
Source File: Serial.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
static void testDoubleAdder() {
    DoubleAdder a = new DoubleAdder();
    a.add(20.1d);
    DoubleAdder result = echo(a);
    if (result.doubleValue() != a.doubleValue())
        throw new RuntimeException("Unexpected doubleValue");

    checkSerialClassName(a, "java.util.concurrent.atomic.DoubleAdder$SerializationProxy");
}
 
Example 10
Source File: Serial.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
static void testDoubleAdder() {
    DoubleAdder a = new DoubleAdder();
    a.add(20.1d);
    DoubleAdder result = echo(a);
    if (result.doubleValue() != a.doubleValue())
        throw new RuntimeException("Unexpected doubleValue");

    checkSerialClassName(a, "java.util.concurrent.atomic.DoubleAdder$SerializationProxy");
}
 
Example 11
Source File: Serial.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
static void testDoubleAdder() {
    DoubleAdder a = new DoubleAdder();
    a.add(20.1d);
    DoubleAdder result = echo(a);
    if (result.doubleValue() != a.doubleValue())
        throw new RuntimeException("Unexpected doubleValue");

    checkSerialClassName(a, "java.util.concurrent.atomic.DoubleAdder$SerializationProxy");
}
 
Example 12
Source File: Serial.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
static void testDoubleAdder() {
    DoubleAdder a = new DoubleAdder();
    a.add(20.1d);
    DoubleAdder result = echo(a);
    if (result.doubleValue() != a.doubleValue())
        throw new RuntimeException("Unexpected doubleValue");

    checkSerialClassName(a, "java.util.concurrent.atomic.DoubleAdder$SerializationProxy");
}
 
Example 13
Source File: ERRIA.java    From RankSys with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * Returns a score for the recommendation list.
 *
 * @param recommendation recommendation list
 * @return score of the metric to the recommendation
 */
@Override
public double evaluate(Recommendation<U, I> recommendation) {
    RelevanceModel.UserRelevanceModel<U, I> userRelModel = relModel.getModel(recommendation.getUser());
    UserIntentModel<U, I, F> uim = intentModel.getModel(recommendation.getUser());

    DoubleAdder erria = new DoubleAdder();

    Object2DoubleMap<F> pNoPrevRel = new Object2DoubleOpenHashMap<>();
    pNoPrevRel.defaultReturnValue(0.0);
    uim.getIntents().forEach(f -> pNoPrevRel.put(f, 1.0));

    AtomicInteger rank = new AtomicInteger();
    recommendation.getItems().stream().limit(cutoff).forEach(iv -> {
        if (userRelModel.isRelevant(iv.v1)) {
            double gain = userRelModel.gain(iv.v1);
            uim.getItemIntents(iv.v1).forEach(f -> {
                double red = pNoPrevRel.getDouble(f);
                erria.add(uim.pf_u(f) * gain * red / (1.0 + rank.intValue()));
                pNoPrevRel.put(f, red * (1 - gain));
            });
        }
        rank.incrementAndGet();
    });

    return erria.doubleValue();
}
 
Example 14
Source File: VectorFeatureItemDistanceModel.java    From RankSys with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * Returns a function that returns the feature-based similarity to the
 * features of an item.
 *
 * @param features1 stream of features of an item
 * @return function that returns the feature-based similarity to the
 * features of an item
 */
@Override
public ToDoubleFunction<Stream<Tuple2<F, Double>>> dist(Stream<Tuple2<F, Double>> features1) {
    Object2DoubleMap<F> auxMap = new Object2DoubleOpenHashMap<>();
    auxMap.defaultReturnValue(0.0);
    DoubleAdder norm1 = new DoubleAdder();

    features1.forEach(fv -> {
        auxMap.put(fv.v1, fv.v2);
        norm1.add(fv.v2 * fv.v2);
    });

    if (norm1.doubleValue() == 0) {
        return features2 -> Double.NaN;
    }

    return features2 -> {
        DoubleAdder prod = new DoubleAdder();
        DoubleAdder norm2 = new DoubleAdder();
        features2.forEach(fv -> {
            prod.add(fv.v2 * auxMap.getDouble(fv.v1));
            norm2.add(fv.v2 * fv.v2);
        });

        if (norm2.doubleValue() == 0) {
            return Double.NaN;
        }

        return dist(prod.doubleValue(), norm1.doubleValue(), norm2.doubleValue());
    };
}
 
Example 15
Source File: Serial.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
static void testDoubleAdder() {
    DoubleAdder a = new DoubleAdder();
    a.add(20.1d);
    DoubleAdder result = echo(a);
    if (result.doubleValue() != a.doubleValue())
        throw new RuntimeException("Unexpected doubleValue");

    checkSerialClassName(a, "java.util.concurrent.atomic.DoubleAdder$SerializationProxy");
}
 
Example 16
Source File: Serial.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
static void testDoubleAdder() {
    DoubleAdder a = new DoubleAdder();
    a.add(20.1d);
    DoubleAdder result = echo(a);
    if (result.doubleValue() != a.doubleValue())
        throw new RuntimeException("Unexpected doubleValue");

    checkSerialClassName(a, "java.util.concurrent.atomic.DoubleAdder$SerializationProxy");
}