Commit Graph

208 Commits (090945d8a8017e0f2b84aa8123f6ae00ea66af87)

Author SHA1 Message Date
Sébastien Villemot c4a9f93d40
Do not allow the estimation of a parameter that appears in “planner_discount”
Ref. dynare#1173
2020-02-04 17:49:53 +01:00
Sébastien Villemot b0c819cb03
Compute 3rd order dynamic derivatives for “dynare_sensitivity(identification)”
Ref. #40
2020-01-20 17:26:31 +01:00
Houtan Bastani acdfeb4ee6
simplify calls to `symbol_list.checkPass` 2020-01-07 15:58:30 +01:00
Houtan Bastani 98a9c88880
Allow `dynasave` and `dynatype` to support exogenous variables in their var_list
issue dynare#1691
2020-01-06 10:52:18 +01:00
Houtan Bastani 54f73e0864
Symbol List check pass: allow caller to specify the valid types of variables in a Symbol List
dynare#1355
2019-12-23 21:16:00 +01:00
Sébastien Villemot e2d5a83592
Global reindentation 2019-12-20 16:59:30 +01:00
Houtan Bastani 42106f85a8
det_cond_forecast: fix output aesthetics
- remove semicolon after `end`
- don't test for existence of `oo_`
- fix spacing to conform with MATLAB/Octave spacing

issue #39
2019-12-20 14:51:16 +01:00
Houtan Bastani 9d3be05a2d
remove superfluous comma 2019-12-20 14:51:16 +01:00
Houtan Bastani 76b461de4a
organize function with other members of the same class 2019-12-20 14:51:16 +01:00
Houtan Bastani 32c3910e18
allow symbol list to accept auxiliary variables
dynare#1355
2019-12-20 14:51:15 +01:00
Sébastien Villemot 5f451ebc99
Cosmetic fixes to 8baec1e0ec
Ref. #1673
2019-12-20 11:48:50 +01:00
Sébastien Villemot 82c2682bb2
New “with_epilogue” option of “shock_decomposition”, “realtime_shock_decomposition” and “initial_condition_decomposition”
Ref. dynare!1688
2019-12-20 11:47:54 +01:00
Stéphane Adjemian (Charybdis) 8baec1e0ec Allow k order estimation.
Automatically switch to k_order_solver if order>2. Use old mex file if
order==2 (since it seems unexpectedly significantly faster than
local_state_space_iteration_k, and because it can deal with pruning).
2019-12-20 11:15:16 +01:00
Sébastien Villemot 044258b0a2
Make “datafile” option of “perfect_foresight_setup” (and “simul”) equivalent to “initval_file”
Ref. dynare#1663
2019-12-19 14:53:52 +01:00
Sébastien Villemot c2461981d2
Various provisions for improvements to shock decomposition commands
– New “squeeze_shock_decomposition” command
— New “max_nrows” option to “plot_shock_decomposition” and
  “initial_condition_decomposition”
— “plot_shock_decomposition” now returns oo_ as an output argument

Ref. dynare#1687, dynare!1655
2019-12-18 11:39:44 +01:00
Sébastien Villemot 031c0cff5f
Various code simplifications and modernizations 2019-12-16 19:42:59 +01:00
Sébastien Villemot b58bbb8e84
Ramsey: do not warn if instruments are not defined in steady_state_model block
Closes: dynare#1677
2019-12-12 16:19:15 +01:00
Sébastien Villemot 1d3265acb7
C++17: further code simplifications (assignments in if) 2019-12-12 16:19:14 +01:00
Houtan Bastani 8dfa79a0f5
new command `evaluate_planner_objective`
dynare#1678
2019-12-12 11:35:26 +01:00
Dóra Kocsis f11048f2dc Pass oo_ as function input for plot_icforecast. Dynare/dynare#1672 2019-11-29 12:17:02 +01:00
Dóra Kocsis c23e136f93 Revert "Merge branch 'master' into 'master'"
This reverts commit 3ae92499b8, reversing
changes made to 3ec01b8612.
2019-11-26 16:46:12 +01:00
Dóra Kocsis 8bfcefe7fb Add interface for forecast_shock_decomposition. Dynare/dynare#1657 2019-11-25 17:08:59 +01:00
Sébastien Villemot d839aea08b
Drop unused functions for writing C and C++ output
These functions should have been deleted in
946d105c04.
2019-10-24 10:54:46 +02:00
Sébastien Villemot ecdca502aa
Modernization: stop using make_pair() and make_tuple()
In many cases, they can be replaced by the curly braces syntax.

