Class LinearCombinations.ExtendedPrecision
- java.lang.Object
-
- org.apache.commons.numbers.examples.jmh.core.LinearCombinations.BaseLinearCombination
-
- org.apache.commons.numbers.examples.jmh.core.LinearCombinations.ExtendedPrecision
-
- All Implemented Interfaces:
LinearCombination.FourD
,LinearCombination.ND
,LinearCombination.ThreeD
,LinearCombination.TwoD
- Enclosing class:
- LinearCombinations
public static final class LinearCombinations.ExtendedPrecision extends LinearCombinations.BaseLinearCombination implements LinearCombination.TwoD, LinearCombination.ThreeD, LinearCombination.FourD
Computes linear combinations accurately using extended precision representations of floating point numbers.It is based on the paper by Shewchuk (1997): Arbitrary Precision Floating-Point Arithmetic.
-
-
Field Summary
Fields Modifier and Type Field Description static LinearCombinations.ExtendedPrecision
DOUBLE
An instance computing the final summation of the extended precision value using two-fold precision.static LinearCombinations.ExtendedPrecision
EXACT
An instance computing the final summation of the extended precision value exactly.static LinearCombinations.ExtendedPrecision
EXACT2
An instance computing the final summation of the extended precision value exactly.static LinearCombinations.ExtendedPrecision
INSTANCE
An instance computing the final summation of the extended precision value using standard precision.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected double
computeValue(double[] a, double[] b)
Compute the sum of the products of two sequences of factors with high accuracy.double
value(double a1, double b1, double a2, double b2)
Compute the sum of the products of two sequences of factors.double
value(double a1, double b1, double a2, double b2, double a3, double b3)
Compute the sum of the products of two sequences of factors.double
value(double a1, double b1, double a2, double b2, double a3, double b3, double a4, double b4)
Compute the sum of the products of two sequences of factors.-
Methods inherited from class org.apache.commons.numbers.examples.jmh.core.LinearCombinations.BaseLinearCombination
value
-
-
-
-
Field Detail
-
INSTANCE
public static final LinearCombinations.ExtendedPrecision INSTANCE
An instance computing the final summation of the extended precision value using standard precision. The sum will be within 1 ULP of the exact result.
-
DOUBLE
public static final LinearCombinations.ExtendedPrecision DOUBLE
An instance computing the final summation of the extended precision value using two-fold precision. The sum will be within 1 ULP of the exact result.
-
EXACT
public static final LinearCombinations.ExtendedPrecision EXACT
An instance computing the final summation of the extended precision value exactly.
-
EXACT2
public static final LinearCombinations.ExtendedPrecision EXACT2
An instance computing the final summation of the extended precision value exactly.
-
-
Method Detail
-
computeValue
protected double computeValue(double[] a, double[] b)
Description copied from class:LinearCombinations.BaseLinearCombination
Compute the sum of the products of two sequences of factors with high accuracy. The input arrays will have a length of at least 2; the lengths will be the same.- Specified by:
computeValue
in classLinearCombinations.BaseLinearCombination
- Parameters:
a
- Factors.b
- Factors.- Returns:
- \( \sum_i a_i b_i \).
-
value
public double value(double a1, double b1, double a2, double b2)
Description copied from interface:LinearCombination.TwoD
Compute the sum of the products of two sequences of factors.- Specified by:
value
in interfaceLinearCombination.TwoD
- Parameters:
a1
- First factor of the first term.b1
- Second factor of the first term.a2
- First factor of the second term.b2
- Second factor of the second term.- Returns:
- \( a_1 b_1 + a_2 b_2 \)
-
value
public double value(double a1, double b1, double a2, double b2, double a3, double b3)
Description copied from interface:LinearCombination.ThreeD
Compute the sum of the products of two sequences of factors.- Specified by:
value
in interfaceLinearCombination.ThreeD
- Parameters:
a1
- First factor of the first term.b1
- Second factor of the first term.a2
- First factor of the second term.b2
- Second factor of the second term.a3
- First factor of the third term.b3
- Second factor of the third term.- Returns:
- \( a_1 b_1 + a_2 b_2 + a_3 b_3 \)
-
value
public double value(double a1, double b1, double a2, double b2, double a3, double b3, double a4, double b4)
Description copied from interface:LinearCombination.FourD
Compute the sum of the products of two sequences of factors.- Specified by:
value
in interfaceLinearCombination.FourD
- Parameters:
a1
- First factor of the first term.b1
- Second factor of the first term.a2
- First factor of the second term.b2
- Second factor of the second term.a3
- First factor of the third term.b3
- Second factor of the third term.a4
- First factor of the fourth term.b4
- Second factor of the fourth term.- Returns:
- \( a_1 b_1 + a_2 b_2 + a_3 b_3 + a_4 b_4 \)
-
-