Commit Graph

917 Commits (a6e899786c4e6d80c3d3ac521b8e2d072adf5c2a)

Author SHA1 Message Date
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 ae5be8d717
Build system: add provisions for k_order_mean MEX under Octave 2021-12-16 10:42:37 +01:00
Sébastien Villemot 1144de4167
Bump version number 2021-12-08 14:23:26 +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 e155c5cbb2
macOS: fix compilation of MEX files against Homebrew’s octave
It is necessary to link MEX files against Octave libraries, as under Windows.
2021-10-25 18:02:46 +02: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 f1a0bdb8e5
Build system: fix several warnings with Autoconf 2.70 2021-09-28 18:21: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 91e3348806
Windows package: fix bug introduced in c5120e1278 2021-09-21 18:40:54 +02:00
Sébastien Villemot c5120e1278
Build system: no longer link MEX for Octave against liboctave and other libraries
Since Octave 5, mkoctfile no longer links MEX files against shared
libraries (other than libc/libstdc++/libgfortran), so we now mimick that
behaviour.
2021-09-21 15:19:49 +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
Sébastien Villemot 3d6f86c234
Build system: fix detection of SLICOT for MATLAB on RHEL
The MATLAB_CFLAGS variable was not injected when testing for the presence of
libslicot64_pic. In particular, on GNU/Linux system, this means that the -fPIC
flag was not injected when doing the test. This was not a problem on Debian,
where GCC now enables -fPIC by default. But this would fail on RHEL, where
-fPIC is not enabled by default.

By the way:
— rename ac_save_* variables to my_save_*, to avoid conflicts with internal
  autoconf variables;
— do not inject “$(mkoctfile -p LFLAGS)” into LDFLAGS when testing for SLICOT
  under Octave; this is no longer necessary, since those flags are already
  injected at the beginning of mex/build/octave/configure.ac.
2021-09-02 17:14:01 +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
Sébastien Villemot 5d5fefca25
Bump version numbers 2021-07-23 15:57:19 +02:00
Johannes Pfeifer 66dcef2754 k_order_welfare.cc: remove gratuitous screen output 2021-07-22 15:12:59 +02:00
Normann Rion 3d27672c58
kth-order approximation of conditional welfare
Partially addresses issue #1680:
- unconditional welfare resorts to dynare++ simulation tools, which shall be updated very soon
TO DO:
- implement a function computing kth-order approximation of simulated moments of y
2021-06-15 15:04:31 +02:00
Sébastien Villemot a7203095db
A_times_B_kronecker_C MEX: don’t bother adding “only” clauses to “use” directive 2021-06-14 15:28:34 +02:00
Sébastien Villemot 766fff88f6
Use secure URL for link to GNU licenses 2021-06-09 17:35:05 +02:00
Sébastien Villemot a40a9b079c
sparse_hessian_times_B_kronecker_C MEX: bugfix relating to number of rows of B and C
In practice however, it seems that this bug never hits, because B and C always
have the same number of rows when the MEX is called.
2021-06-08 17:58:40 +02:00
Sébastien Villemot 3bd3c78e0e
A_times_B_kronecker_C MEX: rewrite in Fortran 2021-06-04 12:58:39 +02:00
Sébastien Villemot c4ca0ef0b2
Fortran MEX: remove useless return statements after calls to mexErrMsgTxt() 2021-06-04 12:58:39 +02:00
Sébastien Villemot f90a8ab070
Fortran MEX: mark array pointers returned by MEX functions as contiguous
This can make a difference when the return value of those function is directly
passed to a BLAS/LAPACK function.

On the other hand, if the return value is first stored in a pointer variable,
then it seems necessary to explicitly say that this pointer is also contiguous.
2021-06-04 12:58:39 +02:00
Sébastien Villemot dc2695a11f
mjdgges and block_trust_region MEX: optimise by marking some function arguments as contiguous
This avoids unnecessary array copies before calling BLAS/LAPACK functions.
2021-06-04 12:58:36 +02:00
Sébastien Villemot 3a2335975a
Fortran MEX: add missing “implicit none” in blas and lapack modules 2021-06-04 12:57:47 +02:00
Sébastien Villemot 2a1183e1fa
Fortran MEX: add -Wimplicit-interface to compiler flags
This warns about hard-to-detect bugs where a function is called with an
implicit interface, thus possibly having mismatches in the calling sequence.
2021-06-04 12:57:39 +02:00
Sébastien Villemot 45181cfd97
Fortran MEX: add interface for dgemm 2021-06-04 12:57:32 +02:00
Sébastien Villemot 0741963ca5
Build system: streamline handling of compilation flags for MEX
— allow the user to override compilation flags for MATLAB MEX (it was already
  working for the preprocessor, the MEX for Octave and Dynare++)
— increase the symmetry of MEX build infrastructure between MATLAB and Octave
— when linking MEX for Octave, do not add the output of “mkoctfile -p FLIBS”.
  It is unneeded, and it can create a conflict between the system compiler and
  a user-supplied compiler

By the way:
— restore optimization on macOS for C/C++ MEX (it had been removed in
  5df2392a09)
— remove -fno-omit-frame-pointer on MATLAB/Linux, since it would be cancelled
  by subsequent -O2 and should not be needed anyways
— remove FFLAGS under Octave, unused
2021-05-10 14:39:41 +02:00
Sébastien Villemot 47477e152a
Bump minimal Octave version to 6.2.0 2021-03-12 16:21:57 +01:00
Sébastien Villemot c0ccca26cb
macOS package: drop support for Octave
The current Octave support is utterly broken (both in stable and unstable), it
crashes Octave. It relies on an unofficial Octave app for
macOS (https://octave-app.org), which is infrequently updated.

This commits drop support for Octave in the macOS package. We will now tell our
macOS+octave users to use the Homebrew Dynare package (which is maintained by
the Homebrew team, and is in reasonably good shape).
2021-03-12 16:21:57 +01:00
Sébastien Villemot c9eb6920c9
local_state_space_iteration_k MEX: fix bug in output
In its output, the MEX was returning values for all endogenous variables, but
it was used in a context where only the variables from oo_.dr.restrict_var_list
were expected (as is done with local_state_space_iteration_2 MEX).

This commit fixes this discrepancy, and also fixes the test that was checking
that both MEX are returning the same output.

Closes: #1768
2021-03-10 13:45:29 +01:00
Sébastien Villemot 1a0ee5f055
Bytecode / sparse transpose: bug fix
The Jc vector has n+1 elements, where n is the number of columns. Moreover, the
size passed to memset() was wrong.
2021-02-09 16:05:11 +01:00
Sébastien Villemot c9f6d3a626
Bytecode: more simplifications and modernizations 2021-02-09 16:00:53 +01:00
Sébastien Villemot 4a1dbc5ca4
Bytecode: fix bug introduced in previous commit
map::at() does bound checking, and throws an exception if out-of-range,
contrary to [] operator which returns a new element.
2021-02-03 19:52:25 +01:00
Sébastien Villemot 4893f0e82c
Bytecode: various simplifications and modernizations 2021-02-03 18:10:31 +01:00
Sébastien Villemot 30cfb0b03c
Bytecode: bugfix in conditional forecast 2021-02-01 17:54:36 +01:00