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
78621c03
Commit
78621c03
authored
10 years ago
by
Stéphane Adjemian
Browse files
Options
Downloads
Plain Diff
Merge pull request #742 from JohannesPfeifer/second_order_hessian_problems
Deal with NaN and Inf in Hessian of dynamic model
parents
42bcd22a
b43d5227
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
matlab/print_info.m
+4
-0
4 additions, 0 deletions
matlab/print_info.m
matlab/stochastic_solvers.m
+24
-0
24 additions, 0 deletions
matlab/stochastic_solvers.m
with
28 additions
and
0 deletions
matlab/print_info.m
+
4
−
0
View file @
78621c03
...
@@ -68,6 +68,10 @@ if ~noprint
...
@@ -68,6 +68,10 @@ if ~noprint
error
([
'k_order_pert was unable to compute the solution'
])
error
([
'k_order_pert was unable to compute the solution'
])
case
10
case
10
error
([
'The Jacobian of the dynamic model contains Inf. For more information, use options_.debug.'
])
error
([
'The Jacobian of the dynamic model contains Inf. For more information, use options_.debug.'
])
case
11
error
(
'The Hessian of the dynamic model used for second order solutions must not contain Inf'
)
case
12
error
(
'The Hessian of the dynamic model used for second order solutions must not contain NaN'
)
case
19
case
19
error
(
'The steadystate file did not compute the steady state'
)
error
(
'The steadystate file did not compute the steady state'
)
case
20
case
20
...
...
This diff is collapsed.
Click to expand it.
matlab/stochastic_solvers.m
+
24
−
0
View file @
78621c03
...
@@ -113,6 +113,30 @@ elseif options_.order == 2
...
@@ -113,6 +113,30 @@ elseif options_.order == 2
hessian1
=
sparse
(
hessian1
(:,
1
),
hessian1
(:,
2
),
hessian1
(:,
3
),
...
hessian1
=
sparse
(
hessian1
(:,
1
),
hessian1
(:,
2
),
hessian1
(:,
3
),
...
size
(
jacobia_
,
1
),
size
(
jacobia_
,
2
)
*
size
(
jacobia_
,
2
));
size
(
jacobia_
,
1
),
size
(
jacobia_
,
2
)
*
size
(
jacobia_
,
2
));
end
end
[
infrow
,
infcol
]
=
find
(
isinf
(
hessian1
));
if
options_
.
debug
if
~
isempty
(
infrow
)
fprintf
(
'\nSTOCHASTIC_SOLVER: The Hessian of the dynamic model contains Inf.\n'
)
fprintf
(
'STOCHASTIC_SOLVER: Try running model_diagnostics to find the source of the problem.\n'
)
save
([
M_
.
fname
'_debug.mat'
],
'hessian1'
)
end
end
if
~
isempty
(
infrow
)
info
(
1
)
=
11
;
return
end
[
nanrow
,
nancol
]
=
find
(
isnan
(
hessian1
));
if
options_
.
debug
if
~
isempty
(
nanrow
)
fprintf
(
'\nSTOCHASTIC_SOLVER: The Hessian of the dynamic model contains NaN.\n'
)
fprintf
(
'STOCHASTIC_SOLVER: Try running model_diagnostics to find the source of the problem.\n'
)
save
([
M_
.
fname
'_debug.mat'
],
'hessian1'
)
end
end
if
~
isempty
(
nanrow
)
info
(
1
)
=
12
;
return
end
end
end
[
infrow
,
infcol
]
=
find
(
isinf
(
jacobia_
));
[
infrow
,
infcol
]
=
find
(
isinf
(
jacobia_
));
...
...
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