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