Details
-
New Feature
-
Status: Closed
-
Trivial
-
Resolution: Fixed
-
None
-
None
-
None
Description
I propose to add element-by-element addition, subtraction, division and multiplication in the "MathArrays" class. E.g. "ebeDivide" would be defined as:
/** * Creates an array whose contents will be the element-by-element * division of the first argument by the second. * * @param numer Numerator of the division. * @param denom Denominator of the division. * @return a new array {@code r} where {@code r[i] = numer[i] / denom[i]}. * @throws DimensionMismatchException if the array lengths differ. */ public static double[] ebeDivide(double[] numer, double[] denom) { if (numer.length != denom.length) { throw new DimensionMismatchException(numer.length, denom.length); } final double[] result = numer.clone(); for (int i = 0; i < numer.length; i++) { result[i] /= denom[i]; } return result; }
This would allow to resolve MATH-895 without settling the discussion on how the API of RealVector should change.