Example usage for org.apache.commons.math.util FastMath log1p

List of usage examples for org.apache.commons.math.util FastMath log1p

Introduction

In this page you can find the example usage for org.apache.commons.math.util FastMath log1p.

Prototype

public static double log1p(final double x) 

Source Link

Document

Compute log(1 + x).

Usage

From source file:org.onebusaway.nyc.vehicle_tracking.impl.inference.likelihood.ScheduleLikelihood.java

/**
 * Manual truncation (when using the formal run distribution)
 * We shouldn't have to worry about normalization, yet.
 *///w  w  w  .j a va 2  s .  co m
public static double getScheduleDevLogProb(final double x, StudentTDistribution schedDist) {
    final double pSched;
    final boolean isFormal = schedDist == schedDevFormalRunDist;
    if (!isFormal || (x <= POS_SCHED_DEV_CUTOFF && x >= NEG_SCHED_DEV_CUTOFF)) {
        pSched = (isFormal ? FastMath.log(pFormal) : FastMath.log1p(-pFormal))
                + schedDist.getProbabilityFunction().logEvaluate(x);
    } else {
        pSched = Double.NEGATIVE_INFINITY;
    }
    return pSched;
}