Otherwise, we can now use the pair() and tuple() constructors, without the need
to specify template parameters, thanks to class template argument
deduction (new in C++17).
2019-10-24 10:49:13 +02:00
Sébastien Villemot 8a83e08e79
Fix bug with diff or unary ops that have same static representation
Previously, for testing whether two diff() expressions or two unary ops were
the lead/lag of each other, the preprocessor would test whether they have the
same static representation. This is ok for simple expressions (e.g.
diff(x(-1))), but not for more complex ones (e.g. diff(x-y) and diff(x(-1)-y)
should not be given the same auxiliary variable).

This commit fixes this by properly constructing the equivalence relationship
and choosing a representative within each equivalence class. See the comments
above lag_equivalence_table_t in ExprNode.hh for more details.

Closes #27
2019-10-22 15:01:06 +02:00
Houtan Bastani 0b3cd3ec90
pac: fix parsing of linear combination for growth option 2019-10-03 18:26:09 +02:00
Sébastien Villemot b0ac4a4e51
Cosmetic change 2019-09-24 18:47:43 +02:00
Houtan Bastani 04b6a68aef
new calling structure for stoch_simul, discretionary_policy. dynare#1197 2019-09-11 18:05:40 +02:00
Sébastien Villemot 2c6fa34a1f
C++17: use structured bindings instead of std::tie whenever possible 2019-09-11 16:40:19 +02:00
Houtan Bastani d1be4f4946
remove duplicates from stoch_simul symbol_list. closes dynare#1519 2019-09-10 11:13:33 +02:00
Sébastien Villemot fbf535e819
Fix typo 2019-08-27 14:20:00 +02:00
Sébastien Villemot db6d4fb0cd
Support identification(order=3)
In that case, the preprocessor outputs g4 (4th derivatives of model) and
g3p (1st derivs of g3 w.r.t. parameters).

Ref #10
2019-08-22 17:02:40 +02:00
Sébastien Villemot 24d4b2dc77
identification command now accepts the order option
Note that this option does not modify the global options_.order, for
consistency with the semantics of the identification command.

The preprocessor will compute dynamic derivatives up to at least order+1.

