Batched partitioned nonlinear least squares

Speed up when you have a very large number of nonlinear least squares problems, but with one model
Updated 23 Apr 2015

View License

Occasionally I see requests to solve very many nonlinear least squares problems, all of which have the same model, but different sets of data. The simple answer is a loop, or you might use a parallel computing solution. However, you can also use a capability that is built into the optimization toolbox solvers - to allow you to solve many small problems in parallel with a block diagonal Jacobian matrix.
For example, suppose you are asked to estimate the coefficients for the model
y = a1 + a2*exp(a3*x)
This is a simple problem to solve using any nonlinear regression tool. (I recommend my own fminspleas, also on the File Exchange.) But suppose you have 10000 sets of data, so you need to solve for 10000 sets of parameters? You could just use a loop, but loops are not always the most efficient way to solve a problem.
batchpleas is the tool for this problem. It will typically allow for an order of magnitude enhancement in throughput, without the need for any parallel processing toolbox. For example the example I provide in the included demo showed a 13-1 speedup when fitting a set of 10000 curves to data, each with 3 parameters to estimate.

The latest revision now offers bound constraints to be placed on all parameters.

Cite As

John D'Errico (2024). Batched partitioned nonlinear least squares (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!


Version Published Release Notes

Improved the demo, adding a two nonlinear parameter example.

Documentation changes, plus a repair to the demo to show proper usage.

1. Speedup made for non-bound constrained problems.
2. Bound constraints implemented.
3. Code cleaned up, with one minor bug fixed for an error check.