Commit Graph

2840 Commits (748e3054cd6dc07feb7d1dd5e04bf780260dbfae)

Author SHA1 Message Date
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
Sébastien Villemot 4be0d7b8c7 Merge branch 'stoch_simul_order' into 'master'
Make preprocessor recognize default order=2 of stoch_simul

Closes #49

See merge request Dynare/preprocessor!24
2020-07-21 08:43:34 +00: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