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

Reply via email to