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

Gilles updated MATH-430:
------------------------

    Attachment: func.tar.gz

As part of this issue, I'm proposing an alternative to the current 
"ComposableFunction" class.

The attached file contains part of the functionality (e.g. function 
composition, addition and multiplication). There are tests showing the intended 
usage.

The main difference with "ComposableFunction" is that utilities (e.g. 
operators) and function objects are separate: Having a "FunctionUtils" keeps 
the overall design more uniform (similar, in spirit,  to the other "...Utils" 
classes in CM). The purpose is also to stay minimalist (e.g. no need to have a 
"divide" method since you can create it with "multiply" and an "Inverse" 
function object).
Also, function objects are first-class citizens, not needing the "import 
static" construct to be used with relative ease.

Please, let me know whether this is going in the right direction.


> Function objects
> ----------------
>
>                 Key: MATH-430
>                 URL: https://issues.apache.org/jira/browse/MATH-430
>             Project: Commons Math
>          Issue Type: Bug
>            Reporter: Gilles
>            Assignee: Gilles
>            Priority: Minor
>             Fix For: 3.0
>
>         Attachments: func.tar.gz
>
>
> Create a package {{function}} to contain classes implementing the 
> {{UnivariateRealFunction}} interface for all the usual functions.
> As a consequence, all {{mapXxx}} methods and {{mapXxxToSelf}} methods in 
> {{RealVector}} can be respectively replaced with
> {code}
> public void map(UnivariateRealFunction f);
> {code}
> and
> {code}
> public void mapToSelf(UnivariateRealFunction f);
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to