Closes #10
2019-07-05 17:49:16 +02:00
Sébastien Villemot d59f9f75ff
Simplification of previous commit 2019-06-05 15:03:48 +02:00
Houtan Bastani d873414728
pac_model growth: allow single parameters 2019-05-27 16:06:14 +02:00
Houtan Bastani 3509291b74
pac_model: only write growth fields if growth was passed to pac_model 2019-05-20 16:14:40 +02:00
Houtan Bastani 2753ab9887
pac: collect exogenous variables in growth argument to pass exo use test in ModFile.cc 2019-05-17 15:06:16 +02:00
Houtan Bastani a0f74f5c16
pac growth: allow linear combination 2019-05-14 12:33:59 +02:00
Houtan Bastani 21fe0f4bdc
avoid cast warnings when compiling boost headers 2019-04-23 14:57:03 +02:00
Sébastien Villemot b73d554ad2
Use Unicode copyright symbol (in UTF-8 encoding) 2019-04-16 11:35:31 +02:00
Houtan Bastani 7392cd3a6c
add JSON output for plot_shock_decomposition, realtime_shock_decomposition, and initial_condition_decomposition 2019-04-12 14:34:09 +02:00
Sébastien Villemot 39926133b8
More automatic modernizations with clang-tidy 2019-04-03 16:46:20 +02:00
Sébastien Villemot 8a41a75c85
Apply modernize-raw-string-literal from clang-tidy
Use ReplaceShorterLiterals option to enforce replacement of all strings.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-raw-string-literal.html
2019-04-03 16:45:52 +02:00
Houtan Bastani 6ba31087ab
add check for parameter_set option to conditional_forecast 2019-04-03 14:26:02 +02:00
Sébastien Villemot 78583135df
Use true/false instead of 1/0 for boolean options
This is more elegant, and makes it easier to distinguish them from integer
options.
2019-03-19 15:15:10 +01:00
Houtan Bastani fdefb0f52a
move variable initialization out of body 2019-03-08 16:21:01 +01:00
Houtan Bastani e56f994d28
pac_model: write growth argument as string 2019-03-01 11:20:26 +01:00
Houtan Bastani 341b9c6667
pac_model: allow diff as argument to growth option 2019-02-28 19:22:34 +01:00
Houtan Bastani 240aba6709
move pac info out of pac expectation node 2019-02-20 15:35:13 +01:00
Houtan Bastani 0ea84fa9a4
pac: allow steady state growth and model consistent expectation substitution in pac equation 2019-02-18 15:11:45 +01:00
Houtan Bastani d922ae8ffc
pac_model: permit lag on growth option 2019-01-25 14:52:26 +01:00
Houtan Bastani 9c95bfa33f
fix typos 2019-01-18 12:48:45 +01:00
Houtan Bastani 027b59b449
fix typos 2019-01-18 12:36:19 +01:00
Sébastien Villemot e7c9c26d2d
More modernizations with clang-tidy 2019-01-15 11:08:47 +01:00
Houtan Bastani 4c71d143f3
substitute leads/lags appropriately when identification or sensitivity statements are present. Issue: https://git.dynare.org/Dynare/dynare/issues/1631 2019-01-09 14:48:25 +01:00
Sébastien Villemot 01385d1f80
Simplify implementation of nopreprocessoroutput option
Simply redirect cout to /dev/null, instead of propagating a boolean
everywhere.
2018-12-20 17:08:45 +01:00
Sébastien Villemot 67ac4bf8ea
Allow diff() and log() in "expression" option of var_expectation_model 2018-11-29 16:01:49 +01:00
Sébastien Villemot e9341c7153
Implement option "expression" of var_expectation_model
The data structure written in the driver file is changed also in the case of
the "variable" option.
2018-11-28 17:33:59 +01:00
Sébastien Villemot b88e0de53f
Remove useless accessor methods for data members that are const in ExprNode classes
Those const data members are simply made public.
2018-11-28 14:35:30 +01:00
Sébastien Villemot 6fa115aedd
Derivation engine w.r.t. endogenous generalized to any order 2018-11-22 17:13:55 +01:00
Sébastien Villemot 4a974bb428
The preprocessor now compiles the MEX when use_dll is specified
New options "mexext" and "matlabroot" are introduced, so that the preprocessor
knows where to find MATLAB and which architecture to compile for.

Only recent gcc is now supported. A set of optimization flags is used so that
compilation goes reasonably fast on large models.

Consequently, options "msvc", "mingw" and "cygwin" have been removed.
2018-10-26 18:09:13 +02:00
Sébastien Villemot 1c33af4844
Fix bug introduced in bfd93f4ac0 with correlations in estim_params
For correlations, there is one extra columns (since there are two symbol
indices). MATLAB automatically adds the missing column, while Octave is
stricter when verifying dimensions.

By the way, add a missing comma.
2018-10-26 11:11:10 +02:00
Stéphane Adjemia (Scylla) bfd93f4ac0
Fixed estimated_params_init behaviour...
... when an initial value is given to a parameter that is not
estimated.

The generated driver file was crashing with cryptic error message
because we were searching in the first (and second) column of a
potentially empty array with 0 columns. The fix is to initialize the
fields of estimated_params_ with empty arrays with 10 columns (ie
zeros(0, 10)). Also print a message in the matlab command window if
parameter declared in estimated_params_init is not estimated.
2018-10-25 10:24:25 +02:00
Sébastien Villemot 1089a223c4 Clean up default constructors/destructors 2018-10-11 17:08:44 +02:00
Sébastien Villemot f2cf86b734 Add copy constructors / assignment operators for the DataTree class hierarchy
In particular, it is necessary to turn back DataTree::AddVariable() into a
non-virtual method, because it is called from DataTree's constructor. Enforcing
the absence of leads/lags is now done using a new boolean DataTree::is_static.

