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
07137e80
Commit
07137e80
authored
11 years ago
by
Houtan Bastani
Browse files
Options
Downloads
Patches
Plain Diff
preprocessor: move M_.Correlation_matrix and M_.Correlation_matrix_ME to preprocessor #392
parent
9230a1ea
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
preprocessor/ModFile.cc
+7
-2
7 additions, 2 deletions
preprocessor/ModFile.cc
preprocessor/Shocks.cc
+12
-1
12 additions, 1 deletion
preprocessor/Shocks.cc
with
19 additions
and
3 deletions
preprocessor/ModFile.cc
+
7
−
2
View file @
07137e80
...
@@ -537,15 +537,20 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool no_log, b
...
@@ -537,15 +537,20 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool no_log, b
symbol_table
.
writeOutput
(
mOutputFile
);
symbol_table
.
writeOutput
(
mOutputFile
);
// Initialize M_.Sigma_e
and M_.H
// Initialize M_.Sigma_e
, M_.Correlation_matrix, M_.H, and M_.Correlation_matrix_ME
mOutputFile
<<
"M_.Sigma_e = zeros("
<<
symbol_table
.
exo_nbr
()
<<
", "
mOutputFile
<<
"M_.Sigma_e = zeros("
<<
symbol_table
.
exo_nbr
()
<<
", "
<<
symbol_table
.
exo_nbr
()
<<
");"
<<
endl
<<
"M_.Correlation_matrix = eye("
<<
symbol_table
.
exo_nbr
()
<<
", "
<<
symbol_table
.
exo_nbr
()
<<
");"
<<
endl
;
<<
symbol_table
.
exo_nbr
()
<<
");"
<<
endl
;
if
(
mod_file_struct
.
calibrated_measurement_errors
)
if
(
mod_file_struct
.
calibrated_measurement_errors
)
mOutputFile
<<
"M_.H = zeros("
<<
symbol_table
.
observedVariablesNbr
()
<<
", "
mOutputFile
<<
"M_.H = zeros("
<<
symbol_table
.
observedVariablesNbr
()
<<
", "
<<
symbol_table
.
observedVariablesNbr
()
<<
");"
<<
endl
<<
"M_.Correlation_matrix_ME = eye("
<<
symbol_table
.
observedVariablesNbr
()
<<
", "
<<
symbol_table
.
observedVariablesNbr
()
<<
");"
<<
endl
;
<<
symbol_table
.
observedVariablesNbr
()
<<
");"
<<
endl
;
else
else
mOutputFile
<<
"M_.H = 0;"
<<
endl
;
mOutputFile
<<
"M_.H = 0;"
<<
endl
<<
"M_.Correlation_matrix_ME = 1;"
<<
endl
;
if
(
linear
==
1
)
if
(
linear
==
1
)
mOutputFile
<<
"options_.linear = 1;"
<<
endl
;
mOutputFile
<<
"options_.linear = 1;"
<<
endl
;
...
...
This diff is collapsed.
Click to expand it.
preprocessor/Shocks.cc
+
12
−
1
View file @
07137e80
...
@@ -155,17 +155,19 @@ ShocksStatement::writeCovarOrCorrShock(ostream &output, covar_and_corr_shocks_t:
...
@@ -155,17 +155,19 @@ ShocksStatement::writeCovarOrCorrShock(ostream &output, covar_and_corr_shocks_t:
SymbolType
type2
=
symbol_table
.
getType
(
it
->
first
.
second
);
SymbolType
type2
=
symbol_table
.
getType
(
it
->
first
.
second
);
assert
((
type1
==
eExogenous
&&
type2
==
eExogenous
)
assert
((
type1
==
eExogenous
&&
type2
==
eExogenous
)
||
(
symbol_table
.
isObservedVariable
(
it
->
first
.
first
)
&&
symbol_table
.
isObservedVariable
(
it
->
first
.
second
)));
||
(
symbol_table
.
isObservedVariable
(
it
->
first
.
first
)
&&
symbol_table
.
isObservedVariable
(
it
->
first
.
second
)));
string
matrix
;
string
matrix
,
corr_
matrix
;
int
id1
,
id2
;
int
id1
,
id2
;
if
(
type1
==
eExogenous
)
if
(
type1
==
eExogenous
)
{
{
matrix
=
"M_.Sigma_e"
;
matrix
=
"M_.Sigma_e"
;
corr_matrix
=
"M_.Correlation_matrix"
;
id1
=
symbol_table
.
getTypeSpecificID
(
it
->
first
.
first
)
+
1
;
id1
=
symbol_table
.
getTypeSpecificID
(
it
->
first
.
first
)
+
1
;
id2
=
symbol_table
.
getTypeSpecificID
(
it
->
first
.
second
)
+
1
;
id2
=
symbol_table
.
getTypeSpecificID
(
it
->
first
.
second
)
+
1
;
}
}
else
else
{
{
matrix
=
"M_.H"
;
matrix
=
"M_.H"
;
corr_matrix
=
"M_.Correlation_matrix_ME"
;
id1
=
symbol_table
.
getObservedVariableIndex
(
it
->
first
.
first
)
+
1
;
id1
=
symbol_table
.
getObservedVariableIndex
(
it
->
first
.
first
)
+
1
;
id2
=
symbol_table
.
getObservedVariableIndex
(
it
->
first
.
second
)
+
1
;
id2
=
symbol_table
.
getObservedVariableIndex
(
it
->
first
.
second
)
+
1
;
}
}
...
@@ -178,6 +180,15 @@ ShocksStatement::writeCovarOrCorrShock(ostream &output, covar_and_corr_shocks_t:
...
@@ -178,6 +180,15 @@ ShocksStatement::writeCovarOrCorrShock(ostream &output, covar_and_corr_shocks_t:
output
<<
";"
<<
endl
output
<<
";"
<<
endl
<<
matrix
<<
"("
<<
id2
<<
", "
<<
id1
<<
") = "
<<
matrix
<<
"("
<<
id2
<<
", "
<<
id1
<<
") = "
<<
matrix
<<
"("
<<
id1
<<
", "
<<
id2
<<
");"
<<
endl
;
<<
matrix
<<
"("
<<
id1
<<
", "
<<
id2
<<
");"
<<
endl
;
if
(
corr
)
{
output
<<
corr_matrix
<<
"("
<<
id1
<<
", "
<<
id2
<<
") = "
;
it
->
second
->
writeOutput
(
output
);
output
<<
";"
<<
endl
<<
corr_matrix
<<
"("
<<
id2
<<
", "
<<
id1
<<
") = "
<<
corr_matrix
<<
"("
<<
id1
<<
", "
<<
id2
<<
");"
<<
endl
;
}
}
}
void
void
...
...
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