hama-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yexi Jiang (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HAMA-765) Add apply method to Vector/Matrix
Date Fri, 14 Jun 2013 20:41:20 GMT

    [ https://issues.apache.org/jira/browse/HAMA-765?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13683758#comment-13683758
] 

Yexi Jiang commented on HAMA-765:
---------------------------------

In the definition of DoubleVector, there are two methods 'apply(DoubleVectorFunction func)',
'apply(DoubleDoubleVectorFunction func)' do the same thing as I mentioned. 
Actually, we do not need to treat Vector and Matrix separately. Therefore, we only need to
define two general classes DoubleFunction and DoubleDoubleFunction, which can be used both
by DoubleVector and DoubleMatrix.

Moreover, I checked the whole ml package, the original 'apply' methods as well as the DoubleVectorFunction,
DoubleDoubleVectorFunction are not used. In case that the end users may have used them, all
the old codes are kept and are annotated as deprecated.

[~thomas.jungblut] I found this code is written by you, do you have any comments?
                
> Add apply method to Vector/Matrix
> ---------------------------------
>
>                 Key: HAMA-765
>                 URL: https://issues.apache.org/jira/browse/HAMA-765
>             Project: Hama
>          Issue Type: Improvement
>            Reporter: Yexi Jiang
>            Assignee: Yexi Jiang
>            Priority: Minor
>
> Add 'apply' method to Vector/Matrix to allow ad-hoc function apply to the elements of
a Vector/Matrix.
> For example, if a function f( x ) needs to apply to the elements of a vector v, then
we can use
> ------------
> DoubleFunction fun = new DoubleFunction() {
>   public double apply(double element) {
>     //  do what ever
>   }
> };
> v.apply(fun);
> ------------
> This method borrows the style of functional programming by allowing a function to apply
to all the elements of a Vector/Matrix. It can simply the coding, especially for those algorithms
where Vector/Matrix operations are heavily used.

--
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

Mime
View raw message