commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (JIRA)" <>
Subject [jira] [Created] (MATH-910) "ebe..." basic operations in "MathArrays"
Date Tue, 27 Nov 2012 16:29:58 GMT
Gilles created MATH-910:

             Summary: "ebe..." basic operations in "MathArrays"
                 Key: MATH-910
             Project: Commons Math
          Issue Type: New Feature
            Reporter: Gilles
            Assignee: Gilles
            Priority: Trivial
             Fix For: 3.1

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.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message