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

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

Introduction

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

Prototype

public static double max(final double a, final double b) 

Source Link

Document

Compute the maximum of two values

Usage

From source file:com.bc.util.ObjectArray.java

public void set(ObjectArray array) {
    final int start = FastMath.max(_minIndex, array.getMinIndex());
    final int end = FastMath.min(_maxIndex, array.getMaxIndex());

    if (end < start) {
        return;// w  ww.j  a va2s . c om
    }

    final int srcPos = start - array.getMinIndex();
    final int destPos = start - _minIndex;
    System.arraycopy(array._objects, srcPos, _objects, destPos, end - start + 1);
}

From source file:Align_Projections.java

public boolean converged(final int iteration, final RealPointValuePair previous,
        final RealPointValuePair current) {
    if (apObject.getStopTuning()) {
        return true;
    }//from  w  w  w .j  ava2 s  . c  om
    final double p = previous.getValue();
    final double c = current.getValue();
    final double difference = FastMath.abs(p - c);
    final double size = FastMath.max(FastMath.abs(p), FastMath.abs(c));
    return (difference <= (size * relativeThreshold)) || (difference <= absoluteThreshold);
}