commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (MATH-1103) Convergence Checker Fixes
Date Tue, 25 Feb 2014 23:31:21 GMT

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

Gilles commented on MATH-1103:
------------------------------

Please create different tickets for different problems.
The second patch seems to introduce a dependency.

The first patch shows how brittle code can become without defensive copying.

{noformat}
-        Evaluation current = problem.evaluate(new ArrayRealVector(currentPoint, false));
+        Evaluation current = problem.evaluate(new ArrayRealVector(currentPoint));
{noformat}

Although the second may be correct, it is no less dangerous because nothing at this level
warns the developer that a new instance is required for correctness. The "evaluate" method
should be creating a copy of an object that will be used outside the class (i.e. without control).
It is fine to be concerned about performance but IMO robustness must come before premature
optimization.


> Convergence Checker Fixes
> -------------------------
>
>                 Key: MATH-1103
>                 URL: https://issues.apache.org/jira/browse/MATH-1103
>             Project: Commons Math
>          Issue Type: Bug
>            Reporter: Evan Ward
>         Attachments: 0001-Fix-checker-seeing-not-old-point.patch, 0002-Fix-switched-iterations-and-evaluations.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message