Commit ca974cdf authored by ferhat's avatar ferhat
Browse files

The sparse option in model is now compatible with homotopy => matlab commit

git-svn-id: https://www.dynare.org/svn/dynare/trunk@2589 ac1d8469-bf42-47a9-8791-bf33cf982152
parent ee64d9ab
......@@ -33,8 +33,22 @@ function [x,info] = dynare_solve(func,x,jacobian_flag,varargin)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
global options_
global options_ M_
exist_block_structure=isfield(M_,'block_structure');
%disp(['exist_block_structure = ' int2str(exist_block_structure)]);
if exist_block_structure
%block decomposition is inplemented
[x, info]= feval([M_.fname '_static']);
%size(x)
%info
if info<=0
error('solve_one_boundary has failed in block %d\n',-info/10);
else
info = 0;
end;
return;
end;
options_ = set_default_option(options_,'solve_algo',2);
info = 0;
if options_.solve_algo == 0
......
function y = solve_one_boundary(fname, y, x, params, y_index_eq, nze, periods, is_linear, Block_Num, y_kmin, maxit_, solve_tolf, lambda, cutoff, simulation_method, forward_backward, is_dynamic, verbose)
function [y, info] = solve_one_boundary(fname, y, x, params, y_index_eq, nze, periods, is_linear, Block_Num, y_kmin, maxit_, solve_tolf, lambda, cutoff, simulation_method, forward_backward, is_dynamic, verbose)
% Computes the deterministic simulation of a block of equation containing
% lead or lag variables
%
......@@ -134,6 +134,7 @@ function y = solve_one_boundary(fname, y, x, params, y_index_eq, nze, periods, i
continue;
else
disp('The singularity of the jacobian matrix could not be corrected');
info = -Block_Num*10;
return;
end;
end;
......@@ -161,6 +162,7 @@ function y = solve_one_boundary(fname, y, x, params, y_index_eq, nze, periods, i
oo_.deterministic_simulation.block(Block_Num).error = max_res;
oo_.deterministic_simulation.block(Block_Num).iterations = iter;
end;
info = -Block_Num*10;
return;
end;
else
......@@ -193,7 +195,7 @@ function y = solve_one_boundary(fname, y, x, params, y_index_eq, nze, periods, i
if exitval > 0
info = 0;
else
info = 1;
info = -Block_Num*10;
end
elseif(~is_dynamic & options_.solve_algo==2)
lambda=1;
......@@ -276,6 +278,7 @@ function y = solve_one_boundary(fname, y, x, params, y_index_eq, nze, periods, i
else
disp(['options_.solve_algo = ' num2str(options_.solve_algo) ' not implemented']);
end;
info = -Block_Num*10;
return;
end;
iter=iter+1;
......@@ -295,9 +298,11 @@ function y = solve_one_boundary(fname, y, x, params, y_index_eq, nze, periods, i
oo_.deterministic_simulation.block(Block_Num).error = max_res;
oo_.deterministic_simulation.block(Block_Num).iterations = iter;
end;
info = -Block_Num*10;
return;
end
end
info = 1;
if(is_dynamic)
oo_.deterministic_simulation.status = 1;
oo_.deterministic_simulation.error = max_res;
......
Supports Markdown
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