Commit Graph

153 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 c5f9ae89e7
Implement new “occbin” option to “model” block
For the time being, the preprocessor will refuse that this option be used with
any command other than estimation.

By the way, remove occbin_likelihood and occbin_smoother options to estimation.

Ref. dynare#569
2021-05-31 10:00:59 +02:00
Sébastien Villemot 97e9609c28
Streamline use_dll compilation under MATLAB
— drop Windows 32-bit support
— drop -fno-omit-frame-pointer compilation flag under GNU/Linux
— drop -static-libstdc++ flag under Windows
— no longer link to -lstdc++ under GNU/Linux and macOS
— gracefully fail when 'mexext' value is unknown
2021-05-24 18:21:23 +02:00
Sébastien Villemot 825b9ee8ef
Fix bugs introduced in d3e115194b
Ref. #65
2021-02-19 20:29:18 +01:00
Sébastien Villemot 89e2daf7c7
C++17 modernization: convert the remaining enums to enum classes 2021-02-01 12:05:06 +01:00
Sébastien Villemot 7468b4d8d7
Remove more stuff related to unfinished decomposition in linear and nonlinear blocks
Ref. #39, dynare!1626
2021-01-25 18:13:35 +01:00
Sébastien Villemot af9bd8f109
Remove the unfinished decomposition in linear and nonlinear blocks
Also remove the det_cond_forecast interface, that was related to it.

Ref. dynare!1626
Closes: #39
2021-01-25 18:03:37 +01:00
Sébastien Villemot ab656f2d84
macOS/use_dll: upgrade to gcc-10 compiler 2021-01-13 15:42:09 +01:00
Sébastien Villemot a0d12310cb
macOS/use_dll: drop -mmacosx-version-min=10.9 flag
The MEX files are not intended for distribution to other systems.
2021-01-13 15:42:09 +01:00
Sébastien Villemot c91178e3e3
macOS/use_dll: no longer pass -arch x86_64, in preparation for ARM support 2021-01-13 15:42:09 +01:00
Sébastien Villemot 98d01cbbb6
Provide a meaningful error message when 'use_dll' option is used without 'matlabroot' 2020-09-18 15:00:47 +02:00
Sébastien Villemot 7bca47385d
Fixes to include_eqs/exclude_eqs
— fix segfault due to bad handling of iterators while erasing elements of a set
— fix logic for excluding endogenous variable when it is present on the LHS
2020-07-23 11:06:57 +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 ad5e196d30
Block decomposition now compatible with 'use_dll' option 2020-06-23 15:13:04 +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 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 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 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 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 a6d9ba6e55
Rename EquationType::evaluate_s to evaluateRenormalized, for clarity 2020-05-20 11:49:32 +02:00
Sébastien Villemot 2944484442
Bytecode: rename output methods for better consistency 2020-05-19 17:45:33 +02: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 2e6bc7ecaa
Bytecode: fix handling of temporary terms
They were broken by 49036f166d
2020-05-13 12:53:47 +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 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 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 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 e48e761b94
Block decomposition: various minor cleanups 2020-04-23 14:41:18 +02: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 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