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
ca32be2d
Verified
Commit
ca32be2d
authored
2 years ago
by
Sébastien Villemot
Browse files
Options
Downloads
Plain Diff
Merge branch 'model_diag' of git.dynare.org:JohannesPfeifer/dynare
Ref.
!2058
parents
ff85fc64
253c87b8
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!2058
model_diagnostics.m: allow setting tolerance for singularity checks starting with Matlab 2022a
Pipeline
#7328
passed
2 years ago
Stage: build
Stage: test
Stage: pkg
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
matlab/default_option_values.m
+1
-0
1 addition, 0 deletions
matlab/default_option_values.m
matlab/model_diagnostics.m
+15
-5
15 additions, 5 deletions
matlab/model_diagnostics.m
with
16 additions
and
5 deletions
matlab/default_option_values.m
+
1
−
0
View file @
ca32be2d
...
...
@@ -42,6 +42,7 @@ options_.timing = 0;
options_
.
gstep
=
ones
(
2
,
1
);
options_
.
gstep
(
1
)
=
1e-2
;
options_
.
gstep
(
2
)
=
1.0
;
options_
.
jacobian_tolerance
=
[];
%tolerance for rank of Jacobian in model_diagnostics
options_
.
scalv
=
1
;
options_
.
debug
=
false
;
options_
.
initval_file
=
false
;
...
...
This diff is collapsed.
Click to expand it.
matlab/model_diagnostics.m
+
15
−
5
View file @
ca32be2d
...
...
@@ -33,8 +33,6 @@ function model_diagnostics(M,options,oo)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <https://www.gnu.org/licenses/>.
global
jacob
endo_nbr
=
M
.
endo_nbr
;
endo_names
=
M
.
endo_names
;
lead_lag_incidence
=
M
.
lead_lag_incidence
;
...
...
@@ -174,7 +172,11 @@ for b=1:nb
display_problematic_vars_Jacobian
(
imagrow
,
imagcol
,
M
,
dr
.
ys
,
'static'
,
'MODEL_DIAGNOSTICS: '
)
end
try
rank_jacob
=
rank
(
jacob
);
%can sometimes fail
if
isoctave
||
matlab_ver_less_than
(
'9.12'
)
||
isempty
(
options_
.
jacobian_tolerance
)
rank_jacob
=
rank
(
jacob
);
%can sometimes fail
else
rank_jacob
=
rank
(
jacob
,
options_
.
jacobian_tolerance
);
%can sometimes fail
end
catch
rank_jacob
=
size
(
jacob
,
1
);
end
...
...
@@ -185,7 +187,11 @@ for b=1:nb
'singular'
])
disp
([
'MODEL_DIAGNOSTICS: there is '
num2str
(
endo_nbr
-
rank_jacob
)
...
' colinear relationships between the variables and the equations'
])
ncol
=
null
(
jacob
);
if
isoctave
||
matlab_ver_less_than
(
'9.12'
)
||
isempty
(
options_
.
jacobian_tolerance
)
ncol
=
null
(
jacob
);
else
ncol
=
null
(
jacob
,
options_
.
jacobian_tolerance
);
%can sometimes fail
end
n_rel
=
size
(
ncol
,
2
);
for
i
=
1
:
n_rel
if
n_rel
>
1
...
...
@@ -200,7 +206,11 @@ for b=1:nb
end
fprintf
(
'%s\n'
,
endo_names
{
k
})
end
neq
=
null
(
jacob
'
);
if
isoctave
||
matlab_ver_less_than
(
'9.12'
)
||
isempty
(
options_
.
jacobian_tolerance
)
neq
=
null
(
jacob
'
);
%can sometimes fail
else
neq
=
null
(
jacob
'
,
options_
.
jacobian_tolerance
);
%can sometimes fail
end
n_rel
=
size
(
neq
,
2
);
for
i
=
1
:
n_rel
if
n_rel
>
1
...
...
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