Take advantage of the new copy constructor for handling
PlannerObjectiveStatement more elegantly.

Unfortunately it is not possible to implement *move* constructor / assigment
operators, because the reference ExprNode::datatree is not mutable.
2018-10-10 12:53:55 +02:00
Sébastien Villemot 7bb5382428 Always use brace-initializer in constructors
The syntax makes clearer the distinction between a function call and an
initialization. Also, it prevents bugs due to implicit type conversions.
2018-10-04 17:19:18 +02:00
Ferhat Mihoubi 139e3efa82 Adds a new model option "linear_decomposition" that creates a block composed of the non-linear equations o the model 2018-09-28 14:54:52 +02:00
Houtan Bastani 85dbb649b7 move trend_component_table and var_model_table to DynamicModel as they are only used there 2018-09-14 17:04:06 +02:00
Houtan Bastani 0c66e724cb fix typo 2018-08-22 17:09:16 +02:00
Houtan Bastani 7d9072a227 var_expectation: rename var_model_name to aux_model_name 2018-08-22 16:57:36 +02:00
Stéphane Adjemia (Scylla) a406c18598 Allow trend_component_model in var_expectations. 2018-08-22 16:50:01 +02:00
Houtan Bastani 539fddc9f6 introduce var model table 2018-08-22 12:15:02 +02:00
Houtan Bastani afe0e475b1 trend_component_model statement 2018-08-17 16:52:48 +02:00
Houtan Bastani e24cabe3a5 var_expectation: print type specific id for discount index 2018-08-08 14:59:50 +02:00
Stéphane Adjemian(Charybdis) 32da131a77 Added associated index in M_.endo_names for expected variable. 2018-08-04 19:50:12 +02:00
Stéphane Adjemian(Charybdis) ed32caeb46 Added missing field in VAR_EXPECTATION_MODEL description (variable). 2018-08-04 12:03:53 +02:00
Stéphane Adjemian(Charybdis) 022395aaf6 Fixed param_indices vector for VAR_EXPECTATION_MODEL. 2018-08-04 11:46:31 +02:00
Sébastien Villemot f3c2a1bf87 New var_expectation_model statement and re-design of var_expectation operator
Given a previously declared var_model, the var_expectation_model statement is
used to declare a way of forming expectations with this VAR (possibly using a
finite or infinite discounted sum). The var_expectation operator now takes a
single argument, the name of the var_expectation_model.

For the moment, this only works when the var_model is using equations
explicitly declared in the model block.
2018-08-02 08:39:09 +02:00
Sébastien Villemot 122e154764 PlannerObjectiveStatement now owns its model_tree
By the way, error out if the planner_objective statement is used two times.
2018-07-31 13:00:41 +02:00
Sébastien Villemot 725b91e5d6 Several fixes to computing tasks statements
- store objects whose persistence is not guaranteed (e.g. strings) as values
  instead of references (to avoid possible segfaults)
- on the contrary, always store the SymbolTable as a reference, since its
  persistence is guaranteed, and we don't want to copy it
- use pass-by-value in constructors whenever possible
- remove useless const keyword when passing by value
2018-07-31 10:51:28 +02:00
Sébastien Villemot 4a04a38374 C++11: convert ExtendedPreprocessorTypes to class enums 2018-07-18 17:28:26 +02:00
Sébastien Villemot 14948401e4 C++11: convert PriorDistributions to a class enum 2018-07-18 16:52:12 +02:00
Sébastien Villemot 4ad0e500d4 C++11: convert {Unary,Binary,Trinary}Opcode to class enums 2018-07-18 16:18:26 +02:00
Sébastien Villemot d6055c1407 C++11: convert SymbolType to a class enum 2018-07-17 18:55:26 +02:00
Sébastien Villemot 53f83aeb12 No longer use boost::lexical_cast
Most cases can be handled in C++11 by std::stoi() and std::stod().

