Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can NonlinearModelFit be parallelized or compiled to allow one to achieve a scalable speedup for a fitting procedure? Attempting to use this function to fit a bivariate Gaussian (with a decent guess for initial conditions) can take upwards of a second.

share|improve this question
Not really, no. NonLinearModelFit uses FindFit which uses FindMinimum, and this function is well optimized. If none of the FindMinimum methods gives you a solution quickly enough (by which I mean: try them all, including a reasonable selection of suboptions) then I suppose it'll be quite difficult to achieve a speed-up any other way. – Oleksandr R. Jun 26 '13 at 10:50
@OleksandrR. it depends. If the OP would be a little more open and post some code, there might be an issue with the optimizer for instance (catchword NIntegrate etc.) – Stefan Jun 26 '13 at 12:46
@Stefan Apologies, I didn't mean to be cagey about anything. My question here just has to do with a previous question of mine asking about how to best do a 2D Gaussian fit:… – Bob Jun 26 '13 at 13:08
@Stefan yes, you're right of course. It's only because OP's questions so far have all been so vague that I thought the easiest approach was just to assume a sensible approach is being taken and say no rather than painfully try to extract more details such as, I don't know, what the function being fitted actually is. – Oleksandr R. Jun 26 '13 at 14:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.