You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gilles (JIRA)" <ji...@apache.org> on 2012/11/27 23:20:57 UTC

[jira] [Resolved] (MATH-910) "ebe..." basic operations in "MathArrays"

     [ https://issues.apache.org/jira/browse/MATH-910?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gilles resolved MATH-910.
-------------------------

    Resolution: Fixed

Committed in revision 1414435.
                
> "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