For the macroprocessor ArrayMV<T>::print() method, use template
specialization (instead of a lexical_cast to detect between T=int and
T=string).
2018-07-04 15:53:41 +02:00
Sébastien Villemot 30c205f418 C++11: replace calls to std::atof() by std::stod() 2018-07-04 14:53:13 +02:00
Sébastien Villemot 5e1d722013 C++11: replace most calls to std::atoi() by std::stoi()
The latter accepts a std::string as argument.
2018-07-04 14:53:08 +02:00
Sébastien Villemot b91ed6f78c Move the location of static and dynamic files on the filesystem
- M and MEX files are now under +${MODELNAME}/
- bytecode and C source now under ${MODELNAME}/model/
2018-06-27 15:30:25 +02:00
Stéphane Adjemian(Charybdis) a2b19cbfff Added missing writeJsonOutput method for VarModelStatement. 2018-06-15 14:56:44 +02:00
Houtan Bastani d453e81594 pac_model: write as more output to M_ instead of options_; use rmfield instead of clear 2018-06-05 11:14:03 +02:00
Houtan Bastani 16a049f0d8 Make changes to pac code for C++11 2018-06-05 11:14:03 +02:00
Sébastien Villemot 608c43450c Replace most calls to make_pair by braced-initializer lists or emplace()/emplace_back() 2018-06-04 16:36:46 +02:00
Sébastien Villemot 182c53273e Remove useless spaces in type qualifiers
In C++11, it is no longer necessary to put a space between two consecutive ">".
2018-06-04 15:03:31 +02:00
Sébastien Villemot 1e56c73377 Port to C++11 nullptr keyword
Performed using modernize-use-nullptr from clang-tidy.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
2018-06-04 15:03:31 +02:00
Sébastien Villemot 64eb494298 Port to C++11 syntax for default constructors
Performed using modernize-use-equals-default from clang-tidy.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-equals-default.html
2018-06-04 15:03:31 +02:00
Sébastien Villemot c0ed97d247 Port to C++11 auto keyword
Performed using modernize-use-auto from clang-tidy.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-auto.html
2018-06-04 15:03:26 +02:00
Sébastien Villemot dcfc598196 Remove redundant void arguments
Performed using modernize-redundant-void-arg from clang-tidy.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-redundant-void-arg.html
2018-06-04 15:02:57 +02:00
Sébastien Villemot 20bbbd46c3 Port some constructors to pass-by-value using C++11 move semantics
Performed using modernize-pass-by-value from clang-tidy.

Manual intervention was needed to fix an issue in MacroValue.hh.
Also replace std::move by move, since we import the std namespace.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-pass-by-value.html
2018-06-04 12:35:28 +02:00
Sébastien Villemot 6cf4e6dc0c Port to C++11 range-based for loops
Performed using modernize-loop-convert from clang-tidy.

Manual intervention was needed in MacroValue.cc because of a variable name
capture issue.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-loop-convert.html
2018-06-04 12:26:16 +02:00
Sébastien Villemot 08eedcb448 Add const qualifier for tef_terms in writeOutput method and siblings
Consequently, change various function calls where tef_terms was empty, passing
an (empty) rvalue instead of an lvalue.
2018-05-29 14:22:01 +02:00
Houtan Bastani dd8b05e2f0 add undiff info to pac output 2018-05-17 16:53:27 +02:00
Houtan Bastani bb1cc0bebf simplify var_model statement calls 2018-04-17 16:56:02 +02:00
Houtan Bastani fb8d9258d0 add pac_model statement 2018-04-04 11:48:59 +02:00
Houtan Bastani 5d339b69de simplify pac_expectation code 2018-03-07 15:04:07 +01:00
Houtan Bastani 81f2258228 var_model: store max lag info 2018-03-06 15:17:39 +01:00
Houtan Bastani a69c53b0c8 clean up var_model code 2018-03-06 14:42:11 +01:00
Houtan Bastani a1437ac982 Merge remote-tracking branch 'dynare-preprocessor-github/master' into other-master 2018-02-26 12:09:58 +01:00
Houtan Bastani b504f160ca move files to src directory 2018-02-15 11:48:04 +01:00