Commit Graph

153 Commits (74ef3457b4805099ee9885b34173a0d0fd6aca61)

Author SHA1 Message Date
Stéphane Adjemia (Scylla) 8b81474a2e
On macOS use gcc-7 from homebrew instead of gcc-clang.
To install this version of gcc:

~$ brew install gcc@7

Does not seem to work with gcc-8 (missing headers…).
2018-12-20 14:38:37 +01:00
Sébastien Villemot a08ce3de2b
Yet more simplifactions using std::tuple 2018-12-03 16:07:13 +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 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 d733f3fb5a
Various simplifications and modernizations of the block/bytecode part 2018-11-23 17:19:59 +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 b7d50560f8
Move ModelTree constructor up in the file for clarity 2018-11-22 17:13:55 +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
Sébastien Villemot 52ce0d8ba9 Fix bug with discretionary_policy
Since, in this case, there are less equations than endogenous, the
variable_reordered structure was not filled with enough element, leading to an
invalid memory read when printing M_.state_var.

Ref #637
2018-10-10 17:08:01 +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 c47b6e6e4c Fix bug with notmpterms option
Commit c6cb9aa1b8 was not the right fix.
2018-10-05 17:14:27 +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 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
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 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 e19a14869e Convert ExprNodeOutputType into a class enum
Incidentally, replace the IS_* macros by inline functions.
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 edddc9d8ca C++11: convert NodeTreeReference to a class enum 2018-07-18 16:35:19 +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 988a9f6e2d std::open and std::fstream constructor accept a std::string for filename in C++11 2018-06-27 15:30:45 +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 130004ef47 Simplify types for storing derivatives using std::tuple 2018-06-05 15:34:34 +02:00
Sébastien Villemot 52d8bd0b17 Stop using namespace boost globally in ModelTree
Otherwise boost::tuple overrides std::tuple.
2018-06-05 15:33:46 +02:00
Houtan Bastani 4d92baaf29 Clean up writing of equation tags in latex file 2018-06-05 14:47:36 +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 7d9cd718fc Replace more typedefs by using
Those were not automatically replaced by clang-tidy, I don’t know why…
2018-06-04 15:03:31 +02:00
Sébastien Villemot 182c53273e Remove useless spaces in type qualifiers
In C++11, it is no longer necessary to put a space between two consecutive ">".
2018-06-04 15:03:31 +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 33b1359905 Port to C++11 emplace_back() method on containers
Performed using modernize-use-emplace from clang-tidy.

Manual intervention was needed to transform a NULL into nullptr in SymbolTable.cc.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-emplace.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
Sébastien Villemot 6cf4e6dc0c Port to C++11 range-based for loops
Performed using modernize-loop-convert from clang-tidy.

Manual intervention was needed in MacroValue.cc because of a variable name
capture issue.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-loop-convert.html
2018-06-04 12:26:16 +02:00
Sébastien Villemot 08eedcb448 Add const qualifier for tef_terms in writeOutput method and siblings
Consequently, change various function calls where tef_terms was empty, passing
an (empty) rvalue instead of an lvalue.
2018-05-29 14:22:01 +02:00
Sébastien Villemot 33b280b3d5 Remove some ExprNode::writeOutput variants
More precisely, remove those variants where temporary_terms can be specified
without temporary_terms_idxs, in order to make clear that the latter is
expected. For situations where the tt_idxs are not needed (C, block MATLAB), an
empty map has to be explicitly given.
2018-05-29 11:13:55 +02:00
Sébastien Villemot 3f874cfced Remove obsolete function 2018-05-28 16:39:28 +02:00
Sébastien Villemot ea3573180a Fix ordering of model local variables 2018-05-28 15:50:29 +02:00
Sébastien Villemot dd6799187c Fix derivs w.r.t. parameters with temporary terms array 2018-05-28 15:23:15 +02:00
Sébastien Villemot 8657d4dc98 Fix block decomposition with temporary terms array 2018-05-28 11:58:11 +02:00
Sébastien Villemot 968e411c31 Make indexing in temporary terms array ready for a (hypothetical future) implementation in C 2018-05-25 15:19:50 +02:00
Sébastien Villemot bb4b5993b0 Simplify code for model local variables 2018-05-24 19:35:35 +02:00
Sébastien Villemot 164a6f303b Fix bug in temporary terms array in the presence of model local variables
In the presence of MLVs, the temporary terms indexing was corrupted. The code
was using the implicit assumption that the ExprNodeLess ordering was giving the
same ordering as the temporary terms indexes ordering. But MLVs can be higher
in ExprNodeLess ordering than some other temporary terms, while they have the
lowest temporary terms index, hence the bug.

Fix this by no longer relying on the ExprNodeLess ordering, and rather use a
full map<ExprNode *, int> for ModelTree::temporary_terms_idxs. By the way,
simplify the code by removing a few useless data structures (e.g.
ModelTree::temporary_terms_idxs_*).
2018-05-24 19:35:21 +02:00
Houtan Bastani ec215e2a44 separate temporary terms: WIP 2018-03-28 16:41:48 +02:00
Houtan Bastani b504f160ca move files to src directory 2018-02-15 11:48:04 +01:00