Skip to content
Snippets Groups Projects
Verified Commit 5670d393 authored by Johannes Pfeifer's avatar Johannes Pfeifer Committed by Sébastien Villemot
Browse files

dynare_solve: deal with Dulmage-Mendelsohn decomposition returns a non-square block

Related to #1851

(manually cherry picked from commit 5788f1bc)
parent 748ef8b5
No related branches found
No related tags found
No related merge requests found
Checking pipeline status
...@@ -311,11 +311,29 @@ elseif ismember(options.solve_algo, [2, 12, 4]) ...@@ -311,11 +311,29 @@ elseif ismember(options.solve_algo, [2, 12, 4])
dprintf('DYNARE_SOLVE (solve_algo=2|4|12): solving block %u with trust_region routine.', i); dprintf('DYNARE_SOLVE (solve_algo=2|4|12): solving block %u with trust_region routine.', i);
end end
end end
[x, errorflag] = solver(f, x, j1(j), j2(j), jacobian_flag, ... blockcolumns=s(i+1)-s(i);
options.gstep, ... if blockcolumns ~= blocklength
tolf, options.solve_tolx, ... %non-square-block in DM; check whether initial value is solution
maxit, options.debug, args{:}); [fval_check, fjac] = feval(f, x, args{:});
fre = true; if norm(fval_check(j1(j))) < tolf
errorflag = false;
errorcode = 0;
continue
end
end
if blockcolumns>=blocklength
%(under-)determined block
[x, errorflag, errorcode] = solver(f, x, j1(j), j2(j), jacobian_flag, ...
options.gstep, ...
tolf, options.solve_tolx, maxit, ...
options.debug, args{:});
fre = true;
else
fprintf('\nDYNARE_SOLVE (solve_algo=2|4|12): the Dulmage-Mendelsohn decomposition returned a non-square block. This means that the Jacobian is singular. You may want to try another value for solve_algo.\n')
%overdetermined block
errorflag = true;
errorcode = 0;
end
if errorflag if errorflag
return return
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment