- 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
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
— 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
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).
— FCFLAGS needs to contain the compilation flags used when compiling Octave,
otherwise it fails at configure stage when looking for gfortran
— Explicitly add -L$OCTLIBDIR, because with Octave 5 it is no longer there, and
on Fedora the Octave libraries are no in the default linker search path
It applies the approximated policy function to a set of particles, using
Dynare++ routines.
There is support for parallelization, using Dynare++ multithreading
model (itself based on C++11 threads; we don’t use OpenMP because it is
incompatible with MKL). For the time being, default to a single thread. This
should be later refined through empirical testing.
This MEX solves nonlinear systems of equations using a trust region algorithm.
The problem is subdivided in smaller problems by doing a block
triangularisation of the Jacobian at the guess value, using the
Dulmage-Mendelsohn algorithm.
The interface of the MEX is simply:
[x, info] = block_trust_region(f, guess_value);
Where f is either a function handle or a string designating a function.
f must take one argument (the evaluation point), and return either one or two
arguments (the residuals and, optionally, the Jacobian).
On success, info=0; on failure, info=1.
The changes in 8065e9d439 were not working as
intended, because AC_CHECK_PROG expect values and not actions. Hence
AC_MSG_ERROR was not properly executed.
By the way, simplify some test conditions using && instead of if/then/fi
blocks.
In particular, if either MATLAB or Octave is missing, one needs to pass either
--disable-matlab or --disable-octave.
Moreover, several new configure flags have been introduced for disabling some
components:
--disable-doc
--disable-dynare++
--disable-mex-dynare++
--disable-mex-ms-sbvar
--disable-mex-kalman-steady-state
The MEX files are built out-of-tree (because we want to do them in parallel).
This would create a potential race condition if several builds want to create
the symlinks under mex/matlab/ or mex/octave/.
The solution is to disable those symlinks for out-of-tree builds.
The scripts are based the former “dynare-build” project. They have been
overhauled and simplified.
Building a Windows package (both installer and zip archive) is as easy as
running “make -C windows” (provided the right Debian packages are installed,
use the “windows/install-packages.sh” script for that purpose).
The layout of MEX files for Octave in the package has been
changed (mex/octave/win32/ and mex/octave/win64/ instead of mex/octave32/ and
mex/octave/), for consistency with MATLAB MEX.
It constructs the stacked residuals and jacobian of the perfect foresight
problem.
It is an almost perfect replacement for the perfect_foresight_problem.m
routine, while being much more efficient.
Note however that the DLL never return complex numbers (it instead puts NaNs at
the place where there would have been complex). This may create problems for
some MOD files; the algorithms will need to be adapted to use a more
line-search method.