Stéphane Adjemian (Ryûk)
f2bf98ee76
Return the value of info as a third argument (block_trust_region).
2022-03-25 19:42:40 +01:00
Sébastien Villemot
8c16d1745e
block_trust_region MEX: first part of handling complex values returned by solved function
...
If solved function returns complex values (with nonzero imaginary part), turn
them into NaNs. This mimics the behaviour of the use_dll case.
Next step will be to adapt the trust region algorithm to diminish radius when
there are NaNs.
Incidentally, bump the required GCC version to 9, since we use the %re and %im
components of complex values in Fortran.
2022-03-21 18:55:42 +01:00
Sébastien Villemot
d5472d2338
Tighten input sanity checks of various MEX files
...
Note that the unitary test in lyapunov_solver.m that checks sparse matrix input
had to be removed. Previously, this test was passing by chance (because the
sparse test matrices had actually no zero element, hence the internal double
float storage was the same as in the dense case). Now it consistently fails
with the additional checks in disclyap_fast MEX.
2022-03-18 22:49:46 +01:00
Sébastien Villemot
4f6d8a198a
k_order_perturbation MEX: convert complex elements of residuals or derivatives matrices to NaNs
2022-03-18 16:45:33 +01:00
Sébastien Villemot
2d73ae2971
Bytecode: fix typo
2022-03-16 15:00:09 +01:00
Sébastien Villemot
96fb676be7
Bytecode: fix stack_solve_algo=4 when a “solve backward/forward” block follows a “solve two boundaries” block
...
When solving a “Solve two boundarise” block with stack_solve_algo=4, the
“slowc” variable is modified. This would affect the resolution of further
“solve backward/forward” blocks, which would yield results.
The fix consists in saving and restoring “slowc”.
2022-03-15 17:42:03 +01:00
Sébastien Villemot
65e18fe883
Bytecode: fix stack_solve_algo=4 on linear blocks
...
Only one iteration is performed on linear blocks. But in the case of
stack_solve_algo=4 it is not enough, since it will not find the right optimal
path lenght at the first iteration (even though that optimal path length is
ufnitary).
2022-03-01 11:29:29 +01:00
Sébastien Villemot
dbbbb75874
Bytecode: fix typo, replace “substract” by “subtract”
2022-02-28 18:47:20 +01:00
Sébastien Villemot
67a003aa73
Bytecode: fix stack_solve_algo=1 (relaxation method)
...
There were various issues with the construction of sparse submatrices.
By the way, refactor and document the code to make it more readable.
2022-02-28 18:47:20 +01:00
Sébastien Villemot
811e53f9ad
Bytecode: document matrix computation routines
2022-02-28 18:47:20 +01:00
Sébastien Villemot
59b8ee9c33
Bytecode: remove unused matrix subtraction routine
2022-02-28 18:47:20 +01:00
Sébastien Villemot
a7cc466285
Bytecode: fix bug in sparse matrix multiplication routines
...
Since those routines compute Aᵀ·B, the number of rows of the output is equal to
the number of columns of A.
2022-02-28 12:18:58 +01:00
Sébastien Villemot
8536b63827
Bytecode: remove superfluous debug information
2022-02-18 14:17:37 +01:00
Sébastien Villemot
972461c326
Bytecode: add debugging information about input arguments
2022-02-17 17:41:10 +01:00
Sébastien Villemot
a376d8c9fe
Fix steady state computation with bytecode+block and solve_algo ⩽ 4 or ⩾ 9
...
– Temporary terms were not correctly passed between blocks
– solve_algo ⩾ 9 was incorrectly passed through bytecode own’s solver instead
of through dynare_solve
2022-02-17 17:28:37 +01:00
Sébastien Villemot
ceb3ec2487
Bytecode: remove unused constructors
2022-02-15 16:54:41 +01:00
Sébastien Villemot
863fa2de1c
Bytecode: perfect foresight simulation of *linear* “Solve forward simple/complete” blocks was giving was results
2022-02-15 16:54:41 +01:00
Sébastien Villemot
803e3721ec
Bytecode: correctly handle M_.{endo_names,exo_names,param_names}, which are now cell arrays
2022-02-14 15:06:07 +01:00
Sébastien Villemot
92e82cfa0a
Bytecode: remove unused function prototype
2022-02-14 14:40:34 +01:00
Sébastien Villemot
188df7711d
Bytecode: fix simulation of blocks “Solve forward/backward complete” with stack_solve_algo={0,1,4}
...
The problem would also manifest at steady state computation with solve_algo=6.
It could crash or give incorrect results.
2022-02-11 12:00:25 +01:00
Sébastien Villemot
d74cb031d2
Bytecode: fix error message about convergence failure that can happen in Solve Backward Complete as well
2022-02-10 17:27:07 +01:00
Sébastien Villemot
cdb4f872b2
Bytecode: fix crash with stack_solve_algo=1 on “Solve forward/backward” blocks
2022-02-10 17:15:24 +01:00
Sébastien Villemot
ef6e4c7745
Bytecode: remove unused code
2022-02-10 16:58:39 +01:00
Sébastien Villemot
0caefa1593
Bytecode: exit gracefully when M_ does not exist
2022-02-09 14:32:25 +01:00
Sébastien Villemot
8d3e0587dc
k_order_mean MEX: check number of output arguments
...
Incidentally, this fixes a gfortran warning
2022-02-04 14:38:30 +01:00
Sébastien Villemot
964763ef4d
pthread Fortran interface: fix internal type for representing pthread_t structure
2022-02-04 12:33:19 +01:00
Sébastien Villemot
39f47dc957
local_state_space_iteration_k MEX now uses the Fortran code (instead of the C++ code)
...
Closes : #1802
2022-02-04 11:49:46 +01:00
NormannR
5f828e241f
Parallelizes local_state_space_iteration_fortran
2022-01-31 18:44:48 +01:00
Sébastien Villemot
0c68e7336b
perfect_foresight_problem MEX: error out properly when called MATLAB function triggers an exception
...
Closes : #1832
2022-01-03 18:11:31 +01:00
Sébastien Villemot
5f675eee18
Add erfc() primitive
2021-12-07 17:00:59 +01:00
Normann Rion
cf829fb28e
A few fixes for k-order welfare assesment in `evaluate_planner_objective`
...
As suggested in !1962
2021-12-07 12:19:30 +01:00
Sébastien Villemot
10698ba896
Fix building of source package
...
Bug introduced in 06fd42c19b
.
2021-11-26 19:15:27 +01:00
Sébastien Villemot
06fd42c19b
Drop the dynare_simul_ MEX in favour of the new Fortran k_order_simul MEX
2021-11-26 17:37:53 +01:00
NormannR
f889a25e86
Amend the k_order_welfare routine for it to return the adequate output variables
2021-11-24 17:16:03 +01:00
NormannR
45aad05670
Implements a Fortran routine `k_order_moment` to compute the k-order unconditional moment of the vector of endogenous variables using simulation
2021-11-24 17:09:12 +01:00
NormannR
cb5971d60f
Fix typo in local_state_space_iteration_fortran
2021-11-24 14:32:37 +01:00
Sébastien Villemot
ebec02c6e4
local_state_space_iteration_2 MEX: yet more fixes to comments
...
In particular, use ε instead of u in mathematical expressions for consistency
with the C++ variable name.
2021-10-22 17:57:29 +02:00
Sébastien Villemot
0be7e0a0d7
local_state_space_iteration_2 MEX: more fixes to comments
2021-10-21 16:34:57 +02:00
Sébastien Villemot
05ea09eee9
local_state_space_iteration_2 MEX: error out properly when trying to use with BLAS+MATLAB+parallelization
...
By the way, rename the C preprocessor symbol so that it is undefined by
default.
2021-10-20 15:50:34 +02:00
Sébastien Villemot
e3b1f9e79a
local_state_space_iteration_2 MEX: various fixes to comments
2021-10-20 15:39:58 +02:00
Sébastien Villemot
ce282dc29c
local_state_space_iteration_2 MEX: fix bug when there are more shocks that states
...
The code that computes ghx·yhat+ghu·u (both with and without pruning) was
making the implicit assumption that q⩽n, i.e. that the number of shocks is less
than or equal to the number of states. If q>n, it would try to read invalid
memory references in ghx and yhat, and would thus either crash or return dummy
results.
Closes : #1820
2021-10-14 16:18:17 +02:00
Sébastien Villemot
e722e908e5
k_order_simul+local_state_space_iteration_fortran MEX: fix gfortran warnings
2021-09-24 16:44:40 +02:00
Normann Rion
6475c52b3d
Implements k-order simulation routine in Fortran (Ref: #1802 )
...
`k_order_simul` may replace `dynare_simul_` in the long run
2021-09-24 09:11:15 +02:00
Normann Rion
a576bdd03f
Fixing the header doc and automake files for the local state space iteration Fortran MEX
2021-09-24 09:11:06 +02:00
Sébastien Villemot
7083f1d692
Merge branch 'local_state_space_it' into 'master'
...
Implements the Fortran replacement of local_state_space_iteration_k (Ref #1802 )
See merge request Dynare/dynare!1918
2021-09-22 15:54:17 +00:00
NormannR
cab65dabb5
Implements `local_state_space_iteration_fortran`, the Fortran replacement of `local_state_space_iteration_k` (Ref #1802 )
...
- Creates the library `libkordersim` with all the relevant Fortran routines to `folded_to_unfolded_dr` and `local_state_space_iteration_fortran`
- Implements `folded_to_unfolded_dr`, which converts folded decision rule matrices to their unfolded counterparts
2021-09-22 16:28:46 +02:00
Sébastien Villemot
271d80abee
Bytecode: release the lock on dynamic.bin when an exception occurs
...
Closes : #1815
2021-09-20 17:28:43 +02:00
Sébastien Villemot
67c205e0a4
Fortran 2008: add interface for mxCreateStructMatrix
...
Needed by Normann.
2021-09-14 17:05:07 +02:00
Stéphane Adjemian (Ryûk)
e72dde69d3
Add option for trust region algorithm (mex).
...
trust_region_initial_step_bound_factor is determinining thye initial
step bound. Default value is 100 (previous hard coded value was 1).
2021-07-23 19:44:16 +02:00
Johannes Pfeifer
66dcef2754
k_order_welfare.cc: remove gratuitous screen output
2021-07-22 15:12:59 +02:00