On 02/24/2014 02:18 PM, Ted Dunning wrote: > > On Mon, Feb 24, 2014 at 10:23 AM, Gilles <gil...@harfang.homelinux.org > <mailto:gil...@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.
Agreed. Perhaps by providing the result matrix the optimization algorithm can choose the best data layout for itself. Regards, Evan