You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the NonlinearObjectiveModel for nonlinear least squares fitting of weighted data. However, the fitting fails due to an overflow exception when the number of data points becomes too large (let's say, 10000+).
The origin of this exception is the SetObserved method in the NonlinearObjectiveFunction. At the end of this method, a DenseMatrix is constructed for the data point weights, although this matrix contains diagonal elements only. The dense matrix stores all (10000+)^2 (mostly zero) entries, which exceeds my memory. To my mind, a DiagonalMatrix would be the better choice here.
... and it solves my issue. I also tested this for small data (10 points) and didn't notice any performance declines there either.
Is there any reason for hanging on to the DenseMatrix? If not, I would suggest modifying the mentioned lines as described. I'm happy to great a pull request for this.