Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dóra Kocsis
dynare
Commits
08bcf39f
Commit
08bcf39f
authored
Apr 02, 2012
by
Houtan Bastani
Browse files
estimation: clear subsamples substructure whenever a subsamples statement is encountered
parent
7e6bd80f
Changes
4
Hide whitespace changes
Inline
Side-by-side
matlab/global_initialization.m
View file @
08bcf39f
...
...
@@ -246,12 +246,12 @@ options_.timeless = 0;
% estimation
estimation_info
.
empty_prior
=
struct
(
...
'domain'
,
{}
,
'interval'
,
{}
,
'mean'
,
{}
,
...
'median'
,
{}
,
'mode'
,
{}
,
'shape'
,
{}
,
...
'shift'
,
{}
,
'stdev'
,
{}
,
'truncate'
,
{}
,
'variance'
,
{}
);
'domain'
,
[]
,
'interval'
,
[]
,
'mean'
,
[]
,
...
'median'
,
[]
,
'mode'
,
[]
,
'shape'
,
[]
,
...
'shift'
,
[]
,
'stdev'
,
[]
,
'truncate'
,
[]
,
'variance'
,
[]
);
estimation_info
.
empty_options
=
struct
(
...
'bounds'
,
{}
,
'init'
,
{}
,
'jscale'
,
{}
);
estimation_info
.
subsamples
.
range
=
struct
(
'date1'
,
{}
,
'date2'
,
{}
);
'bounds'
,
[]
,
'init'
,
[]
,
'jscale'
,
[]
);
estimation_info
.
subsamples
.
range
=
struct
(
'date1'
,
[]
,
'date2'
,
[]
);
estimation_info
.
parameter
.
prior
=
estimation_info
.
empty_prior
;
estimation_info
.
parameter
.
subsample_prior
=
estimation_info
.
empty_prior
;
estimation_info
.
parameter
.
options
=
estimation_info
.
empty_options
;
...
...
preprocessor/ComputingTasks.cc
View file @
08bcf39f
...
...
@@ -1632,10 +1632,12 @@ EstimationDataStatement::writeOutput(ostream &output, const string &basename) co
SubsamplesStatement
::
SubsamplesStatement
(
const
string
&
name1_arg
,
const
string
&
name2_arg
,
const
subsample_declaration_map_t
subsample_declaration_map_arg
)
:
const
subsample_declaration_map_t
subsample_declaration_map_arg
,
const
SymbolTable
&
symbol_table_arg
)
:
name1
(
name1_arg
),
name2
(
name2_arg
),
subsample_declaration_map
(
subsample_declaration_map_arg
)
subsample_declaration_map
(
subsample_declaration_map_arg
),
symbol_table
(
symbol_table_arg
)
{
}
...
...
@@ -1664,6 +1666,40 @@ SubsamplesStatement::writeOutput(ostream &output, const string &basename) const
<<
it
->
second
.
first
<<
"';"
<<
endl
<<
"estimation_info.subsamples(subsamples_indx).range("
<<
map_indx
<<
").date2 = '"
<<
it
->
second
.
second
<<
"';"
<<
endl
;
// Initialize associated subsample substructures in estimation_info
const
SymbolType
symb_type
=
symbol_table
.
getType
(
name1
);
string
lhs_field
;
if
(
symb_type
==
eParameter
)
lhs_field
=
"parameter"
;
else
if
(
symb_type
==
eExogenous
||
symb_type
==
eExogenousDet
)
lhs_field
=
"structural_innovation"
;
else
lhs_field
=
"measurement_error"
;
output
<<
"eifind = get_new_or_existing_ei_index('"
<<
lhs_field
;
if
(
!
name2
.
empty
())
output
<<
"_corr"
;
output
<<
"_prior_index', '"
<<
name1
<<
"', '"
;
if
(
!
name2
.
empty
())
output
<<
name2
;
output
<<
"');"
<<
endl
;
lhs_field
=
"estimation_info."
+
lhs_field
;
if
(
!
name2
.
empty
())
lhs_field
+=
"_corr"
;
output
<<
lhs_field
<<
"_prior_index(eifind) = {'"
<<
name1
;
if
(
!
name2
.
empty
())
output
<<
":"
<<
name2
;
output
<<
"'};"
<<
endl
;
output
<<
lhs_field
<<
"(eifind).subsample_prior = estimation_info.empty_prior;"
<<
endl
<<
lhs_field
<<
"(eifind).subsample_prior(1:"
<<
subsample_declaration_map
.
size
()
<<
") = estimation_info.empty_prior;"
<<
endl
<<
lhs_field
<<
"(eifind).range_index = estimation_info.subsamples(subsamples_indx).range_index;"
<<
endl
;
}
SubsamplesEqualStatement
::
SubsamplesEqualStatement
(
const
string
&
to_name1_arg
,
...
...
preprocessor/ComputingTasks.hh
View file @
08bcf39f
...
...
@@ -588,10 +588,12 @@ private:
const
string
name1
;
const
string
name2
;
const
subsample_declaration_map_t
subsample_declaration_map
;
const
SymbolTable
symbol_table
;
public:
SubsamplesStatement
(
const
string
&
name1_arg
,
const
string
&
name2_arg
,
const
subsample_declaration_map_t
subsample_declaration_map_arg
);
const
subsample_declaration_map_t
subsample_declaration_map_arg
,
const
SymbolTable
&
symbol_table_arg
);
virtual
void
checkPass
(
ModFileStructure
&
mod_file_struct
,
WarningConsolidation
&
warnings
);
virtual
void
writeOutput
(
ostream
&
output
,
const
string
&
basename
)
const
;
};
...
...
preprocessor/ParsingDriver.cc
View file @
08bcf39f
...
...
@@ -1242,7 +1242,7 @@ ParsingDriver::set_subsamples(string *name1, string *name2)
if
(
!
name2
->
empty
())
check_symbol_existence
(
*
name2
);
mod_file
->
addStatement
(
new
SubsamplesStatement
(
*
name1
,
*
name2
,
subsample_declaration_map
));
mod_file
->
addStatement
(
new
SubsamplesStatement
(
*
name1
,
*
name2
,
subsample_declaration_map
,
mod_file
->
symbol_table
));
subsample_declarations
[
make_pair
(
*
name1
,
*
name2
)]
=
subsample_declaration_map
;
subsample_declaration_map
.
clear
();
delete
name1
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment