Sébastien Villemot
c3fc5b1dd7
Enable -Wunused-parameter
...
As a consequence, add many [[maybe_unused]] attributes for legitimate
cases (mainly in virtual functions).
2022-06-24 17:11:48 +02:00
Sébastien Villemot
a6b5d40d4b
Pac{Expectation,TargetNonstationary}Node::writeOutput(): error out for non-LaTeX, as for VarExpectationNode
2022-06-24 17:11:48 +02:00
Sébastien Villemot
297f86a90e
NumConstNode::write{Bytecode,Json}Output(): check for temporary terms, as is done for MATLAB output
2022-06-24 17:11:48 +02:00
Sébastien Villemot
3b99ac5df0
Remove unused parameters to various methods
2022-06-24 17:11:38 +02:00
Sébastien Villemot
7e01d01d80
VariableNode::writeBytecodeOutput(): check for temporary terms, as done for other types of output
2022-06-24 13:10:23 +02:00
Sébastien Villemot
9bd2973034
Refactor bytecode output around a new BytecodeWriter class and operator<< overloads
2022-06-24 13:10:04 +02:00
Sébastien Villemot
83693e4427
Bytecode: stop using unsigned integers where signed ones avoid unnecessary casts
2022-06-20 17:49:31 +02:00
Sébastien Villemot
5cd5676c8e
Bytecode: directly use several enums inside instruction classes
2022-06-20 15:19:08 +02:00
Sébastien Villemot
a85730313c
Split CodeInterpreter.hh into two headers
...
– a generic one: CommonEnums.hh
– and a bytecode-specific one: Bytecode.hh
By the way, rename global constant “near_zero” into “power_deriv_near_zero”,
for clarity.
2022-06-16 17:53:23 +02:00
Sébastien Villemot
49277dbbf2
StaticModel::getDerivID() now throws an exception when arg is not endo or parameter
...
Previously it would return -1, which is bad practice.
2022-06-08 14:54:09 +02:00
Sébastien Villemot
c94dfb848c
C++20 modernization: use initialization within range-based for loop
...
In particular, use this feature in many loops which feature a special treatment
for the first iteration, using a boolean variable (replacing iterator
manipulation). By the way, also use std::exchange() to simultaneously test the
value of this variable and update it.
2022-06-07 14:35:59 +02:00
Sébastien Villemot
9ace2dc413
C++17 modernization: take advantage of class template argument deduction
2022-06-07 14:35:26 +02:00
Sébastien Villemot
0b5c88109f
Various simplifications
2022-06-07 14:34:30 +02:00
Sébastien Villemot
cec47cc78c
Implement bytecode compilation of 2nd deriv of external functions
2022-05-20 12:35:38 +02:00
Sébastien Villemot
d1a3b227fd
Fix bug in bytecode compilation of 1st deriv of external functions
2022-05-20 12:35:23 +02:00
Sébastien Villemot
171cd65566
Fix bytecode compilation of external function nodes
2022-05-20 11:43:02 +02:00
Sébastien Villemot
701db61e09
JSON output: fix several bugs related to switch/case fallthrough
2022-05-18 16:33:42 +02:00
Sébastien Villemot
3e94250582
C++17 modernization: use std::optional in ExprNode::getPacOptimizingShareAndExprNodes()
2022-05-16 19:10:16 +02:00
Sébastien Villemot
0eb11d3323
C++17 modernization: use std::optional in expression matching functions
2022-05-16 19:10:16 +02:00
Sébastien Villemot
fa7a926143
C++17 modernization: use std::optional for the storage of orig_symb_id and orig_lead_lag in SymbolTable
...
For the diff and unaryOp auxvar types, these value may be set or unset
depending on the complexity of the expression represented by the auxvar.
2022-05-16 19:10:15 +02:00
Sébastien Villemot
0b51294994
C++17 modernization: use std::optional for trend variables in TCM
2022-05-16 19:10:15 +02:00
Sébastien Villemot
b42ee40b55
C++20 modernization: use contains() method on containers
2022-05-04 17:37:57 +02:00
Sébastien Villemot
ef02b79486
Various minor simplifications
2022-05-04 17:36:59 +02:00
Sébastien Villemot
621134b8d8
Julia: more adaptation of DynamicSetAuxiliarySeries.jl for TimeDataFrame objects
...
– also use vectorized versions for .+ and .-
– add a space before vectorized operators to avoid syntactical ambiguity
This commits complements bfdcc546ec
.
2022-04-08 15:06:29 +02:00
Sébastien Villemot
bfdcc546ec
Julia: adapt DynamicSetAuxiliarySeries.jl for TimeDataFrame objects
2022-04-01 17:34:37 +02:00
Sébastien Villemot
71edfd05e4
Add new “log” option to “var” statement
...
When an endogenous is declared with “var(log)”, say “y”:
– creates an auxiliary named “LOG_y”
– replaces “y(±l)” everywhere by “exp(LOG_y(±l))”
– adds a new auxiliary equation “y=exp(LOG_y)”
– adds a new definition “LOG_y=log(y)” in set_auxiliary_variables.m and
dynamic_set_auxiliary_series.m files
This option also works in conjunction with “deflator=…”, such as “var(log,
deflator=…)” (the “log” must appear befor “deflator”). There are no provisions
for combining “log” with “log_deflator”, because that would not make much sense
from an economic point of view (amounts to taking the log two times).
Ref. dynare#349
2022-03-30 17:46:07 +02:00
Sébastien Villemot
adab6c7f93
Comment improvement + cosmetics
2022-01-28 17:24:48 +01:00
Sébastien Villemot
01bea3f5e7
TCM: remove useless 3rd dimension of A0 and A0star (supposedly for lags)
2022-01-28 16:38:50 +01:00
Sébastien Villemot
1e77f7c5a7
SymbolTable::getOrigSymbIdForAuxVar() now also works on unaryOp and diffForward auxvars
...
This is a more natural semantics.
Incidentally, this fixes a bug in the variable mapping (M_.mapping) where some
endogenous, appearing in a log() in a VAR or TCM, would not be mentioned (e.g.
in the var-expectations/7/example1.mod test, and many others).
2022-01-28 16:30:11 +01:00
Sébastien Villemot
a93e264c2c
Harmonize “diffForward” auxvar with “diff” auxvar by giving it an orig_lead_lag as well
...
By the way:
– Fix and improve the explanation of the purpose of the orig_symb_id and
orig_lead_lag fields for auxvars
– Factorize the code that prints those fields in MATLAB and JSON output
2022-01-28 15:53:41 +01:00
Sébastien Villemot
289b4773d7
Fix matching of diff leads/lags in TCM and PAC models
...
The logic was flawed in several ways. In particular, the test files
pac/trend-component-{3,10,11}/example1.mod would return A0 and A0star matrices
where the (2,2) element was incorrectly zero.
2022-01-28 15:53:41 +01:00
Sébastien Villemot
2c84d500d9
Add GDB pretty-printer for ExprNode class hierarchy
2022-01-26 15:40:40 +01:00
Sébastien Villemot
96e2a8f971
Fix orig_lead_lag field for diff lag aux vars
2022-01-19 15:52:46 +01:00
Sébastien Villemot
a71100b971
Fix comment
2022-01-19 15:41:37 +01:00
Sébastien Villemot
0d7d5f1ae7
In case of nested unary ops (e.g. log(log())), ensure that the definition of the external aux var references the internal aux var
2022-01-19 15:40:52 +01:00
Sébastien Villemot
064a3dcd77
Fix orig_lead_lag field for unary op auxiliary variables
...
Ref. dynare#1843
2022-01-19 15:40:24 +01:00
Sébastien Villemot
ea6fb40db7
PAC: new “pac_target_info” block and “pac_target_nonstationary” operator
...
Ref. Madysson/estimation-codes#5
2021-12-16 15:40:47 +01:00
Sébastien Villemot
342c4faf8d
New var_remove statement
2021-12-15 12:20:29 +01:00
Sébastien Villemot
1f004584e9
New model_remove statement and model_replace block
...
Factorize the implementation with the existing code for the include_eqs and
exclude_eqs options (which has been refactored by the way).
Ref. #19
2021-12-15 12:11:25 +01:00
MichelJuillard
d047878333
Julia specific interface for normcdf and normpdf
2021-12-10 10:17:06 +01:00
Sébastien Villemot
c0ea8d7203
Add hyperbolic primitives (cosh, sinh, tanh, acosh, asinh, atanh)
...
Everything was already in place (since ages!), except that the parser interface
was missing.
Also fix the derivation formula for atanh, which was incorrect.
2021-12-07 18:03:33 +01:00
Sébastien Villemot
d15b2110a0
Add erfc() primitive
...
Closes : #85
2021-12-07 15:19:40 +01:00
Sébastien Villemot
81abea042b
Occbin: use element-by-element multiply, divide and power in occbin_difference.m
...
This file operates on vectors.
Ref. dynare#1826
2021-12-07 12:22:59 +01:00
Sébastien Villemot
5fe94ed606
Simplify constant equations also in equations marked [static]
...
The simplifyEquations() methods had to be moved to DynamicModel, in order to
access the static_only_equations member.
2021-12-06 17:17:37 +01:00
Sébastien Villemot
1cc512962c
No longer consider an equation of the form “x(+1) = 0” as defining x to be a constant
...
Fix this by restricting the detection of constant equations to those where the
variable appears without a lead or lag.
Closes : #83
2021-11-19 18:01:11 +01:00
Sébastien Villemot
6ad3d02ec6
Minor simplification in ExprNode::matchLinearCombinationOfVariables()
2021-10-29 15:39:40 +02:00
Sébastien Villemot
c4e9432eef
Remove implementation of various methods of PacExpectationNode
...
Those implementations are dummy and are normally never used. Rather error out
on those, factorizing them within SubModelNode.
2021-10-29 14:11:30 +02:00
Sébastien Villemot
3e242dd481
New class SubModelNode to factorize between VarExpectationNode and PacExpectationNode
2021-10-29 14:11:30 +02:00
Sébastien Villemot
6ae3d3131f
Occbin: handle external functions in “occbin_constraints”
2021-07-21 16:33:19 +02:00
Sébastien Villemot
0d6eb053d4
Ensure that “pac_expectation” operators are never inserted into a static model
...
The implementation of PacExpectationNode::toStatic() did not make sense. It
should normally never be called, hence we error out at this point.
Also do a cosmetic change in the PacExpectationNode::clone() methode.
2021-07-21 16:33:14 +02:00