On Fri, Jul 08, 2011 at 08:44:15AM +0200, Sebastien Brisard wrote: > Hi everyone, > well the message below did not raise much of an interest... My apology, I > forgot to quote [math] in the title. > Anyway, I have a new proposal regarding this issue. I do not know what your > view on the subject is, but I tend to think that exceptions should return > references and not deep copies of the objects that caused these exceptions to > be raised. This facilitates debugging (I guess), and also helps identify the > exact origin of the problem, without having to specialize the exception. As an > example, Conjugate Gradient requires positive definiteness of both matrix (a) > and preconditioner (m). If a NonPositiveDefiniteLinearOperatorException is > caught, then I can simply test > a == e.getOffendingLinearOperator() > or > m = e.getOffendingLinearOperator() > > Now, coming to offending vectors, the issue is that these can either be > instances of RealVector, or double[]. So, what type should be returned by > getOffendingVector()? > > I propose to have the exceptions return a reference to the RealVector.
It looks like the best solution. > If the > exception was raised with a double[], then the returned RealVector will > actually be an instance of ArrayRealVector, with a reference to the initial > double[]. All this is to be clearly specified in the javadoc. Does that sound > like a viable option? > > I'll attach the corresponding files to the JIRA issue, if you want to have a > more precise idea of what I'm talking about. Regards, Gilles --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org