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
Dynare
dynare
Commits
029d3dda
Commit
029d3dda
authored
12 years ago
by
MichelJuillard
Browse files
Options
Downloads
Patches
Plain Diff
dynare++: add steady state to first part of simulation when
interrupted by non finite result
parent
87b78f65
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dynare++/kord/decision_rule.hweb
+11
-8
11 additions, 8 deletions
dynare++/kord/decision_rule.hweb
with
11 additions
and
8 deletions
dynare++/kord/decision_rule.hweb
+
11
−
8
View file @
029d3dda
...
...
@@ -300,7 +300,7 @@ TwoDMatrix* simulate(emethod em, int np, const Vector& ystart,
@<initialize vectors and subvectors for simulation@>;
@<perform the first step of simulation@>;
@<perform all other steps of simulations@>;
@<add the steady state to
all
columns of |res|@>;
@<add the steady state to columns of |res|@>;
return res;
}
...
...
@@ -327,10 +327,11 @@ evaluate the polynomial.
eval(em, out, dyu);
@ Also clear. If the result at some period is not finite, we pad the
rest of the matrix with zeros
and return immediatelly
.
rest of the matrix with zeros.
@<perform all other steps of simulations@>=
for (int i = 1; i < np; i++) {
int i=1;
while (i < np) {
ConstVector ym(*res, i-1);
ConstVector dym(ym, ypart.nstat, ypart.nys());
dy = dym;
...
...
@@ -342,14 +343,16 @@ rest of the matrix with zeros and return immediatelly.
TwoDMatrix rest(*res, i+1, np-i-1);
rest.zeros();
}
re
turn res
;
b
re
ak
;
}
i++;
}
@ Even clearer.
@<add the steady state to all columns of |res|@>=
for (int i = 0; i < res->ncols(); i++) {
Vector col(*res, i);
@ Even clearer. We add the steady state to the numbers computed above and leave the padded columns to zero.
@<add the steady state to columns of |res|@>=
for (int j = 0; j < i; j++) {
Vector col(*res, j);
col.add(1.0, ysteady);
}
...
...
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