SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.misc

Class PrecisionUtils

• public final class PrecisionUtils
extends Object
Precision-related utility functions.
• Method Summary

All Methods
Modifier and Type Method and Description
static double autoEpsilon(double... inputs)
Guess a reasonable precision parameter.
static double autoEpsilon(double[]... inputs)
Guess a reasonable precision parameter.
static double autoEpsilon(MatrixTable A)
Guess a reasonable precision parameter.
• Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• Method Detail

• autoEpsilon

public static double autoEpsilon(double... inputs)
Guess a reasonable precision parameter. In numerical computing, we often need to guess how small a number needs to be for it to be considered 0. Changing the threshold often changes the results, e.g., the numerical rank of a matrix.

This method suggests a more 'objective' way to determine the 'correct' epsilon from the inputs. Roughly,

auto ε = |max(inputs)| * sqrt(number of inputs) * machine ε * 10
Parameters:
inputs - doubles
Returns:
a precision parameter
• autoEpsilon

public static double autoEpsilon(double[]... inputs)
Guess a reasonable precision parameter. In numerical computing, we often need to guess how small a number needs to be for it to be considered 0. Changing the threshold often changes the results, e.g., the numerical rank of a matrix.

This method suggests a more 'objective' way to determine the 'correct' epsilon from the inputs. Roughly,

auto ε = |max(inputs)| * sqrt(number of inputs) * machine ε * 10
Parameters:
inputs - arrays of double[]s
Returns:
a precision parameter
• autoEpsilon

public static double autoEpsilon(MatrixTable A)
Guess a reasonable precision parameter. In numerical computing, we often need to guess how small a number needs to be for it to be considered 0. Changing the threshold often changes the results, e.g., the numerical rank of a matrix.

This method suggests a more 'objective' way to determine the 'correct' epsilon from the inputs. Roughly,

auto ε = |max(inputs)| * sqrt(number of inputs) * machine ε * 10
Parameters:
A - a matrix
Returns:
a precision parameter