Class LinearCombination
- java.lang.Object
-
- org.apache.commons.numbers.arrays.LinearCombination
-
public class LinearCombination extends java.lang.ObjectComputes linear combinations accurately. This method computes the sum of the productsai bito high accuracy. It does so by using specific multiplication and addition algorithms to preserve accuracy and reduce cancellation effects. It is based on the 2005 paper Accurate Sum and Dot Product by Takeshi Ogita, Siegfried M. Rump, and Shin'ichi Oishi published in SIAM J. Sci. Comput.
-
-
Constructor Summary
Constructors Constructor Description LinearCombination()
-
Method Summary
Modifier and Type Method Description static doublevalue(double[] a, double[] b)static doublevalue(double a1, double b1, double a2, double b2)static doublevalue(double a1, double b1, double a2, double b2, double a3, double b3)static doublevalue(double a1, double b1, double a2, double b2, double a3, double b3, double a4, double b4)
-
-
-
Method Detail
-
value
public static double value(double[] a, double[] b)- Parameters:
a- Factors.b- Factors.- Returns:
- \( \sum_i a_i b_i \).
- Throws:
java.lang.IllegalArgumentException- if the sizes of the arrays are different.
-
value
public static double value(double a1, double b1, double a2, double b2)- 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 \)
- See Also:
value(double, double, double, double, double, double),value(double, double, double, double, double, double, double, double),value(double[], double[])
-
value
public static double value(double a1, double b1, double a2, double b2, double a3, double b3)- 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 \)
- See Also:
value(double, double, double, double),value(double, double, double, double, double, double, double, double),value(double[], double[])
-
value
public static double value(double a1, double b1, double a2, double b2, double a3, double b3, double a4, double b4)- 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 \)
- See Also:
value(double, double, double, double),value(double, double, double, double, double, double),value(double[], double[])
-
-