Gilles created MATH-910:
---------------------------

             Summary: "ebe..." basic operations in "MathArrays"
                 Key: MATH-910
                 URL: https://issues.apache.org/jira/browse/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:
{code}
    /**
     * 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;
    }
{code}

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: http://www.atlassian.com/software/jira

Reply via email to