[
https://issues.apache.org/jira/browse/HAMA-782?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Yexi Jiang updated HAMA-782:
----------------------------
Attachment: HAMA-782.patch
1. Change the name of argument and comments to make it more clear.
2. Add pre-condition check.
3. Add test cases.
> The arguments of DoubleVector.slice(int, int) method will mislead the user
> --------------------------------------------------------------------------
>
> Key: HAMA-782
> URL: https://issues.apache.org/jira/browse/HAMA-782
> Project: Hama
> Issue Type: Improvement
> Components: machine learning, math
> Reporter: Yexi Jiang
> Assignee: Yexi Jiang
> Fix For: 0.6.3
>
> Attachments: HAMA-782.patch
>
>
> The current implementation of DoubleVector.slice(int, int) is ambiguous.
> Current description of this method is as follows:
> --------------------------------------------------------
> Slices this vector from index offset with the given length. So you end at the
> upper bound of (offset+length).
> --------------------------------------------------------
> If the given vector is vec = [0, 1, 2, 3, 4, 5, 6], and user uses
> vec.slice(2, 3) and hope to get [2, 3, 4]. However, it actually returns [2,3].
> This is because the actual implementation extract the elements start from
> 'offset' and end at 'length' (exclusive). The argument name will mislead the
> user.
--
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