Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dynare
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Frédéric Karamé
dynare
Commits
3c7b1cf2
Commit
3c7b1cf2
authored
10 years ago
by
MichelJuillard
Browse files
Options
Downloads
Patches
Plain Diff
changed calling sequence for sim1; use local variable names without _;
sim1 honors options_.nodisplay
parent
21f009a5
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
matlab/perfect-foresight-models/perfect_foresight_solver_core.m
+1
-1
1 addition, 1 deletion
.../perfect-foresight-models/perfect_foresight_solver_core.m
matlab/perfect-foresight-models/sim1.m
+16
-16
16 additions, 16 deletions
matlab/perfect-foresight-models/sim1.m
with
17 additions
and
17 deletions
matlab/perfect-foresight-models/perfect_foresight_solver_core.m
+
1
−
1
View file @
3c7b1cf2
...
...
@@ -39,7 +39,7 @@ else
oo_ = sim1_purely_forward(options_, M_, oo_);
else % General case
if options_.stack_solve_algo == 0
oo_ = sim1(options_,
M_,
oo_);
oo_ = sim1(
M_,
options_, oo_);
elseif options_.stack_solve_algo == 6
oo_ = sim1_lbj(options_, M_, oo_);
elseif options_.stack_solve_algo == 7
...
...
This diff is collapsed.
Click to expand it.
matlab/perfect-foresight-models/sim1.m
+
16
−
16
View file @
3c7b1cf2
function
oo_
=
sim1
(
options
_
,
M_
,
oo
_
)
function
oo_
=
sim1
(
M
,
options
,
oo
)
% function sim1
% Performs deterministic simulations with lead or lag on one period.
% Uses sparse matrices.
...
...
@@ -31,7 +31,7 @@ function oo_ = sim1(options_, M_, oo_)
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
verbose
=
options
_
.
no_homotopy
;
verbose
=
options
.
no_homotopy
&&
~
options
.
nodisplay
;
endogenous_terminal_period
=
options
.
endogenous_terminal_period
;
vperiods
=
options
.
periods
*
ones
(
1
,
options
.
simul
.
maxit
);
...
...
@@ -170,11 +170,11 @@ end
if
stop
if
any
(
isnan
(
res
))
||
any
(
isinf
(
res
))
||
any
(
isnan
(
Y
))
||
any
(
isinf
(
Y
))
||
~
isreal
(
res
)
||
~
isreal
(
Y
)
oo
_
.
deterministic_simulation
.
status
=
false
;
% NaN or Inf occurred
oo
_
.
deterministic_simulation
.
error
=
err
;
oo
_
.
deterministic_simulation
.
iterations
=
iter
;
oo
_
.
deterministic_simulation
.
periods
=
vperiods
(
1
:
iter
);
oo
_
.
endo_simul
=
reshape
(
Y
,
ny
,
periods
+
maximum_lag
+
M
_
.
maximum_lead
);
oo
.
deterministic_simulation
.
status
=
false
;
% NaN or Inf occurred
oo
.
deterministic_simulation
.
error
=
err
;
oo
.
deterministic_simulation
.
iterations
=
iter
;
oo
.
deterministic_simulation
.
periods
=
vperiods
(
1
:
iter
);
oo
.
endo_simul
=
reshape
(
Y
,
ny
,
periods
+
maximum_lag
+
M
.
maximum_lead
);
if
verbose
skipline
();
fprintf
(
'\nSimulation terminated after %d iterations.\n'
,
iter
);
...
...
@@ -194,11 +194,11 @@ if stop
fprintf
(
'Max. Abs. Error : %16.13f\n'
,
err
);
fprintf
(
'Convergency obtained!\n'
);
end
oo
_
.
deterministic_simulation
.
status
=
true
;
% Convergency obtained.
oo
_
.
deterministic_simulation
.
error
=
err
;
oo
_
.
deterministic_simulation
.
iterations
=
iter
;
oo
_
.
deterministic_simulation
.
periods
=
vperiods
(
1
:
iter
);
oo
_
.
endo_simul
=
reshape
(
Y
,
ny
,
periods
+
maximum_lag
+
M
_
.
maximum_lead
);
oo
.
deterministic_simulation
.
status
=
true
;
% Convergency obtained.
oo
.
deterministic_simulation
.
error
=
err
;
oo
.
deterministic_simulation
.
iterations
=
iter
;
oo
.
deterministic_simulation
.
periods
=
vperiods
(
1
:
iter
);
oo
.
endo_simul
=
reshape
(
Y
,
ny
,
periods
+
maximum_lag
+
M
.
maximum_lead
);
end
elseif
~
stop
if
verbose
...
...
@@ -208,10 +208,10 @@ elseif ~stop
fprintf
(
'Max. Abs. Error : %16.13f\n'
,
err
);
fprintf
(
'WARNING : maximum number of iterations is reached (modify option maxit).\n'
)
;
end
oo
_
.
deterministic_simulation
.
status
=
false
;
% more iterations are needed.
oo
_
.
deterministic_simulation
.
error
=
err
;
oo
_
.
deterministic_simulation
.
periods
=
vperiods
(
1
:
iter
);
oo
_
.
deterministic_simulation
.
iterations
=
options
_
.
simul
.
maxit
;
oo
.
deterministic_simulation
.
status
=
false
;
% more iterations are needed.
oo
.
deterministic_simulation
.
error
=
err
;
oo
.
deterministic_simulation
.
periods
=
vperiods
(
1
:
iter
);
oo
.
deterministic_simulation
.
iterations
=
options
.
simul
.
maxit
;
end
if
verbose
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment