Commit Graph

55 Commits (74ef3457b4805099ee9885b34173a0d0fd6aca61)

Author SHA1 Message Date
Sébastien Villemot 74ef3457b4
Use secure URL for link to GNU licenses 2021-06-09 17:21:00 +02:00
Sébastien Villemot 12b61e4817
Bugfix in DataTree::writeToFileIfModified()
If the old file and the new contents shared a common prefix, then the output in
the generated file would be truncated at the start.

Ref. DynareJulia/Dynare.jl#1
2021-04-26 14:10:47 +02:00
MichelJuillard 9773bafc5b Julia: write definition of get_power_deriv inside generated static/dynamic files 2021-04-26 10:52:18 +00:00
Sébastien Villemot 4cfc7a563b
Julia: do not overwrite Static/Dynamic files if contents has not changed
Ref. DynareJulia/Dynare.jl#1
2021-04-22 18:03:47 +02:00
Sébastien Villemot 7b3df21f11
DataTree::operator=(): fix crash when symbol ID ordering of model local variables does not correspond to the recursive ordering in the model block
Ref. dynare#1782
2021-04-16 17:34:13 +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 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 ad5e196d30
Block decomposition now compatible with 'use_dll' option 2020-06-23 15:13:04 +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 e88c05e3b8
Change prototype of DataTree::AddEqual()
This permits some simplifications.
2020-04-02 19:19:57 +02:00
Sébastien Villemot e2d5a83592
Global reindentation 2019-12-20 16:59:30 +01:00
Sébastien Villemot 031c0cff5f
Various code simplifications and modernizations 2019-12-16 19:42:59 +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
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 0c1373bc5e
stop processing when certain functions are used in a linear context on endogenous/exogenous variables. closes dynare#1537 2019-09-10 12:37:28 +02:00
Sébastien Villemot 4594fdd0fd
More comment improvements in relation to diff operator expansion/substitution 2019-08-20 18:22:02 +02:00
Houtan Bastani ae0a91256a
add cubic root to dynare language 2019-07-15 12:18:26 -04:00
Houtan Bastani 21fe0f4bdc
avoid cast warnings when compiling boost headers 2019-04-23 14:57:03 +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 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
Houtan Bastani 7c9f272e15
always substitute diffs of expressions that contain leads. closes #21 2019-03-05 12:43:54 +01:00
Sébastien Villemot c5fc2e38c1
Simplify log(1/x) into -log(x) (and similarly for log10) 2019-01-28 15:15:58 +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
Sébastien Villemot f223af91af
Improve the fix in 366701c094
Now both x+(-y) and (-x)+y are simplified using a minus operator.

Also simplify some code using std::swap().
2018-11-05 12:31:12 +01:00
Sébastien Villemot 366701c094
Apply x+(-y) ⇒ x-y simplification even when x and y are permuted
Incidentally, this fixes an issue in DataTree::operator=(), where this would
cause to the copy to have a different number of nodes than the original.
2018-11-05 11:28:00 +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
Sébastien Villemot 1089a223c4 Clean up default constructors/destructors 2018-10-11 17:08:44 +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 24f1276b42 Make all DataTree::*_map private
Introducing a new DataTree::getVariable() const method was necessary in the process.
2018-10-10 13:03:52 +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 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
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
Sébastien Villemot 004d909621 Use smart pointers for storage of ExprNode in DataTree class
- BTW, store them in a std::vector rather than std::list

- incidentally, fix issue in VariableNode::removeTrendLeadLag where expression
  sharing was possibly violated when creating a new VariableNode
2018-09-05 18:28:32 +02:00
Houtan Bastani 539fddc9f6 introduce var model table 2018-08-22 12:15:02 +02:00
Houtan Bastani afe0e475b1 trend_component_model statement 2018-08-17 16:52:48 +02:00
Sébastien Villemot f3c2a1bf87 New var_expectation_model statement and re-design of var_expectation operator
Given a previously declared var_model, the var_expectation_model statement is
used to declare a way of forming expectations with this VAR (possibly using a
finite or infinite discounted sum). The var_expectation operator now takes a
single argument, the name of the var_expectation_model.

For the moment, this only works when the var_model is using equations
explicitly declared in the model block.
2018-08-02 08:39:09 +02:00
Sébastien Villemot 4ad0e500d4 C++11: convert {Unary,Binary,Trinary}Opcode to class enums 2018-07-18 16:18:26 +02:00
Sébastien Villemot d6055c1407 C++11: convert SymbolType to a class enum 2018-07-17 18:55:26 +02:00
Sébastien Villemot b8a5dfdc39 Replace several usages of C macroprocessor with C++ constructs 2018-07-17 16:36:58 +02:00
Sébastien Villemot b91ed6f78c Move the location of static and dynamic files on the filesystem
- M and MEX files are now under +${MODELNAME}/
- bytecode and C source now under ${MODELNAME}/model/
2018-06-27 15:30:25 +02:00
Sébastien Villemot 7e16307382 Simplify DataTree maps using std::tuple 2018-06-04 17:35:02 +02:00
Sébastien Villemot 608c43450c Replace most calls to make_pair by braced-initializer lists or emplace()/emplace_back() 2018-06-04 16:36:46 +02:00
Sébastien Villemot 1e56c73377 Port to C++11 nullptr keyword
Performed using modernize-use-nullptr from clang-tidy.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
2018-06-04 15:03:31 +02:00
Sébastien Villemot e73ebc7033 Port to C++11 noexcept keyword
Performed using modernize-use-noexcept from clang-tidy.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-noexcept.html
2018-06-04 15:03:31 +02:00
Sébastien Villemot c0ed97d247 Port to C++11 auto keyword
Performed using modernize-use-auto from clang-tidy.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-auto.html
2018-06-04 15:03:26 +02:00