Commit Graph

332 Commits (74ef3457b4805099ee9885b34173a0d0fd6aca61)

Author SHA1 Message Date
Sébastien Villemot 74ef3457b4
Use secure URL for link to GNU licenses 2021-06-09 17:21:00 +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
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 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
Michel Juillard fd979f625a
add maximum lead and lag to modfile.json 2021-04-01 17:05:13 +02:00
Sébastien Villemot 4798a5e2bc
Cosmetic change 2021-02-19 20:09:48 +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
Sébastien Villemot 2781e3e6f6
A few modernizations using clang-tidy 2021-02-10 16:48:46 +01:00
Sébastien Villemot 89e2daf7c7
C++17 modernization: convert the remaining enums to enum classes 2021-02-01 12:05:06 +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 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 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
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
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 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 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 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 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 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
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 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 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 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 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