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

Sébastien Brisard commented on MATH-761:
----------------------------------------

As of {{r1303674}}, the last breach in data encapsulation is the reference to 
an instance of {{SymmLQ.State}} that {{SymmLQ.SymmLQEvent}} keeps. The 
rationale for this is the ability to call {{SymmLQ.State.moveToCG(RealVector)}} 
from within {{SymmLQ.SymmLQEvent}}. Indeed, throughout the iterations, the 
SYMMLQ algorithm does not evaluate the current estimate of the solution to the 
linear system. After the iterations have converged, a final refinement is 
performed to get the solution. However, the current estimate of the solution 
*should* be accessible from the events fired by {{SymmLQ}}. In order to spare 
some CPU time, this estimate is lazily initialized when 
{{SymmLQ.SymmLQEvent.getSolution()}} is called. This leads to rather unwanted 
sharing of data between different classes.

Monitoring shows that the gain provided by this lazy initialization is in fact 
negligible for decently large linear systems. It is therefore decided that the 
refinement of the solution should be evaluated *at each iteration* in the main 
loop of the SYMMLQ algo, rather than on demand in the {{SymmLQEvent}}. This 
allows better data encapsulation in {{SymmLQ.State}}. More precisely, all 
vector updates occur *explicitely* instead of transparently (through the use of 
references). Also, {{SymmLQEvent}} can be completely removed, and replaced with 
{{DefaultIterativeLinearSolverEvent}}.

All these changes are performed in {{r1304574}}.
                
> Improve encapsulation of data in the nested classes of SymmLQ
> -------------------------------------------------------------
>
>                 Key: MATH-761
>                 URL: https://issues.apache.org/jira/browse/MATH-761
>             Project: Commons Math
>          Issue Type: Improvement
>    Affects Versions: 3.1
>            Reporter: Sébastien Brisard
>            Assignee: Sébastien Brisard
>              Labels: linear
>
> In order to limit object creation, the current implementation of the 
> {{SymmLQ}} solver makes heavy use of references accross nested classes in 
> {{SymmLQ}}. This makes the code difficult to read, and should be modified, 
> keeping the public API.

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


Reply via email to