Commit Graph

209 Commits (0bb233d291ea1ade8ac2ebfea2e70b9a58d1bb44)

Author SHA1 Message Date
Houtan Bastani 0bb233d291
fix bug causing auxiliary variables for pac growth parameters not to contain their original symbol id 2019-11-07 14:17:49 -05:00
Dóra Kocsis 7a78593df4 introduce variableMapping, default equation name tags in M_ and JSON output 2019-10-30 16:30:51 +01:00
Houtan Bastani 217dadabbd
Use `if` statements with initializers allowed by C++17 2019-10-29 11:20:13 +01:00
Sébastien Villemot ecdca502aa
Modernization: stop using make_pair() and make_tuple()
In many cases, they can be replaced by the curly braces syntax.

Otherwise, we can now use the pair() and tuple() constructors, without the need
to specify template parameters, thanks to class template argument
deduction (new in C++17).
2019-10-24 10:49:13 +02:00
Sébastien Villemot 2a127b1f23
VAR/TCM models: use lag-equivalence relationship to compute maximum lags
This is made possible by the getLagEquivalenceClass() method introduced in the
previous commit.

Previously, the static version of the LHS expressions was used.

As a consequence, drop ModFile::diff_static_model, now useless.
2019-10-22 16:04:24 +02:00
Sébastien Villemot 8a83e08e79
Fix bug with diff or unary ops that have same static representation
Previously, for testing whether two diff() expressions or two unary ops were
the lead/lag of each other, the preprocessor would test whether they have the
same static representation. This is ok for simple expressions (e.g.
diff(x(-1))), but not for more complex ones (e.g. diff(x-y) and diff(x(-1)-y)
should not be given the same auxiliary variable).

This commit fixes this by properly constructing the equivalence relationship
and choosing a representative within each equivalence class. See the comments
above lag_equivalence_table_t in ExprNode.hh for more details.

Closes #27
2019-10-22 15:01:06 +02:00
Sébastien Villemot d38ac48cfa
Create set_auxiliary_series routine in use_dll, block/bytecode and julia modes
Closes #34
2019-10-17 15:03:26 +02:00
Houtan Bastani fac9e4436c
fix bug in `fast` option: printing temporary terms hid changes in model when the temporary term changed as the temporary terms themselves were not printed. closes dynare#1661
Furthermore, modifications to model local variables were not taken into account.

To fix, take checksum of model local variables, temporary terms, and equations

Also, use existing functions to print these to a stringstream instead of repeating print functionality in this function
2019-10-07 18:55:20 +02:00
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