commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Dunning <ted.dunn...@gmail.com>
Subject Re: [math] refactoring least squares
Date Mon, 24 Feb 2014 19:18:22 GMT
On Mon, Feb 24, 2014 at 10:23 AM, Gilles <gilles@harfang.homelinux.org>wrote:

> One way to improve performance would be to provide pre-allocated space
>> for the Jacobian and reuse it for each evaluation.
>>
>
> Do you have actual data to back this statement?
>
>
>  The
>> LeastSquaresProblem interface would then be:
>>
>> void evaluate(RealVector point, RealVector resultResiduals, RealVector
>> resultJacobian);
>>
>> I'm interested in hearing your ideas on other approaches to solve this
>> issue. Or even if this is an issue worth solving.
>>
>
> Not before we can be sure that in-place modification (rather than
> reallocation) always provides a performance benefit.


Allocation is rarely the problem in these situations.  The implied copying
of data is.

And even the copying isn't always a problem.  For instance, it often pays
off big to copy data to column (or row) major representation to improve
cache coherency.  The result is that a large fraction of the time is spent
copying, but without the copying, the remaining time would take 10x longer.
 The net time taken is 3x faster with the copy.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message