You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "greg sterijevski (JIRA)" <ji...@apache.org> on 2011/09/22 09:23:26 UTC
[jira] [Created] (MATH-675) MathUtils should have a static method
which checks whether an array of doubles or Comparables is monotone
MathUtils should have a static method which checks whether an array of doubles or Comparables is monotone
----------------------------------------------------------------------------------------------------------
Key: MATH-675
URL: https://issues.apache.org/jira/browse/MATH-675
Project: Commons Math
Issue Type: New Feature
Affects Versions: 3.0
Environment: Java
Reporter: greg sterijevski
Assignee: greg sterijevski
Priority: Minor
Fix For: 3.0
The static method checkOrder in MathUtils is a useful piece of code which checks for monotonically increasing or decreasing elements in an array. It would be useful to have a similar method for Comparable. Furthermore, this new method would just return true or false. Unlike the current checkOrder, no exception would be thrown if monotonicity did not exist.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (MATH-675) MathUtils should have a static method
which checks whether an array of doubles or Comparables is monotone
Posted by "greg sterijevski (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-675?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13150976#comment-13150976 ]
greg sterijevski commented on MATH-675:
---------------------------------------
Yes, my apologies. Have had a lot of things going on.
On Tue, Nov 15, 2011 at 5:34 AM, Gilles (Commented) (JIRA)
> MathUtils should have a static method which checks whether an array of doubles or Comparables is monotone
> ----------------------------------------------------------------------------------------------------------
>
> Key: MATH-675
> URL: https://issues.apache.org/jira/browse/MATH-675
> Project: Commons Math
> Issue Type: New Feature
> Affects Versions: 3.0
> Environment: Java
> Reporter: greg sterijevski
> Assignee: greg sterijevski
> Priority: Minor
> Labels: MathUtils
> Fix For: 3.0
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> The static method checkOrder in MathUtils is a useful piece of code which checks for monotonically increasing or decreasing elements in an array. It would be useful to have a similar method for Comparable. Furthermore, this new method would just return true or false. Unlike the current checkOrder, no exception would be thrown if monotonicity did not exist.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (MATH-675) MathUtils should have a static method
which checks whether an array of doubles or Comparables is monotone
Posted by "Gilles (Resolved) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-675?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gilles resolved MATH-675.
-------------------------
Resolution: Fixed
> MathUtils should have a static method which checks whether an array of doubles or Comparables is monotone
> ----------------------------------------------------------------------------------------------------------
>
> Key: MATH-675
> URL: https://issues.apache.org/jira/browse/MATH-675
> Project: Commons Math
> Issue Type: New Feature
> Affects Versions: 3.0
> Environment: Java
> Reporter: greg sterijevski
> Assignee: greg sterijevski
> Priority: Minor
> Labels: MathUtils
> Fix For: 3.0
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> The static method checkOrder in MathUtils is a useful piece of code which checks for monotonically increasing or decreasing elements in an array. It would be useful to have a similar method for Comparable. Furthermore, this new method would just return true or false. Unlike the current checkOrder, no exception would be thrown if monotonicity did not exist.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (MATH-675) MathUtils should have a static method
which checks whether an array of doubles or Comparables is monotone
Posted by "Gilles (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-675?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13126983#comment-13126983 ]
Gilles commented on MATH-675:
-----------------------------
All remarks implemented as part of MATH-689 (revisions 1182134, 1182137, 1182147) and in revision 1183119.
> MathUtils should have a static method which checks whether an array of doubles or Comparables is monotone
> ----------------------------------------------------------------------------------------------------------
>
> Key: MATH-675
> URL: https://issues.apache.org/jira/browse/MATH-675
> Project: Commons Math
> Issue Type: New Feature
> Affects Versions: 3.0
> Environment: Java
> Reporter: greg sterijevski
> Assignee: greg sterijevski
> Priority: Minor
> Labels: MathUtils
> Fix For: 3.0
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> The static method checkOrder in MathUtils is a useful piece of code which checks for monotonically increasing or decreasing elements in an array. It would be useful to have a similar method for Comparable. Furthermore, this new method would just return true or false. Unlike the current checkOrder, no exception would be thrown if monotonicity did not exist.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (MATH-675) MathUtils should have a static method
which checks whether an array of doubles or Comparables is monotone
Posted by "Gilles (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-675?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13116327#comment-13116327 ]
Gilles commented on MATH-675:
-----------------------------
# The new method is currently named "isMonotone". However, we agreed (on the "dev" ML) to use "Monotonic" (in a related exception name). Thus shouldn't the name be "isMonotonic"?
# I don't understand the purpose or/and implementation of those tests:
{code}
@Test
public void testIsMonotone() {
if(MathUtils.isMonotone(new double[] {-15, -5.5, -1, -1, 2,15},
MathUtils.OrderDirection.INCREASING, true) ){
Assert.fail("an exception should have been thrown");
}
if(MathUtils.isMonotone(new double[] {-15, -5.5,-1,-2,2},
MathUtils.OrderDirection.INCREASING, false)){
Assert.fail("an exception should have been thrown");
}
if(MathUtils.isMonotone(new double[] {3,3,-5.5,-11,-27.5},
MathUtils.OrderDirection.DECREASING, true)){
Assert.fail("an exception should have been thrown");
}
if( MathUtils.isMonotone(new double[] {3,-1,0,-5.5,-11,-27.5},
MathUtils.OrderDirection.DECREASING, false) ){
Assert.fail("an exception should have been thrown");
}
}
{code}
Since "isMonotone" never throws an exception, the message is misleading.
I think that you should just have used "Assert.assertTrue" and "Assert.assertFalse".
# "isMonotone" with a {{double[]}} argument is redundant with "checkOrder". Either we should remove the new method, or, if the syntactic sugar of the new naming is necessary, it should call "checkOrder" to avoid unnecessary code duplication.
> MathUtils should have a static method which checks whether an array of doubles or Comparables is monotone
> ----------------------------------------------------------------------------------------------------------
>
> Key: MATH-675
> URL: https://issues.apache.org/jira/browse/MATH-675
> Project: Commons Math
> Issue Type: New Feature
> Affects Versions: 3.0
> Environment: Java
> Reporter: greg sterijevski
> Assignee: greg sterijevski
> Priority: Minor
> Labels: MathUtils
> Fix For: 3.0
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> The static method checkOrder in MathUtils is a useful piece of code which checks for monotonically increasing or decreasing elements in an array. It would be useful to have a similar method for Comparable. Furthermore, this new method would just return true or false. Unlike the current checkOrder, no exception would be thrown if monotonicity did not exist.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (MATH-675) MathUtils should have a static method
which checks whether an array of doubles or Comparables is monotone
Posted by "Gilles (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-675?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13150390#comment-13150390 ]
Gilles commented on MATH-675:
-----------------------------
Can we close this issue?
> MathUtils should have a static method which checks whether an array of doubles or Comparables is monotone
> ----------------------------------------------------------------------------------------------------------
>
> Key: MATH-675
> URL: https://issues.apache.org/jira/browse/MATH-675
> Project: Commons Math
> Issue Type: New Feature
> Affects Versions: 3.0
> Environment: Java
> Reporter: greg sterijevski
> Assignee: greg sterijevski
> Priority: Minor
> Labels: MathUtils
> Fix For: 3.0
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> The static method checkOrder in MathUtils is a useful piece of code which checks for monotonically increasing or decreasing elements in an array. It would be useful to have a similar method for Comparable. Furthermore, this new method would just return true or false. Unlike the current checkOrder, no exception would be thrown if monotonicity did not exist.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira