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
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
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
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
7827d2e04d
add info about max endo/exo lag by variable. closes dynare#1596
2019-09-09 14:29:22 +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
Sébastien Villemot
4594fdd0fd
More comment improvements in relation to diff operator expansion/substitution
2019-08-20 18:22:02 +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
Sébastien Villemot
0988a1f755
Generated LaTeX files are now under <basename>/latex/
2019-07-11 17:33:53 +02:00
Sébastien Villemot
271a579808
Remove symmetric elements in 3rd derivatives
2019-06-17 15:28:33 +02:00
Sébastien Villemot
51beb9c2ef
New M_.has_external_function field
2019-05-15 15:02:36 +02:00
Sébastien Villemot
840b5f4f7f
Bugfix for M_.dynamic_tmp_nbr: first element was not including temp. terms for model local vars
2019-05-14 17:08:38 +02:00
Houtan Bastani
a0f74f5c16
pac growth: allow linear combination
2019-05-14 12:33:59 +02:00
Sébastien Villemot
40ef954802
Add new dynamic_g1_nz.m generated file, for perfect_foresight_stacked_solver DLL
2019-05-03 19:25:23 +02:00
Sébastien Villemot
82cd95a653
Remove some unnecessary headers
2019-05-02 15:30:33 +02:00
Houtan Bastani
bf89cedd88
fix compilation of static/dynamic files on macOS
2019-04-24 17:40:50 +02:00
Sébastien Villemot
1907249fac
Ask GCC to warn about C-style casts (-Wold-style-cast)
...
Adapt the code accordingly.
2019-04-23 12:54:11 +02:00
Sébastien Villemot
c628f21245
JSON: output derivatives at an arbitrary order
...
Backward incompatible change: the temporary terms for 3rd order are now stored
in "temporary_terms_third_derivative" (without the final "s"; same for external
functions), for consistency with the name of the slot for the derivatives
themselves ("third_derivative").
Ref dynare#217
2019-04-18 17:13:16 +02:00
Sébastien Villemot
43906691d3
JSON: simplification of method for writing temporary terms
2019-04-18 17:10:39 +02:00
Sébastien Villemot
b73d554ad2
Use Unicode copyright symbol (in UTF-8 encoding)
2019-04-16 11:35:31 +02:00
Sébastien Villemot
bbab112d65
Support for output of arbitrary derivation order (in MATLAB and DLL modes)
...
Does not work for Julia mode, neither with block and bytecode.
Note: in DLL mode, the number of temporary terms in no longer given in the
‘ntt’ symbol; it must be computed using ‘M_.dynamic_tmp_nbr’.
Ref dynare#217
2019-04-12 18:13:50 +02:00
Sébastien Villemot
8a41a75c85
Apply modernize-raw-string-literal from clang-tidy
...
Use ReplaceShorterLiterals option to enforce replacement of all strings.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-raw-string-literal.html
2019-04-03 16:45:52 +02:00
Sébastien Villemot
58adbdeddd
Compatibility fix with MATLAB ≤ R2011a
2019-03-26 15:41:48 +01:00
Sébastien Villemot
fd6e700ec7
Simplification: use std::max when computing maxima
2019-03-21 17:24:49 +01:00
Sébastien Villemot
78583135df
Use true/false instead of 1/0 for boolean options
...
This is more elegant, and makes it easier to distinguish them from integer
options.
2019-03-19 15:15:10 +01:00
Houtan Bastani
f1d1c1e1c1
trend_component_model: simplify AR
2019-03-15 12:27:32 +01:00
Houtan Bastani
a3c08f932e
simplify code to find autoregressive matrix for VARs
2019-03-15 12:26:59 +01:00
Houtan Bastani
69e7763490
pac: change vectors that store additive parts
2019-03-07 12:57:47 +01:00
Houtan Bastani
2201907245
pac: support additive elements whether optimizing agents are present or not
2019-03-07 12:36:08 +01:00
Houtan Bastani
9b1b4113d9
pac: keep order of variables in ec part of pac equation and add scaling factor to output
2019-03-07 11:31:45 +01:00
Houtan Bastani
b0dac547e9
shorten writing of istarget output
2019-03-07 11:31:45 +01:00
Houtan Bastani
9963686e72
handle additive terms when PAC equation does NOT have non/optimizing agents
2019-03-05 12:20:45 +01:00
Houtan Bastani
341b9c6667
pac_model: allow diff as argument to growth option
2019-02-28 19:22:34 +01:00
Houtan Bastani
5f013756f2
find additive parts to pac equation
2019-02-27 23:12:05 +01:00
Stéphane Adjemian (Charybdis)
2312ce13dc
Changed non_optimizing_behaviour.type field to non_optimizing_behaviour.isendo.
...
The elements are logicals true/false (true iff corresponding variable is an endogenous variable).
2019-02-27 15:35:19 +01:00
Houtan Bastani
ec21208ed7
pac: specify type of variables in non optimizing part of equation
2019-02-27 15:10:48 +01:00
Houtan Bastani
64f55e4a5e
pac: declare endogenous variables needed by pac model consistent expectation before the creation of auxiliary variables
2019-02-25 15:29:46 +01:00
Houtan Bastani
36b2ae5026
pac: model consistent expectation: add 1 to max lag from pac equation to obtain correct `m` for substitution
2019-02-25 10:48:53 +01:00
Stéphane Adjemian (Charybdis)
6a34603f91
Conform to spelling used in Matlab codes.
2019-02-22 12:31:58 +01:00
Houtan Bastani
d8c9bbc353
ensure that h1/h0_param_indices are created regardless of whether there are parameters or not
2019-02-22 11:52:07 +01:00
Sébastien Villemot
7d16fff786
Further simplifications
2019-02-21 12:16:22 +01:00
Sébastien Villemot
be023bdab9
Simplification: the [] operator already inserts the new element
...
See https://en.cppreference.com/w/cpp/container/map/operator_at
2019-02-21 12:15:50 +01:00
Houtan Bastani
f41e681122
use emplace instead of insert and emplace_back instead of push_back
2019-02-21 10:59:53 +01:00
Houtan Bastani
520c7fc9b2
use auto instead of specific initializer
2019-02-21 10:52:59 +01:00
Houtan Bastani
469a328cfc
replace make_pair and make_tuple
2019-02-21 10:42:10 +01:00
Houtan Bastani
b09b50472b
pac: fix writing to use modstruct instead of M_
2019-02-20 16:46:52 +01:00
Houtan Bastani
f88682d683
pac: output model type in M_.pac.(model_name)
2019-02-20 16:43:24 +01:00
Houtan Bastani
5e1521f42b
don’t save unnecessary pac model info
2019-02-20 16:38:44 +01:00
Houtan Bastani
240aba6709
move pac info out of pac expectation node
2019-02-20 15:35:13 +01:00
Houtan Bastani
34756833ae
pac: output info into substructures based on pac model name & equation tag
2019-02-19 18:32:42 +01:00
Houtan Bastani
fc6d04b015
create A0 and A0star matrices for trend component models
2019-02-19 12:26:30 +01:00
Houtan Bastani
0ea84fa9a4
pac: allow steady state growth and model consistent expectation substitution in pac equation
2019-02-18 15:11:45 +01:00
Houtan Bastani
f4837e6c94
fix AR and EC matrices when `equation = C` results in a simplified equation
2019-02-14 17:09:57 +01:00
Houtan Bastani
d922ae8ffc
pac_model: permit lag on growth option
2019-01-25 14:52:26 +01:00
Sébastien Villemot
e7c9c26d2d
More modernizations with clang-tidy
2019-01-15 11:08:47 +01:00
Sébastien Villemot
01385d1f80
Simplify implementation of nopreprocessoroutput option
...
Simply redirect cout to /dev/null, instead of propagating a boolean
everywhere.
2018-12-20 17:08:45 +01:00
Sébastien Villemot
38152c34a4
Make histval compatible with diff operator
...
The idea is to make use of the dynamic_set_auxiliary_dseries.m file to generate
the initial conditions for all auxiliary variables, including the diffs.
Also remove the check done by the preprocessor for the lags in histval, since
it does not work correctly with the diff operator.
2018-12-11 17:32:05 +01:00
Sébastien Villemot
66a766b0b7
Small modernization
2018-12-04 18:41:04 +01:00
Sébastien Villemot
571b5d0816
Computation of temporary terms generalized to any derivation order
2018-11-30 12:22:13 +01:00
Sébastien Villemot
67ac4bf8ea
Allow diff() and log() in "expression" option of var_expectation_model
2018-11-29 16:01:49 +01:00
Sébastien Villemot
e9341c7153
Implement option "expression" of var_expectation_model
...
The data structure written in the driver file is changed also in the case of
the "variable" option.
2018-11-28 17:33:59 +01:00
Sébastien Villemot
b88e0de53f
Remove useless accessor methods for data members that are const in ExprNode classes
...
Those const data members are simply made public.
2018-11-28 14:35:30 +01:00
Houtan Bastani
41af0841c3
extend nopreprocessoroutput option to substitution output
2018-11-28 11:53:50 +01:00
Sébastien Villemot
16a97a96fd
Rewrite engine for matching the non-optimizing agents part in PAC
...
The engine is now more robust and should reject any expression that does not
conform to the expected form. It is also able to deal with more cases, such as
terms appearing with a minus sign, or variables in the middle of a
three-factors product.
BTW, use a std::tuple for storing the result of the matching inside
PacExpectationNode, and change the order of components within the
structure (variable first, scalar last).
2018-11-27 19:03:35 +01:00
Sébastien Villemot
fa039b8c41
Fix bug in block decomposition with treatment of varexo_det
2018-11-23 17:39:18 +01:00
Sébastien Villemot
d733f3fb5a
Various simplifications and modernizations of the block/bytecode part
2018-11-23 17:19:59 +01:00
Sébastien Villemot
fc9cc2dc50
Output symmetric elements in derivatives of hessian w.r.t. parameters
...
The preprocessor now writes all the symmetric elements in the "hp"
matrix (derivatives of the hessian w.r.t. parameters), for consistency with all
other derivatives output.
Previously it was only writing one of the two symmetric elements, when indices
of endogenous were different.
2018-11-22 17:51:14 +01:00
Sébastien Villemot
e3a3992c1c
Derivation engine w.r.t. parameters generalized to any order
...
Also, no longer compute two times symmetric elements in derivation w.r.t.
parameters at order 2, for consistency with derivation w.r.t. endogenous.
It is therefore now necessary to duplicate them in the output to keep behavior
unchanged.
2018-11-22 17:13:55 +01:00
Sébastien Villemot
6fa115aedd
Derivation engine w.r.t. endogenous generalized to any order
2018-11-22 17:13:55 +01:00
Sébastien Villemot
33994dde03
Optimization for use_dll at 2nd and 3rd order
...
When creating the sparse matrix (in MATLAB or C mode), since storage is in
column-major order, output the first column, then the second, then the third.
This gives a significant performance boost in use_dll mode (at both compilation
and runtime), because it facilitates memory accesses and expression reusage.
2018-11-19 16:03:47 +01:00
Sébastien Villemot
b524e19cde
Remove duplicate storage of temp terms for params derivs in ModelTree
2018-11-16 18:26:36 +01:00
Sébastien Villemot
e9b5f239df
Properly deal with model local variables in params derivatives file
...
Closes #13
2018-11-16 18:26:11 +01:00
Sébastien Villemot
3d2125287a
Temporary terms: various simplifications and added comments
2018-11-16 17:11:06 +01:00
Sébastien Villemot
e89dd9cb8b
Make storage of derivatives ready for k-order
...
This is the first step towards computing k-order derivatives.
Ref Dynare/dynare#217, #10
2018-11-15 17:48:46 +01:00
Sébastien Villemot
4a974bb428
The preprocessor now compiles the MEX when use_dll is specified
...
New options "mexext" and "matlabroot" are introduced, so that the preprocessor
knows where to find MATLAB and which architecture to compile for.
Only recent gcc is now supported. A set of optimization flags is used so that
compilation goes reasonably fast on large models.
Consequently, options "msvc", "mingw" and "cygwin" have been removed.
2018-10-26 18:09:13 +02:00
Houtan Bastani
bef7c2a193
remove need to declare equations nonstationary
2018-10-24 16:04:51 +02:00
Sébastien Villemot
ac94ad906e
Various fixes for silencing errors and warnings under Clang 6
2018-10-11 11:21:58 +02:00
Sébastien Villemot
bcdfb43fd3
Replate DynamicModel::toStatic() by a converting constructor in StaticModel
...
It is therefore now possible to write:
static_model = static_cast<StaticModel>(dynamic_model);
2018-10-10 17:08:54 +02:00
Sébastien Villemot
63a5ffb761
Rename ExprNode::cloneDynamic into ExprNode::clone, for clarity
2018-10-10 13:08:11 +02:00
Sébastien Villemot
f2cf86b734
Add copy constructors / assignment operators for the DataTree class hierarchy
...
In particular, it is necessary to turn back DataTree::AddVariable() into a
non-virtual method, because it is called from DataTree's constructor. Enforcing
the absence of leads/lags is now done using a new boolean DataTree::is_static.
Take advantage of the new copy constructor for handling
PlannerObjectiveStatement more elegantly.
Unfortunately it is not possible to implement *move* constructor / assigment
operators, because the reference ExprNode::datatree is not mutable.
2018-10-10 12:53:55 +02:00
Sébastien Villemot
215283005e
No longer store symbol type in VariableNode
...
This facilitates switching variable types on the fly. In particular, this
allows removing the hack in DynamicModel::updateAfterVariableChange() that way
basically recreating all the nodes after the type change.
2018-10-10 12:34:05 +02:00
Sébastien Villemot
7bb5382428
Always use brace-initializer in constructors
...
The syntax makes clearer the distinction between a function call and an
initialization. Also, it prevents bugs due to implicit type conversions.
2018-10-04 17:19:18 +02:00
Sébastien Villemot
5e6b8f0a6b
No longer test for __MINGW32__ macro, testing for _WIN32 is enough
...
Closes : Dynare/dynare#1315
2018-10-02 16:50:07 +02:00
Sébastien Villemot
15d026e54e
C output: split generated function into several smaller subfunctions
...
This mimicks the structure of M-functions (though the logic for filling the
temporary terms vector is a bit different).
This change implied a modification in the way we compute the checksum in case
of block decomposition (the temporary terms for the C output are not correctly
computed in that case).
2018-10-01 16:04:01 +02:00
Ferhat Mihoubi
139e3efa82
Adds a new model option "linear_decomposition" that creates a block composed of the non-linear equations o the model
2018-09-28 14:54:52 +02:00
Houtan Bastani
63a334cfd3
fix typo
2018-09-27 10:47:13 +02:00
Sébastien Villemot
c6cb9aa1b8
Fix bug in option notmpterms with model local variables
...
Since model local variables are now treated as temporary terms, they must be
marked as such even when option notmpterms is present.
2018-09-25 15:57:56 +02:00
Houtan Bastani
7282b7bf32
fix bug in filling of var AR matrix
2018-09-25 15:47:52 +02:00
Houtan Bastani
c9f5cef99b
write AST in JSON
2018-09-18 17:48:04 +02:00
Houtan Bastani
9f9c8fdfbf
fix typo
2018-09-18 14:50:54 +02:00
Houtan Bastani
85dbb649b7
move trend_component_table and var_model_table to DynamicModel as they are only used there
2018-09-14 17:04:06 +02:00
Houtan Bastani
eb74d48393
trend_component_model: replace `trends` option with `targets`
2018-09-13 12:21:23 +02:00
Houtan Bastani
dc9ecbb49a
fix bug in columns of EC matrix
2018-09-12 17:56:30 +02:00
Houtan Bastani
0376f7f173
fix bugs in creation of AR/EC matrices
2018-09-12 11:57:14 +02:00
Houtan Bastani
aa120abd02
simplify code
2018-09-12 11:57:14 +02:00