Commit 560771be authored by Marco Ratto's avatar Marco Ratto
Browse files

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

parent 285e40eb
......@@ -133,7 +133,7 @@ while i<n
end
f1(:,i)=fx;
if outer_product_gradient,
if any(isnan(ffx))
if any(isnan(ffx)) || isempty(ffx),
ff1=ones(size(ff0)).*fx/length(ff0);
else
ff1=ffx;
......@@ -143,7 +143,7 @@ while i<n
[fx, ffx]=feval(func,xh1,DynareDataset,DynareOptions,Model,EstimatedParameters,BayesInfo,DynareResults);
f_1(:,i)=fx;
if outer_product_gradient,
if any(isnan(ffx))
if any(isnan(ffx)) || isempty(ffx),
ff_1=ones(size(ff0)).*fx/length(ff0);
else
ff_1=ffx;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment