Trap the case when second output of objective function is empty.

time-shift
Marco Ratto 2012-10-01 08:50:47 +02:00
parent 285e40eb2c
commit 560771bedc
1 changed files with 2 additions and 2 deletions

View File

@ -133,7 +133,7 @@ while i<n
end end
f1(:,i)=fx; f1(:,i)=fx;
if outer_product_gradient, if outer_product_gradient,
if any(isnan(ffx)) if any(isnan(ffx)) || isempty(ffx),
ff1=ones(size(ff0)).*fx/length(ff0); ff1=ones(size(ff0)).*fx/length(ff0);
else else
ff1=ffx; ff1=ffx;
@ -143,7 +143,7 @@ while i<n
[fx, ffx]=feval(func,xh1,DynareDataset,DynareOptions,Model,EstimatedParameters,BayesInfo,DynareResults); [fx, ffx]=feval(func,xh1,DynareDataset,DynareOptions,Model,EstimatedParameters,BayesInfo,DynareResults);
f_1(:,i)=fx; f_1(:,i)=fx;
if outer_product_gradient, if outer_product_gradient,
if any(isnan(ffx)) if any(isnan(ffx)) || isempty(ffx),
ff_1=ones(size(ff0)).*fx/length(ff0); ff_1=ones(size(ff0)).*fx/length(ff0);
else else
ff_1=ffx; ff_1=ffx;