Sébastien Villemot
cec47cc78c
Implement bytecode compilation of 2nd deriv of external functions
2022-05-20 12:35:38 +02:00
Sébastien Villemot
d1a3b227fd
Fix bug in bytecode compilation of 1st deriv of external functions
2022-05-20 12:35:23 +02:00
Sébastien Villemot
03dc9837d0
Comment improvement
2022-05-20 12:27:22 +02:00
Sébastien Villemot
171cd65566
Fix bytecode compilation of external function nodes
2022-05-20 11:43:02 +02:00
Johannes Pfeifer
1dbf9c8041
Add tolx-option for steady
2022-05-19 22:43:41 +02:00
Sébastien Villemot
591b5e5f9e
Always create bytecode output
...
And, symmetrically, when the “bytecode” option is requested by the user, always
create the .m static/dynamic files.
The “bytecode” option therefore no longer modifies the preprocessor output.
2022-05-19 14:49:46 +02:00
Sébastien Villemot
af88f50d44
Forbid multiple identical clauses in “occbin_constraints” block
...
Closes : #97
2022-05-19 14:36:15 +02:00
Sébastien Villemot
0284b249f5
Remove unused “bytecode” argument in {Static,Dynamic}Model::computingPass()
2022-05-19 14:10:22 +02:00
Sébastien Villemot
25a32b1a32
Cosmetics
2022-05-19 12:27:44 +02:00
Sébastien Villemot
17ba60e587
Mark copy constructor and assignment of ModelTree as protected
...
This limits the risk of slicing.
The same is not possible for DataTree, since that base class is directly used
in some places.
2022-05-19 12:27:39 +02:00
Sébastien Villemot
2483639f4d
Fix bug introduced in 3516894a71
related to new estimation syntax
2022-05-18 19:27:00 +02:00
Sébastien Villemot
3516894a71
JSON output: fix handling of vector value options
...
The vectors were previously stored as strings internally, which would not
necessarily contain the commas which are required in JSON (but not in
MATLAB/Octave). The fix consists in internally storing those options as
std::vector.
Closes : #96
2022-05-18 17:44:36 +02:00
Sébastien Villemot
5b50c10229
Simplify OptionsList::writeJsonOutput()
2022-05-18 16:33:49 +02:00
Sébastien Villemot
29c683c6ad
JSON output: add missing comma for paired numerical options
2022-05-18 16:33:49 +02:00
Sébastien Villemot
d64682f346
JSON output: fix possible spurious commas in vector of int or string options
2022-05-18 16:33:49 +02:00
Sébastien Villemot
2795207802
No longer delete move constructor/assignment operator
...
We follow the advice given by Josuttis in his book about move semantics.
Deleting those member fuctions can be a bug if we want to allow copy semantics,
because overload resolution will no longer fallback to the copy
constructor/assignment operator when given an rvalue.
In particular, this explain why it was not possible to delete the move
assignment operator of the StaticModel class.
2022-05-18 16:33:48 +02:00
Sébastien Villemot
c6007aa780
C++17 modernization: use [[fallthrough]] attribute
...
This disables warnings when -Wimplicit-fallthrough is used (enabled by -Wextra).
2022-05-18 16:33:48 +02:00
Sébastien Villemot
701db61e09
JSON output: fix several bugs related to switch/case fallthrough
2022-05-18 16:33:42 +02:00
Sébastien Villemot
ae97c4eb29
Factorization in OptionsList class
2022-05-17 18:08:10 +02:00
Sébastien Villemot
3e94250582
C++17 modernization: use std::optional in ExprNode::getPacOptimizingShareAndExprNodes()
2022-05-16 19:10:16 +02:00
Sébastien Villemot
0eb11d3323
C++17 modernization: use std::optional in expression matching functions
2022-05-16 19:10:16 +02:00
Sébastien Villemot
3496d77eb4
C++17 modernization: use std::optional to store orig diff vars in VAR and TCM
...
By the way, remove the unused TrendComponentModelTable::getOrigDiffVar() method.
2022-05-16 19:10:16 +02:00
Sébastien Villemot
34aa1d3bb4
Fix comment
2022-05-16 19:10:16 +02:00
Sébastien Villemot
06d05e9a8d
C++17 modernization: use std::optional for SymbolTable::getEquationNumberForMultiplier()
2022-05-16 19:10:16 +02:00
Sébastien Villemot
fa7a926143
C++17 modernization: use std::optional for the storage of orig_symb_id and orig_lead_lag in SymbolTable
...
For the diff and unaryOp auxvar types, these value may be set or unset
depending on the complexity of the expression represented by the auxvar.
2022-05-16 19:10:15 +02:00
Sébastien Villemot
8fd1505ca2
C++17 modernization: use std::optional for “periods” option of “plot_conditional_forecast”
...
Incidentally, in the JSON output, no longer assign a value to the “periods”
field if not passed by the user (previously the value -1 was output in the JSON
file).
2022-05-16 19:10:15 +02:00
Sébastien Villemot
fc037a4352
Simplify printing of booleans using std::boolalpha
2022-05-16 19:10:15 +02:00
Sébastien Villemot
92d3b8166a
C++17 modernization: use std::optional for equation line numbers
2022-05-16 19:10:15 +02:00
Sébastien Villemot
0b51294994
C++17 modernization: use std::optional for trend variables in TCM
2022-05-16 19:10:15 +02:00
Sébastien Villemot
fb3b1c301f
endval(learnt_in=…) block: fix treatment of unused endogenous variables
2022-05-06 12:56:24 +02:00
Sébastien Villemot
46a85644d8
C++20 modernization: update comment about workaround for clang
2022-05-04 17:37:58 +02:00
Sébastien Villemot
7bd449d6c3
C++20 modernization: use new std::erase_if function
2022-05-04 17:37:58 +02:00
Sébastien Villemot
b42ee40b55
C++20 modernization: use contains() method on containers
2022-05-04 17:37:57 +02:00
Sébastien Villemot
ef02b79486
Various minor simplifications
2022-05-04 17:36:59 +02:00
Sébastien Villemot
e0c3cb72b7
No longer link against libstdc++fs
...
That requirement was dropped in GCC 9.
2022-05-04 17:11:44 +02:00
Sébastien Villemot
3a820fffa2
New += and *= syntaxes in “endval(learnt_in=…)” blocks
...
Incidentally, forbid exogenous deterministic variables in “endval” blocks.
2022-05-03 16:52:04 +02:00
Sébastien Villemot
8c07fb5e43
Compatibility fix for GCC 12
...
Ref. dynare#1852
2022-05-02 17:03:42 +02:00
Sébastien Villemot
32761173e0
Add solve_algo, markowitz, maxit and tolf options to pfwee_setup
2022-04-29 15:53:26 +02:00
Sébastien Villemot
6509bc7d36
Allow “learnt_in=1” for “shocks” and “endval”
...
In that case, the option has no effect.
2022-04-29 11:17:11 +02:00
Sébastien Villemot
76a16a69a8
New “add” and “multiply” keywords in “shocks(learnt_in=…)” block
2022-04-26 15:21:45 +02:00
Sébastien Villemot
dbe14ecfd4
Add checks on the value of the “learnt_in” option of “shocks” and “endval”
2022-04-26 11:45:22 +02:00
Sébastien Villemot
e47ea565b9
Use booleans for “exo_det” and “multiplicative” fields of M_.det_shocks
2022-04-26 11:32:07 +02:00
Sébastien Villemot
8e3590ee71
Reject exogenous deterministic variables in a few places where they were erroneously accepted
...
– heteroskedastic_shocks block
– generate_irfs command
– new estimation syntax
2022-04-21 17:59:04 +02:00
Sébastien Villemot
516f0bf41f
Fix bug in new estimation syntax introduced in 7280c92642
2022-04-21 17:38:41 +02:00
Sébastien Villemot
b5a4df1608
New shocks(learnt_in=…) and endval(learnt_in=…) blocks
...
For use with perfect_foresight_with_expectation_errors_setup.
2022-04-21 17:07:33 +02:00
Sébastien Villemot
54ca5d9cc0
Improve messages during model normalization
...
– Indicate whether we are trying to normalize the static or dynamic model
– If failed to normalize the static model, suggest to use the “no_static”
option
– Remove a superfluous error message
2022-04-19 17:11:13 +02:00
Sébastien Villemot
894f5cda46
Macro-processor: more robust handling of empty files
...
The support for empty files at the macro-processor level, as implemented in
1291320053
, was relying on
basic_streambuf::in_avail(), which does not seem to behave consistently across
platforms, and which may not be the right tool for the job.
Rather use the Bison grammar to support empty files.
Closes : #93
2022-04-19 16:40:18 +02:00
Sébastien Villemot
8064bdc7d0
Use Unicode copyright symbol (in UTF-8 encoding)
...
This file was apparently a left-over from a previous conversion.
[skip ci]
2022-04-13 13:24:33 +02:00
Sébastien Villemot
acaabd59da
New option “constant_simulation_length” to “perfect_foresight_with_simulation_errors_solver” command
2022-04-12 15:26:04 +02:00
Sébastien Villemot
0a3782df8c
Fix error in grammar for options of “perfect_foresight_with_expectations_errors_solver”
2022-04-12 15:26:04 +02:00
Sébastien Villemot
a431682697
Fix check for the presence of ramsey_{model,policy} when ramsey_constraints is used
...
The existing check would incorrectly fail if ramsey_constraints appeared before
ramsey_{model,policy}.
Also, the check would not terminate the processing in case of error.
Closes : #91
2022-04-11 12:28:38 +02:00
Sébastien Villemot
621134b8d8
Julia: more adaptation of DynamicSetAuxiliarySeries.jl for TimeDataFrame objects
...
– also use vectorized versions for .+ and .-
– add a space before vectorized operators to avoid syntactical ambiguity
This commits complements bfdcc546ec
.
2022-04-08 15:06:29 +02:00
Sébastien Villemot
bfdcc546ec
Julia: adapt DynamicSetAuxiliarySeries.jl for TimeDataFrame objects
2022-04-01 17:34:37 +02:00
Sébastien Villemot
71edfd05e4
Add new “log” option to “var” statement
...
When an endogenous is declared with “var(log)”, say “y”:
– creates an auxiliary named “LOG_y”
– replaces “y(±l)” everywhere by “exp(LOG_y(±l))”
– adds a new auxiliary equation “y=exp(LOG_y)”
– adds a new definition “LOG_y=log(y)” in set_auxiliary_variables.m and
dynamic_set_auxiliary_series.m files
This option also works in conjunction with “deflator=…”, such as “var(log,
deflator=…)” (the “log” must appear befor “deflator”). There are no provisions
for combining “log” with “log_deflator”, because that would not make much sense
from an economic point of view (amounts to taking the log two times).
Ref. dynare#349
2022-03-30 17:46:07 +02:00
Sébastien Villemot
ee14027e1b
Remove duplicate functions for setting current parser data tree to dynamic model
2022-03-30 17:27:08 +02:00
Sébastien Villemot
40398425ae
Refactor some symbol declaration helpers so that they return the symbol ID
...
This avoids useless calls to SymbolTable::getID().
2022-03-29 16:44:04 +02:00
Sébastien Villemot
46cc47266b
Refactor parsing of symbol lists
...
For symbol lists (such as those given to “var” or “stoch_simul”), return a
semantic value at the Bison level, rather than building the list through a
temporary object in ParsingDriver. This allows various simplifications, and
leads to a more functional code.
By the way, homogeneize the naming of the various flavours of symbol lists in
the Bison file (with TeX names, partitioning, or with a wildcard).
2022-03-29 14:59:34 +02:00
Sébastien Villemot
7fff8b3406
Fix detection of nonlinearity of blocks of type “Solve backward/forward simple”
...
They were always marked as linear.
2022-03-15 16:47:03 +01:00
Sébastien Villemot
9db21a231c
Handle “resid” command at the preprocessor level and add “non_zero” option
2022-03-01 14:23:18 +01:00
Sébastien Villemot
11a81e3047
Add a couple of missing “explicit” keywords on single-argument constructors
2022-03-01 12:15:03 +01:00
Sébastien Villemot
17c5e1935d
Fix error message when “ramsey_policy” follows a “ramsey_model” statement
...
By the way, also fix error message when there are several “ramsey_model” or
“ramsey_policy” statements.
Closes : #90
2022-02-21 16:45:56 +01:00
Sébastien Villemot
b78ac1d31f
Bytecode: fix temporary terms for dynamic derivatives in “evaluate” mode
...
The temporary terms for dynamic derivatives were only computed in the
“simulate” mode.
2022-02-18 12:38:06 +01:00
Sébastien Villemot
cb78300e95
Transform predetermined variables before simplifying equations
...
Equation simplification takes leads/lags into account, so those need to be
correct upon entry of the procedure.
2022-02-17 18:27:08 +01:00
Sébastien Villemot
c03f4a559a
Fix JSON output when there are multiple “var_expectation_model” statements
...
Ref. Madysson/estimation-codes#19
2022-02-15 20:58:36 +01:00
Sébastien Villemot
7df6781982
Add interface for “static” and “incidence” options of “model_info”
2022-02-09 12:26:00 +01:00
Sébastien Villemot
adab6c7f93
Comment improvement + cosmetics
2022-01-28 17:24:48 +01:00
Sébastien Villemot
01bea3f5e7
TCM: remove useless 3rd dimension of A0 and A0star (supposedly for lags)
2022-01-28 16:38:50 +01:00
Sébastien Villemot
1e77f7c5a7
SymbolTable::getOrigSymbIdForAuxVar() now also works on unaryOp and diffForward auxvars
...
This is a more natural semantics.
Incidentally, this fixes a bug in the variable mapping (M_.mapping) where some
endogenous, appearing in a log() in a VAR or TCM, would not be mentioned (e.g.
in the var-expectations/7/example1.mod test, and many others).
2022-01-28 16:30:11 +01:00
Sébastien Villemot
28f89261ab
Minor simplification of SymbolTable::addDiffAuxiliaryVar()
...
For symmetry with SymbolTable::addUnaryOpAuxiliaryVar().
2022-01-28 16:01:44 +01:00
Sébastien Villemot
a93e264c2c
Harmonize “diffForward” auxvar with “diff” auxvar by giving it an orig_lead_lag as well
...
By the way:
– Fix and improve the explanation of the purpose of the orig_symb_id and
orig_lead_lag fields for auxvars
– Factorize the code that prints those fields in MATLAB and JSON output
2022-01-28 15:53:41 +01:00
Sébastien Villemot
289b4773d7
Fix matching of diff leads/lags in TCM and PAC models
...
The logic was flawed in several ways. In particular, the test files
pac/trend-component-{3,10,11}/example1.mod would return A0 and A0star matrices
where the (2,2) element was incorrectly zero.
2022-01-28 15:53:41 +01:00
Sébastien Villemot
b709da7f17
Fix SymbolTable’s getOrigSymbIdForAuxVar() and getUltimateOrigSymbID() so that they never return -1
...
The case of a diff aux var corresponding to a complex expression was not
correctly handled, and could lead to a value -1 being returned by these
methods.
2022-01-28 15:53:39 +01:00
Sébastien Villemot
2c84d500d9
Add GDB pretty-printer for ExprNode class hierarchy
2022-01-26 15:40:40 +01:00
Sébastien Villemot
ff0e094d6f
Macroprocessor: MinGW bug for filesystem::path→string implicit conversion is still present in Debian 11
2022-01-25 12:57:12 +01:00
Sébastien Villemot
3d894b3a47
Macroprocessor: under Windows, trim trailing slashes and backslashes in the value of “@#includepath”
...
This is a workaround for a GCC/MinGW bug present in version 10.2
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88881 ), that affects
gcc-mingw-w64 in Debian “Bullseye” 11. It is fixed in GCC 10.3, and thus should
be fixed in Debian “Bookworm” 12.
Ref. Madysson/estimation-codes#11
2022-01-25 12:57:09 +01:00
Sébastien Villemot
6936e54d42
Remove unused field M_.pac.(model_name).lhs
...
It contains symbol IDs, so it cannot be used from MATLAB/Octave code.
2022-01-25 10:34:46 +01:00
Stéphane Adjemian (Charybdis)
c56d58822e
Get the value of periods returned by the initval_file command.
2022-01-21 16:43:46 +01:00
Stéphane Adjemian (Charybdis)
ddddf89d9c
Add new option last_simulation_period for initval_file command.
2022-01-21 16:43:46 +01:00
Sébastien Villemot
5e8b478ccf
Add check to ensure that column indices in derivative matrices do not overflow
...
Closes : #89
2022-01-21 14:31:29 +01:00
Sébastien Villemot
f17c40f272
Cosmetics
2022-01-21 11:31:35 +01:00
Sébastien Villemot
6c7c2bc321
Simplification using std::set range constructor
2022-01-21 11:05:17 +01:00
Sébastien Villemot
49fa876444
Add missing “time_shift” option to JSON output of var_expectation_model
2022-01-20 16:26:17 +01:00
Sébastien Villemot
aa0e06bc7d
Refactor handling of var_expectation_model statements
...
Creates a VarExpectationModelTable analogous to PacModelTable.
2022-01-20 16:26:15 +01:00
Sébastien Villemot
e1e5118373
Refactor the code that substitutes unary ops in model equations
...
In particular, make it more visible that the substitution also occurs in PAC
equations (and not only in VAR and TCM equations).
2022-01-19 15:56:44 +01:00
Sébastien Villemot
96e2a8f971
Fix orig_lead_lag field for diff lag aux vars
2022-01-19 15:52:46 +01:00
Sébastien Villemot
a71100b971
Fix comment
2022-01-19 15:41:37 +01:00
Sébastien Villemot
0d7d5f1ae7
In case of nested unary ops (e.g. log(log())), ensure that the definition of the external aux var references the internal aux var
2022-01-19 15:40:52 +01:00
Sébastien Villemot
064a3dcd77
Fix orig_lead_lag field for unary op auxiliary variables
...
Ref. dynare#1843
2022-01-19 15:40:24 +01:00
Sébastien Villemot
d149d3a76c
PAC: substitute unary ops in “growth” expressions (in “pac_model” and “pac_target_info”)
...
Ref. dynare#1837
2022-01-18 12:40:15 +01:00
Sébastien Villemot
f05b552f31
PAC: correctly handle log() and diff() operators in the equation defining the target
...
By default, the preprocessor substitutes logs and diffs by auxiliary variables
only in equations of auxiliary models (VAR, PAC). Hence they are not
substituted in the equation defining the target, since it is outside the
auxiliary model.
The fix consists in doing the substitution in that equation as well, when we
parse the linear combination within that equation.
Ref. dynare#1837
2022-01-17 12:57:37 +01:00
Sébastien Villemot
8c528f4f9a
Add missing include
...
(“endl” is defined in “ostream”)
2022-01-06 14:55:57 +01:00
Sébastien Villemot
0db05a886a
Move “using namespace std” statement after inclusion of standard headers
...
Otherwise clang emits this warning:
using directive refers to implicitly-defined namespace 'std'
2022-01-06 14:54:57 +01:00
Sébastien Villemot
75a26b6d11
Remove unused member in the RamseyPolicyStatement class
2022-01-06 14:47:34 +01:00
Sébastien Villemot
5572e478f1
Indentation fix
2022-01-06 14:46:38 +01:00
Sébastien Villemot
ebf7b6c51d
Clang compatibility fix
2022-01-06 14:35:39 +01:00
Sébastien Villemot
a8fce06dc4
PAC: new options “auxname” and “kind” to “pac_model”
2021-12-16 15:40:47 +01:00
Sébastien Villemot
ea6fb40db7
PAC: new “pac_target_info” block and “pac_target_nonstationary” operator
...
Ref. Madysson/estimation-codes#5
2021-12-16 15:40:47 +01:00
Sébastien Villemot
6a31ba4b62
PAC: minor simplification in the matching of the growth expression
...
Simple variable nodes are already correctly matched by
ExprNode::matchLinearCombinationOfVariables().
Also improve the related documentation.
2021-12-16 15:40:47 +01:00
Sébastien Villemot
7dde09169e
estimated_params: check that no parameter is declared twice across concatenated blocks
...
The existing check (in AbstractEstimatedParamsStatement::commonCheckPass()) was
only working inside a given estimated_params block, but not across blocks.
2021-12-16 15:22:48 +01:00
Sébastien Villemot
ea44aa19d6
New option “overwrite” to “estimated_params” block
...
This option provides the same behaviour as before the change in
60ef6bbdbd
.
It is typically useful when doing several estimations in the same .mod file.
2021-12-16 14:22:31 +01:00
Sébastien Villemot
5ffbc5bad3
New estimated_params_remove statement
2021-12-15 16:02:57 +01:00
Sébastien Villemot
06a436fdf0
Minors simplification in EstimatedParams* classes
...
Also use a better name for the type-specific ID variable.
2021-12-15 16:02:53 +01:00
Sébastien Villemot
342c4faf8d
New var_remove statement
2021-12-15 12:20:29 +01:00
Sébastien Villemot
60ef6bbdbd
Allow multiple estimated_params statements
2021-12-15 12:20:29 +01:00
Sébastien Villemot
2d07186b8b
New model_options statement
...
The purpose of this statement is to specify the options that apply to the whole
model, when there are several “model” blocks, so as to restore the symmetry
between those blocks (since otherwise one “model” block would typically bear
the options, while the other ones would typically have no option).
It still remains possible to specify the options on one “model” block, or even
spread accross several ones.
Closes : #19
2021-12-15 12:20:14 +01:00
Sébastien Villemot
1f004584e9
New model_remove statement and model_replace block
...
Factorize the implementation with the existing code for the include_eqs and
exclude_eqs options (which has been refactored by the way).
Ref. #19
2021-12-15 12:11:25 +01:00
Sébastien Villemot
a73b0d911a
Fix logic of include_eqs in the presence of [static]/[dynamic] equations
...
In a model with [static]/[dynamic] equations, if the user was using include_eqs
with a list of equations that does *not* contain equations marked
[static]/[dynamic], then the call to ModelTree::includeExcludeEquations(…,
static_equations=true) would have an empty list of equation tags (as stored
in tag_eqns).
The right behaviour in this case is to exclude all static equations. However,
the code would exclude none, and this would disrupt the equilibrium between
[static] and [dynamic] equations (since all [dynamic] equations were excluded
by the other call to the same method).
The fix consists in removing the shortcut that returns from the method if
tag_eqns is empty.
2021-12-10 12:50:10 +01:00
Sébastien Villemot
a492417a5b
Fix typo
2021-12-10 12:44:42 +01:00
MichelJuillard
d047878333
Julia specific interface for normcdf and normpdf
2021-12-10 10:17:06 +01:00
Sébastien Villemot
c0ea8d7203
Add hyperbolic primitives (cosh, sinh, tanh, acosh, asinh, atanh)
...
Everything was already in place (since ages!), except that the parser interface
was missing.
Also fix the derivation formula for atanh, which was incorrect.
2021-12-07 18:03:33 +01:00
Sébastien Villemot
d15b2110a0
Add erfc() primitive
...
Closes : #85
2021-12-07 15:19:40 +01:00
Sébastien Villemot
a040a7dbde
Merge branch 'write_regimes' of git.dynare.org:JohannesPfeifer/preprocessor
...
Ref. !55
2021-12-07 12:24:38 +01:00
Sébastien Villemot
81abea042b
Occbin: use element-by-element multiply, divide and power in occbin_difference.m
...
This file operates on vectors.
Ref. dynare#1826
2021-12-07 12:22:59 +01:00
Sébastien Villemot
b356b8d5fa
Substitute out adl() operators in equations marked [static]
2021-12-06 17:17:38 +01:00
Sébastien Villemot
dc99d81c45
Explain why expectation() operators need not be substituted in equations marked [static]
...
By the way, also perform a small code simplification.
2021-12-06 17:17:38 +01:00
Sébastien Villemot
214f0db4db
Add comment about predetermined variables and equations marked [static]
...
By the way, also perform a small code simplification.
2021-12-06 17:17:38 +01:00
Sébastien Villemot
5fe94ed606
Simplify constant equations also in equations marked [static]
...
The simplifyEquations() methods had to be moved to DynamicModel, in order to
access the static_only_equations member.
2021-12-06 17:17:37 +01:00
Sébastien Villemot
fe974c4c31
When looking for unused endos/exos, also search in equations marked [static]
2021-12-06 17:17:37 +01:00
Sébastien Villemot
8d4cab6fe3
Substitute model-local variables in equations marked [static]
2021-12-06 17:17:27 +01:00
Johannes Pfeifer
164e2debdc
occbin_write_regimes: add option to select type
2021-12-06 16:10:58 +01:00
Sébastien Villemot
7b8fc8edb7
Symbolic detrending engine: correctly handle equations marked [static]
...
Incidentally, this also fixes a detrending bug in the Occbin engine (since the
latter internally generates a [static] equation).
Ref. dynare#1827
By the way, perform a small code simplification.
2021-12-06 12:59:21 +01:00
Sébastien Villemot
607c5aab19
Merge branch 'planner_objective_options' into 'master'
...
evaluate_planner_objective: add options
See merge request Dynare/preprocessor!54
2021-12-03 16:07:14 +00:00
Johannes Pfeifer
befd432be7
evaluate_planner_objective: add options
...
Related to https://git.dynare.org/Dynare/dynare/-/merge_requests/1967
2021-12-03 14:06:57 +01:00
Sébastien Villemot
3c6d5126b3
PAC: fix comment
2021-12-03 11:07:59 +01:00
Sébastien Villemot
a210a8fd59
Add several types of auxiliary variables to M_.mapping
...
In practice, only those auxiliary variables which do not have an orig_symb_id
will be listed (in addition to unary ops, due to an implementation bug).
2021-11-24 11:27:17 +01:00
Sébastien Villemot
2282d4773c
PAC: new auxiliary variable type for pac_expectation operator
...
Also add the new equation to auxiliary equations in the backward case (but not
in the MCE case, since that equation is recursive).
2021-11-23 14:31:03 +01:00
Sébastien Villemot
ae242770f9
PAC: in the backward case, unify h0 and h1 parameters vector into a single vector
...
There is no reason to keep this distinction.
Additionally, since the data structure is now symmetric with the MCE case,
unify this “h” parameter vector with the “α” parameter vector.
2021-11-23 14:31:03 +01:00
Sébastien Villemot
0f89569f7e
PAC: in the backward case, create an aux. var. for the pac_expectation expression
...
By the way, refactor the MCE case by merging two routines related to the Z₁ aux. var.
This restores the symmetry with the backward case, now that the latter also has
an aux. var. for the pac_expectation operator. Also store the aux. var. IDs in a
structure common to the backward and MCE cases.
2021-11-23 14:31:03 +01:00
Sébastien Villemot
0e62206203
PAC: drop support for multiple PAC equations associated to a given PAC model
2021-11-23 14:31:02 +01:00
Sébastien Villemot
1cc512962c
No longer consider an equation of the form “x(+1) = 0” as defining x to be a constant
...
Fix this by restricting the detection of constant equations to those where the
variable appears without a lead or lag.
Closes : #83
2021-11-19 18:01:11 +01:00
Sébastien Villemot
b51f122e59
With nostrict, really ignore unused endogenous in initval/endval/histval
...
Closes : #82
2021-11-19 17:49:57 +01:00
Sébastien Villemot
02ee077663
Fix handling of undeclared variables in the planner_objective statement
...
Closes : #81
2021-11-19 17:32:45 +01:00
Sébastien Villemot
1e4eadb266
Macroprocessor: make the removal of “@#line” directives and extra newlines consistent across LF and CR+LF conventions
...
Simplify the algorithm using only regexps, and add comments.
2021-11-19 16:49:21 +01:00
Sébastien Villemot
1de3476546
Macroprocessor: fix line counter inside @{} constructs
...
There were two bugs:
– with the LF convention, newlines were counted twice
– with the CR+LF convention, they were counted four times (because the CR was
included in yyleng, alongside the LF)
The fix consists in implementing a location_increment() method similar to the
one used for the Dynare parser. This is the most robust solution.
By the way, mark the method DynareFlex::location_increment() method static.
2021-11-19 14:55:14 +01:00
Sébastien Villemot
487c372900
Macroprocessor: fix newlines in output when under Windows and input uses CR+LF convention
...
If the input .mod file uses CR+LF convention, and if the user is under Windows,
then the output of the macroprocessor (as given by the “savemacro” option) had
incorrect end of lines: those would be CR+CR+LF.
The reason is that some TextNode(s) internally created by the macroprocessor
would themselves contain CR+LF sequences, which would then be transformed into
CR+CR+LF in the output (because MinGW transforms LF into CR+LF in output
streams).
The fix consists in changing the nature of the EOL token: the parsed text is no
longer attached to it, so that the Bison file now systematically turns it into
a LF inside TextNode(s).
Closes : #80
2021-11-19 14:55:12 +01:00
Sébastien Villemot
1041f205ea
PAC: trap a few more cases when an auxiliary param conflicts with a declared one
2021-11-09 15:48:59 +01:00
Sébastien Villemot
6ad3d02ec6
Minor simplification in ExprNode::matchLinearCombinationOfVariables()
2021-10-29 15:39:40 +02:00
Sébastien Villemot
c4e9432eef
Remove implementation of various methods of PacExpectationNode
...
Those implementations are dummy and are normally never used. Rather error out
on those, factorizing them within SubModelNode.
2021-10-29 14:11:30 +02:00
Sébastien Villemot
3e242dd481
New class SubModelNode to factorize between VarExpectationNode and PacExpectationNode
2021-10-29 14:11:30 +02:00
Sébastien Villemot
37a6ed6261
PAC: rethink the relation between PacModelTable and DynamicModel classes
2021-10-29 14:11:30 +02:00
Sébastien Villemot
127361971f
PAC: refactor with new PacModelTable that replaces PacModelStatement(s)
...
Incidentally, the auxiliary endogenous variable representing Z₁ and created for
PAC MCE models no longer necessarily appear as the first auxiliary variable (so
this is effectively a revert of 64f55e4a5e
).
2021-10-29 14:11:30 +02:00
Sébastien Villemot
0123326123
Fix error message when using pac_expectation with occbin_constraints
...
By the way, also fix the argument name (the model is not a VAR).
2021-10-29 14:11:08 +02:00
Sébastien Villemot
bc827326eb
JSON: fix syntax error in the aux vars table introduced in a7fb198463
2021-10-26 12:31:01 +02:00
Sébastien Villemot
5bef185370
PAC: add growth correction term for definition of Z₁ in the MCE case
2021-10-25 17:28:01 +02:00
Sébastien Villemot
4191cec9aa
Merge branch 'master' into 'master'
...
Master
See merge request Dynare/preprocessor!53
2021-10-08 13:42:16 +00:00
Sébastien Villemot
8bb8e59410
Improve message for GCC installation under macOS
2021-10-08 12:59:17 +02:00
MichelJuillard
a7fb198463
add field aux_vars to modfile.json
2021-10-08 09:26:49 +02:00
MichelJuillard
561bee0790
add NNZderivatives to JSON + use AbstractVector for Julia functions
2021-10-06 17:45:11 +02:00
Sébastien Villemot
78e295115a
PAC: better error message in case of name conflict for the growth neutrality correction parameter
2021-10-06 16:41:09 +02:00
Johannes Pfeifer
b496c4ba2c
ramsey_model: Fix error message logic
...
one of the statements being present is sufficient
2021-09-24 09:14:41 +02:00
Sébastien Villemot
eb006ecaeb
Remove unused steady_state_growth option to pac_model
2021-09-22 16:26:42 +02:00
Johannes Pfeifer
8d14e18cdb
Rename mh_mode to correct mh_posterior_mode_estimation option
...
Closes https://git.dynare.org/Dynare/preprocessor/-/issues/60
2021-09-21 17:28:37 +02:00
Sébastien Villemot
b12746190d
ramsey_{model,policy}, discretionary_policy: check that instruments are declared endogenous
...
Closes : #72
2021-09-21 17:17:36 +02:00
Sébastien Villemot
3d215020ae
Fix use_dll on macOS + Octave
...
Enforce GCC with mkoctfile. Otherwise Clang will be used, and it does not
accept our custom optimization flags.
Ref. dynare#1797
2021-09-13 16:50:13 +02:00
Sébastien Villemot
989347f448
Fix bug introduced in previous commit that triggers a crash for DSGE-VAR models
2021-09-08 19:00:15 +02:00
Sébastien Villemot
cb19ece049
estimated_params*: add a check that prevents (apparently) recursive prior definitions
...
Closes : #77
2021-09-08 17:10:56 +02:00
Sébastien Villemot
62ba9a434a
estimated_params_{bounds,init} now check that a parameter (or correlation) is never declared twice
...
This check was previously only implemented in estimated_params.
2021-09-08 16:38:15 +02:00
Sébastien Villemot
784dd4122a
PAC: generate the “growth_neutrality_param_index” MATLAB field for MCE models
...
Previously it was only generated in the case of backward PAC models.
2021-08-31 17:54:20 +02:00
Sébastien Villemot
6863494db2
Ensure that the “discount” option of “pac_model” is a parameter
...
Ref. Madysson/estimation-codes#4
2021-08-31 12:52:00 +02:00
Sébastien Villemot
15658fda5c
Merge branch 'mom_namespace' of git.dynare.org:JohannesPfeifer/preprocessor
...
Ref. !50
2021-08-30 16:05:44 +02:00
Sébastien Villemot
297888ce72
Merge remote-tracking branch 'origin/updated_covariance'
...
Ref. !47
2021-08-30 16:05:13 +02:00
Stéphane Adjemian (Charybdis)
79d5a2d687
Fix warning (missing option in occbin_setup).
2021-08-18 15:18:21 +02:00
Johannes Pfeifer
3f37d9692c
method_of_moments: move to namespace
2021-08-15 20:44:24 +02:00
Johannes Pfeifer
6fb86522ea
Occbin: Add missing options
2021-08-10 20:28:32 +02:00
Sébastien Villemot
bb19d98712
Merge branch 'results_file' into 'master'
...
Move results file to output folder
See merge request Dynare/preprocessor!48
2021-07-23 11:58:46 +00:00
Johannes Pfeifer
361b789e88
Move results file to output folder
2021-07-22 19:36:12 +02:00
Johannes Pfeifer
38714a58c4
Add updated_covariance option
...
Related to https://git.dynare.org/Dynare/dynare/-/issues/1784
2021-07-22 17:12:02 +02:00
Sébastien Villemot
5cfe6303e2
Cosmetic changes
2021-07-22 16:49:59 +02:00
Johannes Pfeifer
5da01faa74
Introduce option consider_all_endogenous_and_auxiliary
2021-07-22 11:49:36 +02:00
Sébastien Villemot
e1f7d8c735
VAR models: add a parameter representing the constant in the development of the pac_expectation operator
2021-07-21 17:53:55 +02:00
Sébastien Villemot
da9e0acc2d
VAR models: add a parameter representing the constant in the development of the var_expectation operator
2021-07-21 17:53:55 +02:00
Sébastien Villemot
1a5fb4d5e6
DynamicModel: make PAC data members private
2021-07-21 17:53:55 +02:00
Stéphane Adjemian (Ryûk)
8305b94d29
Fix constant definition in reduced form VAR.
2021-07-21 17:53:55 +02:00
Stéphane Adjemian (Ryûk)
c6a7d56b36
Fix constants in var model (it has to be a vector).
2021-07-21 17:53:55 +02:00
Sébastien Villemot
a6add6127b
VAR models: output vector of constants in varmatrices.m
2021-07-21 17:53:54 +02:00
Sébastien Villemot
1cf03a5f07
Cosmetic improvement
2021-07-21 17:53:54 +02:00
Sébastien Villemot
5498ce98ee
Use NumConstNode* type for DataTree constants (previously they were just expr_t)
2021-07-21 17:53:54 +02:00
Sébastien Villemot
15d7432105
Occbin: add more sanity checks on expressions in “occbin_constraints” block
...
— forbid leads and lags
— forbid expectation operators
This is implemented by moving the occbin_constraints expression to a separate
DataTree. As a side-effect, this removes the spurious non-linearity warning in
a stochastic context (because we were introducing inequalities and abs()
operators in the main DynamicModel tree).
2021-07-21 16:33:23 +02:00
Sébastien Villemot
ed31d1cb5e
Remove unused functions
2021-07-21 16:33:23 +02:00
Sébastien Villemot
6ae3d3131f
Occbin: handle external functions in “occbin_constraints”
2021-07-21 16:33:19 +02:00
Sébastien Villemot
0d6eb053d4
Ensure that “pac_expectation” operators are never inserted into a static model
...
The implementation of PacExpectationNode::toStatic() did not make sense. It
should normally never be called, hence we error out at this point.
Also do a cosmetic change in the PacExpectationNode::clone() methode.
2021-07-21 16:33:14 +02:00
Sébastien Villemot
b16ab9b247
Fix preprocessor crash when a [static] equation contains a “var_expectation” operator
...
Rather error out with a meaningful message.
2021-07-21 16:33:09 +02:00
Sébastien Villemot
ebd9954d33
Occbin: new syntax for constructing multi-regime equations
...
Ref. #68
2021-07-20 18:18:24 +02:00
Sébastien Villemot
0b8e3345fc
Ensure that a tag is not declared twice in the same equation
...
Previously the first value was silently ignored. It’s better to explicitly
forbid this. If this change creates problems (since it’s a change in an
undocumented behaviour), we can turn it into a warning.
2021-07-20 14:56:48 +02:00
Sébastien Villemot
81d4fd5d83
Occbin: generate +<basename>/occbin_difference.m
...
In particular, this implies that steady state values of endogenous in the
“occbin_constraints” block must now be specified using the STEADY_STATE()
operator (and not with a “_ss” suffix).
Moreover:
– make various simplifications to the fields generated under M_
– in the driver file, replace the call to occbin.initialize() by a few explicit operations
Ref. #68
2021-07-20 12:26:11 +02:00
Sébastien Villemot
90b1235a64
New utility to check if an expression contains an exogenous (possibly deterministic)
2021-07-20 12:10:58 +02:00
Sébastien Villemot
08ac455fcd
Implement “occbin_constraints” block
...
Consequently drop “occbin” option to “model”.
Incidentally, allow more values in equation tag names (previously some keywords
such as “alpha” were disallowed).
Ref. #68
2021-07-16 11:34:27 +02:00
Stéphane Adjemian (Ryûk)
6b9d94405c
Return the reduced form of the structural VAR model optionally.
...
Also
- changed the name of the generated matlab routine,
- changed initialization of matrix a0.
2021-07-16 08:33:26 +02:00
Sébastien Villemot
2e696a2e0d
Add shocks(surprise) block (for occbin)
...
Ref. #68
2021-07-13 21:55:31 +02:00
Sébastien Villemot
f0002c5ac6
Fix compiler warning introduced by 61b37942ab
2021-07-13 17:18:06 +02:00
Sébastien Villemot
c3b0ce8e69
shocks/mshocks/conditional_forecast_paths: various cleanups
2021-07-13 17:17:57 +02:00
Sébastien Villemot
5624260a07
Merge branch 'occbin_rebase' into 'master'
...
First part of Occbin interface
See merge request Dynare/preprocessor!42
2021-07-13 13:38:26 +00:00
Johannes Pfeifer
61b37942ab
First part of Occbin interface
2021-07-13 13:38:25 +00:00
Sébastien Villemot
c9c36c037a
New preprocessor option “nocommutativity”
...
This option tells the preprocessor not to use the commutativity of addition and
multiplication when looking for common subexpressions.
As a consequence, when using this option, equations in various outputs (LaTeX,
JSON…) will appear as the user entered them.
There is however a potential performance cost to using this option, yet to be
determined.
Ref. dynare#1788
2021-07-13 14:35:10 +02:00
Sébastien Villemot
6aeef11bb2
New perfect_foresight_with_expectation_errors_{setup,solver} commands
2021-07-09 17:14:22 +02:00
Sébastien Villemot
365fb27f3d
New “structural” option to “var_model”
...
As the name implies, this option allows contemporaneous variables on the RHS.
The A0 matrix for contemporaneous variables is added as a second (optional)
output to the generated var_ar.m file. Note that for reduced-form VAR, this
matrix will be the identity.
Also, the user is now allowed to write the VAR models in a more flexible form:
the LHS must still be a single variable, but the RHS can be an arbitrary
expression (as long as it is linear, obviously). Internally, the preprocessor
now uses derivation to compute the coefficients of the AR and A0. This change
applies to both reduced-form and structural VAR models.
Ref. dynare#1785
2021-07-08 12:55:47 +02:00
Sébastien Villemot
f7a367d7b1
“var_model” statement: make “eqtags” option mandatory
2021-07-08 12:55:40 +02:00
Sébastien Villemot
67f4777ac3
Remove support for obsolete syntax: var_model(order = 2) X Y Z;
2021-07-07 18:26:09 +02:00
Sébastien Villemot
4cc22897b7
Cosmetic improvements
2021-07-06 19:09:25 +02:00
Sébastien Villemot
8df34c1ca5
VAR and trend component models: improve sanity checks on lead/lags on RHS
...
In particular, forbid lagged exogenous.
2021-07-06 18:52:38 +02:00
Sébastien Villemot
c9d6d9c6f8
Enforce non-positivity of the “time_shift” option to “var_expectation_model”
...
Closes : #70
2021-07-06 16:40:20 +02:00
Sébastien Villemot
221daeab6f
New time_shift option to var_expectation_model
...
Ref. dynare#1787
2021-07-01 17:56:07 +02:00
Sébastien Villemot
5a33699f03
VAR / trend component models: cosmetic changes
2021-07-01 17:52:05 +02:00
Sébastien Villemot
700dd31d57
Merge branch 'mom_varlist' into 'master'
...
method_of_moments: remove var_list_
Closes #69
See merge request Dynare/preprocessor!44
2021-06-28 09:32:07 +00:00
Sébastien Villemot
e6e25a5c87
macOS: fix detection of GCC installed by Dynare package
...
Since the preprocessor has moved, the relative path of the local Homebrew needs
to be adjusted.
2021-06-24 15:16:55 +02:00
Johannes Pfeifer
f354458418
method_of_moments: remove var_list_
2021-06-24 15:10:24 +02:00
Sébastien Villemot
1c3e6f89af
macOS: bump to GCC 11 (for compilation and for use_dll)
2021-06-24 12:34:29 +02:00
Sébastien Villemot
824433aa3f
Refactor driver output for heteroskedastic_shocks
...
Ref. dynare#1791
2021-06-15 12:53:40 +02:00
NormannR
d0ec5eb155
Allows to write M_.objective_tmp_nbr in the driver.m file
...
Writes the number of temporary terms of the planner objective function derivatives objective_tmp_nbr in the driver.m file.
Useful for the k-order approximations of welfare.
2021-06-11 12:37:31 +02:00
Sébastien Villemot
74ef3457b4
Use secure URL for link to GNU licenses
2021-06-09 17:21:00 +02:00
Sébastien Villemot
86b2b4c2da
When order option > 3, compute planner objective derivatives at that order
...
Ref. dynare!1866
2021-06-04 16:20:29 +02:00
Sébastien Villemot
04f242f971
xls_sheet option: allow quoted strings as value
...
Closes : #67
2021-05-31 18:18:25 +02:00
Johannes Pfeifer
4b401e6253
Preparations for Occbin MR
...
Related to https://git.dynare.org/Dynare/dynare/-/merge_requests/1863
2021-05-31 15:12:46 +02:00
Sébastien Villemot
c5f9ae89e7
Implement new “occbin” option to “model” block
...
For the time being, the preprocessor will refuse that this option be used with
any command other than estimation.
By the way, remove occbin_likelihood and occbin_smoother options to estimation.
Ref. dynare#569
2021-05-31 10:00:59 +02:00
Sébastien Villemot
1e9ea1acf4
Merge branch 'smoother_redux' into 'master'
...
Add smoother_redux option
See merge request Dynare/preprocessor!38
2021-05-27 14:55:35 +00:00
Johannes Pfeifer
2a8726fe6e
Add kalman_algo and filter_covariance to calib_smoother
2021-05-27 16:42:10 +02:00
Johannes Pfeifer
0d635aed36
Add smoother_redux option
2021-05-27 16:41:36 +02:00
Sébastien Villemot
b12b254f2c
Add heteroskedastic_filter option and heteroskedastic_shocks block
...
Ref. dynare!1844, dynare!1851
2021-05-26 18:27:52 +02:00
Sébastien Villemot
e552bfc4b3
Refactor parsing of deterministic shocks
...
This will simplify the implementation of heteroskedastic_shocks.
2021-05-26 17:05:51 +02:00
Sébastien Villemot
c35f160e3f
Minor simplification
2021-05-26 16:17:18 +02:00
Sébastien Villemot
97e9609c28
Streamline use_dll compilation under MATLAB
...
— drop Windows 32-bit support
— drop -fno-omit-frame-pointer compilation flag under GNU/Linux
— drop -static-libstdc++ flag under Windows
— no longer link to -lstdc++ under GNU/Linux and macOS
— gracefully fail when 'mexext' value is unknown
2021-05-24 18:21:23 +02:00
Sébastien Villemot
a2c96a9d79
Allow empty quoted strings
...
Can be useful when resetting a filename option to an empty value, e.g. for the
mh_initialize_from_previous_mcmc_* options.
Ref. dynare!1841
2021-05-11 18:50:18 +02:00
Sébastien Villemot
73e07b78b8
Add mh_initialize_from_previous_mcmc option family to estimation command
...
Ref. dynare!1841
2021-05-11 18:12:54 +02:00
Sébastien Villemot
be7ff255f6
The fast_realtime option now accepts a vector of integers
...
Ref. dynare!1842
2021-05-10 15:41:36 +02:00
Sébastien Villemot
80e1090257
Add no_init_estimation_check_first_obs option to estimation
...
Ref. dynare!1839
2021-05-07 17:41:20 +02:00
Sébastien Villemot
337b6f469c
New parallel_use_psexec command-line option
...
Ref. dynare!1843
2021-05-06 16:25:46 +02:00
Sébastien Villemot
1d188a7444
Add comment
...
[skip ci]
2021-05-04 17:21:47 +02:00
Sébastien Villemot
3c4d647cc3
Forbid mfs > 0 in a stochastic setup (or even when using check)
...
The result would be wrong.
Ref. dynare#1726
2021-05-04 17:11:09 +02:00
Sébastien Villemot
7765efe95b
Windows: fix detection of location of MinGW compiler
2021-04-30 15:03:53 +02:00
Sébastien Villemot
12b61e4817
Bugfix in DataTree::writeToFileIfModified()
...
If the old file and the new contents shared a common prefix, then the output in
the generated file would be truncated at the start.
Ref. DynareJulia/Dynare.jl#1
2021-04-26 14:10:47 +02:00
MichelJuillard
9773bafc5b
Julia: write definition of get_power_deriv inside generated static/dynamic files
2021-04-26 10:52:18 +00:00
Sébastien Villemot
dca294de3a
Julia: refactor the auxiliary variable/series files
...
— rename the files with camel case
— encapsulate the functions with modules
— change the signature of function <MODFILE>_dynamic_set_series!, by removing
the output argument and appending the exclamation mark, since this function
modifies one of its arguments, and for symmetry with the static version
Ref. DynareJulia/Dynare.jl#1
2021-04-23 17:57:33 +02:00
Sébastien Villemot
4354d8a578
Julia: do not overwrite steady state / auxiliary variables/series files if contents has not changed
...
Ref. DynareJulia/Dynare.jl#1
2021-04-23 17:56:54 +02:00
Sébastien Villemot
4cfc7a563b
Julia: do not overwrite Static/Dynamic files if contents has not changed
...
Ref. DynareJulia/Dynare.jl#1
2021-04-22 18:03:47 +02:00
Sébastien Villemot
81b1d02748
Julia: fix typo in StatsFuns package name
...
Ref. DynareJulia/Dynare.jl#1
2021-04-22 15:48:25 +02:00
Sébastien Villemot
0213c9be73
Merge branch 'ramsey_k_order' into 'master'
...
Allows to write M_.NNZDerivatives_objective in the driver.m file
See merge request Dynare/preprocessor!36
2021-04-22 13:28:18 +00:00
normann
22fbfb0fba
Allows to write M_.NNZDerivatives_objective in the driver.m file
...
Writes the number of non-zero derivatives of the planner objective function NNZDerivatives_objective in the driver.m file. Useful for the k-order approximations of welfare.
2021-04-22 15:26:25 +02:00
Michel Juillard
d511e3ec3a
add deterministic_trends statement (only used by Dynare Julia)
2021-04-22 15:19:21 +02:00
Sébastien Villemot
910649dd28
Fix treatment of “series” option of “initval_file”
...
This option was treated as a numeric value: it was a hack to ensure that the
name of the dseries object was printed without quotes in the driver file.
However, that would make the JSON output synctically incorrect.
This commits removes the hack, and treats the “series” option as a string
value (in the same way as for the “data” command). A modification of the MATLAB
code will thus be needed to accomodate the change.
2021-04-20 10:39:14 +02:00
Sébastien Villemot
1f17528383
Julia: update dependencies of Static/Dynamic modules
...
Ref. DynareJulia/Dynare.jl#1
2021-04-19 17:02:46 +02:00
Sébastien Villemot
c2d47fb48e
Julia: remove driver file
...
The Julia code now uses the JSON output for retrieving the information that
previously was in the driver file.
2021-04-19 17:02:41 +02:00
Sébastien Villemot
7b3df21f11
DataTree::operator=(): fix crash when symbol ID ordering of model local variables does not correspond to the recursive ordering in the model block
...
Ref. dynare#1782
2021-04-16 17:34:13 +02:00
MichelJuillard
c2009e2012
fix set_auxiliary_variables.jl
2021-04-01 17:05:13 +02:00
MichelJuillard
6662d8014e
fix writeJsonOutput for load_params_and_steady_state
2021-04-01 17:05:13 +02:00
Michel Juillard
fd979f625a
add maximum lead and lag to modfile.json
2021-04-01 17:05:13 +02:00
Michel Juillard
c9dd241f5b
add varobs statement to JSON output
2021-04-01 17:05:12 +02:00
Michel Juillard
50a2e7c44f
Add escape codes in NativeStatement and VerbatimStatement writeJsonOutput() method
2021-04-01 17:05:10 +02:00
Sébastien Villemot
29b3b744ef
Remove spurious space produced when parsing key/value pairs
...
Introduced in e46168db66
.
2021-02-26 12:28:06 +01:00
Stéphane Adjemian (Charybdis)
f0d67b01dd
Honour bi-annual dates in mod file.
2021-02-26 09:30:02 +01:00
Sébastien Villemot
5581052451
Add particle_filter_options option to estimation
...
Ref. #59
2021-02-23 16:54:36 +01:00
Sébastien Villemot
e46168db66
Simplify parsing of lists of key/value pairs options
2021-02-23 16:49:11 +01:00
Sébastien Villemot
54365b16ed
Remove unfinished “occbin” option to perfect_foresight_solver and extended_path
...
Partially reverts f914837aff
and
567156aad4
.
2021-02-22 16:22:17 +01:00
Sébastien Villemot
825b9ee8ef
Fix bugs introduced in d3e115194b
...
Ref. #65
2021-02-19 20:29:18 +01:00
Sébastien Villemot
4798a5e2bc
Cosmetic change
2021-02-19 20:09:48 +01:00
Sébastien Villemot
ca4b1ba4ed
Remove time subscript in LaTeX output of model-local variables
...
See https://forum.dynare.org/t/tex-output-unwanted-subscript-t/16072
2021-02-19 17:45:58 +01:00
Sébastien Villemot
d3e115194b
Fix output write_latex_original_model for model-local variables
...
Those variables were substituted out by early substitution methods (which are
also called on the original model, for an unknown reason).
Closes : #65
2021-02-19 17:45:02 +01:00
Willi Mutschler
071a46a798
Add interface to set zero_moments_tolerance
...
Useful in identification and method_of_moments toolbox to set the tolerance which replaces very small numbers by hard zeros in unconditional second moments (particularly in pruned_state_space_system.m and disp_moments.m)
2021-02-16 16:29:57 +01:00
Sébastien Villemot
2781e3e6f6
A few modernizations using clang-tidy
2021-02-10 16:48:46 +01:00
Sébastien Villemot
9274675efb
Allow booleans in optimization options list
...
Closes : #63
2021-02-10 16:18:58 +01:00
Willi Mutschler
f7cd6dbf0a
🐛 save oo_.time also in _results.mat
2021-02-04 10:48:59 +01:00
Sébastien Villemot
702cf62ee3
Declare some methods as const
2021-02-03 18:09:11 +01:00
Sébastien Villemot
234fcd1d2b
Remove obsolete stuff from bytecode
2021-02-01 14:46:08 +01:00
Sébastien Villemot
754a1a464d
Use default member init
...
Performed using modernize-use-default-member-init from clang-tidy.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-default-member-init.html
2021-02-01 12:44:24 +01:00
Sébastien Villemot
4ee89d6e70
Use more auto keyword
...
Performed using modernize-use-auto from clang-tidy.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-auto.html
2021-02-01 12:42:59 +01:00
Sébastien Villemot
07391e0f9f
Remove unused kludge
2021-02-01 12:07:33 +01:00
Sébastien Villemot
89e2daf7c7
C++17 modernization: convert the remaining enums to enum classes
2021-02-01 12:05:06 +01:00
Willi Mutschler
c79ae5d4bd
Save 'Total computing time' into oo_.time
2021-01-28 11:28:41 +01:00
Johannes Pfeifer
ad22e62874
filter_initial_state: Port lost preprocessor commits from https://git.dynare.org/JohannesPfeifer/dynare/-/commits/filter_initial_state
2021-01-26 16:03:04 +01:00
Sébastien Villemot
7468b4d8d7
Remove more stuff related to unfinished decomposition in linear and nonlinear blocks
...
Ref. #39 , dynare!1626
2021-01-25 18:13:35 +01:00
Sébastien Villemot
af9bd8f109
Remove the unfinished decomposition in linear and nonlinear blocks
...
Also remove the det_cond_forecast interface, that was related to it.
Ref. dynare!1626
Closes : #39
2021-01-25 18:03:37 +01:00
Sébastien Villemot
1e5de7d71e
Fix typo
...
Introduced in 4c14dc3fbf
.
2021-01-22 14:20:52 +01:00
Sébastien Villemot
4c14dc3fbf
Macro processor: gracefully fail when argument to @#ifdef/@#ifndef is not a variable name
...
Ref. dynare#1771
2021-01-22 12:20:13 +01:00
Sébastien Villemot
ec66768a63
Forbid exogenous deterministic variables with a lead or lag
...
Ref. dynare#1765
2021-01-22 11:59:44 +01:00
Sébastien Villemot
ab656f2d84
macOS/use_dll: upgrade to gcc-10 compiler
2021-01-13 15:42:09 +01:00
Sébastien Villemot
a0d12310cb
macOS/use_dll: drop -mmacosx-version-min=10.9 flag
...
The MEX files are not intended for distribution to other systems.
2021-01-13 15:42:09 +01:00
Sébastien Villemot
c91178e3e3
macOS/use_dll: no longer pass -arch x86_64, in preparation for ARM support
2021-01-13 15:42:09 +01:00
Stéphane Adjemian (Charybdis)
7a8446e836
Added call to a routine filling the fields required by some nonlinear solvers.
...
At some point this task might be delegated to the preprocessor.
(cherry picked from commit ca230d0902eadeb89ab705cf66790ffa2f135192)
2021-01-12 19:50:37 +01:00
Willi Mutschler
a87b2753ed
MoM: Add option analytic_jacobian
2021-01-08 18:57:06 +01:00
Sébastien Villemot
8e03f17350
Cleanup the “output” option
...
— output Julia files as soon as “language=julia” is passed, independently of
the value of the “output” option
— drop the “dynamic” and “first” values of the “output” option, since they
actually do nothing
— obey the “output” option even in the deterministic case
Ref. dynare#1600
2021-01-08 18:51:48 +01:00
Sébastien Villemot
a9daec1c07
Rename preprocessor binary to dynare-preprocessor
...
Ref. dynare#1728
2021-01-06 17:08:42 +01:00
Sébastien Villemot
cd443a6083
Revert to accepting the “nolog” option, but do nothing about it
...
This is necessary to avoid an “unknown option” error.
Ref. dynare#1743
2021-01-06 15:50:30 +01:00
Sébastien Villemot
78874a01d3
No longer deal with the log file at the preprocessor level
...
Ref. dynare#1743
2021-01-06 14:19:33 +01:00
Johannes Pfeifer
1def52a088
Add interface to set schur_vec_tol
2020-12-17 19:55:20 +01:00
Sébastien Villemot
91db87b1cf
Forbid some basenames, since they will cause trouble
...
Closes: preprocessor#62
2020-12-16 18:21:55 +01:00
Sébastien Villemot
84d79226cd
Lexer: no longer associate a semantic value to GMM and SMM tokens
...
This was forgotten from commit 78f6d48601
.
2020-12-14 19:10:29 +01:00
Johannes Pfeifer
78f6d48601
GMM: introduce option analytic_standard_errors
2020-12-12 09:36:40 +01:00
Sébastien Villemot
7baeda8b8d
Occbin: add equation number in M_.occbin.constraint structure
...
Ref. #569
2020-12-10 15:57:47 +01:00
Sébastien Villemot
f67e9c044b
JSON output: fix “variable_mapping” for Ramsey models
...
Ref. dynare#1755
2020-12-09 17:32:29 +01:00
Sébastien Villemot
bf1da3c6fb
JSON output: fix logic in “variable_mapping” that could lead to invalid JSON formatting
...
Ref. dynare#1755
2020-12-09 16:47:55 +01:00
Sébastien Villemot
ec779235ea
Macro-processor: move environment out of node classes
...
This completes the separation of parse trees from their evaluation.
Closes : #32
2020-12-07 17:29:05 +01:00
Sébastien Villemot
638b4c7ac5
Ensure that all statements produce an output in JSON mode
2020-11-26 16:25:22 +01:00
Sébastien Villemot
a99ca9f450
Remove obsolete “var_estimation” statement
2020-11-26 16:13:52 +01:00
Sébastien Villemot
1b40327639
Remove obsolete “restrictions” block
2020-11-26 16:13:49 +01:00
Sébastien Villemot
c697a63119
Fix typo
2020-11-25 18:08:49 +01:00
Sébastien Villemot
9292b0692e
Rename DetCondForecast to DetCondForecastStatement, for naming consistency
2020-11-25 17:40:00 +01:00
Sébastien Villemot
4b8290faa5
Do not crash when unknown symbol is passed to “irf_shocks” option
...
Closes : #57
2020-11-18 17:47:37 +01:00
Sébastien Villemot
b1df9ecc38
Parallel config file: switch back to DynarePath field (instead of ProgramPath)
...
This is a partial revert of f022f666b7
Ref. dynare#1748
2020-11-13 15:35:01 +01:00
Sébastien Villemot
cfb41d291c
Substitute out model-local variables early in the model transform pass
...
Incidentally, this makes it possible to use model-local variables with either
the “block” or “bytecode” option. (Ref: dynare#1243)
2020-11-10 18:07:57 +01:00
Sébastien Villemot
1e419a48e4
Remove unused function
2020-11-10 18:02:06 +01:00
Sébastien Villemot
9bca65c7e5
Deterministic models: replace exogenous with lead/lags by auxiliary variables
...
This brings those models in line with stochastic models.
However note that transformation is still not exactly the same on stochastic
and deterministic models, because there is no need to take into account the
Jensen inequality on the latter. In deterministic models, there is a one-to-one
mapping between exogenous with lead/lags and auxiliaries, while in stochastic
models, an auxiliary endo may correspond to a more complex nonlinear expression.
2020-11-09 16:28:32 +01:00
Sébastien Villemot
5d564eed07
Fix the interpretation of @#elseif clauses within an @#ifdef or @#ifndef
2020-11-02 12:47:33 +01:00
Sébastien Villemot
df8d8ef116
Fix logic for @#ifndef
...
Ref. dynare#1747
2020-11-02 12:27:27 +01:00
Stéphane Adjemian (Charybdis)
abf5a6553b
Removed useless subfield (only julia output).
...
TODO: Check that we can do the same in the matlab version…
2020-10-21 18:16:07 +02:00
Stéphane Adjemian (Charybdis)
b8f7b5846b
Fixed flags for temporaries (julia output).
2020-10-21 16:37:13 +02:00
Sébastien Villemot
56581b1dd4
PAC model: make detection of non-optimizing part more robust
...
Introduce a new method for decomposing a product of factors, so that we can
identify expressions of the form (1-optim_share)*A*B.
Also enforce that the optim_share parameter be in a factor of the form
1-optim_share (previously it would accept any expression containing the
parameter).
Note that this fix does not yet allow to actually write non-optimizing parts of
the form (1-optim_share)*A*B, since at a later point the preprocessor imposes
that this part be a linear combination of variables (but in the future we could
think of expanding the A*B product into a linear combination if, for example, A
is a paramater or a constant and B is a linear combination).
Closes : #50
2020-10-19 18:32:30 +02:00
Sébastien Villemot
db3ef925a7
Fix handling of diffLead in SymbolTable::getOrigLeadLagForDiffAuxVar()
2020-10-16 16:31:55 +02:00
Sébastien Villemot
d2cbe2a19e
PAC model: fixes to M_.pac.MODEL.ar (information about autoregressive part)
...
– Fix order of items in this structure. Previously, items were ordered
according to the declaration order of parameters. Now, items are order
according to lag order (first lag appears first)
– Gracefully handle the case where there is no autoregressive part
(Closes : #52 )
2020-10-16 16:31:51 +02:00
Sébastien Villemot
740ea833f6
Block decomposition: bugfix for solve one boundary blocks with mfs>0
...
Ref. dynare#1726
2020-10-07 18:55:19 +02:00
Sébastien Villemot
e736b9234f
Minor simplification
2020-10-07 17:15:53 +02:00
Sébastien Villemot
4560639eb4
Block decomposition: fix evaluation of recursive variables in solved blocks
...
Ref. dynare#1726
2020-10-06 18:30:34 +02:00
Sébastien Villemot
5979885714
Block decomposition, chain rule derivation: code improvement
2020-10-02 18:31:55 +02:00
Sébastien Villemot
d347a92f14
Drop ExprNode::containsExogenous()
...
Replace it by calls to ExprNode::collectVariables() at the single place where
it was used.
2020-09-29 18:41:31 +02:00
Sébastien Villemot
063207e71f
ExprNode::collectEndogenous() is not a virtual method
2020-09-29 18:41:31 +02:00
Sébastien Villemot
2424b7358c
Remove unused ExprNode::collectExogenous()
2020-09-29 18:41:31 +02:00
Sébastien Villemot
b0bd031a9f
Remove unused ExprNode::containsEndogenous()
2020-09-29 18:41:31 +02:00
Sébastien Villemot
7f05489639
Simplify ExprNode::findConstantEquations()
2020-09-29 18:41:31 +02:00
Sébastien Villemot
a377fc8398
Fix various potential bugs with model local variables
...
Many recursive function on ExprNodes were not correctly recursing into the
definition of model local variables.
2020-09-29 18:41:17 +02:00
Sébastien Villemot
e4687bb976
Ensure that negative constants are never marked as temporary terms
2020-09-23 17:28:53 +02:00
Sébastien Villemot
571ea3eb8a
SymbolTable: add some const qualifiers
2020-09-23 17:28:04 +02:00
Sébastien Villemot
8f31e443d6
SymbolTable::getTypeSpecificID() now throws an exception instead of returning -1 when symbol does not have a type-specific ID
...
This can potentially avoid some undetected bugs.
2020-09-23 17:09:36 +02:00
Houtan Bastani
7ba77751c3
simplify external function C output
2020-09-18 17:05:54 +02:00
Sébastien Villemot
98d01cbbb6
Provide a meaningful error message when 'use_dll' option is used without 'matlabroot'
2020-09-18 15:00:47 +02:00
Sébastien Villemot
7e1563fdbb
Allow 'use_dll' option to be specified on the command line
...
Ref. Enteprise/dynare#4
2020-09-18 15:00:00 +02:00
Stéphane Adjemian (Charybdis)
0f268ce70c
Fixed logic.
...
Value passed to steady_state_growth was not acknowledge.
2020-09-18 11:11:50 +02:00
Sébastien Villemot
feee0ffa12
PAC model: better error message when pac_expectation refers to a non-existent pac_model
...
Closes : #53
2020-09-10 14:24:20 +02:00
Sébastien Villemot
de65e74c8f
use_dll: add the “restrict” C99 keyword to all pointers to double in computation functions
...
This greatly facilitates the job of the compiler during the optimization pass,
since we promise that the various pointers do not overlap each other. It may
now be possible to reenable some of the optimization flags that were disabled
without sacrificing compilation time, but this needs more investigation.
For the gory details, see:
https://en.cppreference.com/w/c/language/restrict
https://cellperformance.beyond3d.com/articles/2006/05/demystifying-the-restrict-keyword.html
2020-09-03 18:09:06 +02:00
Sébastien Villemot
5a9d1c4d87
Merge branch 'MoM' into 'master'
...
Remove matched_moments_ as input of method_of_moments
See merge request Dynare/preprocessor!27
2020-09-01 13:13:26 +00:00
Sébastien Villemot
c6ad212c8a
Merge branch 'typo' into 'master'
...
Fix typo
See merge request Dynare/preprocessor!26
2020-09-01 12:15:44 +00:00
Johannes Pfeifer
9d9a4bd4d1
Remove matched_moments_ as input of method_of_moments
...
Now a subfield of M_
2020-08-05 13:46:09 +02:00
Johannes Pfeifer
d714cac8e1
EquationTags.hh: fix typo
2020-08-04 16:21:50 +02:00
Sébastien Villemot
09054e11dc
Add new “matched_moments” block
...
Closes : #51
2020-07-28 18:30:24 +02:00
Sébastien Villemot
ecf6d67e1c
PAC/MCE model: fix timing of target in PAC expectation term
...
Also be more strict on the form of the target (must now be X(-1) or log(X(-1))
where X is *not* an auxiliary variable).
By the way, improve some comments in SymbolTable.
2020-07-24 18:26:16 +02:00
Sébastien Villemot
3b3589b958
PAC model: rewrite the algorithm for detecting the target, to make it more robust
...
Closes : #54
2020-07-23 17:19:16 +02:00
Sébastien Villemot
7bca47385d
Fixes to include_eqs/exclude_eqs
...
— fix segfault due to bad handling of iterators while erasing elements of a set
— fix logic for excluding endogenous variable when it is present on the LHS
2020-07-23 11:06:57 +02:00
Sébastien Villemot
86ac7d5bbc
PAC/MCE: improve informative message about # of aux. vars/eqs by adding the model name
...
This makes the output more useful when there are multiple PAC models.
2020-07-22 16:09:12 +02:00
Sébastien Villemot
2b25ab3e85
Fix handling of multiple PAC models
2020-07-22 12:21:05 +02:00
Sébastien Villemot
f2f6097777
Merge branch 'tune_jscale' into 'master'
...
Fix faulty logic in checks for mh_tune_jscale
Closes #46
See merge request Dynare/preprocessor!25
2020-07-21 08:59:20 +00:00
Johannes Pfeifer
eb464665ac
Fix faulty logic in checks
2020-07-21 10:48:45 +02:00
Johannes Pfeifer
5cc9f216ca
Make preprocessor recognize default order=2 of stoch_simul
2020-07-21 10:40:08 +02:00
Sébastien Villemot
d4e20c7ec4
Merge branch 'moment_estimation' into 'master'
...
Method of moments: Preprocessor preparations
See merge request Dynare/preprocessor!23
2020-07-16 08:56:03 +00:00
Stéphane Adjemian (Charybdis)
03f53c1b0d
Allow empty shocks(overwrite) block.
2020-07-15 12:33:02 +02:00
Sébastien Villemot
16f9168fda
PAC MCE: fix incorrect detection of the target variable
...
The detection of the target EC variable to be used when constructing the
forward-looking expectation variable is rather fragile.
When the PAC model is written with an (non-)optimizing share of agents,
restrict the identification of the target variable to the optimizing
expression, to minimize the risk of wrong identification.
By the way, add a few comments, and a small simplification.
2020-07-13 17:52:42 +02:00
Johannes Pfeifer
98ddbb61ba
Method of moments: Preprocessor preparations
2020-07-10 11:18:57 +02:00
Stéphane Adjemian (Charybdis)
51b3d5c68f
Do not print aux. var. for PAC expectation in dynamic_set_auxiliary_series routine.
...
It is useless in the backward looking version, and it cannot be
evaluated in the MCE case (because of the forward looking recursion).
2020-07-08 22:51:35 +02:00
Sébastien Villemot
3a9b0fc9ce
PAC MCE expectations: add corresponding auxiliary variables in dynamic_set_auxiliary_series.m and set_auxiliary_variables.m
2020-07-08 22:49:51 +02:00
Sébastien Villemot
4b3f010bc6
Simplify DynamicModel::writeAuxVarRecursiveDefinitions()
2020-07-08 18:48:45 +02:00
Sébastien Villemot
5b80a4db59
Unary ops substitution: bugfix, actually restrict the substitution to the chosen equations
...
By default, the preprocessor is supposed to only do the “unary ops”
transformation in the equations of VAR/PAC/trend component models.
However, the implementation was slightly different so far. It would detect
candidates to this transformation in the chosen equations, but it would then
perform the substitution in *all* equations.
This could lead for crashes, for example if the chosen equation contains
log(X(-1)), but another (non-chosen) equation has log(X(-2)). Then this latter
expression, even though it belongs to the same lag-equivalence class, is not
properly handled, causing a segfault.
Also do a few related cosmetic changes.
2020-07-08 15:13:14 +02:00
Sébastien Villemot
59bda04d8b
Block decomposition + use_dll: fix bug in timing of exogenous variables
2020-06-25 15:19:49 +02:00
Sébastien Villemot
c4351166a9
use_dll: remove nb_row_x from static file, it is useless
2020-06-23 18:19:27 +02:00
Sébastien Villemot
db8c5439f7
use_dll: higher order derivatives are now returned as sparse matrices by static/dynamic files
...
Previously they were returned as 3-column matrices. But this was inconsistent
with the M-file mode.
2020-06-23 17:50:50 +02:00