Commit Graph

2768 Commits (5d564eed071b009ae382440435ede70be163ca39)

Author SHA1 Message Date
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 64ebb36290
macOS: use GCC 10 for building, since GCC 9 is no longer in Homebrew 2020-09-01 14:33:59 +02: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
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