Using parfor with fminsearch

Hi everybody. I would like to generate a distribution of parameter vectors using different subsamples. The estimates are produced using my self-defined function criterion. I have B samples, so Bsamples{b} picks out the b-th saple.
parfor b=1:B
Bresults(b,:)=fminsearch(@criterion,x,options,nsimu,Bsamples{b},0,ss);
% find estimator, x=starting parameter vector
end
While this works fine with a "for" loop, when using "parfor" it always returns the starting parameter vector as result. It seems not to recognize the different inputs Bsamples{b}. Is it in general not possible to parfor with optimization routines? Other operations, like mean(Bsample{b}) in the loop work fine.
Many thanks! Philipp

1 Comment

Can you provide some values? I see no reason why what you have above would not work with a parfor() loop.
Also, I would recommend using an anonymous function do pass the extra parameters:

Sign in to comment.

Answers (0)

Categories

Find more on Parallel Computing Toolbox in Help Center and File Exchange

Asked:

on 29 Jan 2013

Community Treasure Hunt

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

Start Hunting!