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
Sébastien Villemot
95bdfcee8c
use_dll: better safeguards on the number of input/output argument to static/dynamic MEX files
2020-06-23 16:30:21 +02:00
Sébastien Villemot
633b89db64
use_dll: remove hack for Microsoft Visual C++
...
We don’t support that compiler, and in any case it should support C99.
2020-06-23 16:00:55 +02:00
Sébastien Villemot
fd13c03401
use_dll: use fmax() and fmin() from C99 to compute max and min operators
2020-06-23 15:59:35 +02:00
Sébastien Villemot
ad5e196d30
Block decomposition now compatible with 'use_dll' option
2020-06-23 15:13:04 +02:00
Sébastien Villemot
479c2c029f
Block decomposition: move core of the routine for writing per-block files in separate function
...
This is a preparatory step to allow use_dll with block decomposition.
2020-06-22 14:18:21 +02:00
Sébastien Villemot
7641c2f7ee
Cosmetics
2020-06-22 11:33:16 +02:00
Sébastien Villemot
f098329c74
Block decomposition: static and dynamic files are now pure wrappers around the per-block files
2020-06-19 18:45:42 +02:00
Sébastien Villemot
f4d2ce70da
Block decomposition: move logic for Jacobians in stochastic mode outside the dynamic file
2020-06-19 17:44:05 +02:00
Sébastien Villemot
92aff91066
Block decomposition: in per-block files, construct sparse Jacobians more efficiently
...
Use 3-column format before calling sparse().
Ensure that the 3-column matrix is constructed in column-major order: data
locality will greatly improve performance once we implement use_dll.
2020-06-19 16:42:32 +02:00
Sébastien Villemot
93c18d514b
Block decomposition: in per-block dynamic files, fix nonzero elements for deterministic Jacobians
2020-06-19 15:26:19 +02:00
Sébastien Villemot
8ec43b1fb2
Block decomposition: small simplification in per-block dynamic files
2020-06-19 12:39:54 +02:00
Sébastien Villemot
dc28aaa5e9
Block decomposition: fix bug in reduction of block decomposition
...
Some evaluated blocks could be incorrectly merged, leading to wrong
results (e.g. blocks incorrectly marked as evaluable forward).
Bug introduced in 39407083be
2020-06-17 19:42:13 +02:00
Sébastien Villemot
79763911b2
Block decomposition: in the dynamic file, y and T are now vectors as in non-block mode
2020-06-17 16:49:12 +02:00
Sébastien Villemot
91d5be3b8c
Block decomposition: fix value of M_.block_structure.dyn_tmp_nbr
2020-06-17 16:04:49 +02:00
Sébastien Villemot
257b399a94
Block decomposition: in dynamic files, rename “jacobian_eval” to “stochastic_mode”
...
This is much more explicit.
2020-06-16 15:54:51 +02:00
Sébastien Villemot
379be6ccef
Block decomposition: for “solve two-boundaries” blocks, move the iteration loop outside the dynamic file
2020-06-16 15:34:45 +02:00
Sébastien Villemot
85b900363d
Block decomposition: for “solve two boundaries” block, no longer compute “b” (-residuals+g1*y) in the dynamic function
2020-06-16 13:49:23 +02:00
Sébastien Villemot
8496979375
Block decomposition: remove useless “y” output for static/dynamic files of solved blocks
2020-06-16 10:38:16 +02:00
Sébastien Villemot
ad583adcd4
Block decomposition: for evaluate blocks, move the iteration loop outside the dynamic file
2020-06-15 18:13:17 +02:00
Sébastien Villemot
f022c0e16e
Block decomposition: remove duplicate “periods” arg. to dynamic file of complete two-boundaries blocks
2020-06-15 16:54:11 +02:00
Sébastien Villemot
d530ccd012
Misc cosmetic improvements
2020-06-05 17:12:15 +02:00
Sébastien Villemot
b402e35683
In the driver file, provide mapping between model local variables and indices in the temporary terms vector
...
The structures are M_.model_local_variables_{dynamic,static}_tt_idxs.
Ref. dynare#1722
2020-06-05 17:12:15 +02:00
Sébastien Villemot
90b9b6a1e4
JSON output: write model local variables in parsed model (modfile.json)
...
Ref. dynare#1723
2020-06-05 16:10:38 +02:00
Sébastien Villemot
7b9495bb2f
JSON output: when writing the model after computing pass, use TEF terms for (not derived) external functions
2020-06-05 16:10:38 +02:00
Sébastien Villemot
f9ab44da56
JSON output: do not append two underscores after model local variable names in their definition
...
This is inconsistent with the way they are printed in equations (without
underscores).
The practice of appending underscores only makes sense in a MATLAB workspace context.
2020-06-05 16:10:37 +02:00
Sébastien Villemot
931935a942
Bug fix: allow external functions in model local variables
2020-06-05 14:50:06 +02:00
Sébastien Villemot
050f1cdd74
Block decomposition: remove unused 2nd and 3rd derivatives in output of dynamic functions
2020-06-03 16:59:04 +02:00
Sébastien Villemot
f0c8a14551
Block decomposition: no longer compute deterministic simulation from dynamic.m file
2020-06-02 17:42:00 +02:00
Sébastien Villemot
2caad3ee84
Block decomposition: simplify DynamicModel::writeDynamicBlockMFile()
2020-05-29 16:48:38 +02:00
Sébastien Villemot
7b11898689
use_dll: merge the two generated C source files into a single one
...
Also, do various other cosmetic/simplification changes.
2020-05-29 16:12:01 +02:00
Sébastien Villemot
3c5d731500
Fix compilation with GCC 10
2020-05-28 14:21:58 +02:00
Sébastien Villemot
3ca1914e03
Block decomposition: fix simulation of blocks of type "evaluate backward" (without bytecode)
...
Ref. dynare#1727
2020-05-26 17:00:21 +02:00
Sébastien Villemot
faa6666abe
Block decomposition: no longer use global variables for temporary terms in the dynamic M-file
...
Rather use a single vector as in non-block mode.
By the way, change the order of output arguments in static functions, to be
closer to the dynamic ones.
2020-05-26 16:21:11 +02:00
Sébastien Villemot
04b7d4386d
Block decomposition: no longer use global variables for temporary terms in the static M-file
...
Rather use a single vector as in non-block mode.
2020-05-25 18:35:36 +02:00
Sébastien Villemot
a5abbae46a
use_dll: remove workaround for char16_t type
...
Should no longer be needed now that the minimal MATLAB version is R2014a.
2020-05-25 16:06:17 +02:00
Sébastien Villemot
b9216be277
Block decomposition: fix incorrect check with model local variables
...
We normally never arrive here, since MLV are not compatible with 'block'
option.
2020-05-25 15:42:16 +02:00
Sébastien Villemot
3033417f5a
Block decomposition: remove ExprNodeOutputType::matlabDynamicSparseSteadyStateOperator
...
It’s not really needed, since it does the same as
ExprNodeOutputType::matlabDynamicSteadyStateOperator.
2020-05-25 15:35:55 +02:00
Sébastien Villemot
7b1a77ca47
Block decomposition: use logical values for some inputs to solve_{one_boundary,two_boundaries}
2020-05-25 15:12:43 +02:00
Sébastien Villemot
a6d9ba6e55
Rename EquationType::evaluate_s to evaluateRenormalized, for clarity
2020-05-20 11:49:32 +02:00
Sébastien Villemot
c6a17913b4
Rename {Static,Dynamic}Model::writeOutput() to ::writeDriverOutput() for clarity
2020-05-20 11:44:40 +02:00
Sébastien Villemot
becc433d56
Rename byte_code to bytecode for consistency with user option name
2020-05-20 11:39:59 +02:00
Sébastien Villemot
c579a45b08
Remove helper now unused because of 1d838e96ff
2020-05-20 11:35:44 +02:00
Sébastien Villemot
96657b4974
Block decomposition: refactor code that writes the block structure to the driver file
2020-05-20 11:35:14 +02:00
Sébastien Villemot
4b28f1fe9c
Bytecode: remove unused data structure
2020-05-20 10:31:31 +02:00
Sébastien Villemot
2944484442
Bytecode: rename output methods for better consistency
2020-05-19 17:45:33 +02:00
Sébastien Villemot
1d838e96ff
Block decomposition: simplify routines for writing output dynamic/static M files
2020-05-19 17:33:58 +02:00
Sébastien Villemot
d05ffde63e
Merge branch 'hif' into 'master'
...
histval_file initval_file refactoring
See merge request Dynare/preprocessor!20
2020-05-14 14:36:36 +00:00
MichelJuillard
ed4c36a267
add first_simulation_period to the lexer
...
(cherry picked from commit c8575e11d2f81ad606ab50849c52127653699a93)
2020-05-14 14:36:35 +00:00
Sébastien Villemot
a2bea00fee
Block decomposition: another fix related to temporary terms refactoring
...
Temporary terms need to be computed per equation (as was done previously), and
not simply per block.
It’s necessary to track temporary terms per equation, because some equations
are evaluated instead of solved, and an equation E1 may depend on the value of
an endogenous Y computed by a previously evaluated equation E2; in this case,
if some temporary term TT of equation E2 contains Y, then TT needs to be
computed after E1, but before E2.
2020-05-13 16:58:19 +02:00
Sébastien Villemot
c9388da649
Bytecode: still another fix for temporary terms
2020-05-13 15:16:38 +02:00
Sébastien Villemot
2e6bc7ecaa
Bytecode: fix handling of temporary terms
...
They were broken by 49036f166d
2020-05-13 12:53:47 +02:00
Sébastien Villemot
f8796c67c5
ExprNode::computeTemporaryTerms: minor simplifications, for symmetry with blocks code
2020-05-12 18:39:15 +02:00
Sébastien Villemot
49036f166d
Block decomposition: refactor code for computing temporary terms
...
In particular, in dynamic models, temporary terms are now computed for
derivatives w.r.t. exogenous, and also w.r.t. endogenous variables that do not
belong to the block.
2020-05-12 18:39:13 +02:00
Sébastien Villemot
ba214a100d
Block decomposition: bugfix, cutoff option was ignored
...
Introduced in c699d57308
2020-05-07 18:41:01 +02:00
Sébastien Villemot
928aa977b6
Block decomposition: replace expr_t by BinaryOpNode * in a couple of places
2020-05-07 15:24:35 +02:00
Sébastien Villemot
c699d57308
Block decomposition: no longer compute static Jacobian, it’s not used
...
Also remove a message about elements below the cutoff that was no longer
correct (elements below the cutoff have no impact on the incidence matrix
outside of normalization).
2020-05-06 18:11:11 +02:00
Sébastien Villemot
a1b37288f9
Block decomposition: do not write unnecessary zeros in dynamic Jacobian
...
Also do cosmetic change in the corresponding code for static Jacobian.
2020-05-06 14:22:04 +02:00
Sébastien Villemot
9f361e9e37
Block decomposition: simplify code for ordering dynamic Jacobian columns
2020-05-06 14:21:24 +02:00
Sébastien Villemot
061245e50d
Block decomposition: simplify routines that write static model in MATLAB form
...
By the way, this probably fixes a bug in the presence of external
functions (so-called TEF terms were not properly repeated in each per-block
static file).
Also remove debugging output in the M-file.
2020-05-05 18:59:28 +02:00
Sébastien Villemot
38ccd5e0cf
Block decomposition: remove unneeded code for bytecode
2020-05-05 17:15:08 +02:00
Sébastien Villemot
5f22f00436
PAC models: handle PAC data in DynamicModel copy constructor and assignment operator
2020-05-05 16:34:51 +02:00
Sébastien Villemot
4f453320d1
Block decomposition: remove unneeded code for exogenous
2020-05-05 16:17:22 +02:00
Sébastien Villemot
cb61ee8506
Block decomposition: make structures storing derivatives w.r.t. other endo/exo symmetric with those for endos belonging to the block
2020-04-30 18:24:24 +02:00
Sébastien Villemot
b1a739c56a
DynamicModel: add missing members in copy constructor/assignment operator
2020-04-30 14:57:50 +02:00
Sébastien Villemot
a8c2defe26
Block decomposition: compute simulation types into separate function; prologue and epilogue are no longer class members
...
By the way, remove the BlockType stuff which was purely informative (and it’s
not worth carrying over prologue and epilogue information just for that).
2020-04-30 12:48:16 +02:00
Sébastien Villemot
26fc71ffa7
Block decomposition: store max lead/lag of all variables in the “blocks” structure
...
By the way, regroup all code that computes the dynamic structure of a block
into a single function.
2020-04-30 12:03:14 +02:00
Sébastien Villemot
7f57821401
Now compute blocks[].first_equation from ModelTree::computeBlockDecompositionAndFeedbackVariablesForEachBlock
...
Also include various cosmetic changes.
2020-04-29 18:48:42 +02:00
Sébastien Villemot
1886746581
VariableDependencyGraph::reorderRecursiveVariables now returns indices from vertex_index
...
This is for consistency with other graph algorithms. Previously it would return
an index from vertex_index1.
See also 1d92adacf4
(which this commit basically
reverts).
Also do some cosmetic changes in calling graph code.
2020-04-29 18:46:15 +02:00
Sébastien Villemot
24db5e6033
Minor simplifications in graph algorithms
2020-04-29 18:12:22 +02:00
Sébastien Villemot
4948adf2cd
Block decomposition: remove unused data structure
2020-04-29 17:47:48 +02:00
Sébastien Villemot
f39c687d85
Block decomposition: store mapping between endos/eqs and their block
...
Previously this computation was done at several places.
2020-04-29 17:42:46 +02:00
Sébastien Villemot
39407083be
Block decomposition: ensure that the cutoff option only impacts normalization
...
Previously, the cutoff option would also impact the block decomposition itself,
since it would had an influence on the incidence matrix used for computing the
blocks and their derivatives.
The problem is that, in the general case, it’s quite possible that an element
of the numerical Jacobian be zero at the evaluation point, while being quite
different from zero along the simulation path. A typical example is an
expression of the type x*y, where y is an endogenous and x is an exogenous not
present in the initval block (and hence initialized to zero).
2020-04-29 12:41:39 +02:00
Sébastien Villemot
470cb5fcb0
Block decomposition: remove mostly unused structure ModelTree::derivative_endo
...
It has been superseded by ModelTree::blocks_derivatives.
By the way, fix the initial number of non-zero elements in sparse Jacobian.
Also avoid computing suboptimal temporary terms.
2020-04-28 14:12:29 +02:00
Sébastien Villemot
2c69f1f31e
Cosmetic changes to ModelTree::determineLinearBlocks()
2020-04-28 12:35:18 +02:00
Sébastien Villemot
2e136cae56
Block decomposition: simplify computation of block derivatives
...
— use a std::map for storing block derivatives
— remove redundant ModelTree::first_chain_rule_derivatives structure
— remove unused codepaths in StaticModel
— DynamicModel: simplify code that determines the type of derivatives in a
block. We now use a slightly different categorization.
— by the way, fix the max lead/lag information for blocks that are obtained via
merging. A workaround was previously implemented in
DynamicModel::get_Derivative(), but it is no longer needed with this fix.
2020-04-28 12:26:51 +02:00
Sébastien Villemot
5bd41f8599
Improve comments
2020-04-24 19:06:30 +02:00
Sébastien Villemot
45b260cf20
VariableNode::getChainRuleDerivative: do not cache values in ExprNode::derivatives
...
This field is used for standard derivatives. Using it also for chain rule
derivatives can only lead to wrong results.
2020-04-24 19:06:30 +02:00
Sébastien Villemot
29f28be772
Further simplify ModelTree::computeBlockDecompositionAndFeedbackVariablesForEachBlock()
2020-04-24 11:36:05 +02:00
Sébastien Villemot
5ee45f5bd4
Block decomposition: remove helpers that are no longer needed since data structure are cleaner
...
Add a new helper for getting the number of recursive variables in a block.
2020-04-23 16:31:57 +02:00
Sébastien Villemot
2154227990
Block decomposition, bugfix: M_.block_structure_stat.block().mfs was wrong
2020-04-23 16:03:38 +02:00
Sébastien Villemot
e48e761b94
Block decomposition: various minor cleanups
2020-04-23 14:41:18 +02:00
Houtan Bastani
8b6e42559d
fix typo
...
[skip ci]
2020-04-21 13:08:27 -04:00
Sébastien Villemot
118ceab85b
Block decomposition: reorganize data structures storing block information
2020-04-21 18:25:33 +02:00
Sébastien Villemot
8eafd9ab4f
Block decomposition: various refactorings
2020-04-17 19:23:52 +02:00
Sébastien Villemot
1d92adacf4
Block decomposition: fix bug with mfs > 0 introduced in 5431451db3
2020-04-17 18:19:07 +02:00
Sébastien Villemot
a741799f90
Block decomposition: factorize various helper functions
...
Should have been done in 76c2e87c3b
.
2020-04-17 16:04:19 +02:00
Sébastien Villemot
7327fb9f17
Block decomposition: give more explicit names to ModelTree::{inv_,}{equation,variable}_reordered
2020-04-17 15:09:22 +02:00
Sébastien Villemot
4e819f09b2
Block decomposition: various refactorings
2020-04-15 17:56:28 +02:00
Sébastien Villemot
5431451db3
Block decomposition: refactor algorithms on the variable dependency graph
...
In particular, move them into a separate class rather than a namespace.
2020-04-10 12:55:07 +02:00
Stéphane Adjemian (Charybdis)
c38f9aa7c3
Cosmetic change.
2020-04-06 09:29:57 +02:00
Stéphane Adjemian (Charybdis)
27a8b3b70e
Added preprocessor option: notime.
...
Do not print the total computing time at the end of the driver.
2020-04-03 11:00:48 +02:00
Sébastien Villemot
daa8d01686
Complete rewrite of the equation normalization symbolic engine
2020-04-02 19:19:57 +02:00
Sébastien Villemot
e88c05e3b8
Change prototype of DataTree::AddEqual()
...
This permits some simplifications.
2020-04-02 19:19:57 +02:00
Sébastien Villemot
fb72472ee0
Block decomposition: fix several bugs in computation of renormalized equations
...
This would only hit for mfs=2 or mfs=3.
2020-03-30 18:39:25 +02:00
Sébastien Villemot
1949a355a7
Block decomposition: simplifications to ModelTree::equationTypeDetermination
2020-03-30 17:06:48 +02:00
Sébastien Villemot
4d30f17e0b
Block decomposition: move collectFirstOrderDerivativesEndogenous in ModelTree
...
By the way, use camel case for the function name.
2020-03-30 14:51:53 +02:00
Sébastien Villemot
ad48697abe
Block decomposition without bytecode: fix call to solve_one_boundary
...
Ref. dynare#1717
2020-03-30 12:44:01 +02:00
Sébastien Villemot
9263a02a9b
Skip constant equations replacement only when there is an “mcp” tag
...
Since bef537d40a
, constant equations were not
simplified as soon as they had a tag attached.
But this is too wide a restriction. In particular, this breaks the trend
component models which have a target that is set to a constant.
So we now only skip the replacement in the case where there is an “mcp” tag.
Ref. dynare#1697
2020-03-27 18:17:04 +01:00
Sébastien Villemot
50776a766a
Remove the unsignedness of many integer variables and function arguments
...
This was only adding unneeded complexity, for no clear reason (we’re very far
from reaching 2³¹ equations, and if we wanted to support models that large, it
would be better to use long integers to avoid being limited to 2³²).
2020-03-24 18:28:03 +01:00
Sébastien Villemot
92c3cbdfa1
Remove unused classes
2020-03-24 17:04:53 +01:00
Sébastien Villemot
78ff24ea14
Block decomposition: misc style and doc improvements
2020-03-24 16:57:45 +01:00
Sébastien Villemot
a2caa8b4a8
Block decomposition: in symbolic normalization, no longer insert a null pointer in dynamic Jacobian
...
Rather use DataTree::Zero, since we use numerical zero for static and
contemporanous Jacobians.
2020-03-24 15:28:22 +01:00
Sébastien Villemot
5d6e6338f4
Block decomposition: remove unused codepaths in computation of normalization
2020-03-20 18:49:31 +01:00
Sébastien Villemot
097bdfde03
Misc simplifications and cosmetics
2020-03-20 18:42:59 +01:00
Sébastien Villemot
ce1cbb3e52
Block decomposition: turn EquationType into an enum class
2020-03-20 18:00:56 +01:00
Sébastien Villemot
8b4d046f9f
Block decomposition: turn BlockSimulationType into an enum class
2020-03-20 17:31:14 +01:00
Sébastien Villemot
f1061e8df1
Block decomposition: turn BlockType into an enum class
2020-03-20 16:38:43 +01:00
Sébastien Villemot
fcef9cf8b9
Block decomposition: further streamlining of function prototypes
2020-03-20 15:23:23 +01:00
Sébastien Villemot
bd6eee93df
Block decomposition: refactor the prototypes of various functions
...
— return output arguments on the left-hand side
— do not pass class members as input/output arguments
By the way, fix a (benign) vector allocation bug in
{Static,Dynamic}Model::computeChainRuleJacobian().
2020-03-19 17:47:12 +01:00
Sébastien Villemot
76c2e87c3b
Block decomposition: factorize data structures between StaticModel and DynamicModel
2020-03-17 18:58:34 +01:00
Sébastien Villemot
7aea50b988
Do not import MFS namespace
2020-03-17 16:49:22 +01:00
Sébastien Villemot
ec57ee96c3
MinimumFeedbackSet: make most functions (de facto) private
2020-03-17 16:48:55 +01:00
Sébastien Villemot
ca7024802e
Merge branch 'shock_decomp' into 'master'
...
Add missing smoother options to shock_decomposition
See merge request Dynare/preprocessor!18
2020-03-17 13:22:41 +00:00
Johannes Pfeifer
dab769c6f4
Add missing smoother options to shock_decomposition
2020-03-17 11:48:51 +01:00
Michel Juillard
d668590ff8
modify Julia output for mapping eqidx
2020-03-17 09:27:10 +01:00
Sébastien Villemot
7d1a467aa3
Transform predetermined variables before computing original model leads/lags
...
This is necessary to correctly compute those original model leads/lags. In
particular, this is needed for correct interaction with “histval”.
Closes : #47
2020-03-02 17:10:24 +01:00
Stéphane Adjemian (Charybdis)
2a048a487c
Throw an error if mh_tune_guess is used without mh_tune_jscale.
2020-02-29 09:54:18 +01:00
Stéphane Adjemian (Charybdis)
3c6a23137b
Throw an error if mh_tune_jscale is used with mh_jscale.
2020-02-28 18:28:09 +01:00
Stéphane Adjemian (Charybdis)
5a12f56b0f
Cosmetic change (indentation).
2020-02-28 13:17:01 +01:00
Stéphane Adjemian (Charybdis)
baa3804314
Shorten option name.
2020-02-28 13:10:47 +01:00
Johannes Pfeifer
02fa6c7814
Add interface to set initial guess for mh_tune_jscale
2020-02-26 11:20:48 +01:00
Sébastien Villemot
9ff10f482a
Fix typos (thanks lintian)
2020-02-25 15:20:33 +01:00
Johannes Pfeifer
312edf0dba
Provide M_ as an output to stoch_simul and discretionary_policy
...
Related to https://git.dynare.org/Dynare/dynare/issues/1711
2020-02-24 13:06:59 +00:00
Houtan Bastani
2813ef2d18
remove unused header
2020-02-21 19:51:04 +01:00
Houtan Bastani
7371558321
rework equation tags
...
Create new EquationTags class to simplify use of equation tags throughout the code and avoid repeated code
issue #38
2020-02-21 17:49:38 +01:00
Houtan Bastani
28b98c7c0e
Rework the function that handles the macro-expansion of the .mod file
2020-02-20 15:30:46 +01:00
Houtan Bastani
abedb47573
macro processor: allow for the definition of a variable without a value
...
- by default, set the value of the variable to `1`, as is done on the command line with the `-D` flag
issue #43
2020-02-19 21:40:40 +01:00
Houtan Bastani
4a68f8a38d
dragonfly: add new field to `options_.parallel_info`
2020-02-18 21:31:07 +01:00
Houtan Bastani
a3fb2b123e
fix bug introduced in a778ba4
2020-02-18 12:32:34 +01:00
Houtan Bastani
a778ba4ab4
fix lookbehind to handle `-` sign in substitution of dates in native statements
...
closes dynare#1708
2020-02-17 17:37:58 +01:00
Houtan Bastani
976e2ae17a
remove support for weekly dates
2020-02-17 15:03:26 +01:00
Houtan Bastani
fb8a26f877
dragonfly: support ProgramConfig config file option
2020-02-13 18:35:56 +01:00
Houtan Bastani
f022f666b7
dragonfly: support ProgramPath config file option
2020-02-13 17:47:15 +01:00
Houtan Bastani
ac4749edf9
add undocumented `gui` option to preprocessor
2020-02-12 12:32:40 +01:00
Houtan Bastani
14be6bad00
occbin: support occbin tags in equation tags, add occbin_likelihood and occbin_smoother as options to estimation
2020-02-11 14:24:06 +01:00
Houtan Bastani
f9a7d8ded3
make loop variables const
2020-02-06 16:09:03 +01:00
Houtan Bastani
de6ca5cdcc
Combine `DynareMain.cc` and `DynareMain2.cc`
2020-02-05 16:27:40 +01:00
Houtan Bastani
1dbbd87d3d
Remove options `noemptylinemacro` and `nolinemacro`; add option `linemacro`
...
This only concerns the situation when `savemacro` is also passed.
When `linemacro` is passed, the macro expanded .mod file is the same as before
When `linemacro` is not passed, the macro expanded .mod file is equivalent to what it was before when both `noemptylinemacro` and `nolinemacro` were passed.
closes #44
closes #45
2020-02-05 15:19:01 +01:00
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
Houtan Bastani
12296b620f
macro processor: fix bug in file reported when error encountered after a file has been included
...
closes #42
2020-02-04 11:12:41 +01:00
Houtan Bastani
6284e991fc
macro processor: remove unnecessary type specifiers
2020-02-04 11:12:41 +01:00
Sébastien Villemot
ee972d9638
Fix “planner_discount” option of “discretionary_policy”
...
Since fe0c781c06
, the discount factor would
always be equal to one.
Ref. dynare#1699
2020-01-30 15:42:39 +01:00
Houtan Bastani
3fec11b183
code simplifications
2020-01-30 14:55:39 +01:00
Houtan Bastani
148aa9d924
macro processor: simplify handling of `@#define`
2020-01-29 14:52:01 +01:00
Stéphane Adjemian (Charybdis)
2479a2a78c
Fixed bug introduced in 985d742
.
...
If a float smaller than one in absolute value is written without a
leading zero in the mod file, for instance as `.5`, we really need to
prefix the number with a zero. The simplest approach is to convert
the strings representing the numerical constants into floats.
2020-01-28 18:11:55 +01:00
Stéphane Adjemian (Charybdis)
985d742381
Removed prefixing of doubles between -1 and 1 with 0.
...
This resulted in values like `00.018` in the AST's NumConstNode which
cannot be read by some JSON readers (e.g. Mathworks' jsondecode).
2020-01-27 16:45:21 +01:00
Sébastien Villemot
bef537d40a
Do not simplify constant equations which have a tag attached
...
In particular, in the case of an 'mcp' tag, this could lead to a convergence
failure.
Ref. dynare#1697
2020-01-27 16:09:05 +01:00
Sébastien Villemot
0f3f6a2332
Add comments and simplify code in function that parses the --+ options: … +-- line
2020-01-23 18:45:02 +01:00
Houtan Bastani
c6a52fd778
macro processor: c++ modernization
2020-01-21 15:43:25 +01:00
Houtan Bastani
fa2f6c9206
macro processor: use `map.count()` instead of `map.find()`
2020-01-21 15:41:25 +01:00
Houtan Bastani
3c546ddb20
macro processor: declare function const
2020-01-21 15:41:08 +01:00
Sébastien Villemot
a8b7bd31c5
Fix bug introduced in use_dll mode in 23a08a3662
...
Ref. #40
2020-01-20 18:33:31 +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
Sébastien Villemot
23a08a3662
Ensure that dynamic model files contains all the derivatives that have been computed
...
Previously, there could be a discrepancy if the order mandated by
“identification” was less that the one mandated by “stoch_simul”.
Ref. #40
2020-01-20 17:22:32 +01:00
Sébastien Villemot
1c44baea05
New option “filtered_theoretical_moments_grid”, that supersedes “hp_ngrid”
...
The old option is left for backward-compatibility purposes, but it has the same
effect as the new one.
Ref. dynare#1093
2020-01-20 16:21:25 +01:00
Houtan Bastani
e9049aa81f
use prefix notation `R"()"` for quote in quotes
2020-01-16 16:24:21 +01:00
Houtan Bastani
6d1c2ca82b
macro processor: allow colon-separated arrays as command-line defines
...
colon-separated command line arguments such as
```
dynare <<.mod file>> -DA=1:5 -DAA=1:2:5
```
are now translated as:
```
@#define C = [2, 3, 4, 5, 6]
@#define CC = [2, 5]
```
2020-01-16 16:24:21 +01:00
Houtan Bastani
f00d7c4b4c
macro processor: fix bug where command line arguments that began with an integer were being treated as integers even if they weren't (e.g. dates)
2020-01-16 13:09:42 +01:00
Johannes Pfeifer
a70511e057
Add xls_sheet and xls_range options to calib_smoother
2020-01-13 11:36:31 +00:00
Houtan Bastani
15df06bf29
fix bug in writing equation tags in latex output; special characters (`& % $ # _ { } ~ ^ \`) were not escaped
2020-01-07 15:59:01 +01:00
Houtan Bastani
70c3d478ba
add newline after equation tag in latex output
2020-01-07 15:58:58 +01:00
Houtan Bastani
acdfeb4ee6
simplify calls to `symbol_list.checkPass`
2020-01-07 15:58:30 +01:00
Houtan Bastani
d2860c4f6b
place braces directly around latex name
...
issue dynare#263
2020-01-07 15:58:00 +01:00
Sébastien Villemot
4e2538a2a2
Ensure original tags and line numbers are preserved with ramsey_model
...
In particular, introduce a method for clearing all equations, so that tags and
line numbers are also cleared.
Ref. dynare#1685
2020-01-06 18:26:35 +01:00
Houtan Bastani
05f00aa33f
fix bug causing equation tags to be ignored when casting to StaticModel
2020-01-06 16:05:22 +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
Houtan Bastani
f2271eb806
Partial reversion of global indentation of macro processor header files introduced in e2d5a83592
...
The global indentation introduced in e2d5a83592
made the macro processor header files difficult to read. Revert spacing changes that made simple, inline, one-line functions take up 5 lines making headers tougher to read. Similary change for constructors, not to place each brace on an individual line.
2019-12-23 19:39:34 +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
0cd59dbcf8
bug fix: clear symbol list and options list after call to `DetCondForecast` constructor
...
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
Houtan Bastani
137dc31bb0
remove unnecessary headers
2019-12-20 12:49:23 +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
Sébastien Villemot
ebafd8f3b6
Epilogue: always initialize M_.epilogue_names and M_.epilogue_var_list_
...
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
d441ff059a
Fill the “M_.aux_vars(:).orig_expr” field for all auxiliary variables
...
This field contains a string representation of the expression that the
auxiliary variable replaces.
It is non-empty for all auxiliary variables, except for Lagrange multipliers.
Ref. dynare#773
2019-12-19 16:58:26 +01:00
Sébastien Villemot
8b23a2d575
Fix incorrect static model when “diff” operator is present
...
The “diff” operator was incorrectly replaced by its argument in the static
model, leading to an incorrect result for the steady state.
This is because the information contained in the “expr_node” field of the
auxiliary variables storage was not consistent across all types of auxiliary
variables: for a “diff()” operator, it would contain the argument of the
operator, instead of the full node. Hence it would not simplify to zero at the
steady state.
A similar inconsistency was also present for the “expectation()” operator,
though it was not leading to an incorrect static model.
2019-12-19 16:50:40 +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
d1d244086d
Remove spurious spaces within parentheses in generated MATLAB code
2019-12-18 17:35:25 +01:00
Sébastien Villemot
fe0c781c06
New “planner_discount_latex_name” option of “ramsey_policy”
...
Accepts a TeX name, as for variable declarations (i.e. enclosed within dollar
signs).
Ref. dynare#1686
2019-12-18 17:32:41 +01:00
Sébastien Villemot
1a08cdf01a
BinaryOpNode::findConstantEquations(): fix bug related to nested if/else
...
In the absence of braces, the last “else” clause is always associated with the
closest “if”, which is not what was intended here. The indentation was
misleading.
2019-12-18 16:32:59 +01:00
Houtan Bastani
a4ef5a01d3
Epilogue: handle case where `dseries.firstobservedperiod` ends in an error
...
issue #36
2019-12-18 15:54:50 +01:00
Houtan Bastani
4f20b1146e
Epilogue static file: handle case where RHS is not a dseries
...
issue #36
2019-12-18 15:50:37 +01:00
Houtan Bastani
e2d9e179a2
Include missing header
2019-12-18 15:43:49 +01:00
Houtan Bastani
86c79250cf
Make iterator const
2019-12-18 15:43:49 +01:00
Houtan Bastani
653b2477db
Update for bison 3.5
2019-12-18 15:43:48 +01:00
Houtan Bastani
87870eaae8
Epilogue: remove +1
...
issue #36
2019-12-18 15:43:48 +01:00
Houtan Bastani
efb2752e4e
Ramsey: fix bug: symbol_list is not passed to RamseyPolicy statement when it was not passed options
2019-12-18 12:07:59 +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
97fa005b33
Use 1-based indexing in M_.nonzero_hessian_eqs
2019-12-13 22:31:49 +01:00
Sébastien Villemot
141cff0761
New field M_.endo_trends
...
For each endogenous variable, gives the deflator and the growth factor (as well
as the “log” versions).
Ref. dynare#1648
2019-12-13 18:02:37 +01:00
Sébastien Villemot
2af26ee2c2
Ramsey: use information from transformed model for filling M_.nonzero_hessian_eqs
...
Since commit 9c9e8f816f
, it’s the information
from the original model which was in this field, which is not what is expected.
By the way, do not output this field (and the related M_.hessian_eq_zero) when
the Hessian is not computed by the preprocessor (i.e. in practice for perfect
foresight), since they would otherwise contain incorrect information.
Ref. dynare#1681
2019-12-13 18:02:35 +01:00
Houtan Bastani
2646f01424
fix quotes from 7958f76fae
2019-12-13 16:03:37 +01:00
Houtan Bastani
fddfb7fe2f
Issue deprecation warning for `simul`
...
closes dynare#1683
2019-12-13 16:01:47 +01:00
Houtan Bastani
c1b8cdf811
epilogue: simplify _static file
...
issue #36
2019-12-12 16:32:12 +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
047b397899
Simplify x+y-y in x
...
Note that this actually corresponds to 4 different abstract syntax trees:
— (x+y)-y
— (y+x)-y
— (x-y)+y
— y+(x-y)
2019-12-12 16:19:15 +01:00
Sébastien Villemot
d747b53a8b
Simplify x*y/y in x
...
Note that this actually corresponds to 4 different abstract syntax trees:
— (x*y)/y
— (y*x)/y
— (x/y)*y
— y*(x/y)
2019-12-12 16:19:15 +01:00
Sébastien Villemot
50275f3588
Simplify x-(-y) in x+y
2019-12-12 16:19:15 +01:00
Sébastien Villemot
f24f28b2b2
Simplify x/(1/y) in x*y
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
44adcbb488
epilogue: replace `dseries__` with `ds` making the file easier to read
2019-12-12 14:46:45 +01:00
Houtan Bastani
dfcd381d20
epilogue: fix bug with external functions in `epilogue` block
...
issue #36
2019-12-12 14:45:49 +01:00
Houtan Bastani
7958f76fae
issue deprecation warning for `ramsey_policy`
...
dynare#1678
2019-12-12 11:36:43 +01:00
Houtan Bastani
8dfa79a0f5
new command `evaluate_planner_objective`
...
dynare#1678
2019-12-12 11:35:26 +01:00
Houtan Bastani
5430bb4bc6
simplify for statement
2019-12-11 16:21:18 +01:00
Houtan Bastani
4111bc8cfc
epilogue: create _dynamic and _static files
...
#36
2019-12-11 16:17:54 +01:00
Houtan Bastani
34a41b557d
epilogue: output endogs used in epilogue equations
...
#36
2019-12-11 15:51:26 +01:00
Houtan Bastani
41d38551e5
write names of epilogue variables
2019-12-11 15:51:26 +01:00
Houtan Bastani
3694fc40b3
detrend epilogue equations
2019-12-11 14:45:47 +01:00
Houtan Bastani
8dc70602c8
macro processor: move evaluation of all arguments for unary, binary, and trinary ops into their switch cases
2019-12-10 16:33:32 +01:00
Houtan Bastani
952e899f3a
fix bug in macro processor ensuring short-circuit functionality of `||` and `&&` statements
...
closes dynare#1676
2019-12-10 16:30:11 +01:00
Sébastien Villemot
5c081db76f
Add option “colormap” to “initial_condition_decomposition” command.
...
Ref dynare#1586
2019-12-09 15:43:39 +01:00
Sébastien Villemot
8962a9d589
Windows: apply the workaround for +<basename> removal to +objective subfolder
...
Because MATLAB under Windows maintains a lock on the “+<basename>” subdirectory,
we use a workaround consisting in first renaming the directory, then deleting
it.
But this is not enough when the “ramsey_policy” command is used, because the
latter creates a “+objective” subfolder inside “+<basename>”, on which MATLAB
also maintains a lock.
The fix consists in recursively using the same workaround as for the top-level
directory: renaming before deleting.
2019-12-06 15:19:23 +01:00
Houtan Bastani
3f3ef7ca00
fix bugs in initial_condition_decomposition statement
...
closes #37
2019-12-06 10:40:44 +01:00
Houtan Bastani
2814f05a67
Add flag to compilation of flex file
...
Without this flag flex errors out because it hits a hard-coded size limit
2019-12-04 16:57:20 +01:00
Houtan Bastani
02cb4cc973
add compiler statement
...
Allows the user to set the compiler, flags, and libs to be used with `use_dll`
Issue #35
2019-12-04 16:57:20 +01:00
Houtan Bastani
bf56d6fb82
fix LaTeX output for sqrt, exp, sin, cos, tan
2019-12-04 11:26:30 +01:00
Houtan Bastani
2db2133796
fix bugs with cbrt
...
- it was not handled in the model block
- output was incorrect for MATLAB/Octave and LaTeX
2019-12-04 11:10:19 +01:00
Houtan Bastani
abbdbb5862
Clarify part of code
2019-12-03 16:42:38 +01:00
Sébastien Villemot
23ff36a0dd
Systematically compute recursive ordering of auxiliary equations
...
Auxiliary equations appearing in set_auxiliary_variables.m and
dynamic_set_auxiliary_series.m need to appear in recursive ordering, since
those files are used for sequential evaluation.
Previously, the recursive ordering was guaranteed by a set of ad hoc rules and
workarounds, but that would not cover certain edge cases.
With this commit, the recursive ordering is systematically computed, using a
topological sort on the directed acyclic graph whose vertices are auxiliary
equations and whose edges are dependency relationships.
Closes : #22
2019-12-03 14:26:13 +01:00
Houtan Bastani
4a1fb239da
Add interface for init2shocks
...
Dynare/dynare#1650
2019-12-02 13:58:44 +01:00
Houtan Bastani
de3de15249
add nograph option to plot_shock_decomposition
...
closes #30
2019-11-29 14:58:42 +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
Sébastien Villemot
d008113d69
Forbid exogenous and exogenous deterministic variables in STEADY_STATE operator
...
Closes: dynare#825
2019-11-27 17:27:04 +01:00
Sébastien Villemot
61ea8811de
Remove the undocumented and confusing “linear” option of stoch_simul
...
Closes : #33
2019-11-27 15:08:56 +01:00
Dóra Kocsis
dfb5a856c4
bugfix: forecast type option in shock_decomposition.
2019-11-26 18:29:12 +01:00
Sébastien Villemot
0573475891
Merge branch 'master' into 'master'
...
Master
See merge request Dynare/preprocessor!8
2019-11-26 17:08:03 +00:00
Dóra Kocsis
3e43b36cf3
Introduce forecast type option in shock_decomposition command. Dynare/dynare#1657
2019-11-26 17:49:12 +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
28bfc72a5c
Revert "Merge branch 'master' into 'master'"
...
This reverts commit a37fea0dfc
, reversing
changes made to 3ae92499b8
.
2019-11-26 16:44:17 +01:00
Houtan Bastani
e3a3979eba
remove unnecessary line included in 0ff7a9d
2019-11-26 16:37:01 +01:00
Houtan Bastani
0ff7a9d2ab
introduce command line options: `exclude_eqs` and `include_eqs`
...
Allows for the inclusion/exclusion of a set of equations, specified either on the command line or in a text file.
If the equation has a single endogenous variable on the LHS, then the equation is moved. If not, if the equation has an `endogenous` tag then that variable is removed along with this equation. If not, then an error is thrown.
As a command line argument, `exclude_eqs` can take the form (same syntax for `include_eqs`):
* `exclude_eqs=eq1 to remove all equations declared as `[name=eq1]`
* `exclude_eqs=[eq 1, eq 2]` to remove all equations declared as `[name=eq 1]` or `[name=eq 2]`
* `exclude_eqs=[tagname=X]` to remove all equations declared as `[tagname=X]`
* `exclude_eqs=[tagname=(X, Y)]` to remove all equations declared as `[tagname=X]` or `[tagname=Y]`
When declared in a file, the file should be of the form:
```
eq 1
eq 2
```
to remove all equations declared as `[name=eq 1]` or `[name=eq 2]`.
It should be of the form:
```
tagname=
X
Y
```
to remove all equations declared as `[tagname=X]` or `[tagname=Y]`.
2019-11-26 14:16:00 +01:00
Houtan Bastani
a61565bd01
macro processor: fix bug in cast of string to bool
...
The incorrect `equal` template was being used.
2019-11-26 11:11:34 +01:00
Houtan Bastani
4540bed06c
macro processor: missed if statement with initializer for C++17
2019-11-26 10:40:51 +01:00
Houtan Bastani
4e3bf09495
macro processor: fix typo that caused logical or not to work when one of the arguments is Real == 1 and other arguments are false
2019-11-26 10:39:16 +01:00
Houtan Bastani
8034513578
macro processor: fix bug: allow empty strings
...
previously, `@#define str=""` caused an error
2019-11-26 10:32:43 +01:00
Dóra Kocsis
926ccccb26
fix missing tokens in the lexer: conditional, unconditional.
2019-11-25 17:34:52 +01:00
Dóra Kocsis
8bfcefe7fb
Add interface for forecast_shock_decomposition. Dynare/dynare#1657
2019-11-25 17:08:59 +01:00
Houtan Bastani
3ec01b8612
modifications for compiling mex on macOS
...
* only support 64 bit mex
* check whether local compiler exists; if not use system compiler; if that doesn't exist stop processing
* move to minimum macOS 10.9, corresponding to the MATLAB mex min
2019-11-22 16:36:01 +01:00
Houtan Bastani
c6beb6c5c6
macro processor: ignore `@#line` directive
2019-11-22 14:14:05 +01:00
Sébastien Villemot
5a5817b4fe
Improvements to the test for balanced growth path
...
— Raise the default tolerance for cross-derivatives to 1e-6, to reduce the
number of false positives
— New option “balanced_growth_test_tol” to the “model” block for changing that
tolerance
— Turn back test failures into errors. Since there is now an option for
controlling the tolerance, the user always has the possibility of making the
test pass.
Closes: dynare#1389
2019-11-14 17:55:17 +01:00
Houtan Bastani
0f0299bc1c
fix to allow for diffs of unary ops to go through variable mapping
2019-11-07 16:15:49 -05:00
Houtan Bastani
0bb233d291
fix bug causing auxiliary variables for pac growth parameters not to contain their original symbol id
2019-11-07 14:17:49 -05:00
Dóra Kocsis
7a78593df4
introduce variableMapping, default equation name tags in M_ and JSON output
2019-10-30 16:30:51 +01:00
Houtan Bastani
fa9c9435ff
add xref for equation tags
2019-10-29 14:05:55 +01:00
Houtan Bastani
ef4710cdb1
macro processor: fix for loops
2019-10-29 11:21:09 +01:00
Houtan Bastani
8a789d060f
aesthetic fix: for conformity to the rest of the code, prefer `const auto` to `auto const`
2019-10-29 11:20:27 +01:00
Houtan Bastani
4866bb5902
macro processor: use C++17 structured bindings in for loops
2019-10-29 11:20:21 +01:00
Houtan Bastani
217dadabbd
Use `if` statements with initializers allowed by C++17
2019-10-29 11:20:13 +01:00
Houtan Bastani
361e99bee5
simplify code
2019-10-28 17:25:40 +01:00
Houtan Bastani
7b13ee1b3a
macro processor: remove unused variable
2019-10-24 17:52:32 +02: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
2a127b1f23
VAR/TCM models: use lag-equivalence relationship to compute maximum lags
...
This is made possible by the getLagEquivalenceClass() method introduced in the
previous commit.
Previously, the static version of the LHS expressions was used.
As a consequence, drop ModFile::diff_static_model, now useless.
2019-10-22 16:04:24 +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
Sébastien Villemot
c5d223a79b
Fix semantics of ExprNode::maxLag(), maxLead() and maxLagWithDiffsExpanded() with constants
...
Those methods can return a negative value in some cases. For example,
maxLead(x₋₁) = −1.
But constants were always returning a value of zero, which means that we had
inconsistent behaviour like maxLead(x₋₁ + 2) = 0.
This commits fixes the behaviour by making these methods return the smallest
possible integer when called on constants.
2019-10-22 11:35:11 +02:00
Sébastien Villemot
d38ac48cfa
Create set_auxiliary_series routine in use_dll, block/bytecode and julia modes
...
Closes #34
2019-10-17 15:03:26 +02:00
Houtan Bastani
7306132644
remove unused headers
2019-10-11 11:44:39 +02:00
Houtan Bastani
8211edc4e8
fix typo
2019-10-10 15:31:03 +02:00
Houtan Bastani
9e454debb5
support external functions in MATLAB namespace. closes dynare#1639
2019-10-09 14:49:05 +02:00
Houtan Bastani
4e1b1e4405
fix typo in parser
2019-10-08 15:36:30 +02:00
Houtan Bastani
f77413ebb8
remove unused argument to function
2019-10-08 11:22:29 +02:00
Houtan Bastani
fac9e4436c
fix bug in `fast` option: printing temporary terms hid changes in model when the temporary term changed as the temporary terms themselves were not printed. closes dynare#1661
...
Furthermore, modifications to model local variables were not taken into account.
To fix, take checksum of model local variables, temporary terms, and equations
Also, use existing functions to print these to a stringstream instead of repeating print functionality in this function
2019-10-07 18:55:20 +02:00
Houtan Bastani
6e92f79c13
simplify isChecksumMatching, move to filesystem::path
2019-10-07 17:43:45 +02:00
Houtan Bastani
6191c69d74
move to hash algorithm defined since C++11 for calculating checksums. dynare#1661
2019-10-07 17:43:16 +02:00
Houtan Bastani
979453815c
simplify initialization of `hasModelChanged` variable in writing of output
2019-10-07 11:32:02 +02:00
Stéphane Adjemian (Charybdis)
14b6cb6bee
Fixed logic for output language.
2019-10-07 09:28:49 +02:00
Houtan Bastani
7b4616e853
fix cross compilation due to bug in MinGW 8.3.0
...
implicit conversion from `filesystem::path` to `string` not supported even though it's in the standard
2019-10-04 14:41:48 +02:00
Houtan Bastani
1291320053
macro processor: handle empty files
2019-10-04 11:18:03 +02:00
Houtan Bastani
125adff59c
macro processor: insert path instead of string as the path has already been created
2019-10-04 11:10:21 +02:00
Houtan Bastani
2ce6e411b4
remove unused headers
2019-10-04 10:57:36 +02:00
Houtan Bastani
2f6f0d8cf6
use filesystem::path instead of string to hold include paths passed on the command line
2019-10-04 10:57:36 +02:00
Houtan Bastani
0b3cd3ec90
pac: fix parsing of linear combination for growth option
2019-10-03 18:26:09 +02:00
Houtan Bastani
031bc62f3a
macro processor: use filesystem after move to C++17, closes #31
...
ancillary to this change is the move of `paths` out of the Driver class into an argument to parsing/evaluation #32
2019-10-03 14:24:47 +02:00
Houtan Bastani
d7e70a4063
macro processor: fix bug: interpret @#include at node level instead of at the Driver level
2019-10-02 17:39:11 +02:00
Houtan Bastani
310f3936fe
macro processor: fix bug: interpret @#includepath at node level instead of at the Driver level
2019-10-02 17:39:05 +02:00
Houtan Bastani
db52e02158
capitalize MATLAB
2019-10-02 14:04:31 +02:00
Houtan Bastani
93077bbcdd
macro processor: fix bug in range when start point == end point
2019-10-02 10:22:46 +02:00
Houtan Bastani
5e54761201
clarify error message in bfcfbac66d
. #29
2019-09-30 14:27:58 +02:00
Houtan Bastani
bfcfbac66d
change error message when trying to write unused endogenous variable. #29
2019-09-30 14:21:37 +02:00
Houtan Bastani
12bf59ea28
remove unused line. #29
2019-09-30 14:21:37 +02:00
Houtan Bastani
e3c23df9b8
fix spacing and typos
2019-09-30 14:21:36 +02:00
Houtan Bastani
6d783ec9cd
add comment
2019-09-30 14:09:49 +02:00
Houtan Bastani
1fcd305015
allow for expressions as upper bound for irf_calibration and moment_calibration. Closes #12
2019-09-30 12:22:59 +02:00
Sébastien Villemot
f66e6a7f35
Fix check for unused endos in the presence of PAC model-consistent expectations
...
Since commit 64f55e4a5e
, in the presence of PAC
model-consistent expectations, some endogenous variables are added to the
symbol table at the beginning of ModFile::transformPass(), while their defining
equations are added at a later point.
But commit 7c3f981eac
has introduced a check that
verifies that all endogenous are used in equations. That check happens after
the above mentioned endogenous are created, but after their defining equations
are added. Hence it fails.
The fix consists in creating those endogenous after the check. Incidently, they
are no longer part of the saved original model, but this is a good thing.
2019-09-25 12:00:40 +02:00
Houtan Bastani
d3db73b7e4
remove unused symbols
2019-09-25 11:36:03 +02:00
Sébastien Villemot
b0ac4a4e51
Cosmetic change
2019-09-24 18:47:43 +02:00
Houtan Bastani
92ad5aad2c
Revert "add info about max endo/exo lag by variable. closes dynare#1596"
...
This reverts commit 7827d2e04d
.
2019-09-24 14:03:38 +02:00
Houtan Bastani
047b3b25bb
add print, noprint options to perfect_foresight_solver
2019-09-12 14:35:29 +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
bad0c3cf27
Fix preprocessor failure to rename +<model> directory if /tmp is not on the same filesystem
...
Bug introduced in 0c755460
, that manifested on the Gitlab runners.
2019-09-11 17:03:37 +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
9a5ad17349
suppress sign comparison warnings when compiling with g++-9
2019-09-11 16:25:10 +02:00
Houtan Bastani
6a937689d4
ignore warnings from boost headers when compiling with g++-9
2019-09-11 16:25:10 +02:00
Sébastien Villemot
0c755460b1
Use std::filesystem instead of boost::filesystem
...
Note that there is no equivalent of boost::filesystem::unique_path(), so I
implemented ModFile::unique_path() which does something similar.
2019-09-11 14:47:48 +02:00
Houtan Bastani
0c1373bc5e
stop processing when certain functions are used in a linear context on endogenous/exogenous variables. closes dynare#1537
2019-09-10 12:37:28 +02:00
Houtan Bastani
d1be4f4946
remove duplicates from stoch_simul symbol_list. closes dynare#1519
2019-09-10 11:13:33 +02:00
Houtan Bastani
7827d2e04d
add info about max endo/exo lag by variable. closes dynare#1596
2019-09-09 14:29:22 +02:00
Houtan Bastani
7c3f981eac
stop processing if not all endogenous variables are used in the model block. closes #25
2019-09-05 12:19:21 +02:00
Sébastien Villemot
fbf535e819
Fix typo
2019-08-27 14:20:00 +02:00
Houtan Bastani
0df8dd3bc2
include header needed to compile 3a21eda40e
with g++
...
#26
2019-08-26 18:17:41 +02:00
Houtan Bastani
3a21eda40e
macro processor: support @#echomacrovars with symbol_list
...
closes #26
2019-08-26 18:12:04 +02:00
Houtan Bastani
2b3519e3b0
macro processor: add for syntax for shortcut with filtering comprehension
...
closes #28
2019-08-26 16:08:31 +02:00
Houtan Bastani
def99f9dd3
macro processor: simplify parser code
2019-08-26 15:00:53 +02:00
Houtan Bastani
d4ad2cbb5e
macro processor: Expression class has to_string function as well, so no need for cast
2019-08-23 12:07:31 +02:00
Houtan Bastani
7f96d4a1c9
macro processor: remove unnecessary check in Function evaluation
...
Not necessary because of parser rules for function definition
2019-08-23 11:12:36 +02:00
Sébastien Villemot
8cdbdee315
Various cleanups around the “language” option
...
— allow “language=matlab” for symmetry (this is the default)
— remove the useless “cuda” and “python” values
— give a more meaningful error message when “output” is used in conjunction
with “language=matlab”
2019-08-22 17:43:34 +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
1491b2d225
Give better names to ostringstream variables storing derivs w.r.t. params.
2019-08-22 17:02:39 +02:00
Houtan Bastani
6ced2aaedb
macro processor: fix bug in array power: disallow reals that are not integers
2019-08-22 15:44:31 +02:00
Houtan Bastani
8da3dc5c6b
macro processor: add noexcept to functions
2019-08-21 18:25:08 +02:00
Houtan Bastani
48466f0e10
macro processor: remove double evaluations of ExpressionPtr
2019-08-21 18:07:40 +02:00
Houtan Bastani
92f18f58f5
macro processor: comment If class
2019-08-21 18:04:09 +02:00
Sébastien Villemot
4594fdd0fd
More comment improvements in relation to diff operator expansion/substitution
2019-08-20 18:22:02 +02:00
Houtan Bastani
cfc7a1467b
macro processor: fix error message
2019-08-20 15:21:41 +02:00
Houtan Bastani
6e523aaf28
macro processor: add immutable Range class, making Array immutable
2019-08-20 15:21:41 +02:00
Houtan Bastani
6c72980580
macro processor: replace uses of make_pair
2019-08-20 14:29:44 +02:00
Houtan Bastani
16080f2bb8
macro processor: make Variable class immutable
2019-08-20 11:16:33 +02:00
Houtan Bastani
b3ec807b90
macro processor: move changes from `cd99bb3af9c8ef6fd881fa0457121894f8edd14e` to the header file
2019-08-19 18:31:18 +02:00
Sébastien Villemot
9b9c5beb5c
Ensure that unary ops aux vars are never created when there is a lead
...
The transformation would be incorrect because of the expectation operator.
There was already a safety check, but it was not entirely correct. For example,
if “exp(y)” was appearing before “exp(y(+1))”, the check would not catch the
problem, because it happened after the substitution table had been filled. So
we now do the check before filling that table.
2019-08-19 18:27:57 +02:00
Sébastien Villemot
3941278832
Add more comments in routines for aux vars for unary ops / diff operators
...
By the way, do some small code simplifications.
2019-08-19 18:27:57 +02:00
Sébastien Villemot
8e9f6e4c57
Improve some function prototypes for better distinction between input and output arguments
2019-08-19 18:27:57 +02:00
Houtan Bastani
cd99bb3af9
macro processor: Make @#include and @#includepath immutable
2019-08-19 18:20:53 +02:00
Houtan Bastani
b77f6ecd94
macro processor: add `defined` operator
2019-08-19 15:14:51 +02:00
Houtan Bastani
8ebd2a1735
macro processor: support `@#elseif` directive
2019-08-19 15:14:43 +02:00
Sébastien Villemot
75b000a0b5
Macro processor: ensure that all read-accessors return a const reference
...
Useless copies are thus avoided in some situations.
2019-08-14 17:36:10 +02:00
Sébastien Villemot
8c1e48a09e
Add a few more calls to std::move()
2019-08-14 17:27:31 +02:00
Sébastien Villemot
c4f331c74c
Macro processor: make more node classes immutable
...
Since the node classes are stored and copied as std::shared_ptr, a given class
instance can actually be shared by two different expressions. Hence, in order
to prevent weird bugs, it’s necessary to make these classes immutable.
This commit deals with the easy cases.
The remaining (and more complex) ones are:
— Variable
— Array
— Include
— IncludePath
2019-08-14 17:14:42 +02:00
Sébastien Villemot
46a7cf5db7
Macro processor: fix the use of move semantics in constructor
...
In particular, remove the const keyword before arguments passed-by-value,
because otherwise they can't be moved (since they are immutable).
Also add a few missing calls to std::move(), and remove some calls to
std::move() when they are useless (on class enums, which are fundamental
types.)
2019-08-14 16:43:45 +02:00
Sébastien Villemot
37e7a6d1c1
Now that we require Bison ≥ 3.2, the stack.hh and position.hh files are no longer generated
2019-08-14 15:36:31 +02:00
Sébastien Villemot
b299983a8b
Fix the notmpterms option in the presence of external functions
2019-08-14 15:28:41 +02:00
Sébastien Villemot
ecad2dfb10
Avoid running bison and flex multiple times when doing parallel builds
2019-08-14 11:22:33 +02:00