Merge remote-tracking branch 'community/master' into enterprise
commit
43ed7b2b69
|
@ -40,6 +40,7 @@ checksum
|
||||||
|
|
||||||
# Make Check Rules
|
# Make Check Rules
|
||||||
*.trs
|
*.trs
|
||||||
|
*.tls
|
||||||
|
|
||||||
# Doc rules
|
# Doc rules
|
||||||
*.pdf
|
*.pdf
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
variables:
|
variables:
|
||||||
GIT_SUBMODULE_STRATEGY: recursive
|
GIT_SUBMODULE_STRATEGY: recursive
|
||||||
TERM: linux
|
TERM: linux
|
||||||
|
MATLAB_VERSION: R2020a
|
||||||
|
OLD_MATLAB_VERSION: R2009b
|
||||||
|
|
||||||
# The next stanza creates the version number used for the source tarball and the
|
# The next stanza creates the version number used for the source tarball and the
|
||||||
# binary packages. Here are the following possible cases:
|
# binary packages. Here are the following possible cases:
|
||||||
|
@ -10,15 +12,11 @@ variables:
|
||||||
# + if on master: use enterprise-unstable-$TIMESTAMP-$COMMIT
|
# + if on master: use enterprise-unstable-$TIMESTAMP-$COMMIT
|
||||||
# + on another branch: use $BRANCH-$TIMESTAMP-$COMMIT
|
# + on another branch: use $BRANCH-$TIMESTAMP-$COMMIT
|
||||||
# - if in a personal repository: use $USER-$TIMESTAMP-$COMMIT
|
# - if in a personal repository: use $USER-$TIMESTAMP-$COMMIT
|
||||||
#
|
|
||||||
# Also sets the path and version of the default MATLAB installation.
|
|
||||||
before_script:
|
before_script:
|
||||||
- '[[ -z $VERSION ]] && [[ $CI_PROJECT_NAMESPACE == Enterprise ]] && [[ -n $CI_COMMIT_TAG ]] && export VERSION=$CI_COMMIT_TAG'
|
- '[[ -z $VERSION ]] && [[ $CI_PROJECT_NAMESPACE == Enterprise ]] && [[ -n $CI_COMMIT_TAG ]] && export VERSION=$CI_COMMIT_TAG'
|
||||||
- '[[ -z $VERSION ]] && [[ $CI_PROJECT_NAMESPACE == Enterprise ]] && [[ $CI_COMMIT_REF_NAME == enterprise ]] && export VERSION=enterprise-unstable-$(date +%F-%H%M)-$CI_COMMIT_SHORT_SHA'
|
- '[[ -z $VERSION ]] && [[ $CI_PROJECT_NAMESPACE == Enterprise ]] && [[ $CI_COMMIT_REF_NAME == enterprise ]] && export VERSION=enterprise-unstable-$(date +%F-%H%M)-$CI_COMMIT_SHORT_SHA'
|
||||||
- '[[ -z $VERSION ]] && [[ $CI_PROJECT_NAMESPACE == Enterprise ]] && export VERSION=$CI_COMMIT_REF_NAME-$(date +%F-%H%M)-$CI_COMMIT_SHORT_SHA'
|
- '[[ -z $VERSION ]] && [[ $CI_PROJECT_NAMESPACE == Enterprise ]] && export VERSION=$CI_COMMIT_REF_NAME-$(date +%F-%H%M)-$CI_COMMIT_SHORT_SHA'
|
||||||
- '[[ -z $VERSION ]] && export VERSION=$CI_PROJECT_NAMESPACE-$(date +%F-%H%M)-$CI_COMMIT_SHORT_SHA'
|
- '[[ -z $VERSION ]] && export VERSION=$CI_PROJECT_NAMESPACE-$(date +%F-%H%M)-$CI_COMMIT_SHORT_SHA'
|
||||||
- 'export MATLAB_PATH=$(dirname $(dirname $(readlink -f $(which matlab))))'
|
|
||||||
- 'export MATLAB_VERSION=$(echo version | matlab -nodesktop -nodisplay -nosplash 2>/dev/null | sed -En "/ans\ =/!d;n;n;s/^[^0-9]*([0-9]+\.[0-9]+).*$/\1/;p")'
|
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
|
@ -29,7 +27,7 @@ build_binaries:
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- autoreconf -si
|
- autoreconf -si
|
||||||
- ./configure --with-matlab=$MATLAB_PATH MATLAB_VERSION=$MATLAB_VERSION PACKAGE_VERSION=$VERSION PACKAGE_STRING="dynare $VERSION"
|
- ./configure --with-matlab=/usr/local/MATLAB/$MATLAB_VERSION MATLAB_VERSION=$MATLAB_VERSION PACKAGE_VERSION=$VERSION PACKAGE_STRING="dynare $VERSION"
|
||||||
- make -j $(nproc) LN_S="cp -p"
|
- make -j $(nproc) LN_S="cp -p"
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
|
@ -68,9 +66,10 @@ build_doc:
|
||||||
pkg_source:
|
pkg_source:
|
||||||
stage: test_and_pkg
|
stage: test_and_pkg
|
||||||
script:
|
script:
|
||||||
|
- rm doc/manual/source/_static/mathjax && sed -i "/^mathjax_path *=/d" doc/manual/source/conf.py
|
||||||
- 'for f in configure.ac preprocessor/configure.ac mex/build/matlab/configure.ac mex/build/octave/configure.ac; do sed -i "s/^AC_INIT(\[\(.*\)\],\s*\[\(.*\)\])/AC_INIT([\1], [$VERSION])/" $f; done'
|
- 'for f in configure.ac preprocessor/configure.ac mex/build/matlab/configure.ac mex/build/octave/configure.ac; do sed -i "s/^AC_INIT(\[\(.*\)\],\s*\[\(.*\)\])/AC_INIT([\1], [$VERSION])/" $f; done'
|
||||||
- autoreconf -si
|
- autoreconf -si
|
||||||
- ./configure --with-matlab=$MATLAB_PATH MATLAB_VERSION=$MATLAB_VERSION
|
- ./configure --with-matlab=/usr/local/MATLAB/$MATLAB_VERSION MATLAB_VERSION=$MATLAB_VERSION
|
||||||
- make dist
|
- make dist
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
|
@ -142,14 +141,14 @@ test_matlab:
|
||||||
extends: .test_matlab_template
|
extends: .test_matlab_template
|
||||||
script:
|
script:
|
||||||
- autoreconf -si
|
- autoreconf -si
|
||||||
- ./configure --disable-octave --with-matlab=$MATLAB_PATH MATLAB_VERSION=$MATLAB_VERSION
|
- ./configure --disable-octave --with-matlab=/usr/local/MATLAB/$MATLAB_VERSION MATLAB_VERSION=$MATLAB_VERSION
|
||||||
- make -j $(($(nproc) * 3 / 4)) -C tests check-matlab
|
- make -j $(($(nproc) * 3 / 4)) -C tests check-matlab
|
||||||
|
|
||||||
test_old_matlab:
|
test_old_matlab:
|
||||||
extends: .test_matlab_template
|
extends: .test_matlab_template
|
||||||
script:
|
script:
|
||||||
- autoreconf -si
|
- autoreconf -si
|
||||||
- ./configure --disable-octave --with-matlab=/usr/local/MATLAB/R2009b MATLAB_VERSION=R2009b
|
- ./configure --disable-octave --with-matlab=/usr/local/MATLAB/$OLD_MATLAB_VERSION MATLAB_VERSION=$OLD_MATLAB_VERSION
|
||||||
- make -C mex/build/matlab clean
|
- make -C mex/build/matlab clean
|
||||||
- make -j $(nproc) -C mex/build/matlab
|
- make -j $(nproc) -C mex/build/matlab
|
||||||
- make -j $(($(nproc) * 3 / 4)) -C tests check-matlab
|
- make -j $(($(nproc) * 3 / 4)) -C tests check-matlab
|
||||||
|
|
10
Makefile.am
10
Makefile.am
|
@ -16,7 +16,7 @@ ACLOCAL_AMFLAGS = -I m4
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
matlab \
|
matlab \
|
||||||
contrib \
|
contrib \
|
||||||
NEWS \
|
NEWS.md \
|
||||||
license.txt \
|
license.txt \
|
||||||
README.md \
|
README.md \
|
||||||
COPYING \
|
COPYING \
|
||||||
|
@ -34,9 +34,10 @@ all-local: preprocessor/src/dynare_m$(EXEEXT)
|
||||||
ARCH="32"; \
|
ARCH="32"; \
|
||||||
fi; \
|
fi; \
|
||||||
mkdir -p $(abs_srcdir)/matlab/preprocessor$$ARCH && \
|
mkdir -p $(abs_srcdir)/matlab/preprocessor$$ARCH && \
|
||||||
$(LN_S) -f $(abs_builddir)/preprocessor/src/dynare_m$(EXEEXT) $(abs_srcdir)/matlab/preprocessor$$ARCH && \
|
$(LN_S) -f $(abs_builddir)/preprocessor/src/dynare_m$(EXEEXT) $(abs_srcdir)/matlab/preprocessor$$ARCH
|
||||||
mkdir -p $(abs_srcdir)/julia/preprocessor$$ARCH && \
|
|
||||||
$(LN_S) -f $(abs_builddir)/preprocessor/src/dynare_m$(EXEEXT) $(abs_srcdir)/julia/preprocessor$$ARCH
|
clean-local:
|
||||||
|
rm -rf $(abs_srcdir)/matlab/preprocessor32 $(abs_srcdir)/matlab/preprocessor64
|
||||||
|
|
||||||
dist-hook:
|
dist-hook:
|
||||||
rm -rf `find $(distdir)/matlab $(distdir)/examples -name *~`
|
rm -rf `find $(distdir)/matlab $(distdir)/examples -name *~`
|
||||||
|
@ -62,5 +63,4 @@ install-exec-local:
|
||||||
cp preprocessor/src/dynare_m $(DESTDIR)$(pkglibdir)/matlab/preprocessor$$ARCH
|
cp preprocessor/src/dynare_m $(DESTDIR)$(pkglibdir)/matlab/preprocessor$$ARCH
|
||||||
|
|
||||||
uninstall-local:
|
uninstall-local:
|
||||||
rm -f $(DESTDIR)$(bindir)/dynare++
|
|
||||||
rm -rf $(DESTDIR)$(pkglibdir)
|
rm -rf $(DESTDIR)$(pkglibdir)
|
||||||
|
|
999
NEWS → NEWS.md
999
NEWS → NEWS.md
File diff suppressed because it is too large
Load Diff
20
README.md
20
README.md
|
@ -234,7 +234,7 @@ All the prerequisites are packaged:
|
||||||
- `texlive-fonts-extra` (for ccicons)
|
- `texlive-fonts-extra` (for ccicons)
|
||||||
- `texlive-latex-recommended`
|
- `texlive-latex-recommended`
|
||||||
- `texlive-science` (for amstex)
|
- `texlive-science` (for amstex)
|
||||||
- `texlive-generic-extra` (for Sphinx)
|
- `texlive-plain-generic`
|
||||||
- `lmodern` (for macroprocessor PDF)
|
- `lmodern` (for macroprocessor PDF)
|
||||||
- `python3-sphinx`
|
- `python3-sphinx`
|
||||||
- `latexmk`
|
- `latexmk`
|
||||||
|
@ -243,7 +243,7 @@ All the prerequisites are packaged:
|
||||||
|
|
||||||
You can install them all at once with:
|
You can install them all at once with:
|
||||||
```
|
```
|
||||||
apt install build-essential gfortran liboctave-dev libboost-graph-dev libgsl-dev libmatio-dev libslicot-dev libslicot-pic libsuitesparse-dev flex bison autoconf automake texlive texlive-publishers texlive-latex-extra texlive-fonts-extra texlive-latex-recommended texlive-science texlive-generic-extra lmodern python3-sphinx latexmk libjs-mathjax doxygen
|
apt install build-essential gfortran liboctave-dev libboost-graph-dev libgsl-dev libmatio-dev libslicot-dev libslicot-pic libsuitesparse-dev flex bison autoconf automake texlive texlive-publishers texlive-latex-extra texlive-fonts-extra texlive-latex-recommended texlive-science texlive-plain-generic lmodern python3-sphinx latexmk libjs-mathjax doxygen
|
||||||
```
|
```
|
||||||
|
|
||||||
## Windows
|
## Windows
|
||||||
|
@ -262,30 +262,32 @@ pacman -Syu
|
||||||
```
|
```
|
||||||
pacman -S git autoconf automake-wrapper bison flex make tar texinfo mingw-w64-x86_64-gcc mingw-w64-x86_64-gcc-fortran mingw-w64-x86_64-boost mingw-w64-x86_64-gsl mingw-w64-x86_64-matio mingw-w64-x86_64-openblas
|
pacman -S git autoconf automake-wrapper bison flex make tar texinfo mingw-w64-x86_64-gcc mingw-w64-x86_64-gcc-fortran mingw-w64-x86_64-boost mingw-w64-x86_64-gsl mingw-w64-x86_64-matio mingw-w64-x86_64-openblas
|
||||||
```
|
```
|
||||||
- **(Optional)** compile and install SLICOT, needed for the `kalman_steady_state`
|
- Compile and install SLICOT, needed for the `kalman_steady_state` MEX file
|
||||||
MEX file
|
|
||||||
```
|
```
|
||||||
wget https://deb.debian.org/debian/pool/main/s/slicot/slicot_5.0+20101122.orig.tar.gz
|
wget https://deb.debian.org/debian/pool/main/s/slicot/slicot_5.0+20101122.orig.tar.gz
|
||||||
tar xf slicot_5.0+20101122.orig.tar.gz
|
tar xf slicot_5.0+20101122.orig.tar.gz
|
||||||
cd slicot-5.0+20101122
|
cd slicot-5.0+20101122
|
||||||
make FORTRAN=gfortran OPTS="-O2 -fno-underscoring -fdefault-integer-8" LOADER=gfortran slicot.a
|
make FORTRAN=gfortran OPTS="-O2 -fno-underscoring -fdefault-integer-8" LOADER=gfortran lib
|
||||||
mkdir -p /usr/local/lib
|
mkdir -p /usr/local/lib
|
||||||
cp slicot.a /usr/local/lib/libslicot64_pic.a
|
cp slicot.a /usr/local/lib/libslicot64_pic.a
|
||||||
cd ..
|
cd ..
|
||||||
```
|
```
|
||||||
- Clone and prepare the Dynare sources:
|
- Prepare the Dynare sources, either by unpacking the source tarball, or with:
|
||||||
```
|
```
|
||||||
git clone --recurse-submodules https://git.dynare.org/Dynare/dynare.git
|
git clone --recurse-submodules https://git.dynare.org/Dynare/dynare.git
|
||||||
cd dynare
|
cd dynare
|
||||||
autoreconf -si
|
autoreconf -si
|
||||||
```
|
```
|
||||||
- Configure Dynare:
|
- Configure Dynare from the source directory:
|
||||||
```
|
```
|
||||||
./configure --with-slicot=/usr/local --with-matlab=<…> MATLAB_VERSION=<…> --disable-octave
|
./configure --with-slicot=/usr/local --with-matlab=<…> MATLAB_VERSION=<…> --disable-octave --disable-doc
|
||||||
```
|
```
|
||||||
where the path and version of MATLAB are specified. Note that you should use
|
where the path and version of MATLAB are specified. Note that you should use
|
||||||
the MSYS2 notation and not put spaces in the MATLAB path, so you probably want
|
the MSYS2 notation and not put spaces in the MATLAB path, so you probably want
|
||||||
to use something like `/c/Progra~1/MATLAB/…`.
|
to use something like `/c/Progra~1/MATLAB/…`. Alternatively, if your filesystem
|
||||||
|
does not have short filenames (8dot3), then you can run `mkdir -p
|
||||||
|
/usr/local/MATLAB && mount c:/Program\ Files/MATLAB /usr/local/MATLAB`, and
|
||||||
|
then pass `/usr/local/MATLAB/…` as MATLAB path to the configure script.
|
||||||
- Compile:
|
- Compile:
|
||||||
```
|
```
|
||||||
make
|
make
|
||||||
|
|
|
@ -18,7 +18,7 @@ dnl You should have received a copy of the GNU General Public License
|
||||||
dnl along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
dnl along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
AC_PREREQ([2.62])
|
AC_PREREQ([2.62])
|
||||||
AC_INIT([dynare], [4.6-unstable])
|
AC_INIT([dynare], [4.7-unstable])
|
||||||
AC_CONFIG_SRCDIR([preprocessor/src/DynareMain.cc])
|
AC_CONFIG_SRCDIR([preprocessor/src/DynareMain.cc])
|
||||||
AM_INIT_AUTOMAKE([1.11 -Wall -Wno-portability foreign no-dist-gzip dist-xz tar-pax])
|
AM_INIT_AUTOMAKE([1.11 -Wall -Wno-portability foreign no-dist-gzip dist-xz tar-pax])
|
||||||
|
|
||||||
|
|
|
@ -16,3 +16,4 @@ build/latex/dynare-manual.pdf: $(SRC) source/conf.py
|
||||||
|
|
||||||
clean-local:
|
clean-local:
|
||||||
rm -rf build
|
rm -rf build
|
||||||
|
rm -rf utils/__pycache__
|
||||||
|
|
|
@ -44,6 +44,7 @@ Bibliography
|
||||||
* Kim, Jinill and Sunghyun Kim (2003): “Spurious welfare reversals in international business cycle models,” *Journal of International Economics*, 60, 471–500.
|
* Kim, Jinill and Sunghyun Kim (2003): “Spurious welfare reversals in international business cycle models,” *Journal of International Economics*, 60, 471–500.
|
||||||
* Kanzow, Christian and Stefania Petra (2004): “On a semismooth least squares formulation of complementarity problems with gap reduction,” *Optimization Methods and Software*, 19, 507–525.
|
* Kanzow, Christian and Stefania Petra (2004): “On a semismooth least squares formulation of complementarity problems with gap reduction,” *Optimization Methods and Software*, 19, 507–525.
|
||||||
* Kim, Jinill, Sunghyun Kim, Ernst Schaumburg, and Christopher A. Sims (2008): “Calculating and using second-order accurate solutions of discrete time dynamic equilibrium models,” *Journal of Economic Dynamics and Control*, 32(11), 3397–3414.
|
* Kim, Jinill, Sunghyun Kim, Ernst Schaumburg, and Christopher A. Sims (2008): “Calculating and using second-order accurate solutions of discrete time dynamic equilibrium models,” *Journal of Economic Dynamics and Control*, 32(11), 3397–3414.
|
||||||
|
* Komunjer, Ivana and Ng, Serena (2011): ”Dynamic identification of dynamic stochastic general equilibrium models”, *Econometrica*, 79, 1995–2032.
|
||||||
* Koop, Gary (2003), *Bayesian Econometrics*, John Wiley & Sons.
|
* Koop, Gary (2003), *Bayesian Econometrics*, John Wiley & Sons.
|
||||||
* Koopman, S. J. and J. Durbin (2000): “Fast Filtering and Smoothing for Multivariate State Space Models,” *Journal of Time Series Analysis*, 21(3), 281–296.
|
* Koopman, S. J. and J. Durbin (2000): “Fast Filtering and Smoothing for Multivariate State Space Models,” *Journal of Time Series Analysis*, 21(3), 281–296.
|
||||||
* Koopman, S. J. and J. Durbin (2003): “Filtering and Smoothing of State Vector for Diffuse State Space Models,” *Journal of Time Series Analysis*, 24(1), 85–98.
|
* Koopman, S. J. and J. Durbin (2003): “Filtering and Smoothing of State Vector for Diffuse State Space Models,” *Journal of Time Series Analysis*, 24(1), 85–98.
|
||||||
|
@ -52,13 +53,16 @@ Bibliography
|
||||||
* Liu, Jane and Mike West (2001): “Combined parameter and state estimation in simulation-based filtering”, in *Sequential Monte Carlo Methods in Practice*, Eds. Doucet, Freitas and Gordon, Springer Verlag.
|
* Liu, Jane and Mike West (2001): “Combined parameter and state estimation in simulation-based filtering”, in *Sequential Monte Carlo Methods in Practice*, Eds. Doucet, Freitas and Gordon, Springer Verlag.
|
||||||
* Lubik, Thomas and Frank Schorfheide (2007): “Do Central Banks Respond to Exchange Rate Movements? A Structural Investigation,” *Journal of Monetary Economics*, 54(4), 1069–1087.
|
* Lubik, Thomas and Frank Schorfheide (2007): “Do Central Banks Respond to Exchange Rate Movements? A Structural Investigation,” *Journal of Monetary Economics*, 54(4), 1069–1087.
|
||||||
* Murray, Lawrence M., Emlyn M. Jones and John Parslow (2013): “On Disturbance State-Space Models and the Particle Marginal Metropolis-Hastings Sampler”, *SIAM/ASA Journal on Uncertainty Quantification*, 1, 494–521.
|
* Murray, Lawrence M., Emlyn M. Jones and John Parslow (2013): “On Disturbance State-Space Models and the Particle Marginal Metropolis-Hastings Sampler”, *SIAM/ASA Journal on Uncertainty Quantification*, 1, 494–521.
|
||||||
|
* Mutschler, Willi (2015): “Identification of DSGE models - The effect of higher-order approximation and pruning“, *Journal of Economic Dynamics & Control*, 56, 34-54.
|
||||||
* Pearlman, Joseph, David Currie, and Paul Levine (1986): “Rational expectations models with partial information,” *Economic Modelling*, 3(2), 90–105.
|
* Pearlman, Joseph, David Currie, and Paul Levine (1986): “Rational expectations models with partial information,” *Economic Modelling*, 3(2), 90–105.
|
||||||
* Planas, Christophe, Marco Ratto and Alessandro Rossi (2015): “Slice sampling in Bayesian estimation of DSGE models”.
|
* Planas, Christophe, Marco Ratto and Alessandro Rossi (2015): “Slice sampling in Bayesian estimation of DSGE models”.
|
||||||
* Pfeifer, Johannes (2013): “A Guide to Specifying Observation Equations for the Estimation of DSGE Models”.
|
* Pfeifer, Johannes (2013): “A Guide to Specifying Observation Equations for the Estimation of DSGE Models”.
|
||||||
* Pfeifer, Johannes (2014): “An Introduction to Graphs in Dynare”.
|
* Pfeifer, Johannes (2014): “An Introduction to Graphs in Dynare”.
|
||||||
|
* Qu, Zhongjun and Tkachenko, Denis (2012): “Identification and frequency domain quasi-maximum likelihood estimation of linearized dynamic stochastic general equilibrium models“, *Quantitative Economics*, 3, 95–132.
|
||||||
* Rabanal, Pau and Juan Rubio-Ramirez (2003): “Comparing New Keynesian Models of the Business Cycle: A Bayesian Approach,” Federal Reserve of Atlanta, *Working Paper Series*, 2003-30.
|
* Rabanal, Pau and Juan Rubio-Ramirez (2003): “Comparing New Keynesian Models of the Business Cycle: A Bayesian Approach,” Federal Reserve of Atlanta, *Working Paper Series*, 2003-30.
|
||||||
* Raftery, Adrian E. and Steven Lewis (1992): “How many iterations in the Gibbs sampler?,” in *Bayesian Statistics, Vol. 4*, ed. J.O. Berger, J.M. Bernardo, A.P. * Dawid, and A.F.M. Smith, Clarendon Press: Oxford, pp. 763-773.
|
* Raftery, Adrian E. and Steven Lewis (1992): “How many iterations in the Gibbs sampler?,” in *Bayesian Statistics, Vol. 4*, ed. J.O. Berger, J.M. Bernardo, A.P. * Dawid, and A.F.M. Smith, Clarendon Press: Oxford, pp. 763-773.
|
||||||
* Ratto, Marco (2008): “Analysing DSGE models with global sensitivity analysis”, *Computational Economics*, 31, 115–139.
|
* Ratto, Marco (2008): “Analysing DSGE models with global sensitivity analysis”, *Computational Economics*, 31, 115–139.
|
||||||
|
* Ratto, Marco and Iskrev, Nikolay (2011): “Identification Analysis of DSGE Models with DYNARE.“, *MONFISPOL* 225149.
|
||||||
* Schorfheide, Frank (2000): “Loss Function-based evaluation of DSGE models,” *Journal of Applied Econometrics*, 15(6), 645–670.
|
* Schorfheide, Frank (2000): “Loss Function-based evaluation of DSGE models,” *Journal of Applied Econometrics*, 15(6), 645–670.
|
||||||
* Schmitt-Grohé, Stephanie and Martin Uríbe (2004): “Solving Dynamic General Equilibrium Models Using a Second-Order Approximation to the Policy Function,” *Journal of Economic Dynamics and Control*, 28(4), 755–775.
|
* Schmitt-Grohé, Stephanie and Martin Uríbe (2004): “Solving Dynamic General Equilibrium Models Using a Second-Order Approximation to the Policy Function,” *Journal of Economic Dynamics and Control*, 28(4), 755–775.
|
||||||
* Schnabel, Robert B. and Elizabeth Eskow (1990): “A new modified Cholesky algorithm,” *SIAM Journal of Scientific and Statistical Computing*, 11, 1136–1158.
|
* Schnabel, Robert B. and Elizabeth Eskow (1990): “A new modified Cholesky algorithm,” *SIAM Journal of Scientific and Statistical Computing*, 11, 1136–1158.
|
||||||
|
@ -68,6 +72,3 @@ Bibliography
|
||||||
* Stock, James H. and Mark W. Watson (1999). “Forecasting Inflation,”, *Journal of Monetary Economics*, 44(2), 293–335.
|
* Stock, James H. and Mark W. Watson (1999). “Forecasting Inflation,”, *Journal of Monetary Economics*, 44(2), 293–335.
|
||||||
* Uhlig, Harald (2001): “A Toolkit for Analysing Nonlinear Dynamic Stochastic Models Easily,” in *Computational Methods for the Study of Dynamic Economies*, Eds. Ramon Marimon and Andrew Scott, Oxford University Press, 30–61.
|
* Uhlig, Harald (2001): “A Toolkit for Analysing Nonlinear Dynamic Stochastic Models Easily,” in *Computational Methods for the Study of Dynamic Economies*, Eds. Ramon Marimon and Andrew Scott, Oxford University Press, 30–61.
|
||||||
* Villemot, Sébastien (2011): “Solving rational expectations models at first order: what Dynare does,” *Dynare Working Papers*, 2, CEPREMAP.
|
* Villemot, Sébastien (2011): “Solving rational expectations models at first order: what Dynare does,” *Dynare Working Papers*, 2, CEPREMAP.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
# Copyright (C) 2018-2019 Dynare Team
|
# Copyright (C) 2018-2020 Dynare Team
|
||||||
#
|
#
|
||||||
# This file is part of Dynare.
|
# This file is part of Dynare.
|
||||||
#
|
#
|
||||||
|
@ -36,7 +36,7 @@ mathjax_path = 'mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML'
|
||||||
master_doc = 'index'
|
master_doc = 'index'
|
||||||
|
|
||||||
project = u'Dynare'
|
project = u'Dynare'
|
||||||
copyright = u'2019, Dynare Team'
|
copyright = u'2020, Dynare Team'
|
||||||
author = u'Dynare Team'
|
author = u'Dynare Team'
|
||||||
|
|
||||||
add_function_parentheses = False
|
add_function_parentheses = False
|
||||||
|
@ -77,6 +77,7 @@ latex_elements = {
|
||||||
warningBorderColor={RGB}{255,50,50},OuterLinkColor={RGB}{34,139,34}, \
|
warningBorderColor={RGB}{255,50,50},OuterLinkColor={RGB}{34,139,34}, \
|
||||||
InnerLinkColor={RGB}{51,51,255},TitleColor={RGB}{51,51,255}',
|
InnerLinkColor={RGB}{51,51,255},TitleColor={RGB}{51,51,255}',
|
||||||
'papersize': 'a4paper',
|
'papersize': 'a4paper',
|
||||||
|
'preamble': r'\DeclareUnicodeCharacter{200B}{}', # Part of the workaround for #1707
|
||||||
}
|
}
|
||||||
|
|
||||||
latex_documents = [
|
latex_documents = [
|
||||||
|
|
|
@ -167,24 +167,26 @@ Dynare misc commands
|
||||||
|
|
||||||
A ``1*Nblck`` array of doubles. Current acceptance ratios.
|
A ``1*Nblck`` array of doubles. Current acceptance ratios.
|
||||||
|
|
||||||
.. matcomm:: prior [options[, ...]];
|
.. matcomm:: prior [OPTIONS[, ...]];
|
||||||
|
|
||||||
Prints various informations about the prior distribution depending
|
Prints information about the prior distribution given the provided
|
||||||
on the options. If no options are provided, the command returns
|
options. If no options are provided, the command returns the list of
|
||||||
the list of available options. Following options are available:
|
available options.
|
||||||
|
|
||||||
``table``
|
*Options*
|
||||||
|
|
||||||
|
.. option:: table
|
||||||
|
|
||||||
Prints a table describing the marginal prior distributions
|
Prints a table describing the marginal prior distributions
|
||||||
(mean, mode, std., lower and upper bounds, HPD interval).
|
(mean, mode, std., lower and upper bounds, HPD interval).
|
||||||
|
|
||||||
``moments``
|
.. option:: moments
|
||||||
|
|
||||||
Computes and displays first and second order moments of the
|
Computes and displays first and second order moments of the
|
||||||
endogenous variables at the prior mode (considering the
|
endogenous variables at the prior mode (considering the
|
||||||
linearized version of the model).
|
linearized version of the model).
|
||||||
|
|
||||||
``moments(distribution)``
|
.. option:: moments(distribution)
|
||||||
|
|
||||||
Computes and displays the prior mean and prior standard
|
Computes and displays the prior mean and prior standard
|
||||||
deviation of the first and second moments of the endogenous
|
deviation of the first and second moments of the endogenous
|
||||||
|
@ -193,7 +195,7 @@ Dynare misc commands
|
||||||
stored in the ``prior`` subfolder in a
|
stored in the ``prior`` subfolder in a
|
||||||
``_endogenous_variables_prior_draws.mat`` file.
|
``_endogenous_variables_prior_draws.mat`` file.
|
||||||
|
|
||||||
``optimize``
|
.. option:: optimize
|
||||||
|
|
||||||
Optimizes the prior density (starting from a random initial
|
Optimizes the prior density (starting from a random initial
|
||||||
guess). The parameters such that the steady state does not
|
guess). The parameters such that the steady state does not
|
||||||
|
@ -203,7 +205,7 @@ Dynare misc commands
|
||||||
defined over such regions, the optimization algorithm may fail
|
defined over such regions, the optimization algorithm may fail
|
||||||
to converge to the true solution (the prior mode).
|
to converge to the true solution (the prior mode).
|
||||||
|
|
||||||
``simulate``
|
.. option:: simulate
|
||||||
|
|
||||||
Computes the effective prior mass using a Monte-Carlo. Ideally
|
Computes the effective prior mass using a Monte-Carlo. Ideally
|
||||||
the effective prior mass should be equal to 1, otherwise
|
the effective prior mass should be equal to 1, otherwise
|
||||||
|
@ -215,6 +217,6 @@ Dynare misc commands
|
||||||
:math:`p_A\neq p_B \leq 1` so that the prior mass of the
|
:math:`p_A\neq p_B \leq 1` so that the prior mass of the
|
||||||
compared models are identical.
|
compared models are identical.
|
||||||
|
|
||||||
``plot``
|
.. option:: plot
|
||||||
|
|
||||||
Plots the marginal prior density.
|
Plots the marginal prior density.
|
||||||
|
|
|
@ -56,3 +56,9 @@ description, please refer to the comments inside the files themselves.
|
||||||
Baseline New Keynesian Model estimated in *Fernández-Villaverde
|
Baseline New Keynesian Model estimated in *Fernández-Villaverde
|
||||||
(2010)*. It demonstrates how to use an explicit steady state file
|
(2010)*. It demonstrates how to use an explicit steady state file
|
||||||
to update parameters and call a numerical solver.
|
to update parameters and call a numerical solver.
|
||||||
|
|
||||||
|
``Ramsey_Example.mod``
|
||||||
|
|
||||||
|
File demonstrating how to conduct optimal policy experiments in a
|
||||||
|
simple New Keynesian model either under commitment (Ramsey) or using
|
||||||
|
optimal simple rules (OSR)
|
|
@ -25,7 +25,7 @@ The following people used to be members of the team:
|
||||||
* Stéphane Lhuissier
|
* Stéphane Lhuissier
|
||||||
* George Perendia
|
* George Perendia
|
||||||
|
|
||||||
Copyright © 1996-2019, Dynare Team.
|
Copyright © 1996-2020, Dynare Team.
|
||||||
|
|
||||||
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ Installation and configuration
|
||||||
Software requirements
|
Software requirements
|
||||||
=====================
|
=====================
|
||||||
|
|
||||||
Packaged versions of Dynare are available for Windows 7/8/10, several GNU/Linux
|
Packaged versions of Dynare are available for Windows (7, 8.1, 10), several GNU/Linux
|
||||||
distributions (Debian, Ubuntu, Linux Mint, Arch Linux) and macOS
|
distributions (Debian, Ubuntu, Linux Mint, Arch Linux) and macOS
|
||||||
10.11 or later. Dynare should work on other systems, but some compilation steps
|
10.11 or later. Dynare should work on other systems, but some compilation steps
|
||||||
are necessary in that case.
|
are necessary in that case.
|
||||||
|
@ -15,7 +15,10 @@ are necessary in that case.
|
||||||
In order to run Dynare, you need one of the following:
|
In order to run Dynare, you need one of the following:
|
||||||
|
|
||||||
* MATLAB version 7.9 (R2009b) or above;
|
* MATLAB version 7.9 (R2009b) or above;
|
||||||
* Octave version 4.2.1 or above, with the statistics package from `Octave-Forge`_.
|
* GNU Octave version 4.4 or above, with the statistics package from
|
||||||
|
`Octave-Forge`_. Note however that the Dynare installers for Windows and
|
||||||
|
macOS require a more specific version of Octave, as indicated on the download
|
||||||
|
page.
|
||||||
|
|
||||||
The following optional extensions are also useful to benefit from
|
The following optional extensions are also useful to benefit from
|
||||||
extra features, but are in no way required:
|
extra features, but are in no way required:
|
||||||
|
@ -84,27 +87,33 @@ be under ``/usr/share/doc/dynare-doc`` (only on Debian, Ubuntu and Linux Mint).
|
||||||
On macOS
|
On macOS
|
||||||
--------
|
--------
|
||||||
|
|
||||||
To install Dynare for use with MATLAB, execute the automated installer
|
To install Dynare for use with MATLAB, execute the automated installer called
|
||||||
called ``dynare-4.x.y.pkg`` (where *4.x.y* is the version number), and
|
``dynare-4.x.y.pkg`` (where *4.x.y* is the version number), and follow the
|
||||||
follow the instructions. The default installation directory is
|
instructions. The default installation directory is
|
||||||
``/Applications/Dynare/4.x.y`` (please refer to the `Dynare wiki`_ for
|
``/Applications/Dynare/4.x.y``. After installation, this directory will contain
|
||||||
detailed instructions).
|
several sub-directories, among which are ``matlab``, ``mex``, and ``doc``.
|
||||||
|
|
||||||
After installation, this directory will contain several
|
|
||||||
sub-directories, among which are ``matlab``, ``mex`` and ``doc``.
|
|
||||||
|
|
||||||
Note that several versions of Dynare can coexist (by default in
|
Note that several versions of Dynare can coexist (by default in
|
||||||
``/Applications/Dynare``), as long as you correctly adjust your path
|
``/Applications/Dynare``), as long as you correctly adjust your path
|
||||||
settings (see :ref:`words-warning`).
|
settings (see :ref:`words-warning`).
|
||||||
|
|
||||||
To install Dynare for Octave, first install Homebrew following the
|
By default, the installer installs a version of GCC (for use with :opt:`use_dll`)
|
||||||
instructions on their site: `https://brew.sh/
|
in the installation directory, under the ``.brew`` folder. To do so, it also
|
||||||
<https://brew.sh/>`__. Then install Octave, issuing the command ``brew
|
installs a version of `Homebrew <https://brew.sh>`__ in the same folder and
|
||||||
install octave`` at the Terminal prompt. You can then install the
|
Xcode Command Line Tools (this is an Apple product) in a system folder.
|
||||||
latest stable version of Dynare by typing ``brew install dynare`` at
|
|
||||||
the Terminal prompt. You can also pass options to the installation
|
All of this requires a bit of time and hard disk space. The amount of time it
|
||||||
command. These options can be viewed by typing ``brew info dynare`` at
|
takes will depend on your computing power and internet connection. To reduce
|
||||||
the Terminal prompt.
|
the time the Dynare installer takes, you can install Xcode Command Line Tools
|
||||||
|
yourself (see :ref:`prerequisites-macos`). Dynare, Homebrew, and GCC use
|
||||||
|
about 600 MB of disk space while the Xcode Command Line Tools require about 400
|
||||||
|
MB.
|
||||||
|
|
||||||
|
If you do not use the :opt:`use_dll` option, you have the choice to forgo the
|
||||||
|
installation of GCC and hence Dynare will only take about 50 MB of disk space.
|
||||||
|
|
||||||
|
Dynare for Octave works with Octave installed via the package located here:
|
||||||
|
`https://octave-app.org <https://octave-app.org>`__.
|
||||||
|
|
||||||
|
|
||||||
For other systems
|
For other systems
|
||||||
|
@ -140,14 +149,17 @@ Users of Octave under GNU/Linux should install the package for MEX file
|
||||||
compilation (under Debian, Ubuntu or Linux Mint, it can be done via ``apt
|
compilation (under Debian, Ubuntu or Linux Mint, it can be done via ``apt
|
||||||
install liboctave-dev``).
|
install liboctave-dev``).
|
||||||
|
|
||||||
|
.. _prerequisites-macos:
|
||||||
|
|
||||||
Prerequisites on macOS
|
Prerequisites on macOS
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
Dynare now ships a compilation environment that can be used with the
|
Dynare now ships a compilation environment that can be used with the
|
||||||
:opt:`use_dll` option. Specifically, the Dynare installer downloads and
|
:opt:`use_dll` option. To install this environment correctly, the Dynare
|
||||||
installs the Xcode Command Line Tools, installs `Homebrew <https://brew.sh>`_
|
installer ensures that the Xcode Command Line Tools (an Apple product) have
|
||||||
under the Dynare installation directory (in the ``.brew`` folder), and finally
|
been installed on a system folder. To install the Xcode Command Line Tools
|
||||||
installs GCC.
|
yourself, simply type ``xcode-select --install`` into the Terminal
|
||||||
|
(``/Applications/Utilities/Terminal.app``) prompt.
|
||||||
|
|
||||||
Configuration
|
Configuration
|
||||||
=============
|
=============
|
||||||
|
@ -209,10 +221,10 @@ command; the packaging does it for you. Under Arch Linux, you need to do::
|
||||||
|
|
||||||
octave:1> addpath /usr/lib/dynare/matlab
|
octave:1> addpath /usr/lib/dynare/matlab
|
||||||
|
|
||||||
Under macOS, assuming that you have installed Dynare and Octave via
|
Under macOS, assuming you have installed Octave via `https://octave-app.org
|
||||||
Homebrew, type::
|
<https://octave-app.org>`__, type::
|
||||||
|
|
||||||
octave:1> addpath /usr/local/opt/dynare/lib/dynare/matlab
|
octave:1> addpath /Applications/Dynare/4.x.y/matlab
|
||||||
|
|
||||||
If you don’t want to type this command every time you run Octave, you
|
If you don’t want to type this command every time you run Octave, you
|
||||||
can put it in a file called ``.octaverc`` in your home directory
|
can put it in a file called ``.octaverc`` in your home directory
|
||||||
|
|
|
@ -55,7 +55,7 @@ manual. Part of Dynare is programmed in C++, while the rest is written
|
||||||
using the `MATLAB`_ programming language. The latter implies that
|
using the `MATLAB`_ programming language. The latter implies that
|
||||||
commercially-available MATLAB software is required in order to run
|
commercially-available MATLAB software is required in order to run
|
||||||
Dynare. However, as an alternative to MATLAB, Dynare is also able to
|
Dynare. However, as an alternative to MATLAB, Dynare is also able to
|
||||||
run on top of `Octave`_ (basically a free clone of MATLAB): this
|
run on top of `GNU Octave`_ (basically a free clone of MATLAB): this
|
||||||
possibility is particularly interesting for students or institutions
|
possibility is particularly interesting for students or institutions
|
||||||
who cannot afford, or do not want to pay for, MATLAB and are willing
|
who cannot afford, or do not want to pay for, MATLAB and are willing
|
||||||
to bear the concomitant performance loss.
|
to bear the concomitant performance loss.
|
||||||
|
@ -122,7 +122,7 @@ https://www.dynare.org.
|
||||||
|
|
||||||
|
|
||||||
.. _MATLAB: https://www.mathworks.com/products/matlab/
|
.. _MATLAB: https://www.mathworks.com/products/matlab/
|
||||||
.. _Octave: https://www.octave.org/
|
.. _GNU Octave: https://www.octave.org/
|
||||||
.. _CEPREMAP: https://www.cepremap.fr/
|
.. _CEPREMAP: https://www.cepremap.fr/
|
||||||
.. _web forum: https://forum.dynare.org/
|
.. _web forum: https://forum.dynare.org/
|
||||||
.. _official Dynare website: https://www.dynare.org/
|
.. _official Dynare website: https://www.dynare.org/
|
||||||
|
|
|
@ -104,6 +104,23 @@ by the ``dynare`` command.
|
||||||
Octave, it also means that the ``.mod`` file cannot be named
|
Octave, it also means that the ``.mod`` file cannot be named
|
||||||
``test.mod`` or ``example.mod``.
|
``test.mod`` or ``example.mod``.
|
||||||
|
|
||||||
|
.. _quote-note:
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
Note on Quotes
|
||||||
|
|
||||||
|
When passing command line options that contains a space (or, under
|
||||||
|
Octave, a double quote), you must surround the entire option (keyword
|
||||||
|
and argument) with single quotes, as in the following example.
|
||||||
|
|
||||||
|
*Example*
|
||||||
|
|
||||||
|
Call Dynare with options containing spaces
|
||||||
|
|
||||||
|
.. code-block:: matlab
|
||||||
|
|
||||||
|
>> dynare <<modfile.mod>> '-DA=[ i in [1,2,3] when i > 1 ]' 'conffile=C:\User\My Documents\config.txt'
|
||||||
|
|
||||||
*Options*
|
*Options*
|
||||||
|
|
||||||
.. option:: noclearall
|
.. option:: noclearall
|
||||||
|
@ -140,10 +157,11 @@ by the ``dynare`` command.
|
||||||
|
|
||||||
.. option:: savemacro[=FILENAME]
|
.. option:: savemacro[=FILENAME]
|
||||||
|
|
||||||
Instructs ``dynare`` to save the intermediary file which is
|
Instructs ``dynare`` to save the intermediary file which is obtained
|
||||||
obtained after macro processing (see :ref:`macro-proc-lang`);
|
after macro processing (see :ref:`macro-proc-lang`); the saved output
|
||||||
the saved output will go in the file specified, or if no file
|
will go in the file specified, or if no file is specified in
|
||||||
is specified in ``FILENAME-macroexp.mod``
|
``FILENAME-macroexp.mod``. See the :ref:`note on quotes<quote-note>`
|
||||||
|
for info on passing a ``FILENAME`` argument containing spaces.
|
||||||
|
|
||||||
.. option:: onlymacro
|
.. option:: onlymacro
|
||||||
|
|
||||||
|
@ -152,19 +170,12 @@ by the ``dynare`` command.
|
||||||
debugging purposes or for using the macro processor
|
debugging purposes or for using the macro processor
|
||||||
independently of the rest of Dynare toolbox.
|
independently of the rest of Dynare toolbox.
|
||||||
|
|
||||||
.. option:: nolinemacro
|
.. option:: linemacro
|
||||||
|
|
||||||
Instructs the macro preprocessor to omit line numbering
|
Instructs the macro preprocessor include ``@#line`` directives
|
||||||
information in the intermediary ``.mod`` file created after
|
specifying the line on which macro directives were encountered and
|
||||||
the macro processing step. Useful in conjunction with
|
expanded from. Only useful in conjunction with :opt:`savemacro
|
||||||
:opt:`savemacro <savemacro[=FILENAME]>` when one wants that to reuse the intermediary
|
<savemacro[=FILENAME]>`.
|
||||||
``.mod`` file, without having it cluttered by line numbering
|
|
||||||
directives.
|
|
||||||
|
|
||||||
.. option:: noemptylinemacro
|
|
||||||
|
|
||||||
Passing this option removes all empty from the macro expanded
|
|
||||||
mod file created when the :opt:`savemacro <savemacro[=FILENAME]>` option is used.
|
|
||||||
|
|
||||||
.. option:: onlymodel
|
.. option:: onlymodel
|
||||||
|
|
||||||
|
@ -305,9 +316,10 @@ by the ``dynare`` command.
|
||||||
|
|
||||||
.. option:: matlabroot=<<path>>
|
.. option:: matlabroot=<<path>>
|
||||||
|
|
||||||
The path to the MATLAB installation for use with
|
The path to the MATLAB installation for use with :opt:`use_dll`. Dynare
|
||||||
:opt:`use_dll`. Dynare is able to set this automatically,
|
is able to set this automatically, so you should not need to set it
|
||||||
so you should not need to set it yourself.
|
yourself. See the :ref:`note on quotes<quote-note>` for info on
|
||||||
|
passing a ``<<path>>`` argument containing spaces.
|
||||||
|
|
||||||
.. option:: parallel[=CLUSTER_NAME]
|
.. option:: parallel[=CLUSTER_NAME]
|
||||||
|
|
||||||
|
@ -320,9 +332,11 @@ by the ``dynare`` command.
|
||||||
|
|
||||||
.. option:: conffile=FILENAME
|
.. option:: conffile=FILENAME
|
||||||
|
|
||||||
Specifies the location of the configuration file if it differs
|
Specifies the location of the configuration file if it differs from the
|
||||||
from the default. See :ref:`conf-file`, for more information
|
default. See :ref:`conf-file`, for more information about the
|
||||||
about the configuration file and its default location.
|
configuration file and its default location. See the :ref:`note on
|
||||||
|
quotes<quote-note>` for info on passing a ``FILENAME`` argument
|
||||||
|
containing spaces.
|
||||||
|
|
||||||
.. option:: parallel_slave_open_mode
|
.. option:: parallel_slave_open_mode
|
||||||
|
|
||||||
|
@ -338,18 +352,30 @@ by the ``dynare`` command.
|
||||||
|
|
||||||
.. option:: -DMACRO_VARIABLE=MACRO_EXPRESSION
|
.. option:: -DMACRO_VARIABLE=MACRO_EXPRESSION
|
||||||
|
|
||||||
Defines a macro-variable from the command line (the same
|
Defines a macro-variable from the command line (the same effect as
|
||||||
effect as using the Macro directive ``@#define`` in a model
|
using the Macro directive ``@#define`` in a model file, see
|
||||||
file, see :ref:`macro-proc-lang`).
|
:ref:`macro-proc-lang`). See the :ref:`note on quotes<quote-note>` for
|
||||||
|
info on passing a ``MACRO_EXPRESSION`` argument containing spaces. Note
|
||||||
|
that an expression passed on the command line can reference variables
|
||||||
|
defined before it.
|
||||||
|
|
||||||
|
*Example*
|
||||||
|
|
||||||
|
Call dynare with command line defines
|
||||||
|
|
||||||
|
.. code-block:: matlab
|
||||||
|
|
||||||
|
>> dynare <<modfile.mod>> -DA=true '-DB="A string with space"' -DC=[1,2,3] '-DD=[ i in C when i > 1 ]'
|
||||||
|
|
||||||
.. option:: -I<<path>>
|
.. option:: -I<<path>>
|
||||||
|
|
||||||
Defines a path to search for files to be included by the
|
Defines a path to search for files to be included by the macro
|
||||||
macro processor (using the ``@#include`` command). Multiple
|
processor (using the ``@#include`` command). Multiple ``-I`` flags can
|
||||||
``-I`` flags can be passed on the command line. The paths will
|
be passed on the command line. The paths will be searched in the order
|
||||||
be searched in the order that the ``-I`` flags are passed and
|
that the ``-I`` flags are passed and the first matching file will be
|
||||||
the first matching file will be used. The flags passed here
|
used. The flags passed here take priority over those passed to
|
||||||
take priority over those passed to ``@#includepath``.
|
``@#includepath``. See the :ref:`note on quotes<quote-note>` for info
|
||||||
|
on passing a ``<<path>>`` argument containing spaces.
|
||||||
|
|
||||||
.. option:: nostrict
|
.. option:: nostrict
|
||||||
|
|
||||||
|
@ -475,13 +501,14 @@ by the ``dynare`` command.
|
||||||
after the name of the ``.mod`` file. They can alternatively be
|
after the name of the ``.mod`` file. They can alternatively be
|
||||||
defined in the first line of the ``.mod`` file, this avoids typing
|
defined in the first line of the ``.mod`` file, this avoids typing
|
||||||
them on the command line each time a ``.mod`` file is to be
|
them on the command line each time a ``.mod`` file is to be
|
||||||
run. This line must be a Dynare comment (ie must begin with //)
|
run. This line must be a Dynare one-line comment (i.e. must begin with ``//``)
|
||||||
and the options must be comma separated between ``--+`` options:
|
and the options must be whitespace separated between ``--+ options:``
|
||||||
and ``+--``. Note that any text after the ``+--`` will be
|
and ``+--``. Note that any text after the ``+--`` will be
|
||||||
discarded. As in the command line, if an option admits a value the
|
discarded. As in the command line, if an option admits a value the
|
||||||
equal symbol must not be surrounded by spaces. For instance ``json
|
equal symbol must not be surrounded by spaces. For instance ``json
|
||||||
= compute`` is not correct, and should be written
|
= compute`` is not correct, and should be written
|
||||||
``json=compute``.
|
``json=compute``. The ``nopathchange`` option cannot be specified in
|
||||||
|
this way, it must be passed on the command-line.
|
||||||
|
|
||||||
*Output*
|
*Output*
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -52,7 +52,7 @@ class DynareLexer(RegexLexer):
|
||||||
"save_params_and_steady_state","load_params_and_steady_state",
|
"save_params_and_steady_state","load_params_and_steady_state",
|
||||||
"dynare_version","write_latex_definitions","write_latex_parameter_table",
|
"dynare_version","write_latex_definitions","write_latex_parameter_table",
|
||||||
"write_latex_prior_table","collect_latex_files","prior_function",
|
"write_latex_prior_table","collect_latex_files","prior_function",
|
||||||
"posterior_function","generate_trace_plots")
|
"posterior_function","generate_trace_plots","evaluate_planner_objective")
|
||||||
|
|
||||||
report_commands = ("report","addPage","addSection","addGraph","addTable",
|
report_commands = ("report","addPage","addSection","addGraph","addTable",
|
||||||
"addSeries","addParagraph","addVspace","write","compile")
|
"addSeries","addParagraph","addVspace","write","compile")
|
||||||
|
@ -73,7 +73,7 @@ class DynareLexer(RegexLexer):
|
||||||
(r'\s*(%|//).*$', Comment),
|
(r'\s*(%|//).*$', Comment),
|
||||||
|
|
||||||
(words((
|
(words((
|
||||||
'model','steady_state_model','initval','endval','histval',
|
'model','steady_state_model','initval','endval','histval','epilogue',
|
||||||
'shocks','mshocks','homotopy_setup','observation_trends',
|
'shocks','mshocks','homotopy_setup','observation_trends',
|
||||||
'estimated_params','estimated_params_init','estimated_params_bounds',
|
'estimated_params','estimated_params_init','estimated_params_bounds',
|
||||||
'shock_groups','conditional_forecast_paths','optim_weights',
|
'shock_groups','conditional_forecast_paths','optim_weights',
|
||||||
|
@ -92,7 +92,6 @@ class DynareLexer(RegexLexer):
|
||||||
|
|
||||||
(r'\s*[a-zA-Z_]\s*', Name),
|
(r'\s*[a-zA-Z_]\s*', Name),
|
||||||
|
|
||||||
|
|
||||||
(r'\s*(\d+\.\d+|\d*\.\d+)([eEf][+-]?[0-9]+)?\s*', Number.Float),
|
(r'\s*(\d+\.\d+|\d*\.\d+)([eEf][+-]?[0-9]+)?\s*', Number.Float),
|
||||||
(r'\s*\d+[eEf][+-]?[0-9]+\s*', Number.Float),
|
(r'\s*\d+[eEf][+-]?[0-9]+\s*', Number.Float),
|
||||||
(r'\s*\d+\s*', Number.Integer),
|
(r'\s*\d+\s*', Number.Integer),
|
||||||
|
|
|
@ -1 +1,11 @@
|
||||||
SUBDIRS = utils/cc sylv parser/cc tl doc integ kord src tests
|
SUBDIRS = utils/cc sylv parser/cc tl doc integ kord src tests
|
||||||
|
|
||||||
|
EXTRA_DIST = dynare_simul
|
||||||
|
|
||||||
|
install-exec-local:
|
||||||
|
$(MKDIR_P) $(DESTDIR)$(pkglibdir)/dynare++
|
||||||
|
cp -r dynare_simul/* $(DESTDIR)$(pkglibdir)/dynare++
|
||||||
|
|
||||||
|
uninstall-local:
|
||||||
|
rm -rf $(DESTDIR)$(pkglibdir)/dynare++
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,176 @@
|
||||||
|
%
|
||||||
|
% SYNOPSIS
|
||||||
|
%
|
||||||
|
% r = dynare_simul(name, shocks)
|
||||||
|
% r = dynare_simul(name, prefix, shocks)
|
||||||
|
% r = dynare_simul(name, shocks, start)
|
||||||
|
% r = dynare_simul(name, prefix, shocks, start)
|
||||||
|
%
|
||||||
|
% name name of MAT-file produced by dynare++
|
||||||
|
% prefix prefix of variables in the MAT-file
|
||||||
|
% shocks matrix of shocks
|
||||||
|
% start zero period value
|
||||||
|
%
|
||||||
|
% Note that this file requires the dynare_simul_ DLL to be in the path.
|
||||||
|
% This DLL is distributed with Dynare, under the mex/matlab or mex/octave
|
||||||
|
% subdirectory.
|
||||||
|
%
|
||||||
|
% SEMANTICS
|
||||||
|
%
|
||||||
|
% The command reads a decision rule from the MAT-file having the given
|
||||||
|
% prefix. Then it starts simulating the decision rule with zero time value
|
||||||
|
% equal to the given start. It uses the given shocks for the simulation. If
|
||||||
|
% the start is not given, the state about which the decision rule is
|
||||||
|
% centralized is taken (called fix point, or stochastic steady state, take
|
||||||
|
% your pick).
|
||||||
|
%
|
||||||
|
% prefix Use the prefix with which you called dynare++, the default
|
||||||
|
% prefix in dynare++ is 'dyn'.
|
||||||
|
% shocks Number of rows must be a number of exogenous shocks,
|
||||||
|
% number of columns gives the number of simulated
|
||||||
|
% periods. NaNs and Infs in the matrix are substitued by
|
||||||
|
% draws from the normal distribution using the covariance
|
||||||
|
% matrix given in the model file.
|
||||||
|
% start Vector of endogenous variables in the ordering given by
|
||||||
|
% <prefix>_vars.
|
||||||
|
%
|
||||||
|
% Seed for random generator is derived from calling rand(1,1). Therefore,
|
||||||
|
% seeding can be controlled with rand('state') and rand('state',some_seed).
|
||||||
|
%
|
||||||
|
% EXAMPLES
|
||||||
|
%
|
||||||
|
% All examples suppose that the prefix is 'dyn' and that your_model.mat
|
||||||
|
% has been loaded into Matlab.
|
||||||
|
%
|
||||||
|
% 1. response to permanent negative shock to the third exo var EPS3 for
|
||||||
|
% 100 periods
|
||||||
|
%
|
||||||
|
% shocks = zeros(4,100); % 4 exogenous variables in the model
|
||||||
|
% shocks(dyn_i_EPS3,:) = -0.1; % the permanent shock to EPS3
|
||||||
|
% r = dynare_simul('your_model.mat',shocks);
|
||||||
|
%
|
||||||
|
% 2. one stochastic simulation for 100 periods
|
||||||
|
%
|
||||||
|
% shocks = zeros(4,100)./0; % put NaNs everywhere
|
||||||
|
% r = dynare_simul('your_model.mat',shocks);
|
||||||
|
%
|
||||||
|
% 3. one stochastic simulation starting at 75% undercapitalized economy
|
||||||
|
%
|
||||||
|
% shocks = zeros(4,100)./0; % put NaNs everywhere
|
||||||
|
% ystart = dyn_ss; % get copy of DR fix point
|
||||||
|
% ystart(dyn_i_K) = 0.75*dyn_ss(dyn_i_K); % scale down the capital
|
||||||
|
% r = dynare_simul('your_model.mat',shocks,ystart);
|
||||||
|
%
|
||||||
|
%
|
||||||
|
% SEE ALSO
|
||||||
|
%
|
||||||
|
% "DSGE Models with Dynare++. A Tutorial.", Ondra Kamenik, 2005
|
||||||
|
|
||||||
|
% Copyright (C) 2005-2011, Ondra Kamenik
|
||||||
|
% Copyright (C) 2020, Dynare Team
|
||||||
|
|
||||||
|
|
||||||
|
function r = dynare_simul(varargin)
|
||||||
|
|
||||||
|
if ~exist('dynare_simul_','file')
|
||||||
|
error('Can''t find dynare_simul_ DLL in the path. The simplest way to add it is to run Dynare once in this session.')
|
||||||
|
end
|
||||||
|
|
||||||
|
% get the file name and load data
|
||||||
|
fname = varargin{1};
|
||||||
|
load(fname);
|
||||||
|
|
||||||
|
% set prefix, shocks, ystart
|
||||||
|
if ischar(varargin{2})
|
||||||
|
prefix = varargin{2};
|
||||||
|
if length(varargin) == 3
|
||||||
|
shocks = varargin{3};
|
||||||
|
ystart = NaN;
|
||||||
|
elseif length(varargin) == 4
|
||||||
|
shocks = varargin{3};
|
||||||
|
ystart = varargin{4};
|
||||||
|
else
|
||||||
|
error('Wrong number of parameters.');
|
||||||
|
end
|
||||||
|
else
|
||||||
|
prefix = 'dyn';
|
||||||
|
if length(varargin) == 2
|
||||||
|
shocks = varargin{2};
|
||||||
|
ystart = NaN;
|
||||||
|
elseif length(varargin) == 3
|
||||||
|
shocks = varargin{2};
|
||||||
|
ystart = varargin{3};
|
||||||
|
else
|
||||||
|
error('Wrong number of parameters.');
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
% load all needed variables but prefix_g_*
|
||||||
|
if exist([prefix '_nstat'],'var')
|
||||||
|
nstat = eval([prefix '_nstat']);
|
||||||
|
else
|
||||||
|
error(['Could not find variable ' prefix '_nstat in workspace']);
|
||||||
|
end
|
||||||
|
if exist([prefix '_npred'],'var')
|
||||||
|
npred = eval([prefix '_npred']);
|
||||||
|
else
|
||||||
|
error(['Could not find variable ' prefix '_npred in workspace']);
|
||||||
|
end
|
||||||
|
if exist([prefix '_nboth'],'var')
|
||||||
|
nboth = eval([prefix '_nboth']);
|
||||||
|
else
|
||||||
|
error(['Could not find variable ' prefix '_nboth in workspace']);
|
||||||
|
end
|
||||||
|
if exist([prefix '_nforw'],'var')
|
||||||
|
nforw = eval([prefix '_nforw']);
|
||||||
|
else
|
||||||
|
error(['Could not find variable ' prefix '_nforw in workspace']);
|
||||||
|
end
|
||||||
|
if exist([prefix '_ss'],'var')
|
||||||
|
ss = eval([prefix '_ss']);
|
||||||
|
else
|
||||||
|
error(['Could not find variable ' prefix '_ss in workspace']);
|
||||||
|
end
|
||||||
|
if exist([prefix '_vcov_exo'],'var')
|
||||||
|
vcov_exo = eval([prefix '_vcov_exo']);
|
||||||
|
else
|
||||||
|
error(['Could not find variable ' prefix '_vcov_exo in workspace']);
|
||||||
|
end
|
||||||
|
nexog = size(vcov_exo,1);
|
||||||
|
|
||||||
|
if isnan(ystart)
|
||||||
|
ystart = ss;
|
||||||
|
end
|
||||||
|
|
||||||
|
% newer version of dynare++ doesn't return prefix_g_0, we make it here if
|
||||||
|
% it does not exist in workspace
|
||||||
|
g_zero = [prefix '_g_0'];
|
||||||
|
if ~exist(g_zero,'var')
|
||||||
|
dr.g_0=zeros(nstat+npred+nboth+nforw,1);
|
||||||
|
else
|
||||||
|
dr.g_0=eval(g_zero);
|
||||||
|
end
|
||||||
|
|
||||||
|
% make derstr a string of comma seperated existing prefix_g_*
|
||||||
|
order = 1;
|
||||||
|
cont = 1;
|
||||||
|
while cont == 1
|
||||||
|
g_ord = [prefix '_g_' num2str(order)];
|
||||||
|
if exist(g_ord,'var')
|
||||||
|
dr.(['g_' num2str(order)])=eval(g_ord);
|
||||||
|
order = order + 1;
|
||||||
|
else
|
||||||
|
cont = 0;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
% set seed
|
||||||
|
seed = ceil(10000*rand(1,1));
|
||||||
|
|
||||||
|
% call dynare_simul_
|
||||||
|
[err,r]=dynare_simul_(order-1,nstat,npred,nboth,nforw,...
|
||||||
|
nexog,ystart,shocks,vcov_exo,seed,ss,dr);
|
||||||
|
|
||||||
|
if err
|
||||||
|
error('Simulation failed')
|
||||||
|
end
|
|
@ -29,13 +29,15 @@
|
||||||
static const int gh_num_levels = 26;
|
static const int gh_num_levels = 26;
|
||||||
|
|
||||||
// Number of points in each level
|
// Number of points in each level
|
||||||
static const int gh_num_points[] = {
|
static const int gh_num_points[] =
|
||||||
|
{
|
||||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
||||||
30, 32, 40, 50, 60, 64
|
30, 32, 40, 50, 60, 64
|
||||||
};
|
};
|
||||||
|
|
||||||
// Weights, starting with the first level
|
// Weights, starting with the first level
|
||||||
static const double gh_weights[] = {
|
static const double gh_weights[] =
|
||||||
|
{
|
||||||
// weights 1 = √π
|
// weights 1 = √π
|
||||||
1.77245385090551588191942755656782537698745727539062,
|
1.77245385090551588191942755656782537698745727539062,
|
||||||
// weights 2
|
// weights 2
|
||||||
|
@ -548,10 +550,11 @@ static const double gh_weights[] = {
|
||||||
0.342113801099e-38,
|
0.342113801099e-38,
|
||||||
0.167974799010e-42,
|
0.167974799010e-42,
|
||||||
0.553570653584e-48
|
0.553570653584e-48
|
||||||
};
|
};
|
||||||
|
|
||||||
// Points, starting with the first level
|
// Points, starting with the first level
|
||||||
static const double gh_points[] = {
|
static const double gh_points[] =
|
||||||
|
{
|
||||||
// points 1
|
// points 1
|
||||||
0.0,
|
0.0,
|
||||||
// points 2
|
// points 2
|
||||||
|
@ -1064,7 +1067,7 @@ static const double gh_points[] = {
|
||||||
9.37315954965e+00,
|
9.37315954965e+00,
|
||||||
9.89528758683e+00,
|
9.89528758683e+00,
|
||||||
10.5261231680e+00
|
10.5261231680e+00
|
||||||
};
|
};
|
||||||
|
|
||||||
// Gauss-Legendre quadrature; prefix gl
|
// Gauss-Legendre quadrature; prefix gl
|
||||||
|
|
||||||
|
@ -1072,13 +1075,15 @@ static const double gh_points[] = {
|
||||||
static const int gl_num_levels = 22;
|
static const int gl_num_levels = 22;
|
||||||
|
|
||||||
// Number of points in each level
|
// Number of points in each level
|
||||||
static const int gl_num_points[] = {
|
static const int gl_num_points[] =
|
||||||
|
{
|
||||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
|
||||||
32, 64
|
32, 64
|
||||||
};
|
};
|
||||||
|
|
||||||
// Weights, starting with the first level
|
// Weights, starting with the first level
|
||||||
static const double gl_weights[] = {
|
static const double gl_weights[] =
|
||||||
|
{
|
||||||
// weight 1
|
// weight 1
|
||||||
2.0e+00,
|
2.0e+00,
|
||||||
// weights 2
|
// weights 2
|
||||||
|
@ -1407,10 +1412,11 @@ static const double gl_weights[] = {
|
||||||
0.650445796897836285611736039998e-02,
|
0.650445796897836285611736039998e-02,
|
||||||
0.414703326056246763528753572855e-02,
|
0.414703326056246763528753572855e-02,
|
||||||
0.178328072169643294729607914497e-02
|
0.178328072169643294729607914497e-02
|
||||||
};
|
};
|
||||||
|
|
||||||
// Points, starting with the first level
|
// Points, starting with the first level
|
||||||
static const double gl_points[] = {
|
static const double gl_points[] =
|
||||||
|
{
|
||||||
// points 1
|
// points 1
|
||||||
0.0e+00,
|
0.0e+00,
|
||||||
// points 2
|
// points 2
|
||||||
|
@ -1739,4 +1745,4 @@ static const double gl_points[] = {
|
||||||
0.991013371476744320739382383443e+00,
|
0.991013371476744320739382383443e+00,
|
||||||
0.996340116771955279346924500676e+00,
|
0.996340116771955279346924500676e+00,
|
||||||
0.999305041735772139456905624346e+00
|
0.999305041735772139456905624346e+00
|
||||||
};
|
};
|
||||||
|
|
|
@ -109,10 +109,10 @@ public:
|
||||||
|
|
||||||
See QuadratureImpl class declaration for details. */
|
See QuadratureImpl class declaration for details. */
|
||||||
|
|
||||||
template <typename _Tpit>
|
template<typename _Tpit>
|
||||||
class QuadratureImpl;
|
class QuadratureImpl;
|
||||||
|
|
||||||
template <typename _Tpit>
|
template<typename _Tpit>
|
||||||
class IntegrationWorker : public sthread::detach_thread
|
class IntegrationWorker : public sthread::detach_thread
|
||||||
{
|
{
|
||||||
const QuadratureImpl<_Tpit> &quad;
|
const QuadratureImpl<_Tpit> &quad;
|
||||||
|
@ -168,7 +168,7 @@ public:
|
||||||
In addition, we define a method which saves all the points to a given file.
|
In addition, we define a method which saves all the points to a given file.
|
||||||
Only for debugging purposes. */
|
Only for debugging purposes. */
|
||||||
|
|
||||||
template <typename _Tpit>
|
template<typename _Tpit>
|
||||||
class QuadratureImpl : public Quadrature
|
class QuadratureImpl : public Quadrature
|
||||||
{
|
{
|
||||||
friend class IntegrationWorker<_Tpit>;
|
friend class IntegrationWorker<_Tpit>;
|
||||||
|
|
|
@ -106,7 +106,8 @@ RadicalInverse::print() const
|
||||||
/* Here we have the first 170 primes. This means that we are not able to
|
/* Here we have the first 170 primes. This means that we are not able to
|
||||||
integrate dimensions greater than 170. */
|
integrate dimensions greater than 170. */
|
||||||
|
|
||||||
std::array<int, 170> HaltonSequence::primes = {
|
std::array<int, 170> HaltonSequence::primes =
|
||||||
|
{
|
||||||
2, 3, 5, 7, 11, 13, 17, 19, 23, 29,
|
2, 3, 5, 7, 11, 13, 17, 19, 23, 29,
|
||||||
31, 37, 41, 43, 47, 53, 59, 61, 67, 71,
|
31, 37, 41, 43, 47, 53, 59, 61, 67, 71,
|
||||||
73, 79, 83, 89, 97, 101, 103, 107, 109, 113,
|
73, 79, 83, 89, 97, 101, 103, 107, 109, 113,
|
||||||
|
@ -124,7 +125,7 @@ std::array<int, 170> HaltonSequence::primes = {
|
||||||
811, 821, 823, 827, 829, 839, 853, 857, 859, 863,
|
811, 821, 823, 827, 829, 839, 853, 857, 859, 863,
|
||||||
877, 881, 883, 887, 907, 911, 919, 929, 937, 941,
|
877, 881, 883, 887, 907, 911, 919, 929, 937, 941,
|
||||||
947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013
|
947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013
|
||||||
};
|
};
|
||||||
|
|
||||||
/* This takes first ‘dim’ primes and constructs ‘dim’ radical inverses and
|
/* This takes first ‘dim’ primes and constructs ‘dim’ radical inverses and
|
||||||
calls eval(). */
|
calls eval(). */
|
||||||
|
@ -145,7 +146,7 @@ HaltonSequence::HaltonSequence(int n, int mxn, int dim, const PermutationScheme
|
||||||
void
|
void
|
||||||
HaltonSequence::increase()
|
HaltonSequence::increase()
|
||||||
{
|
{
|
||||||
for (auto & i : ri)
|
for (auto &i : ri)
|
||||||
i.increase();
|
i.increase();
|
||||||
num++;
|
num++;
|
||||||
if (num <= maxn)
|
if (num <= maxn)
|
||||||
|
@ -165,7 +166,7 @@ void
|
||||||
HaltonSequence::print() const
|
HaltonSequence::print() const
|
||||||
{
|
{
|
||||||
auto ff = std::cout.flags();
|
auto ff = std::cout.flags();
|
||||||
for (const auto & i : ri)
|
for (const auto &i : ri)
|
||||||
i.print();
|
i.print();
|
||||||
std::cout << "point=[ "
|
std::cout << "point=[ "
|
||||||
<< std::fixed << std::setprecision(6);
|
<< std::fixed << std::setprecision(6);
|
||||||
|
|
|
@ -70,7 +70,6 @@ VectorFunctionSet::VectorFunctionSet(VectorFunction &f, int n)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Here we construct the object from the given function f and given
|
/* Here we construct the object from the given function f and given
|
||||||
variance-covariance matrix Σ=vcov. The matrix A is calculated as lower
|
variance-covariance matrix Σ=vcov. The matrix A is calculated as lower
|
||||||
triangular and yields Σ=AAᵀ. */
|
triangular and yields Σ=AAᵀ. */
|
||||||
|
|
|
@ -47,7 +47,7 @@ struct QuadParams
|
||||||
QuadParams(int argc, char **argv);
|
QuadParams(int argc, char **argv);
|
||||||
void check_consistency() const;
|
void check_consistency() const;
|
||||||
private:
|
private:
|
||||||
enum class opt {max_level, discard_weight, vcov};
|
enum class opt { max_level, discard_weight, vcov };
|
||||||
};
|
};
|
||||||
|
|
||||||
QuadParams::QuadParams(int argc, char **argv)
|
QuadParams::QuadParams(int argc, char **argv)
|
||||||
|
@ -62,7 +62,7 @@ QuadParams::QuadParams(int argc, char **argv)
|
||||||
outname = argv[argc-1];
|
outname = argv[argc-1];
|
||||||
argc--;
|
argc--;
|
||||||
|
|
||||||
struct option const opts [] = {
|
struct option const opts[] = {
|
||||||
{"max-level", required_argument, nullptr, static_cast<int>(opt::max_level)},
|
{"max-level", required_argument, nullptr, static_cast<int>(opt::max_level)},
|
||||||
{"discard-weight", required_argument, nullptr, static_cast<int>(opt::discard_weight)},
|
{"discard-weight", required_argument, nullptr, static_cast<int>(opt::discard_weight)},
|
||||||
{"vcov", required_argument, nullptr, static_cast<int>(opt::vcov)},
|
{"vcov", required_argument, nullptr, static_cast<int>(opt::vcov)},
|
||||||
|
@ -188,7 +188,7 @@ main(int argc, char **argv)
|
||||||
// Calculate weights and mass
|
// Calculate weights and mass
|
||||||
double mass = 0.0;
|
double mass = 0.0;
|
||||||
std::vector<double> weights;
|
std::vector<double> weights;
|
||||||
for (auto & point : points)
|
for (auto &point : points)
|
||||||
{
|
{
|
||||||
weights.push_back(std::exp(-point->dot(*point)));
|
weights.push_back(std::exp(-point->dot(*point)));
|
||||||
mass += weights.back();
|
mass += weights.back();
|
||||||
|
|
|
@ -51,7 +51,7 @@ Approximation::Approximation(DynamicModel &m, Journal &j, int ns, bool dr_centr,
|
||||||
: model(m), journal(j),
|
: model(m), journal(j),
|
||||||
ypart(model.nstat(), model.npred(), model.nboth(), model.nforw()),
|
ypart(model.nstat(), model.npred(), model.nboth(), model.nforw()),
|
||||||
mom(UNormalMoments(model.order(), model.getVcov())),
|
mom(UNormalMoments(model.order(), model.getVcov())),
|
||||||
nvs{ypart.nys(), model.nexog(), model.nexog(), 1 },
|
nvs{ypart.nys(), model.nexog(), model.nexog(), 1},
|
||||||
steps(ns),
|
steps(ns),
|
||||||
dr_centralize(dr_centr), qz_criterium(qz_crit), ss(ypart.ny(), steps+1)
|
dr_centralize(dr_centr), qz_criterium(qz_crit), ss(ypart.ny(), steps+1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -120,7 +120,7 @@ public:
|
||||||
Storage::unfold. So, there are two implementations of the DecisionRule
|
Storage::unfold. So, there are two implementations of the DecisionRule
|
||||||
interface. */
|
interface. */
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
class DecisionRuleImpl : public ctraits<t>::Tpol, public DecisionRule
|
class DecisionRuleImpl : public ctraits<t>::Tpol, public DecisionRule
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
@ -180,6 +180,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
void fillTensors(const _Tg &g, double sigma);
|
void fillTensors(const _Tg &g, double sigma);
|
||||||
void centralize(const DecisionRuleImpl &dr);
|
void centralize(const DecisionRuleImpl &dr);
|
||||||
|
public:
|
||||||
void eval(emethod em, Vector &out, const ConstVector &v) const override;
|
void eval(emethod em, Vector &out, const ConstVector &v) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -219,7 +220,7 @@ protected:
|
||||||
So we go through i+j=d=0…q and in each loop we form the fully symmetric
|
So we go through i+j=d=0…q and in each loop we form the fully symmetric
|
||||||
tensor [g_(yu)ᵈ] and insert it to the container. */
|
tensor [g_(yu)ᵈ] and insert it to the container. */
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
void
|
void
|
||||||
DecisionRuleImpl<t>::fillTensors(const _Tg &g, double sigma)
|
DecisionRuleImpl<t>::fillTensors(const _Tg &g, double sigma)
|
||||||
{
|
{
|
||||||
|
@ -276,7 +277,7 @@ DecisionRuleImpl<t>::fillTensors(const _Tg &g, double sigma)
|
||||||
|
|
||||||
where ȳ is the steady state of the original rule ‘dr’. */
|
where ȳ is the steady state of the original rule ‘dr’. */
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
void
|
void
|
||||||
DecisionRuleImpl<t>::centralize(const DecisionRuleImpl &dr)
|
DecisionRuleImpl<t>::centralize(const DecisionRuleImpl &dr)
|
||||||
{
|
{
|
||||||
|
@ -309,7 +310,7 @@ DecisionRuleImpl<t>::centralize(const DecisionRuleImpl &dr)
|
||||||
canceled from ‘ystart’, we simulate, and at the end ‘ysteady’ is added to
|
canceled from ‘ystart’, we simulate, and at the end ‘ysteady’ is added to
|
||||||
all columns of the result. */
|
all columns of the result. */
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
TwoDMatrix
|
TwoDMatrix
|
||||||
DecisionRuleImpl<t>::simulate(emethod em, int np, const ConstVector &ystart,
|
DecisionRuleImpl<t>::simulate(emethod em, int np, const ConstVector &ystart,
|
||||||
ShockRealization &sr) const
|
ShockRealization &sr) const
|
||||||
|
@ -377,7 +378,7 @@ DecisionRuleImpl<t>::simulate(emethod em, int np, const ConstVector &ystart,
|
||||||
steady state (fix point) is cancelled and added once. Hence we have two
|
steady state (fix point) is cancelled and added once. Hence we have two
|
||||||
special methods. */
|
special methods. */
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
void
|
void
|
||||||
DecisionRuleImpl<t>::evaluate(emethod em, Vector &out, const ConstVector &ys,
|
DecisionRuleImpl<t>::evaluate(emethod em, Vector &out, const ConstVector &ys,
|
||||||
const ConstVector &u) const
|
const ConstVector &u) const
|
||||||
|
@ -400,7 +401,7 @@ DecisionRuleImpl<t>::evaluate(emethod em, Vector &out, const ConstVector &ys,
|
||||||
/* This is easy. We just return the newly created copy using the centralized
|
/* This is easy. We just return the newly created copy using the centralized
|
||||||
constructor. */
|
constructor. */
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
std::unique_ptr<DecisionRule>
|
std::unique_ptr<DecisionRule>
|
||||||
DecisionRuleImpl<t>::centralizedClone(const Vector &fixpoint) const
|
DecisionRuleImpl<t>::centralizedClone(const Vector &fixpoint) const
|
||||||
{
|
{
|
||||||
|
@ -410,7 +411,7 @@ DecisionRuleImpl<t>::centralizedClone(const Vector &fixpoint) const
|
||||||
/* Here we only encapsulate two implementations to one, deciding according to
|
/* Here we only encapsulate two implementations to one, deciding according to
|
||||||
the parameter. */
|
the parameter. */
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
void
|
void
|
||||||
DecisionRuleImpl<t>::eval(emethod em, Vector &out, const ConstVector &v) const
|
DecisionRuleImpl<t>::eval(emethod em, Vector &out, const ConstVector &v) const
|
||||||
{
|
{
|
||||||
|
@ -422,7 +423,7 @@ DecisionRuleImpl<t>::eval(emethod em, Vector &out, const ConstVector &v) const
|
||||||
|
|
||||||
/* Write the decision rule and steady state to the MAT file. */
|
/* Write the decision rule and steady state to the MAT file. */
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
void
|
void
|
||||||
DecisionRuleImpl<t>::writeMat(mat_t *fd, const std::string &prefix) const
|
DecisionRuleImpl<t>::writeMat(mat_t *fd, const std::string &prefix) const
|
||||||
{
|
{
|
||||||
|
@ -505,7 +506,7 @@ public:
|
||||||
F is given by its derivatives ‘bigf’. The Jacobian of the solved system is
|
F is given by its derivatives ‘bigf’. The Jacobian of the solved system is
|
||||||
given by derivatives stored in ‘bigfder’. */
|
given by derivatives stored in ‘bigfder’. */
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
class DRFixPoint : public ctraits<t>::Tpol
|
class DRFixPoint : public ctraits<t>::Tpol
|
||||||
{
|
{
|
||||||
using _Tpol = typename ctraits<t>::Tpol;
|
using _Tpol = typename ctraits<t>::Tpol;
|
||||||
|
@ -556,7 +557,7 @@ private:
|
||||||
first derivative (Symmetry{1}). Then the derivative of the F polynomial is
|
first derivative (Symmetry{1}). Then the derivative of the F polynomial is
|
||||||
calculated. */
|
calculated. */
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
DRFixPoint<t>::DRFixPoint(const _Tg &g, const PartitionY &yp,
|
DRFixPoint<t>::DRFixPoint(const _Tg &g, const PartitionY &yp,
|
||||||
const Vector &ys, double sigma)
|
const Vector &ys, double sigma)
|
||||||
: ctraits<t>::Tpol(yp.ny(), yp.nys()),
|
: ctraits<t>::Tpol(yp.ny(), yp.nys()),
|
||||||
|
@ -576,7 +577,7 @@ DRFixPoint<t>::DRFixPoint(const _Tg &g, const PartitionY &yp,
|
||||||
such that ‘d+k’ is between the maximum dimension and ‘d’, and add
|
such that ‘d+k’ is between the maximum dimension and ‘d’, and add
|
||||||
σᵏ/(d!k!)[g_yᵈσᵏ] to the tensor [g_yᵈ]. */
|
σᵏ/(d!k!)[g_yᵈσᵏ] to the tensor [g_yᵈ]. */
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
void
|
void
|
||||||
DRFixPoint<t>::fillTensors(const _Tg &g, double sigma)
|
DRFixPoint<t>::fillTensors(const _Tg &g, double sigma)
|
||||||
{
|
{
|
||||||
|
@ -611,7 +612,7 @@ DRFixPoint<t>::fillTensors(const _Tg &g, double sigma)
|
||||||
underrelaxation parameter ‘urelax’, which improves the residual. If ‘urelax’
|
underrelaxation parameter ‘urelax’, which improves the residual. If ‘urelax’
|
||||||
is less that ‘urelax_threshold’, we stop searching and stop the Newton. */
|
is less that ‘urelax_threshold’, we stop searching and stop the Newton. */
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
bool
|
bool
|
||||||
DRFixPoint<t>::solveNewton(Vector &y)
|
DRFixPoint<t>::solveNewton(Vector &y)
|
||||||
{
|
{
|
||||||
|
@ -665,7 +666,7 @@ DRFixPoint<t>::solveNewton(Vector &y)
|
||||||
flastnorm = fnorm;
|
flastnorm = fnorm;
|
||||||
}
|
}
|
||||||
while (!converged && newton_iter_last < max_newton_iter
|
while (!converged && newton_iter_last < max_newton_iter
|
||||||
&&urelax > urelax_threshold);
|
&& urelax > urelax_threshold);
|
||||||
|
|
||||||
newton_iter_total += newton_iter_last;
|
newton_iter_total += newton_iter_last;
|
||||||
if (!converged)
|
if (!converged)
|
||||||
|
@ -687,7 +688,7 @@ DRFixPoint<t>::solveNewton(Vector &y)
|
||||||
|
|
||||||
The ‘out’ vector is not touched if the algorithm has not convered. */
|
The ‘out’ vector is not touched if the algorithm has not convered. */
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
bool
|
bool
|
||||||
DRFixPoint<t>::calcFixPoint(emethod em, Vector &out)
|
DRFixPoint<t>::calcFixPoint(emethod em, Vector &out)
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// Dynamic model abstraction
|
// Dynamic model abstraction
|
||||||
|
|
||||||
/* This file only defines a generic interface to a DSGE model. The model
|
/* This file only defines a generic interface to a DSGE model. The model
|
||||||
|
|
|
@ -57,7 +57,7 @@ public:
|
||||||
void calculate(const UnfoldedStackContainer &cont, const UGSContainer &g,
|
void calculate(const UnfoldedStackContainer &cont, const UGSContainer &g,
|
||||||
UGSTensor &out);
|
UGSTensor &out);
|
||||||
protected:
|
protected:
|
||||||
std::tuple<int,int,int> estimRefinement(const TensorDimens &tdims, int nr, int l);
|
std::tuple<int, int, int> estimRefinement(const TensorDimens &tdims, int nr, int l);
|
||||||
|
|
||||||
// See FaaDiBruno::calculate() folded sparse code for why we have magic_mult
|
// See FaaDiBruno::calculate() folded sparse code for why we have magic_mult
|
||||||
constexpr static double magic_mult = 1.5;
|
constexpr static double magic_mult = 1.5;
|
||||||
|
|
|
@ -31,7 +31,7 @@ template<Storage>
|
||||||
class FirstOrderDerivs;
|
class FirstOrderDerivs;
|
||||||
class FirstOrder
|
class FirstOrder
|
||||||
{
|
{
|
||||||
template <Storage>
|
template<Storage>
|
||||||
friend class FirstOrderDerivs;
|
friend class FirstOrderDerivs;
|
||||||
PartitionY ypart;
|
PartitionY ypart;
|
||||||
int nu;
|
int nu;
|
||||||
|
@ -89,7 +89,7 @@ protected:
|
||||||
/* This class only converts the derivatives g_y* and gᵤ to a folded or unfolded
|
/* This class only converts the derivatives g_y* and gᵤ to a folded or unfolded
|
||||||
container. */
|
container. */
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
class FirstOrderDerivs : public ctraits<t>::Tg
|
class FirstOrderDerivs : public ctraits<t>::Tg
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -26,18 +26,18 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#ifndef KORD_EXCEPTION_H
|
#ifndef KORD_EXCEPTION_H
|
||||||
#define KORD_EXCEPTION_H
|
# define KORD_EXCEPTION_H
|
||||||
|
|
||||||
#define KORD_RAISE(mes) \
|
# define KORD_RAISE(mes) \
|
||||||
throw KordException(__FILE__, __LINE__, mes);
|
throw KordException(__FILE__, __LINE__, mes);
|
||||||
|
|
||||||
#define KORD_RAISE_IF(expr, mes) \
|
# define KORD_RAISE_IF(expr, mes) \
|
||||||
if (expr) throw KordException(__FILE__, __LINE__, mes);
|
if (expr) throw KordException(__FILE__, __LINE__, mes);
|
||||||
|
|
||||||
#define KORD_RAISE_X(mes, c) \
|
# define KORD_RAISE_X(mes, c) \
|
||||||
throw KordException(__FILE__, __LINE__, mes, c);
|
throw KordException(__FILE__, __LINE__, mes, c);
|
||||||
|
|
||||||
#define KORD_RAISE_IF_X(expr, mes, c) \
|
# define KORD_RAISE_IF_X(expr, mes, c) \
|
||||||
if (expr) throw KordException(__FILE__, __LINE__, mes, c);
|
if (expr) throw KordException(__FILE__, __LINE__, mes, c);
|
||||||
|
|
||||||
class KordException
|
class KordException
|
||||||
|
|
|
@ -112,117 +112,173 @@ MatrixS::MatrixS(const FSSparseTensor &f, const IntSequence &ss,
|
||||||
interesting here. */
|
interesting here. */
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
ctraits<Storage::unfold>::Tg& KOrder::g<Storage::unfold>()
|
ctraits<Storage::unfold>::Tg &
|
||||||
|
KOrder::g<Storage::unfold>()
|
||||||
{
|
{
|
||||||
return _ug;
|
return _ug;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
const ctraits<Storage::unfold>::Tg& KOrder::g<Storage::unfold>() const
|
const ctraits<Storage::unfold>::Tg &
|
||||||
{ return _ug;}
|
KOrder::g<Storage::unfold>() const
|
||||||
|
{
|
||||||
|
return _ug;
|
||||||
|
}
|
||||||
template<>
|
template<>
|
||||||
ctraits<Storage::fold>::Tg& KOrder::g<Storage::fold>()
|
ctraits<Storage::fold>::Tg &
|
||||||
|
KOrder::g<Storage::fold>()
|
||||||
{
|
{
|
||||||
return _fg;
|
return _fg;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
const ctraits<Storage::fold>::Tg& KOrder::g<Storage::fold>() const
|
const ctraits<Storage::fold>::Tg &
|
||||||
{ return _fg;}
|
KOrder::g<Storage::fold>() const
|
||||||
|
{
|
||||||
|
return _fg;
|
||||||
|
}
|
||||||
template<>
|
template<>
|
||||||
ctraits<Storage::unfold>::Tgs& KOrder::gs<Storage::unfold>()
|
ctraits<Storage::unfold>::Tgs &
|
||||||
|
KOrder::gs<Storage::unfold>()
|
||||||
{
|
{
|
||||||
return _ugs;
|
return _ugs;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
const ctraits<Storage::unfold>::Tgs& KOrder::gs<Storage::unfold>() const
|
const ctraits<Storage::unfold>::Tgs &
|
||||||
{ return _ugs;}
|
KOrder::gs<Storage::unfold>() const
|
||||||
|
{
|
||||||
|
return _ugs;
|
||||||
|
}
|
||||||
template<>
|
template<>
|
||||||
ctraits<Storage::fold>::Tgs& KOrder::gs<Storage::fold>()
|
ctraits<Storage::fold>::Tgs &
|
||||||
|
KOrder::gs<Storage::fold>()
|
||||||
{
|
{
|
||||||
return _fgs;
|
return _fgs;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
const ctraits<Storage::fold>::Tgs& KOrder::gs<Storage::fold>() const
|
const ctraits<Storage::fold>::Tgs &
|
||||||
{ return _fgs;}
|
KOrder::gs<Storage::fold>() const
|
||||||
|
{
|
||||||
|
return _fgs;
|
||||||
|
}
|
||||||
template<>
|
template<>
|
||||||
ctraits<Storage::unfold>::Tgss& KOrder::gss<Storage::unfold>()
|
ctraits<Storage::unfold>::Tgss &
|
||||||
|
KOrder::gss<Storage::unfold>()
|
||||||
{
|
{
|
||||||
return _ugss;
|
return _ugss;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
const ctraits<Storage::unfold>::Tgss& KOrder::gss<Storage::unfold>() const
|
const ctraits<Storage::unfold>::Tgss &
|
||||||
{ return _ugss;}
|
KOrder::gss<Storage::unfold>() const
|
||||||
|
{
|
||||||
|
return _ugss;
|
||||||
|
}
|
||||||
template<>
|
template<>
|
||||||
ctraits<Storage::fold>::Tgss& KOrder::gss<Storage::fold>()
|
ctraits<Storage::fold>::Tgss &
|
||||||
|
KOrder::gss<Storage::fold>()
|
||||||
{
|
{
|
||||||
return _fgss;
|
return _fgss;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
const ctraits<Storage::fold>::Tgss& KOrder::gss<Storage::fold>() const
|
const ctraits<Storage::fold>::Tgss &
|
||||||
{ return _fgss;}
|
KOrder::gss<Storage::fold>() const
|
||||||
|
{
|
||||||
|
return _fgss;
|
||||||
|
}
|
||||||
template<>
|
template<>
|
||||||
ctraits<Storage::unfold>::TG& KOrder::G<Storage::unfold>()
|
ctraits<Storage::unfold>::TG &
|
||||||
|
KOrder::G<Storage::unfold>()
|
||||||
{
|
{
|
||||||
return _uG;
|
return _uG;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
const ctraits<Storage::unfold>::TG& KOrder::G<Storage::unfold>() const
|
const ctraits<Storage::unfold>::TG &
|
||||||
{ return _uG;}
|
KOrder::G<Storage::unfold>() const
|
||||||
|
{
|
||||||
|
return _uG;
|
||||||
|
}
|
||||||
template<>
|
template<>
|
||||||
ctraits<Storage::fold>::TG& KOrder::G<Storage::fold>()
|
ctraits<Storage::fold>::TG &
|
||||||
|
KOrder::G<Storage::fold>()
|
||||||
{
|
{
|
||||||
return _fG;
|
return _fG;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
const ctraits<Storage::fold>::TG& KOrder::G<Storage::fold>() const
|
const ctraits<Storage::fold>::TG &
|
||||||
{ return _fG;}
|
KOrder::G<Storage::fold>() const
|
||||||
|
{
|
||||||
|
return _fG;
|
||||||
|
}
|
||||||
template<>
|
template<>
|
||||||
ctraits<Storage::unfold>::TZstack& KOrder::Zstack<Storage::unfold>()
|
ctraits<Storage::unfold>::TZstack &
|
||||||
|
KOrder::Zstack<Storage::unfold>()
|
||||||
{
|
{
|
||||||
return _uZstack;
|
return _uZstack;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
const ctraits<Storage::unfold>::TZstack& KOrder::Zstack<Storage::unfold>() const
|
const ctraits<Storage::unfold>::TZstack &
|
||||||
{ return _uZstack;}
|
KOrder::Zstack<Storage::unfold>() const
|
||||||
|
{
|
||||||
|
return _uZstack;
|
||||||
|
}
|
||||||
template<>
|
template<>
|
||||||
ctraits<Storage::fold>::TZstack& KOrder::Zstack<Storage::fold>()
|
ctraits<Storage::fold>::TZstack &
|
||||||
|
KOrder::Zstack<Storage::fold>()
|
||||||
{
|
{
|
||||||
return _fZstack;
|
return _fZstack;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
const ctraits<Storage::fold>::TZstack& KOrder::Zstack<Storage::fold>() const
|
const ctraits<Storage::fold>::TZstack &
|
||||||
{ return _fZstack;}
|
KOrder::Zstack<Storage::fold>() const
|
||||||
|
{
|
||||||
|
return _fZstack;
|
||||||
|
}
|
||||||
template<>
|
template<>
|
||||||
ctraits<Storage::unfold>::TGstack& KOrder::Gstack<Storage::unfold>()
|
ctraits<Storage::unfold>::TGstack &
|
||||||
|
KOrder::Gstack<Storage::unfold>()
|
||||||
{
|
{
|
||||||
return _uGstack;
|
return _uGstack;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
const ctraits<Storage::unfold>::TGstack& KOrder::Gstack<Storage::unfold>() const
|
const ctraits<Storage::unfold>::TGstack &
|
||||||
{ return _uGstack;}
|
KOrder::Gstack<Storage::unfold>() const
|
||||||
|
{
|
||||||
|
return _uGstack;
|
||||||
|
}
|
||||||
template<>
|
template<>
|
||||||
ctraits<Storage::fold>::TGstack& KOrder::Gstack<Storage::fold>()
|
ctraits<Storage::fold>::TGstack &
|
||||||
|
KOrder::Gstack<Storage::fold>()
|
||||||
{
|
{
|
||||||
return _fGstack;
|
return _fGstack;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
const ctraits<Storage::fold>::TGstack& KOrder::Gstack<Storage::fold>() const
|
const ctraits<Storage::fold>::TGstack &
|
||||||
{ return _fGstack;}
|
KOrder::Gstack<Storage::fold>() const
|
||||||
|
{
|
||||||
|
return _fGstack;
|
||||||
|
}
|
||||||
template<>
|
template<>
|
||||||
ctraits<Storage::unfold>::Tm& KOrder::m<Storage::unfold>()
|
ctraits<Storage::unfold>::Tm &
|
||||||
|
KOrder::m<Storage::unfold>()
|
||||||
{
|
{
|
||||||
return _um;
|
return _um;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
const ctraits<Storage::unfold>::Tm& KOrder::m<Storage::unfold>() const
|
const ctraits<Storage::unfold>::Tm &
|
||||||
{ return _um;}
|
KOrder::m<Storage::unfold>() const
|
||||||
|
{
|
||||||
|
return _um;
|
||||||
|
}
|
||||||
template<>
|
template<>
|
||||||
ctraits<Storage::fold>::Tm& KOrder::m<Storage::fold>()
|
ctraits<Storage::fold>::Tm &
|
||||||
|
KOrder::m<Storage::fold>()
|
||||||
{
|
{
|
||||||
return _fm;
|
return _fm;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
const ctraits<Storage::fold>::Tm& KOrder::m<Storage::fold>() const
|
const ctraits<Storage::fold>::Tm &
|
||||||
{ return _fm;}
|
KOrder::m<Storage::fold>() const
|
||||||
|
{
|
||||||
|
return _fm;
|
||||||
|
}
|
||||||
|
|
||||||
/* Here is the constructor of the KOrder class. We pass what we have to. The
|
/* Here is the constructor of the KOrder class. We pass what we have to. The
|
||||||
partitioning of the y vector, a sparse container with model derivatives,
|
partitioning of the y vector, a sparse container with model derivatives,
|
||||||
|
|
|
@ -72,7 +72,7 @@ class UnfoldedZXContainer;
|
||||||
class FoldedGXContainer;
|
class FoldedGXContainer;
|
||||||
class UnfoldedGXContainer;
|
class UnfoldedGXContainer;
|
||||||
|
|
||||||
template <Storage type>
|
template<Storage type>
|
||||||
class ctraits
|
class ctraits
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -296,15 +296,15 @@ public:
|
||||||
|
|
||||||
/* Performs k-order step provided that k=2 or the k−1-th step has been
|
/* Performs k-order step provided that k=2 or the k−1-th step has been
|
||||||
run, this is the core method */
|
run, this is the core method */
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
void performStep(int order);
|
void performStep(int order);
|
||||||
|
|
||||||
/* Calculates residuals of all solved equations for k-order and reports their
|
/* Calculates residuals of all solved equations for k-order and reports their
|
||||||
sizes, it is runnable after k-order performStep() has been run */
|
sizes, it is runnable after k-order performStep() has been run */
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
double check(int dim) const;
|
double check(int dim) const;
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
Vector calcStochShift(int order, double sigma) const;
|
Vector calcStochShift(int order, double sigma) const;
|
||||||
void switchToFolded();
|
void switchToFolded();
|
||||||
const PartitionY &
|
const PartitionY &
|
||||||
|
@ -330,7 +330,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
/* Inserts a g derivative to the g container and also creates subtensors and
|
/* Inserts a g derivative to the g container and also creates subtensors and
|
||||||
insert them to g_y* and g_y** containers */
|
insert them to g_y* and g_y** containers */
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
void insertDerivative(std::unique_ptr<typename ctraits<t>::Ttensor> der);
|
void insertDerivative(std::unique_ptr<typename ctraits<t>::Ttensor> der);
|
||||||
|
|
||||||
/* Solves the sylvester equation (templated fold, and unfold) */
|
/* Solves the sylvester equation (templated fold, and unfold) */
|
||||||
|
@ -339,27 +339,27 @@ protected:
|
||||||
|
|
||||||
/* Calculates derivatives of F by Faà Di Bruno for the sparse container of
|
/* Calculates derivatives of F by Faà Di Bruno for the sparse container of
|
||||||
system derivatives and Z stack container */
|
system derivatives and Z stack container */
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
std::unique_ptr<typename ctraits<t>::Ttensor> faaDiBrunoZ(const Symmetry &sym) const;
|
std::unique_ptr<typename ctraits<t>::Ttensor> faaDiBrunoZ(const Symmetry &sym) const;
|
||||||
|
|
||||||
/* Calculates derivatives of G by Faà Di Bruno for the dense container g**
|
/* Calculates derivatives of G by Faà Di Bruno for the dense container g**
|
||||||
and G stack */
|
and G stack */
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
std::unique_ptr<typename ctraits<t>::Ttensor> faaDiBrunoG(const Symmetry &sym) const;
|
std::unique_ptr<typename ctraits<t>::Ttensor> faaDiBrunoG(const Symmetry &sym) const;
|
||||||
|
|
||||||
// Recovers g_y*ⁱ
|
// Recovers g_y*ⁱ
|
||||||
template<Storage t>
|
template<Storage t>
|
||||||
void recover_y(int i);
|
void recover_y(int i);
|
||||||
// Recovers g_y*ⁱuʲ
|
// Recovers g_y*ⁱuʲ
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
void recover_yu(int i, int j);
|
void recover_yu(int i, int j);
|
||||||
// Recovers g_y*ⁱσʲ
|
// Recovers g_y*ⁱσʲ
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
void recover_ys(int i, int j);
|
void recover_ys(int i, int j);
|
||||||
// Recovers g_y*ⁱuʲσᵏ
|
// Recovers g_y*ⁱuʲσᵏ
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
void recover_yus(int i, int j, int k);
|
void recover_yus(int i, int j, int k);
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
// Recovers g_σⁱ
|
// Recovers g_σⁱ
|
||||||
void recover_s(int i);
|
void recover_s(int i);
|
||||||
// Calculates specified derivatives of G and inserts them to the container
|
// Calculates specified derivatives of G and inserts them to the container
|
||||||
|
@ -367,26 +367,26 @@ protected:
|
||||||
void fillG(int i, int j, int k);
|
void fillG(int i, int j, int k);
|
||||||
|
|
||||||
// Calculates Dᵢⱼₖ
|
// Calculates Dᵢⱼₖ
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
typename ctraits<t>::Ttensor calcD_ijk(int i, int j, int k) const;
|
typename ctraits<t>::Ttensor calcD_ijk(int i, int j, int k) const;
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
typename ctraits<t>::Ttensor calcD_ik(int i, int k) const;
|
typename ctraits<t>::Ttensor calcD_ik(int i, int k) const;
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
typename ctraits<t>::Ttensor calcD_k(int k) const;
|
typename ctraits<t>::Ttensor calcD_k(int k) const;
|
||||||
|
|
||||||
// Calculates Eᵢⱼₖ
|
// Calculates Eᵢⱼₖ
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
typename ctraits<t>::Ttensor calcE_ijk(int i, int j, int k) const;
|
typename ctraits<t>::Ttensor calcE_ijk(int i, int j, int k) const;
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
typename ctraits<t>::Ttensor calcE_ik(int i, int k) const;
|
typename ctraits<t>::Ttensor calcE_ik(int i, int k) const;
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
typename ctraits<t>::Ttensor calcE_k(int k) const;
|
typename ctraits<t>::Ttensor calcE_k(int k) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Here we insert the result to the container. Along the insertion, we
|
/* Here we insert the result to the container. Along the insertion, we
|
||||||
also create subtensors and insert as well. */
|
also create subtensors and insert as well. */
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
void
|
void
|
||||||
KOrder::insertDerivative(std::unique_ptr<typename ctraits<t>::Ttensor> der)
|
KOrder::insertDerivative(std::unique_ptr<typename ctraits<t>::Ttensor> der)
|
||||||
{
|
{
|
||||||
|
@ -405,7 +405,7 @@ KOrder::insertDerivative(std::unique_ptr<typename ctraits<t>::Ttensor> der)
|
||||||
|
|
||||||
where s is a given outer symmetry and k is the dimension of the symmetry. */
|
where s is a given outer symmetry and k is the dimension of the symmetry. */
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
std::unique_ptr<typename ctraits<t>::Ttensor>
|
std::unique_ptr<typename ctraits<t>::Ttensor>
|
||||||
KOrder::faaDiBrunoZ(const Symmetry &sym) const
|
KOrder::faaDiBrunoZ(const Symmetry &sym) const
|
||||||
{
|
{
|
||||||
|
@ -419,7 +419,7 @@ KOrder::faaDiBrunoZ(const Symmetry &sym) const
|
||||||
|
|
||||||
/* The same as KOrder::faaDiBrunoZ(), but for g** and G stack. */
|
/* The same as KOrder::faaDiBrunoZ(), but for g** and G stack. */
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
std::unique_ptr<typename ctraits<t>::Ttensor>
|
std::unique_ptr<typename ctraits<t>::Ttensor>
|
||||||
KOrder::faaDiBrunoG(const Symmetry &sym) const
|
KOrder::faaDiBrunoG(const Symmetry &sym) const
|
||||||
{
|
{
|
||||||
|
@ -441,7 +441,7 @@ KOrder::faaDiBrunoG(const Symmetry &sym) const
|
||||||
Requires: everything at order ≤ i−1
|
Requires: everything at order ≤ i−1
|
||||||
|
|
||||||
Provides: g_yⁱ and G_yⁱ
|
Provides: g_yⁱ and G_yⁱ
|
||||||
*/
|
*/
|
||||||
template<Storage t>
|
template<Storage t>
|
||||||
void
|
void
|
||||||
KOrder::recover_y(int i)
|
KOrder::recover_y(int i)
|
||||||
|
@ -475,8 +475,8 @@ KOrder::recover_y(int i)
|
||||||
Requires: everything at order ≤ i+j−1, G_yⁱ⁺ʲ and g_yⁱ⁺ʲ.
|
Requires: everything at order ≤ i+j−1, G_yⁱ⁺ʲ and g_yⁱ⁺ʲ.
|
||||||
|
|
||||||
Provides: g_yⁱuʲ and G_yⁱuʲ
|
Provides: g_yⁱuʲ and G_yⁱuʲ
|
||||||
*/
|
*/
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
void
|
void
|
||||||
KOrder::recover_yu(int i, int j)
|
KOrder::recover_yu(int i, int j)
|
||||||
{
|
{
|
||||||
|
@ -508,8 +508,8 @@ KOrder::recover_yu(int i, int j)
|
||||||
|
|
||||||
Provides: g_yⁱσʲ and G_yⁱσʲ, and finally G_yⁱu′ᵐσʲ⁻ᵐ for m=1,…,j. The latter
|
Provides: g_yⁱσʲ and G_yⁱσʲ, and finally G_yⁱu′ᵐσʲ⁻ᵐ for m=1,…,j. The latter
|
||||||
is calculated by fillG() before the actual calculation.
|
is calculated by fillG() before the actual calculation.
|
||||||
*/
|
*/
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
void
|
void
|
||||||
KOrder::recover_ys(int i, int j)
|
KOrder::recover_ys(int i, int j)
|
||||||
{
|
{
|
||||||
|
@ -561,8 +561,8 @@ KOrder::recover_ys(int i, int j)
|
||||||
through Eᵢⱼₖ.
|
through Eᵢⱼₖ.
|
||||||
|
|
||||||
Provides: g_yⁱuʲσᵏ, G_yⁱuʲσᵏ, and G_yⁱuʲu′ᵐσᵏ⁻ᵐ for m=1,…,k
|
Provides: g_yⁱuʲσᵏ, G_yⁱuʲσᵏ, and G_yⁱuʲu′ᵐσᵏ⁻ᵐ for m=1,…,k
|
||||||
*/
|
*/
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
void
|
void
|
||||||
KOrder::recover_yus(int i, int j, int k)
|
KOrder::recover_yus(int i, int j, int k)
|
||||||
{
|
{
|
||||||
|
@ -619,8 +619,8 @@ KOrder::recover_yus(int i, int j, int k)
|
||||||
F_u′ᵏ, and g_yᵐuʲσᵏ for j=1,…,i−1 and m+j+k=i through F_u′ʲσⁱ⁻ʲ.
|
F_u′ᵏ, and g_yᵐuʲσᵏ for j=1,…,i−1 and m+j+k=i through F_u′ʲσⁱ⁻ʲ.
|
||||||
|
|
||||||
Provides: g_σⁱ, G_σⁱ, and G_u′ᵐσⁱ⁻ᵐ for m=1,…,i
|
Provides: g_σⁱ, G_σⁱ, and G_u′ᵐσⁱ⁻ᵐ for m=1,…,i
|
||||||
*/
|
*/
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
void
|
void
|
||||||
KOrder::recover_s(int i)
|
KOrder::recover_s(int i)
|
||||||
{
|
{
|
||||||
|
@ -680,7 +680,7 @@ KOrder::fillG(int i, int j, int k)
|
||||||
|
|
||||||
So it is non zero only for even k. */
|
So it is non zero only for even k. */
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
typename ctraits<t>::Ttensor
|
typename ctraits<t>::Ttensor
|
||||||
KOrder::calcD_ijk(int i, int j, int k) const
|
KOrder::calcD_ijk(int i, int j, int k) const
|
||||||
{
|
{
|
||||||
|
@ -700,7 +700,7 @@ KOrder::calcD_ijk(int i, int j, int k) const
|
||||||
ᵐ⁼¹
|
ᵐ⁼¹
|
||||||
The sum can sum only for even m. */
|
The sum can sum only for even m. */
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
typename ctraits<t>::Ttensor
|
typename ctraits<t>::Ttensor
|
||||||
KOrder::calcE_ijk(int i, int j, int k) const
|
KOrder::calcE_ijk(int i, int j, int k) const
|
||||||
{
|
{
|
||||||
|
@ -715,28 +715,28 @@ KOrder::calcE_ijk(int i, int j, int k) const
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
typename ctraits<t>::Ttensor
|
typename ctraits<t>::Ttensor
|
||||||
KOrder::calcD_ik(int i, int k) const
|
KOrder::calcD_ik(int i, int k) const
|
||||||
{
|
{
|
||||||
return calcD_ijk<t>(i, 0, k);
|
return calcD_ijk<t>(i, 0, k);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
typename ctraits<t>::Ttensor
|
typename ctraits<t>::Ttensor
|
||||||
KOrder::calcD_k(int k) const
|
KOrder::calcD_k(int k) const
|
||||||
{
|
{
|
||||||
return calcD_ijk<t>(0, 0, k);
|
return calcD_ijk<t>(0, 0, k);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
typename ctraits<t>::Ttensor
|
typename ctraits<t>::Ttensor
|
||||||
KOrder::calcE_ik(int i, int k) const
|
KOrder::calcE_ik(int i, int k) const
|
||||||
{
|
{
|
||||||
return calcE_ijk<t>(i, 0, k);
|
return calcE_ijk<t>(i, 0, k);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
typename ctraits<t>::Ttensor
|
typename ctraits<t>::Ttensor
|
||||||
KOrder::calcE_k(int k) const
|
KOrder::calcE_k(int k) const
|
||||||
{
|
{
|
||||||
|
@ -763,7 +763,7 @@ KOrder::calcE_k(int k) const
|
||||||
all the recovering methods, he should find out that also all G are
|
all the recovering methods, he should find out that also all G are
|
||||||
provided. */
|
provided. */
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
void
|
void
|
||||||
KOrder::performStep(int order)
|
KOrder::performStep(int order)
|
||||||
{
|
{
|
||||||
|
@ -794,7 +794,7 @@ KOrder::performStep(int order)
|
||||||
The method returns the largest residual size. Each check simply evaluates
|
The method returns the largest residual size. Each check simply evaluates
|
||||||
the equation. */
|
the equation. */
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
double
|
double
|
||||||
KOrder::check(int dim) const
|
KOrder::check(int dim) const
|
||||||
{
|
{
|
||||||
|
@ -849,7 +849,7 @@ KOrder::check(int dim) const
|
||||||
return maxerror;
|
return maxerror;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
Vector
|
Vector
|
||||||
KOrder::calcStochShift(int order, double sigma) const
|
KOrder::calcStochShift(int order, double sigma) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -77,112 +77,134 @@ KOrderStoch::KOrderStoch(const PartitionY &yp, int nu,
|
||||||
|
|
||||||
// KOrderStoch convenience method specializations
|
// KOrderStoch convenience method specializations
|
||||||
template<>
|
template<>
|
||||||
ctraits<Storage::unfold>::Tg &KOrderStoch::g<Storage::unfold>()
|
ctraits<Storage::unfold>::Tg &
|
||||||
|
KOrderStoch::g<Storage::unfold>()
|
||||||
{
|
{
|
||||||
return _ug;
|
return _ug;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
const ctraits<Storage::unfold>::Tg &KOrderStoch::g<Storage::unfold>() const
|
const ctraits<Storage::unfold>::Tg &
|
||||||
|
KOrderStoch::g<Storage::unfold>() const
|
||||||
{
|
{
|
||||||
return _ug;
|
return _ug;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
ctraits<Storage::fold>::Tg &KOrderStoch::g<Storage::fold>()
|
ctraits<Storage::fold>::Tg &
|
||||||
|
KOrderStoch::g<Storage::fold>()
|
||||||
{
|
{
|
||||||
return _fg;
|
return _fg;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
const ctraits<Storage::fold>::Tg &KOrderStoch::g<Storage::fold>() const
|
const ctraits<Storage::fold>::Tg &
|
||||||
|
KOrderStoch::g<Storage::fold>() const
|
||||||
{
|
{
|
||||||
return _fg;
|
return _fg;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
ctraits<Storage::unfold>::Tgs &KOrderStoch::gs<Storage::unfold>()
|
ctraits<Storage::unfold>::Tgs &
|
||||||
|
KOrderStoch::gs<Storage::unfold>()
|
||||||
{
|
{
|
||||||
return _ugs;
|
return _ugs;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
const ctraits<Storage::unfold>::Tgs &KOrderStoch::gs<Storage::unfold>() const
|
const ctraits<Storage::unfold>::Tgs &
|
||||||
|
KOrderStoch::gs<Storage::unfold>() const
|
||||||
{
|
{
|
||||||
return _ugs;
|
return _ugs;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
ctraits<Storage::fold>::Tgs &KOrderStoch::gs<Storage::fold>()
|
ctraits<Storage::fold>::Tgs &
|
||||||
|
KOrderStoch::gs<Storage::fold>()
|
||||||
{
|
{
|
||||||
return _fgs;
|
return _fgs;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
const ctraits<Storage::fold>::Tgs &KOrderStoch::gs<Storage::fold>() const
|
const ctraits<Storage::fold>::Tgs &
|
||||||
|
KOrderStoch::gs<Storage::fold>() const
|
||||||
{
|
{
|
||||||
return _fgs;
|
return _fgs;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
const ctraits<Storage::unfold>::Tgss &KOrderStoch::h<Storage::unfold>() const
|
const ctraits<Storage::unfold>::Tgss &
|
||||||
|
KOrderStoch::h<Storage::unfold>() const
|
||||||
{
|
{
|
||||||
return *_uh;
|
return *_uh;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
const ctraits<Storage::fold>::Tgss &KOrderStoch::h<Storage::fold>() const
|
const ctraits<Storage::fold>::Tgss &
|
||||||
|
KOrderStoch::h<Storage::fold>() const
|
||||||
{
|
{
|
||||||
return *_fh;
|
return *_fh;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
ctraits<Storage::unfold>::TG &KOrderStoch::G<Storage::unfold>()
|
ctraits<Storage::unfold>::TG &
|
||||||
|
KOrderStoch::G<Storage::unfold>()
|
||||||
{
|
{
|
||||||
return _uG;
|
return _uG;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
const ctraits<Storage::unfold>::TG &KOrderStoch::G<Storage::unfold>() const
|
const ctraits<Storage::unfold>::TG &
|
||||||
|
KOrderStoch::G<Storage::unfold>() const
|
||||||
{
|
{
|
||||||
return _uG;
|
return _uG;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
ctraits<Storage::fold>::TG &KOrderStoch::G<Storage::fold>()
|
ctraits<Storage::fold>::TG &
|
||||||
|
KOrderStoch::G<Storage::fold>()
|
||||||
{
|
{
|
||||||
return _fG;
|
return _fG;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
const ctraits<Storage::fold>::TG& KOrderStoch::G<Storage::fold>() const
|
const ctraits<Storage::fold>::TG &
|
||||||
|
KOrderStoch::G<Storage::fold>() const
|
||||||
{
|
{
|
||||||
return _fG;
|
return _fG;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
ctraits<Storage::unfold>::TZXstack &KOrderStoch::Zstack<Storage::unfold>()
|
ctraits<Storage::unfold>::TZXstack &
|
||||||
|
KOrderStoch::Zstack<Storage::unfold>()
|
||||||
{
|
{
|
||||||
return _uZstack;
|
return _uZstack;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
const ctraits<Storage::unfold>::TZXstack &KOrderStoch::Zstack<Storage::unfold>() const
|
const ctraits<Storage::unfold>::TZXstack &
|
||||||
|
KOrderStoch::Zstack<Storage::unfold>() const
|
||||||
{
|
{
|
||||||
return _uZstack;
|
return _uZstack;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
ctraits<Storage::fold>::TZXstack &KOrderStoch::Zstack<Storage::fold>()
|
ctraits<Storage::fold>::TZXstack &
|
||||||
|
KOrderStoch::Zstack<Storage::fold>()
|
||||||
{
|
{
|
||||||
return _fZstack;
|
return _fZstack;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
const ctraits<Storage::fold>::TZXstack &KOrderStoch::Zstack<Storage::fold>() const
|
const ctraits<Storage::fold>::TZXstack &
|
||||||
|
KOrderStoch::Zstack<Storage::fold>() const
|
||||||
{
|
{
|
||||||
return _fZstack;
|
return _fZstack;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
ctraits<Storage::unfold>::TGXstack &KOrderStoch::Gstack<Storage::unfold>()
|
ctraits<Storage::unfold>::TGXstack &
|
||||||
|
KOrderStoch::Gstack<Storage::unfold>()
|
||||||
{
|
{
|
||||||
return _uGstack;
|
return _uGstack;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
const ctraits<Storage::unfold>::TGXstack &KOrderStoch::Gstack<Storage::unfold>() const
|
const ctraits<Storage::unfold>::TGXstack &
|
||||||
|
KOrderStoch::Gstack<Storage::unfold>() const
|
||||||
{
|
{
|
||||||
return _uGstack;
|
return _uGstack;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
ctraits<Storage::fold>::TGXstack &KOrderStoch::Gstack<Storage::fold>()
|
ctraits<Storage::fold>::TGXstack &
|
||||||
|
KOrderStoch::Gstack<Storage::fold>()
|
||||||
{
|
{
|
||||||
return _fGstack;
|
return _fGstack;
|
||||||
}
|
}
|
||||||
template<>
|
template<>
|
||||||
const ctraits<Storage::fold>::TGXstack &KOrderStoch::Gstack<Storage::fold>() const
|
const ctraits<Storage::fold>::TGXstack &
|
||||||
|
KOrderStoch::Gstack<Storage::fold>() const
|
||||||
{
|
{
|
||||||
return _fGstack;
|
return _fGstack;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
containers corresponding to f(h(g*(y*,u,σ),σ),g(y,u,σ),y,u). Further, we
|
containers corresponding to f(h(g*(y*,u,σ),σ),g(y,u,σ),y,u). Further, we
|
||||||
declare IntegDerivs and StochForwardDerivs classes which basically calculate
|
declare IntegDerivs and StochForwardDerivs classes which basically calculate
|
||||||
h as an extrapolation based on an approximation to g at lower σ.
|
h as an extrapolation based on an approximation to g at lower σ.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
/* This class is a container, which has a specialized constructor integrating
|
/* This class is a container, which has a specialized constructor integrating
|
||||||
the policy rule at given σ. */
|
the policy rule at given σ. */
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
class IntegDerivs : public ctraits<t>::Tgss
|
class IntegDerivs : public ctraits<t>::Tgss
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -100,8 +100,8 @@ public:
|
||||||
ⁿ⁺ᵏ⁼ᵖ
|
ⁿ⁺ᵏ⁼ᵖ
|
||||||
|
|
||||||
and this is exactly what the code does.
|
and this is exactly what the code does.
|
||||||
*/
|
*/
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
IntegDerivs<t>::IntegDerivs(int r, const IntSequence &nvs, const typename ctraits<t>::Tgss &g,
|
IntegDerivs<t>::IntegDerivs(int r, const IntSequence &nvs, const typename ctraits<t>::Tgss &g,
|
||||||
const typename ctraits<t>::Tm &mom, double at_sigma)
|
const typename ctraits<t>::Tm &mom, double at_sigma)
|
||||||
: ctraits<t>::Tgss(4)
|
: ctraits<t>::Tgss(4)
|
||||||
|
@ -156,7 +156,7 @@ IntegDerivs<t>::IntegDerivs(int r, const IntSequence &nvs, const typename ctrait
|
||||||
The class calculates derivatives of E[g(y*,u,σ)] at (ȳ*,σ¯). The derivatives
|
The class calculates derivatives of E[g(y*,u,σ)] at (ȳ*,σ¯). The derivatives
|
||||||
are extrapolated based on derivatives at (ỹ*,σ~). */
|
are extrapolated based on derivatives at (ỹ*,σ~). */
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
class StochForwardDerivs : public ctraits<t>::Tgss
|
class StochForwardDerivs : public ctraits<t>::Tgss
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -180,7 +180,7 @@ public:
|
||||||
— Centralize this polynomial about (ȳ,σ¯)
|
— Centralize this polynomial about (ȳ,σ¯)
|
||||||
— Recover general symmetry tensors from the (full symmetric) polynomial
|
— Recover general symmetry tensors from the (full symmetric) polynomial
|
||||||
*/
|
*/
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
StochForwardDerivs<t>::StochForwardDerivs(const PartitionY &ypart, int nu,
|
StochForwardDerivs<t>::StochForwardDerivs(const PartitionY &ypart, int nu,
|
||||||
const typename ctraits<t>::Tgss &g,
|
const typename ctraits<t>::Tgss &g,
|
||||||
const typename ctraits<t>::Tm &m,
|
const typename ctraits<t>::Tm &m,
|
||||||
|
@ -260,7 +260,7 @@ StochForwardDerivs<t>::StochForwardDerivs(const PartitionY &ypart, int nu,
|
||||||
the σ as a second argument to h will be its fourth variable in symmetry, so
|
the σ as a second argument to h will be its fourth variable in symmetry, so
|
||||||
we have to do four member stack having the second and third stack dummy. */
|
we have to do four member stack having the second and third stack dummy. */
|
||||||
|
|
||||||
template <class _Ttype>
|
template<class _Ttype>
|
||||||
class GXContainer : public GContainer<_Ttype>
|
class GXContainer : public GContainer<_Ttype>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -279,8 +279,8 @@ public:
|
||||||
⎢ dummy ⎥
|
⎢ dummy ⎥
|
||||||
⎢ dummy ⎥
|
⎢ dummy ⎥
|
||||||
⎣ σ ⎦
|
⎣ σ ⎦
|
||||||
*/
|
*/
|
||||||
template <class _Ttype>
|
template<class _Ttype>
|
||||||
typename GXContainer<_Ttype>::itype
|
typename GXContainer<_Ttype>::itype
|
||||||
GXContainer<_Ttype>::getType(int i, const Symmetry &s) const
|
GXContainer<_Ttype>::getType(int i, const Symmetry &s) const
|
||||||
{
|
{
|
||||||
|
@ -306,7 +306,7 @@ GXContainer<_Ttype>::getType(int i, const Symmetry &s) const
|
||||||
the size (number of rows) as g**. Since it is very simmilar to ZContainer,
|
the size (number of rows) as g**. Since it is very simmilar to ZContainer,
|
||||||
we inherit form it and override only getType() method. */
|
we inherit form it and override only getType() method. */
|
||||||
|
|
||||||
template <class _Ttype>
|
template<class _Ttype>
|
||||||
class ZXContainer : public ZContainer<_Ttype>
|
class ZXContainer : public ZContainer<_Ttype>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -326,7 +326,7 @@ public:
|
||||||
⎢ y ⎥
|
⎢ y ⎥
|
||||||
⎣ u ⎦
|
⎣ u ⎦
|
||||||
*/
|
*/
|
||||||
template <class _Ttype>
|
template<class _Ttype>
|
||||||
typename ZXContainer<_Ttype>::itype
|
typename ZXContainer<_Ttype>::itype
|
||||||
ZXContainer<_Ttype>::getType(int i, const Symmetry &s) const
|
ZXContainer<_Ttype>::getType(int i, const Symmetry &s) const
|
||||||
{
|
{
|
||||||
|
@ -446,7 +446,7 @@ public:
|
||||||
const FGSContainer &hh, Journal &jr);
|
const FGSContainer &hh, Journal &jr);
|
||||||
KOrderStoch(const PartitionY &ypart, int nu, const TensorContainer<FSSparseTensor> &fcont,
|
KOrderStoch(const PartitionY &ypart, int nu, const TensorContainer<FSSparseTensor> &fcont,
|
||||||
const UGSContainer &hh, Journal &jr);
|
const UGSContainer &hh, Journal &jr);
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
void performStep(int order);
|
void performStep(int order);
|
||||||
const FGSContainer &
|
const FGSContainer &
|
||||||
getFoldDers() const
|
getFoldDers() const
|
||||||
|
@ -459,9 +459,9 @@ public:
|
||||||
return _ug;
|
return _ug;
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
std::unique_ptr<typename ctraits<t>::Ttensor> faaDiBrunoZ(const Symmetry &sym) const;
|
std::unique_ptr<typename ctraits<t>::Ttensor> faaDiBrunoZ(const Symmetry &sym) const;
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
std::unique_ptr<typename ctraits<t>::Ttensor> faaDiBrunoG(const Symmetry &sym) const;
|
std::unique_ptr<typename ctraits<t>::Ttensor> faaDiBrunoG(const Symmetry &sym) const;
|
||||||
|
|
||||||
// Convenience access methods
|
// Convenience access methods
|
||||||
|
@ -497,7 +497,7 @@ protected:
|
||||||
/* This calculates a derivative of f(G(y,u,σ),g(y,u,σ),y,u) of a given
|
/* This calculates a derivative of f(G(y,u,σ),g(y,u,σ),y,u) of a given
|
||||||
symmetry. */
|
symmetry. */
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
std::unique_ptr<typename ctraits<t>::Ttensor>
|
std::unique_ptr<typename ctraits<t>::Ttensor>
|
||||||
KOrderStoch::faaDiBrunoZ(const Symmetry &sym) const
|
KOrderStoch::faaDiBrunoZ(const Symmetry &sym) const
|
||||||
{
|
{
|
||||||
|
@ -512,7 +512,7 @@ KOrderStoch::faaDiBrunoZ(const Symmetry &sym) const
|
||||||
/* This calculates a derivative of G(y,u,σ)=h(g*(y,u,σ),σ) of a given
|
/* This calculates a derivative of G(y,u,σ)=h(g*(y,u,σ),σ) of a given
|
||||||
symmetry. */
|
symmetry. */
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
std::unique_ptr<typename ctraits<t>::Ttensor>
|
std::unique_ptr<typename ctraits<t>::Ttensor>
|
||||||
KOrderStoch::faaDiBrunoG(const Symmetry &sym) const
|
KOrderStoch::faaDiBrunoG(const Symmetry &sym) const
|
||||||
{
|
{
|
||||||
|
@ -535,7 +535,7 @@ KOrderStoch::faaDiBrunoG(const Symmetry &sym) const
|
||||||
as gₛ=-matA⁻¹·RHS. Finally we have to update Gₛ by calling
|
as gₛ=-matA⁻¹·RHS. Finally we have to update Gₛ by calling
|
||||||
Gstack<t>().multAndAdd(1, h<t>(), *G_sym_ptr). */
|
Gstack<t>().multAndAdd(1, h<t>(), *G_sym_ptr). */
|
||||||
|
|
||||||
template <Storage t>
|
template<Storage t>
|
||||||
void
|
void
|
||||||
KOrderStoch::performStep(int order)
|
KOrderStoch::performStep(int order)
|
||||||
{
|
{
|
||||||
|
|
|
@ -116,13 +116,15 @@ SparseGenerator::fillContainer(TensorContainer<FSSparseTensor> &c,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const double vdata [] = { // 3x3
|
const double vdata[] =
|
||||||
|
{ // 3x3
|
||||||
0.1307870268, 0.1241940078, 0.1356703123,
|
0.1307870268, 0.1241940078, 0.1356703123,
|
||||||
0.1241940078, 0.1986920419, 0.2010160581,
|
0.1241940078, 0.1986920419, 0.2010160581,
|
||||||
0.1356703123, 0.2010160581, 0.2160336975
|
0.1356703123, 0.2010160581, 0.2160336975
|
||||||
};
|
};
|
||||||
|
|
||||||
const double gy_data [] = { // 8x4
|
const double gy_data[] =
|
||||||
|
{ // 8x4
|
||||||
0.3985178619, -0.5688233582, 0.9572900437, -0.6606847776, 0.1453004017,
|
0.3985178619, -0.5688233582, 0.9572900437, -0.6606847776, 0.1453004017,
|
||||||
0.3025310675, -0.8627437750, -0.6903410191, 0.4751910580, -0.7270018589,
|
0.3025310675, -0.8627437750, -0.6903410191, 0.4751910580, -0.7270018589,
|
||||||
-0.0939612498, -0.1463831989, 0.6742110220, 0.6046671043, 0.5215893126,
|
-0.0939612498, -0.1463831989, 0.6742110220, 0.6046671043, 0.5215893126,
|
||||||
|
@ -130,9 +132,10 @@ const double gy_data [] = { // 8x4
|
||||||
-0.1037608317, -0.5587378073, -0.1010366945, 0.9462411248, -0.2439199881,
|
-0.1037608317, -0.5587378073, -0.1010366945, 0.9462411248, -0.2439199881,
|
||||||
1.3420621236, -0.7820285935, 0.3205293447, 0.3606124791, 0.2975422208,
|
1.3420621236, -0.7820285935, 0.3205293447, 0.3606124791, 0.2975422208,
|
||||||
-0.5452861965, 1.6320340279
|
-0.5452861965, 1.6320340279
|
||||||
};
|
};
|
||||||
|
|
||||||
const double gu_data [] = { // just some numbers, no structure
|
const double gu_data[] =
|
||||||
|
{ // just some numbers, no structure
|
||||||
1.8415286914, -0.2638743845, 1.7690713274, 0.9668585956, 0.2303143646,
|
1.8415286914, -0.2638743845, 1.7690713274, 0.9668585956, 0.2303143646,
|
||||||
-0.2229624279, -0.4381991822, 1.0082401405, -0.3186555860, -0.0624691529,
|
-0.2229624279, -0.4381991822, 1.0082401405, -0.3186555860, -0.0624691529,
|
||||||
-0.5189085756, 1.4269672156, 0.1163282969, 1.4020183445, -0.0952660426,
|
-0.5189085756, 1.4269672156, 0.1163282969, 1.4020183445, -0.0952660426,
|
||||||
|
@ -141,9 +144,10 @@ const double gu_data [] = { // just some numbers, no structure
|
||||||
-1.1167944865, -1.2263750934, 0.6113636081, 0.6964915482, -0.6451217688,
|
-1.1167944865, -1.2263750934, 0.6113636081, 0.6964915482, -0.6451217688,
|
||||||
0.4062810500, -2.0552251116, -1.6383406284, 0.0198915095, 0.0111014458,
|
0.4062810500, -2.0552251116, -1.6383406284, 0.0198915095, 0.0111014458,
|
||||||
-1.2421792262, -1.0724161722, -0.4276904972, 0.1801494950, -2.0716473264
|
-1.2421792262, -1.0724161722, -0.4276904972, 0.1801494950, -2.0716473264
|
||||||
};
|
};
|
||||||
|
|
||||||
const double vdata2 [] = { // 10×10 positive definite
|
const double vdata2[] =
|
||||||
|
{ // 10×10 positive definite
|
||||||
0.79666, -0.15536, 0.05667, -0.21026, 0.20262, 0.28505, 0.60341, -0.09703, 0.32363, 0.13299,
|
0.79666, -0.15536, 0.05667, -0.21026, 0.20262, 0.28505, 0.60341, -0.09703, 0.32363, 0.13299,
|
||||||
-0.15536, 0.64380, -0.01131, 0.00980, 0.03755, 0.43791, 0.21784, -0.31755, -0.55911, -0.29655,
|
-0.15536, 0.64380, -0.01131, 0.00980, 0.03755, 0.43791, 0.21784, -0.31755, -0.55911, -0.29655,
|
||||||
0.05667, -0.01131, 0.56165, -0.34357, -0.40584, 0.20990, 0.28348, 0.20398, -0.19856, 0.35820,
|
0.05667, -0.01131, 0.56165, -0.34357, -0.40584, 0.20990, 0.28348, 0.20398, -0.19856, 0.35820,
|
||||||
|
@ -154,9 +158,10 @@ const double vdata2 [] = { // 10×10 positive definite
|
||||||
-0.09703, -0.31755, 0.20398, -0.19685, -0.19696, -0.31125, -0.18613, 0.59470, 0.08386, 0.41750,
|
-0.09703, -0.31755, 0.20398, -0.19685, -0.19696, -0.31125, -0.18613, 0.59470, 0.08386, 0.41750,
|
||||||
0.32363, -0.55911, -0.19856, 0.21088, 0.03446, -0.55141, -0.25811, 0.08386, 0.98917, -0.12992,
|
0.32363, -0.55911, -0.19856, 0.21088, 0.03446, -0.55141, -0.25811, 0.08386, 0.98917, -0.12992,
|
||||||
0.13299, -0.29655, 0.35820, -0.31560, -0.12919, -0.02155, -0.19016, 0.41750, -0.12992, 0.89608
|
0.13299, -0.29655, 0.35820, -0.31560, -0.12919, -0.02155, -0.19016, 0.41750, -0.12992, 0.89608
|
||||||
};
|
};
|
||||||
|
|
||||||
const double gy_data2 [] = { // 600 items make gy 30×20, whose gy(6:25,:) has spectrum within unit
|
const double gy_data2[] =
|
||||||
|
{ // 600 items make gy 30×20, whose gy(6:25,:) has spectrum within unit
|
||||||
0.39414, -0.29766, 0.08948, -0.19204, -0.00750, 0.21159, 0.05494, 0.06225, 0.01771, 0.21913,
|
0.39414, -0.29766, 0.08948, -0.19204, -0.00750, 0.21159, 0.05494, 0.06225, 0.01771, 0.21913,
|
||||||
-0.01373, 0.20086, -0.06086, -0.10955, 0.14424, -0.08390, 0.03948, -0.14713, 0.11674, 0.05091,
|
-0.01373, 0.20086, -0.06086, -0.10955, 0.14424, -0.08390, 0.03948, -0.14713, 0.11674, 0.05091,
|
||||||
0.24039, 0.28307, -0.11835, 0.13030, 0.11682, -0.27444, -0.19311, -0.16654, 0.12867, 0.25116,
|
0.24039, 0.28307, -0.11835, 0.13030, 0.11682, -0.27444, -0.19311, -0.16654, 0.12867, 0.25116,
|
||||||
|
@ -217,9 +222,10 @@ const double gy_data2 [] = { // 600 items make gy 30×20, whose gy(6:25,:) has s
|
||||||
0.24285, -0.07564, -0.28349, -0.15658, 0.03135, -0.30909, -0.22534, 0.17363, -0.19376, 0.26038,
|
0.24285, -0.07564, -0.28349, -0.15658, 0.03135, -0.30909, -0.22534, 0.17363, -0.19376, 0.26038,
|
||||||
0.05546, -0.22607, 0.32420, -0.02552, -0.05400, 0.13388, 0.04643, -0.31535, -0.06181, 0.30237,
|
0.05546, -0.22607, 0.32420, -0.02552, -0.05400, 0.13388, 0.04643, -0.31535, -0.06181, 0.30237,
|
||||||
-0.04680, -0.29441, 0.12231, 0.03960, -0.01188, 0.01406, 0.25402, 0.03315, 0.25026, -0.10922
|
-0.04680, -0.29441, 0.12231, 0.03960, -0.01188, 0.01406, 0.25402, 0.03315, 0.25026, -0.10922
|
||||||
};
|
};
|
||||||
|
|
||||||
const double gu_data2 [] = { // raw data 300 items
|
const double gu_data2[] =
|
||||||
|
{ // raw data 300 items
|
||||||
0.26599, 0.41329, 0.31846, 0.92590, 0.43050, 0.17466, 0.02322, 0.72621, 0.37921, 0.70597,
|
0.26599, 0.41329, 0.31846, 0.92590, 0.43050, 0.17466, 0.02322, 0.72621, 0.37921, 0.70597,
|
||||||
0.97098, 0.14023, 0.57619, 0.09938, 0.02281, 0.92341, 0.72654, 0.71000, 0.76687, 0.70182,
|
0.97098, 0.14023, 0.57619, 0.09938, 0.02281, 0.92341, 0.72654, 0.71000, 0.76687, 0.70182,
|
||||||
0.88752, 0.49524, 0.42549, 0.42806, 0.57615, 0.76051, 0.15341, 0.47457, 0.60066, 0.40880,
|
0.88752, 0.49524, 0.42549, 0.42806, 0.57615, 0.76051, 0.15341, 0.47457, 0.60066, 0.40880,
|
||||||
|
@ -250,7 +256,7 @@ const double gu_data2 [] = { // raw data 300 items
|
||||||
0.56552, 0.58556, 0.53554, 0.53507, 0.09831, 0.21229, 0.83135, 0.26375, 0.89287, 0.97069,
|
0.56552, 0.58556, 0.53554, 0.53507, 0.09831, 0.21229, 0.83135, 0.26375, 0.89287, 0.97069,
|
||||||
0.70615, 0.42041, 0.43117, 0.21291, 0.26086, 0.26978, 0.77340, 0.43833, 0.46179, 0.54418,
|
0.70615, 0.42041, 0.43117, 0.21291, 0.26086, 0.26978, 0.77340, 0.43833, 0.46179, 0.54418,
|
||||||
0.67878, 0.42776, 0.61454, 0.55915, 0.36363, 0.31999, 0.42442, 0.86649, 0.62513, 0.02047
|
0.67878, 0.42776, 0.61454, 0.55915, 0.36363, 0.31999, 0.42442, 0.86649, 0.62513, 0.02047
|
||||||
};
|
};
|
||||||
|
|
||||||
class TestRunnable
|
class TestRunnable
|
||||||
{
|
{
|
||||||
|
|
|
@ -158,7 +158,7 @@ AtomAssignings::apply_subst(const AtomSubstitutions::Toldnamemap &mm)
|
||||||
{
|
{
|
||||||
// go through all old variables and see what are their derived new
|
// go through all old variables and see what are their derived new
|
||||||
// variables
|
// variables
|
||||||
for (const auto & it : mm)
|
for (const auto &it : mm)
|
||||||
{
|
{
|
||||||
const string &oldname = it.first;
|
const string &oldname = it.first;
|
||||||
const AtomSubstitutions::Tshiftnameset &sset = it.second;
|
const AtomSubstitutions::Tshiftnameset &sset = it.second;
|
||||||
|
@ -175,7 +175,7 @@ AtomAssignings::apply_subst(const AtomSubstitutions::Toldnamemap &mm)
|
||||||
order.push_back(-1);
|
order.push_back(-1);
|
||||||
// now go through all new names derived from the old name and
|
// now go through all new names derived from the old name and
|
||||||
// reference to the newly added formula
|
// reference to the newly added formula
|
||||||
for (const auto & itt : sset)
|
for (const auto &itt : sset)
|
||||||
{
|
{
|
||||||
const string &newname = itt.first;
|
const string &newname = itt.first;
|
||||||
left_names.insert(newname);
|
left_names.insert(newname);
|
||||||
|
|
|
@ -62,7 +62,7 @@ AtomSubstitutions::substitutions_finished(VarOrdering::ord_type ot)
|
||||||
// add all new names derived from the old name
|
// add all new names derived from the old name
|
||||||
auto it = old2new.find(oname);
|
auto it = old2new.find(oname);
|
||||||
if (it != old2new.end())
|
if (it != old2new.end())
|
||||||
for (const auto & itt : it->second)
|
for (const auto &itt : it->second)
|
||||||
na_ext.push_back(itt.first);
|
na_ext.push_back(itt.first);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ AtomSubstitutions::get_new4old(const string &oldname, int tshift) const
|
||||||
if (it != old2new.end())
|
if (it != old2new.end())
|
||||||
{
|
{
|
||||||
const Tshiftnameset &sset = it->second;
|
const Tshiftnameset &sset = it->second;
|
||||||
for (const auto & itt : sset)
|
for (const auto &itt : sset)
|
||||||
if (itt.second == -tshift)
|
if (itt.second == -tshift)
|
||||||
return itt.first;
|
return itt.first;
|
||||||
}
|
}
|
||||||
|
@ -88,12 +88,12 @@ void
|
||||||
AtomSubstitutions::print() const
|
AtomSubstitutions::print() const
|
||||||
{
|
{
|
||||||
std::cout << u8"Atom Substitutions:\nOld ⇒ New:\n";
|
std::cout << u8"Atom Substitutions:\nOld ⇒ New:\n";
|
||||||
for (const auto & it : old2new)
|
for (const auto &it : old2new)
|
||||||
for (const auto &itt : it.second)
|
for (const auto &itt : it.second)
|
||||||
std::cout << " " << it.first << u8" ⇒ [" << itt.first << ", " << itt.second << "]\n";
|
std::cout << " " << it.first << u8" ⇒ [" << itt.first << ", " << itt.second << "]\n";
|
||||||
|
|
||||||
std::cout << u8"Old ⇐ New:\n";
|
std::cout << u8"Old ⇐ New:\n";
|
||||||
for (const auto & it : new2old)
|
for (const auto &it : new2old)
|
||||||
std::cout << " [" << it.second.first << ", " << it.second.second << "] ⇐ " << it.first << '\n';
|
std::cout << " [" << it.second.first << ", " << it.second.second << "] ⇐ " << it.first << '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ Constants::import_constants(const Constants &c, OperationTree &otree, Tintintmap
|
||||||
void
|
void
|
||||||
Constants::setValues(EvalTree &et) const
|
Constants::setValues(EvalTree &et) const
|
||||||
{
|
{
|
||||||
for (const auto & it : cmap)
|
for (const auto &it : cmap)
|
||||||
et.set_nulary(it.first, it.second);
|
et.set_nulary(it.first, it.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,7 +250,7 @@ vector<int>
|
||||||
DynamicAtoms::variables() const
|
DynamicAtoms::variables() const
|
||||||
{
|
{
|
||||||
vector<int> res;
|
vector<int> res;
|
||||||
for (const auto & var : vars)
|
for (const auto &var : vars)
|
||||||
{
|
{
|
||||||
const Tlagmap &lmap = var.second;
|
const Tlagmap &lmap = var.second;
|
||||||
for (auto itt : lmap)
|
for (auto itt : lmap)
|
||||||
|
@ -372,7 +372,7 @@ DynamicAtoms::print() const
|
||||||
std::cout << "constants:\n";
|
std::cout << "constants:\n";
|
||||||
Constants::print();
|
Constants::print();
|
||||||
std::cout << "variables:\n";
|
std::cout << "variables:\n";
|
||||||
for (const auto & var : vars)
|
for (const auto &var : vars)
|
||||||
{
|
{
|
||||||
const Tlagmap &lmap = var.second;
|
const Tlagmap &lmap = var.second;
|
||||||
for (auto itt : lmap)
|
for (auto itt : lmap)
|
||||||
|
@ -501,7 +501,7 @@ VarOrdering::do_general(ord_type ordering)
|
||||||
|
|
||||||
// make der_atoms and positions
|
// make der_atoms and positions
|
||||||
int off = 0;
|
int off = 0;
|
||||||
for (auto & ord : ords)
|
for (auto &ord : ords)
|
||||||
for (unsigned int j = 0; j < ord->size(); j++, off++)
|
for (unsigned int j = 0; j < ord->size(); j++, off++)
|
||||||
if ((*ord)[j] != -1)
|
if ((*ord)[j] != -1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -347,7 +347,7 @@ namespace ogp
|
||||||
public:
|
public:
|
||||||
/** This is an enum type for an ordering type implemented by
|
/** This is an enum type for an ordering type implemented by
|
||||||
* do_general. */
|
* do_general. */
|
||||||
enum ord_type {pbspbfbf, bfspbfpb};
|
enum ord_type { pbspbfbf, bfspbfpb };
|
||||||
/** Construct the ordering of the variables given by the names
|
/** Construct the ordering of the variables given by the names
|
||||||
* with their dynamic occurrences defined by the atoms. It
|
* with their dynamic occurrences defined by the atoms. It
|
||||||
* calls the virtual method do_ordering which can be
|
* calls the virtual method do_ordering which can be
|
||||||
|
|
|
@ -339,20 +339,20 @@ namespace ogp
|
||||||
int get_pos_of_all(int t) const;
|
int get_pos_of_all(int t) const;
|
||||||
/** Return the mapping from endogenous at time t to outer
|
/** Return the mapping from endogenous at time t to outer
|
||||||
* ordering of endogenous. */
|
* ordering of endogenous. */
|
||||||
const vector<int>&y2outer_endo() const;
|
const vector<int> &y2outer_endo() const;
|
||||||
/** Return the mapping from the outer ordering of endogenous to endogenous
|
/** Return the mapping from the outer ordering of endogenous to endogenous
|
||||||
* at time t. */
|
* at time t. */
|
||||||
const vector<int>&outer2y_endo() const;
|
const vector<int> &outer2y_endo() const;
|
||||||
/** Return the mapping from exogenous at time t to outer
|
/** Return the mapping from exogenous at time t to outer
|
||||||
* ordering of exogenous. */
|
* ordering of exogenous. */
|
||||||
const vector<int>&y2outer_exo() const;
|
const vector<int> &y2outer_exo() const;
|
||||||
/** Return the mapping from the outer ordering of exogenous to exogenous
|
/** Return the mapping from the outer ordering of exogenous to exogenous
|
||||||
* at time t. */
|
* at time t. */
|
||||||
const vector<int>&outer2y_exo() const;
|
const vector<int> &outer2y_exo() const;
|
||||||
/** Return the endo_atoms_map. */
|
/** Return the endo_atoms_map. */
|
||||||
const vector<int>&get_endo_atoms_map() const;
|
const vector<int> &get_endo_atoms_map() const;
|
||||||
/** Return the exo_atoms_map. */
|
/** Return the exo_atoms_map. */
|
||||||
const vector<int>&get_exo_atoms_map() const;
|
const vector<int> &get_exo_atoms_map() const;
|
||||||
/** Return an index in the outer ordering of a given
|
/** Return an index in the outer ordering of a given
|
||||||
* parameter. An exception is thrown if the name is not a
|
* parameter. An exception is thrown if the name is not a
|
||||||
* parameter. */
|
* parameter. */
|
||||||
|
|
|
@ -271,7 +271,7 @@ FormulaDerivatives::derivative(const FoldMultiIndex &mi) const
|
||||||
void
|
void
|
||||||
FormulaDerivatives::print(const OperationTree &otree) const
|
FormulaDerivatives::print(const OperationTree &otree) const
|
||||||
{
|
{
|
||||||
for (const auto & it : ind2der)
|
for (const auto &it : ind2der)
|
||||||
{
|
{
|
||||||
std::cout << "derivative ";
|
std::cout << "derivative ";
|
||||||
it.first.print();
|
it.first.print();
|
||||||
|
|
|
@ -256,7 +256,7 @@ namespace ogp
|
||||||
* different order). */
|
* different order). */
|
||||||
void differentiate(int max_order);
|
void differentiate(int max_order);
|
||||||
/** Return i-th formula derivatives. */
|
/** Return i-th formula derivatives. */
|
||||||
const FormulaDerivatives&derivatives(int i) const;
|
const FormulaDerivatives &derivatives(int i) const;
|
||||||
|
|
||||||
/** This returns a maximum index of zero derivative formulas
|
/** This returns a maximum index of zero derivative formulas
|
||||||
* including all nulary terms. This is a mimumum length of the
|
* including all nulary terms. This is a mimumum length of the
|
||||||
|
|
|
@ -96,7 +96,7 @@ StaticFineAtoms::parsing_finished()
|
||||||
|
|
||||||
// go through all endo and exo insert tree indices, ignore names
|
// go through all endo and exo insert tree indices, ignore names
|
||||||
// whose tree index is -1 (those which are not referenced)
|
// whose tree index is -1 (those which are not referenced)
|
||||||
for (auto & endovar : endovars)
|
for (auto &endovar : endovars)
|
||||||
{
|
{
|
||||||
int t = index(endovar);
|
int t = index(endovar);
|
||||||
if (t != -1)
|
if (t != -1)
|
||||||
|
@ -105,7 +105,7 @@ StaticFineAtoms::parsing_finished()
|
||||||
der_atoms.push_back(t);
|
der_atoms.push_back(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (auto & exovar : exovars)
|
for (auto &exovar : exovars)
|
||||||
{
|
{
|
||||||
int t = index(exovar);
|
int t = index(exovar);
|
||||||
if (t != -1)
|
if (t != -1)
|
||||||
|
|
|
@ -477,7 +477,7 @@ OperationTree::select_terms_inv(int t, const opselector &sel, unordered_set<int>
|
||||||
void
|
void
|
||||||
OperationTree::forget_derivative_maps()
|
OperationTree::forget_derivative_maps()
|
||||||
{
|
{
|
||||||
for (auto & derivative : derivatives)
|
for (auto &derivative : derivatives)
|
||||||
derivative.clear();
|
derivative.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,8 +42,8 @@ namespace ogp
|
||||||
* codes, he should update the code of #OperationTree::add_unary,
|
* codes, he should update the code of #OperationTree::add_unary,
|
||||||
* #OperationTree::add_binary, and of course
|
* #OperationTree::add_binary, and of course
|
||||||
* #OperationTree::add_derivative. */
|
* #OperationTree::add_derivative. */
|
||||||
enum class code_t {NONE, UMINUS, LOG, EXP, SIN, COS, TAN, SQRT, ERF,
|
enum class code_t { NONE, UMINUS, LOG, EXP, SIN, COS, TAN, SQRT, ERF,
|
||||||
ERFC, PLUS, MINUS, TIMES, DIVIDE, POWER};
|
ERFC, PLUS, MINUS, TIMES, DIVIDE, POWER };
|
||||||
|
|
||||||
/** Class representing a nulary, unary, or binary operation. */
|
/** Class representing a nulary, unary, or binary operation. */
|
||||||
class Operation
|
class Operation
|
||||||
|
@ -218,7 +218,7 @@ namespace ogp
|
||||||
* 2/pi. These will be always first four terms having indices
|
* 2/pi. These will be always first four terms having indices
|
||||||
* zero, one and two, three. If adding anything to this
|
* zero, one and two, three. If adding anything to this
|
||||||
* enumeration, make sure ‘num_constants’ remains the last one.*/
|
* enumeration, make sure ‘num_constants’ remains the last one.*/
|
||||||
enum {zero, one, nan, two_over_pi, num_constants};
|
enum { zero, one, nan, two_over_pi, num_constants };
|
||||||
|
|
||||||
/** The unique constructor which initializes the object to
|
/** The unique constructor which initializes the object to
|
||||||
* contain only zero, one and nan and two_over_pi.*/
|
* contain only zero, one and nan and two_over_pi.*/
|
||||||
|
|
|
@ -64,7 +64,7 @@ namespace ogdyn
|
||||||
class DynareDynamicAtoms : public ogp::SAtoms, public ogp::NularyStringConvertor
|
class DynareDynamicAtoms : public ogp::SAtoms, public ogp::NularyStringConvertor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum class atype {endovar, exovar, param};
|
enum class atype { endovar, exovar, param };
|
||||||
protected:
|
protected:
|
||||||
using Tatypemap = map<string, atype>;
|
using Tatypemap = map<string, atype>;
|
||||||
/* The map assigining a type to each name. */
|
/* The map assigining a type to each name. */
|
||||||
|
|
|
@ -29,8 +29,8 @@ class DynareException
|
||||||
std::string mes;
|
std::string mes;
|
||||||
public:
|
public:
|
||||||
DynareException(const std::string &m, const std::string &fname, int line, int col)
|
DynareException(const std::string &m, const std::string &fname, int line, int col)
|
||||||
: mes{"Parse error at " + fname + ", line " + std::to_string(line) + ", column " +
|
: mes{"Parse error at " + fname + ", line " + std::to_string(line) + ", column "
|
||||||
std::to_string(col) + ": " + m}
|
+ std::to_string(col) + ": " + m}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
DynareException(const std::string &fname, int line, const std::string &m)
|
DynareException(const std::string &fname, int line, const std::string &m)
|
||||||
|
|
|
@ -51,7 +51,8 @@ DynareParams::DynareParams(int argc, char **argv)
|
||||||
modname = argv[argc-1];
|
modname = argv[argc-1];
|
||||||
argc--;
|
argc--;
|
||||||
|
|
||||||
struct option const opts [] = {
|
struct option const opts[] =
|
||||||
|
{
|
||||||
{"periods", required_argument, nullptr, static_cast<int>(opt::per)},
|
{"periods", required_argument, nullptr, static_cast<int>(opt::per)},
|
||||||
{"per", required_argument, nullptr, static_cast<int>(opt::per)},
|
{"per", required_argument, nullptr, static_cast<int>(opt::per)},
|
||||||
{"burn", required_argument, nullptr, static_cast<int>(opt::burn)},
|
{"burn", required_argument, nullptr, static_cast<int>(opt::burn)},
|
||||||
|
|
|
@ -89,11 +89,11 @@ struct DynareParams
|
||||||
return 10*check_num;
|
return 10*check_num;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
enum class opt {per, burn, sim, rtper, rtsim, condper, condsim,
|
enum class opt { per, burn, sim, rtper, rtsim, condper, condsim,
|
||||||
prefix, threads,
|
prefix, threads,
|
||||||
steps, seed, order, ss_tol, check,
|
steps, seed, order, ss_tol, check,
|
||||||
check_evals, check_scale, check_num, noirfs, irfs,
|
check_evals, check_scale, check_num, noirfs, irfs,
|
||||||
help, version, centralize, no_centralize, qz_criterium};
|
help, version, centralize, no_centralize, qz_criterium };
|
||||||
void processCheckFlags(const std::string &flags);
|
void processCheckFlags(const std::string &flags);
|
||||||
/* This gathers strings from argv[optind] and on not starting with '-' to the
|
/* This gathers strings from argv[optind] and on not starting with '-' to the
|
||||||
irf_list. It stops one item before the end, since this is the model
|
irf_list. It stops one item before the end, since this is the model
|
||||||
|
|
|
@ -70,7 +70,7 @@ ForwSubstBuilder::substitute_for_term(int t, int i, int j)
|
||||||
// first make lagsubst be substitution setting f(x(+4)) to f(x(+1))
|
// first make lagsubst be substitution setting f(x(+4)) to f(x(+1))
|
||||||
// this is lag = -3 (1-mlead)
|
// this is lag = -3 (1-mlead)
|
||||||
map<int, int> lagsubst;
|
map<int, int> lagsubst;
|
||||||
unordered_set<int> nult = model.eqs.nulary_of_term(t);// make copy of nult!
|
unordered_set<int> nult = model.eqs.nulary_of_term(t); // make copy of nult!
|
||||||
model.variable_shift_map(nult, 1-mlead, lagsubst);
|
model.variable_shift_map(nult, 1-mlead, lagsubst);
|
||||||
int lagt = model.eqs.add_substitution(t, lagsubst);
|
int lagt = model.eqs.add_substitution(t, lagsubst);
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,6 @@ PlannerBuilder::PlannerBuilder(const PlannerBuilder &pb, ogdyn::DynareModel &m)
|
||||||
diff_b_static(pb.diff_b_static),
|
diff_b_static(pb.diff_b_static),
|
||||||
diff_f_static(pb.diff_f_static),
|
diff_f_static(pb.diff_f_static),
|
||||||
aux_map(), static_aux_map()
|
aux_map(), static_aux_map()
|
||||||
|
|
||||||
{
|
{
|
||||||
fill_yset(m.atoms.get_name_storage(), pb.yset);
|
fill_yset(m.atoms.get_name_storage(), pb.yset);
|
||||||
fill_aux_map(m.atoms.get_name_storage(), pb.aux_map, pb.static_aux_map);
|
fill_aux_map(m.atoms.get_name_storage(), pb.aux_map, pb.static_aux_map);
|
||||||
|
@ -384,7 +383,7 @@ MultInitSS::MultInitSS(const PlannerBuilder &pb, const Vector &pvals, Vector &yy
|
||||||
if (it != old2new.end())
|
if (it != old2new.end())
|
||||||
{
|
{
|
||||||
const ogp::AtomSubstitutions::Tshiftnameset &sset = it->second;
|
const ogp::AtomSubstitutions::Tshiftnameset &sset = it->second;
|
||||||
for (const auto & itt : sset)
|
for (const auto &itt : sset)
|
||||||
{
|
{
|
||||||
const std::string &newname = itt.first;
|
const std::string &newname = itt.first;
|
||||||
int iouter = builder.model.atoms.name2outer_endo(newname);
|
int iouter = builder.model.atoms.name2outer_endo(newname);
|
||||||
|
|
|
@ -65,7 +65,7 @@ BlockDiagonal::setZerosToRU(diag_iter edge)
|
||||||
of the right-most non-zero element of i-th row from the left, and
|
of the right-most non-zero element of i-th row from the left, and
|
||||||
col_len[j] is distance of top-most non-zero element of j-th column
|
col_len[j] is distance of top-most non-zero element of j-th column
|
||||||
to the top. (First element has distance 1).
|
to the top. (First element has distance 1).
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
BlockDiagonal::setZeroBlockEdge(diag_iter edge)
|
BlockDiagonal::setZeroBlockEdge(diag_iter edge)
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,7 +42,9 @@ class TransposedMatrix
|
||||||
private:
|
private:
|
||||||
T &orig;
|
T &orig;
|
||||||
public:
|
public:
|
||||||
TransposedMatrix(T &orig_arg) : orig{orig_arg} {};
|
TransposedMatrix(T &orig_arg) : orig{orig_arg}
|
||||||
|
{
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// Syntactic sugar for representing a transposed matrix
|
// Syntactic sugar for representing a transposed matrix
|
||||||
|
|
|
@ -31,7 +31,7 @@ IterativeSylvester::solve(SylvParams &pars, KronVector &x) const
|
||||||
|
|
||||||
auto kpow = matrixK->clone();
|
auto kpow = matrixK->clone();
|
||||||
auto fpow = matrixF->clone();
|
auto fpow = matrixF->clone();
|
||||||
while (steps < max_steps &&norm > max_norm)
|
while (steps < max_steps && norm > max_norm)
|
||||||
{
|
{
|
||||||
kpow->multRight(SqSylvMatrix(*kpow)); // be careful to make copy
|
kpow->multRight(SqSylvMatrix(*kpow)); // be careful to make copy
|
||||||
fpow->multRight(SqSylvMatrix(*fpow)); // also here
|
fpow->multRight(SqSylvMatrix(*fpow)); // also here
|
||||||
|
|
|
@ -148,7 +148,7 @@ void
|
||||||
Diagonal::changeBase(double *p)
|
Diagonal::changeBase(double *p)
|
||||||
{
|
{
|
||||||
int d_size = getSize();
|
int d_size = getSize();
|
||||||
for (auto & it : *this)
|
for (auto &it : *this)
|
||||||
{
|
{
|
||||||
const DiagonalBlock &b = it;
|
const DiagonalBlock &b = it;
|
||||||
int jbar = b.getIndex();
|
int jbar = b.getIndex();
|
||||||
|
@ -179,7 +179,7 @@ Diagonal::getEigenValues(Vector &eig) const
|
||||||
<< ", should be=" << 2*d_size << '.' << std::endl;
|
<< ", should be=" << 2*d_size << '.' << std::endl;
|
||||||
throw SYLV_MES_EXCEPTION(mes.str());
|
throw SYLV_MES_EXCEPTION(mes.str());
|
||||||
}
|
}
|
||||||
for (const auto & b : *this)
|
for (const auto &b : *this)
|
||||||
{
|
{
|
||||||
int ind = b.getIndex();
|
int ind = b.getIndex();
|
||||||
eig[2*ind] = *(b.getAlpha());
|
eig[2*ind] = *(b.getAlpha());
|
||||||
|
@ -303,7 +303,7 @@ Diagonal::print() const
|
||||||
auto ff = std::cout.flags();
|
auto ff = std::cout.flags();
|
||||||
std::cout << "Num real: " << getNumReal() << ", num complex: " << getNumComplex() << std::endl
|
std::cout << "Num real: " << getNumReal() << ", num complex: " << getNumComplex() << std::endl
|
||||||
<< std::fixed;
|
<< std::fixed;
|
||||||
for (const auto & it : *this)
|
for (const auto &it : *this)
|
||||||
if (it.isReal())
|
if (it.isReal())
|
||||||
std::cout << "real: jbar=" << it.getIndex() << ", alpha=" << *(it.getAlpha()) << std::endl;
|
std::cout << "real: jbar=" << it.getIndex() << ", alpha=" << *(it.getAlpha()) << std::endl;
|
||||||
else
|
else
|
||||||
|
|
|
@ -222,7 +222,7 @@ private:
|
||||||
static bool isZero(double p);
|
static bool isZero(double p);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _TRef, class _TPtr>
|
template<class _TRef, class _TPtr>
|
||||||
struct _matrix_iter
|
struct _matrix_iter
|
||||||
{
|
{
|
||||||
using _Self = _matrix_iter<_TRef, _TPtr>;
|
using _Self = _matrix_iter<_TRef, _TPtr>;
|
||||||
|
@ -260,7 +260,7 @@ public:
|
||||||
virtual _Self &operator++() = 0;
|
virtual _Self &operator++() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _TRef, class _TPtr>
|
template<class _TRef, class _TPtr>
|
||||||
class _column_iter : public _matrix_iter<_TRef, _TPtr>
|
class _column_iter : public _matrix_iter<_TRef, _TPtr>
|
||||||
{
|
{
|
||||||
using _Tparent = _matrix_iter<_TRef, _TPtr>;
|
using _Tparent = _matrix_iter<_TRef, _TPtr>;
|
||||||
|
@ -293,7 +293,7 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _TRef, class _TPtr>
|
template<class _TRef, class _TPtr>
|
||||||
class _row_iter : public _matrix_iter<_TRef, _TPtr>
|
class _row_iter : public _matrix_iter<_TRef, _TPtr>
|
||||||
{
|
{
|
||||||
using _Tparent = _matrix_iter<_TRef, _TPtr>;
|
using _Tparent = _matrix_iter<_TRef, _TPtr>;
|
||||||
|
|
|
@ -31,10 +31,10 @@ SchurDecomp::SchurDecomp(const SqSylvMatrix &m)
|
||||||
SqSylvMatrix auxt(m);
|
SqSylvMatrix auxt(m);
|
||||||
lapack_int lda = auxt.getLD(), ldvs = q.getLD();
|
lapack_int lda = auxt.getLD(), ldvs = q.getLD();
|
||||||
lapack_int sdim;
|
lapack_int sdim;
|
||||||
auto wr = std::make_unique<double []>(rows);
|
auto wr = std::make_unique<double[]>(rows);
|
||||||
auto wi = std::make_unique<double []>(rows);
|
auto wi = std::make_unique<double[]>(rows);
|
||||||
lapack_int lwork = 6*rows;
|
lapack_int lwork = 6*rows;
|
||||||
auto work = std::make_unique<double []>(lwork);
|
auto work = std::make_unique<double[]>(lwork);
|
||||||
lapack_int info;
|
lapack_int info;
|
||||||
dgees("V", "N", nullptr, &rows, auxt.base(), &lda, &sdim,
|
dgees("V", "N", nullptr, &rows, auxt.base(), &lda, &sdim,
|
||||||
wr.get(), wi.get(), q.base(), &ldvs,
|
wr.get(), wi.get(), q.base(), &ldvs,
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
neighbour is bubbled also in front. The method returns a new
|
neighbour is bubbled also in front. The method returns a new
|
||||||
position ‘to’, where the original block pointed by ‘to’ happens to
|
position ‘to’, where the original block pointed by ‘to’ happens to
|
||||||
appear at the end. ‘from’ must be greater than ‘to’.
|
appear at the end. ‘from’ must be greater than ‘to’.
|
||||||
*/
|
*/
|
||||||
SchurDecompEig::diag_iter
|
SchurDecompEig::diag_iter
|
||||||
SchurDecompEig::bubbleEigen(diag_iter from, diag_iter to)
|
SchurDecompEig::bubbleEigen(diag_iter from, diag_iter to)
|
||||||
{
|
{
|
||||||
|
@ -65,7 +65,7 @@ SchurDecompEig::bubbleEigen(diag_iter from, diag_iter to)
|
||||||
resolve eigenvalues from ‘itadd’ to ‘it’, before the ‘it’ can be
|
resolve eigenvalues from ‘itadd’ to ‘it’, before the ‘it’ can be
|
||||||
resolved.
|
resolved.
|
||||||
The success is signaled by returned true.
|
The success is signaled by returned true.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
SchurDecompEig::tryToSwap(diag_iter &it, diag_iter &itadd)
|
SchurDecompEig::tryToSwap(diag_iter &it, diag_iter &itadd)
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,7 +52,7 @@ SimilarityDecomp::getXDim(diag_iter start, diag_iter end,
|
||||||
/* Find solution of X for diagonal block given by start(incl.) and
|
/* Find solution of X for diagonal block given by start(incl.) and
|
||||||
end(excl.). If the solution cannot be found, or it is greater than
|
end(excl.). If the solution cannot be found, or it is greater than
|
||||||
norm, X is not changed and flase is returned.
|
norm, X is not changed and flase is returned.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
SimilarityDecomp::solveX(diag_iter start, diag_iter end,
|
SimilarityDecomp::solveX(diag_iter start, diag_iter end,
|
||||||
GeneralMatrix &X, double norm) const
|
GeneralMatrix &X, double norm) const
|
||||||
|
|
|
@ -133,11 +133,11 @@ mxArray *
|
||||||
SylvParams::IntParamItem::createMatlabArray() const
|
SylvParams::IntParamItem::createMatlabArray() const
|
||||||
{
|
{
|
||||||
mxArray *res = mxCreateNumericMatrix(1, 1, mxINT32_CLASS, mxREAL);
|
mxArray *res = mxCreateNumericMatrix(1, 1, mxINT32_CLASS, mxREAL);
|
||||||
#if MX_HAS_INTERLEAVED_COMPLEX
|
# if MX_HAS_INTERLEAVED_COMPLEX
|
||||||
*mxGetInt32s(res) = value;
|
*mxGetInt32s(res) = value;
|
||||||
#else
|
# else
|
||||||
*static_cast<int *>(mxGetData(res)) = value;
|
*static_cast<int *>(mxGetData(res)) = value;
|
||||||
#endif
|
# endif
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,9 @@
|
||||||
# include <dynmex.h>
|
# include <dynmex.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum class status {def, changed, undef};
|
enum class status { def, changed, undef };
|
||||||
|
|
||||||
template <class _Type>
|
template<class _Type>
|
||||||
struct ParamItem
|
struct ParamItem
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
@ -81,7 +81,7 @@ public:
|
||||||
class SylvParams
|
class SylvParams
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum class solve_method {iter, recurse};
|
enum class solve_method { iter, recurse };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
class DoubleParamItem : public ParamItem<double>
|
class DoubleParamItem : public ParamItem<double>
|
||||||
|
|
|
@ -447,7 +447,7 @@ TestRunnable::eig_bubble(const std::string &aname, int from, int to)
|
||||||
double normInf = check.getNormInf();
|
double normInf = check.getNormInf();
|
||||||
double onorm1 = orig.getNorm1();
|
double onorm1 = orig.getNorm1();
|
||||||
double onormInf = orig.getNormInf();
|
double onormInf = orig.getNormInf();
|
||||||
std:: cout << "\tabs. error1 = " << norm1 << std::endl
|
std::cout << "\tabs. error1 = " << norm1 << std::endl
|
||||||
<< u8"\tabs. error∞ = " << normInf << std::endl
|
<< u8"\tabs. error∞ = " << normInf << std::endl
|
||||||
<< "\trel. error1 = " << norm1/onorm1 << std::endl
|
<< "\trel. error1 = " << norm1/onorm1 << std::endl
|
||||||
<< u8"\trel. error∞ = " << normInf/onormInf << std::endl;
|
<< u8"\trel. error∞ = " << normInf/onormInf << std::endl;
|
||||||
|
|
|
@ -90,7 +90,7 @@ public:
|
||||||
method, which returns a type for a given stack as the type of the
|
method, which returns a type for a given stack as the type of the
|
||||||
corresponding (old) stack of the former stack container. */
|
corresponding (old) stack of the former stack container. */
|
||||||
|
|
||||||
template <class _Ttype>
|
template<class _Ttype>
|
||||||
class FineContainer : public SizeRefinement, public StackContainer<_Ttype>
|
class FineContainer : public SizeRefinement, public StackContainer<_Ttype>
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -59,7 +59,7 @@ FFSTensor::FFSTensor(const FFSTensor &t, const ConstVector &x)
|
||||||
symmetry. Let n be a number of variables and d the
|
symmetry. Let n be a number of variables and d the
|
||||||
⎛n+d-1⎞
|
⎛n+d-1⎞
|
||||||
dimension dim. Then the number of indices is ⎝ d ⎠.
|
dimension dim. Then the number of indices is ⎝ d ⎠.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
FFSTensor::calcMaxOffset(int nvar, int d)
|
FFSTensor::calcMaxOffset(int nvar, int d)
|
||||||
|
@ -79,7 +79,7 @@ FFSTensor::FFSTensor(const FSSparseTensor &t)
|
||||||
nv(t.nvar())
|
nv(t.nvar())
|
||||||
{
|
{
|
||||||
zeros();
|
zeros();
|
||||||
for (const auto & it : t.getMap())
|
for (const auto &it : t.getMap())
|
||||||
{
|
{
|
||||||
index ind(*this, it.first);
|
index ind(*this, it.first);
|
||||||
get(it.second.first, *ind) = it.second.second;
|
get(it.second.first, *ind) = it.second.second;
|
||||||
|
|
|
@ -284,7 +284,7 @@ IntSequence::print() const
|
||||||
we want to compute the number of permutations of the word ‘yyyyuuvvv’.
|
we want to compute the number of permutations of the word ‘yyyyuuvvv’.
|
||||||
⎛ 9 ⎞
|
⎛ 9 ⎞
|
||||||
This is equal to the multinomial coefficient ⎝4,2,3⎠.
|
This is equal to the multinomial coefficient ⎝4,2,3⎠.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
IntSequence::noverseq()
|
IntSequence::noverseq()
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,7 +37,7 @@ UNormalMoments::UNormalMoments(int maxdim, const TwoDMatrix &v)
|
||||||
equal to 2n. See the header file for proof and details.
|
equal to 2n. See the header file for proof and details.
|
||||||
|
|
||||||
Here we sequentially construct the Kronecker power ⊗ⁿv and apply Fₙ.
|
Here we sequentially construct the Kronecker power ⊗ⁿv and apply Fₙ.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
UNormalMoments::generateMoments(int maxdim, const TwoDMatrix &v)
|
UNormalMoments::generateMoments(int maxdim, const TwoDMatrix &v)
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
Also, we need PermutationSet class which contains all permutations
|
Also, we need PermutationSet class which contains all permutations
|
||||||
of an n-element set, and a bundle of permutations PermutationBundle
|
of an n-element set, and a bundle of permutations PermutationBundle
|
||||||
which contains all permutation sets up to a given number.
|
which contains all permutation sets up to a given number.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef PERMUTATION_H
|
#ifndef PERMUTATION_H
|
||||||
#define PERMUTATION_H
|
#define PERMUTATION_H
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
indices which yield identity. Also we have a constructor calculating
|
indices which yield identity. Also we have a constructor calculating
|
||||||
map, which corresponds to permutation in sort. This is, we want
|
map, which corresponds to permutation in sort. This is, we want
|
||||||
(sorted s)∘m = s.
|
(sorted s)∘m = s.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Permutation
|
class Permutation
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,7 +86,8 @@
|
||||||
class PerTensorDimens : public TensorDimens
|
class PerTensorDimens : public TensorDimens
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
static IntSequence sortIntSequence(IntSequence s)
|
static IntSequence
|
||||||
|
sortIntSequence(IntSequence s)
|
||||||
{
|
{
|
||||||
s.sort();
|
s.sort();
|
||||||
return s;
|
return s;
|
||||||
|
@ -221,7 +222,7 @@ public:
|
||||||
void addTo(FGSTensor &out) const;
|
void addTo(FGSTensor &out) const;
|
||||||
void addTo(UGSTensor &out) const;
|
void addTo(UGSTensor &out) const;
|
||||||
|
|
||||||
enum class fill_method {first, second};
|
enum class fill_method { first, second };
|
||||||
static fill_method decideFillMethod(const FSSparseTensor &t);
|
static fill_method decideFillMethod(const FSSparseTensor &t);
|
||||||
private:
|
private:
|
||||||
int tailIdentitySize() const;
|
int tailIdentitySize() const;
|
||||||
|
|
|
@ -43,7 +43,7 @@ USubTensor::USubTensor(const TensorDimens &bdims,
|
||||||
"Tensor has not full symmetry in USubTensor()");
|
"Tensor has not full symmetry in USubTensor()");
|
||||||
const EquivalenceSet &eset = TLStatic::getEquiv(bdims.dimen());
|
const EquivalenceSet &eset = TLStatic::getEquiv(bdims.dimen());
|
||||||
zeros();
|
zeros();
|
||||||
for (const auto & it : eset)
|
for (const auto &it : eset)
|
||||||
{
|
{
|
||||||
if (it.numClasses() == hdims.dimen())
|
if (it.numClasses() == hdims.dimen())
|
||||||
{
|
{
|
||||||
|
|
|
@ -119,7 +119,7 @@ WorkerFoldMAASparse1::operator()(std::mutex &mut)
|
||||||
const Permutation &per = pset.get(iper);
|
const Permutation &per = pset.get(iper);
|
||||||
IntSequence percoor(coor.size());
|
IntSequence percoor(coor.size());
|
||||||
per.apply(coor, percoor);
|
per.apply(coor, percoor);
|
||||||
for (const auto & it : eset)
|
for (const auto &it : eset)
|
||||||
{
|
{
|
||||||
if (it.numClasses() == t.dimen())
|
if (it.numClasses() == t.dimen())
|
||||||
{
|
{
|
||||||
|
@ -231,7 +231,7 @@ FoldedStackContainer::multAndAddSparse3(const FSSparseTensor &t,
|
||||||
Vector outcol{out.getCol(*run)};
|
Vector outcol{out.getCol(*run)};
|
||||||
FRSingleTensor sumcol(t.nvar(), t.dimen());
|
FRSingleTensor sumcol(t.nvar(), t.dimen());
|
||||||
sumcol.zeros();
|
sumcol.zeros();
|
||||||
for (const auto & it : eset)
|
for (const auto &it : eset)
|
||||||
if (it.numClasses() == t.dimen())
|
if (it.numClasses() == t.dimen())
|
||||||
{
|
{
|
||||||
StackProduct<FGSTensor> sp(*this, it, out.getSym());
|
StackProduct<FGSTensor> sp(*this, it, out.getSym());
|
||||||
|
@ -485,7 +485,7 @@ WorkerUnfoldMAASparse1::operator()(std::mutex &mut)
|
||||||
const Permutation &per = pset.get(iper);
|
const Permutation &per = pset.get(iper);
|
||||||
IntSequence percoor(coor.size());
|
IntSequence percoor(coor.size());
|
||||||
per.apply(coor, percoor);
|
per.apply(coor, percoor);
|
||||||
for (const auto & it : eset)
|
for (const auto &it : eset)
|
||||||
if (it.numClasses() == t.dimen())
|
if (it.numClasses() == t.dimen())
|
||||||
{
|
{
|
||||||
StackProduct<UGSTensor> sp(cont, it, out.getSym());
|
StackProduct<UGSTensor> sp(cont, it, out.getSym());
|
||||||
|
@ -611,7 +611,7 @@ UnfoldedStackContainer::multAndAddStacks(const IntSequence &fi,
|
||||||
{
|
{
|
||||||
Permutation sort_per(ui.getCoor());
|
Permutation sort_per(ui.getCoor());
|
||||||
sort_per.inverse();
|
sort_per.inverse();
|
||||||
for (const auto & it : eset)
|
for (const auto &it : eset)
|
||||||
if (it.numClasses() == g.dimen())
|
if (it.numClasses() == g.dimen())
|
||||||
{
|
{
|
||||||
StackProduct<UGSTensor> sp(*this, it, sort_per, out.getSym());
|
StackProduct<UGSTensor> sp(*this, it, sort_per, out.getSym());
|
||||||
|
|
|
@ -107,12 +107,12 @@
|
||||||
from zero types, or unit matrices are deleted. See kron_prod.hh for an
|
from zero types, or unit matrices are deleted. See kron_prod.hh for an
|
||||||
explanation. */
|
explanation. */
|
||||||
|
|
||||||
template <class _Ttype>
|
template<class _Ttype>
|
||||||
class StackContainerInterface
|
class StackContainerInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using _Ctype = TensorContainer<_Ttype>;
|
using _Ctype = TensorContainer<_Ttype>;
|
||||||
enum class itype { matrix, unit, zero};
|
enum class itype { matrix, unit, zero };
|
||||||
public:
|
public:
|
||||||
StackContainerInterface() = default;
|
StackContainerInterface() = default;
|
||||||
virtual ~StackContainerInterface() = default;
|
virtual ~StackContainerInterface() = default;
|
||||||
|
@ -145,7 +145,7 @@ public:
|
||||||
|
|
||||||
It does not own its tensors. */
|
It does not own its tensors. */
|
||||||
|
|
||||||
template <class _Ttype>
|
template<class _Ttype>
|
||||||
class StackContainer : virtual public StackContainerInterface<_Ttype>
|
class StackContainer : virtual public StackContainerInterface<_Ttype>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -347,7 +347,7 @@ protected:
|
||||||
on four variables, the third being u′ a dummy and always returning zero if
|
on four variables, the third being u′ a dummy and always returning zero if
|
||||||
dimension of u′ is positive. */
|
dimension of u′ is positive. */
|
||||||
|
|
||||||
template <class _Ttype>
|
template<class _Ttype>
|
||||||
class ZContainer : public StackContainer<_Ttype>
|
class ZContainer : public StackContainer<_Ttype>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -429,7 +429,7 @@ public:
|
||||||
third one is dummy, and always returns zero. The first stack
|
third one is dummy, and always returns zero. The first stack
|
||||||
corresponds to a container of g*. */
|
corresponds to a container of g*. */
|
||||||
|
|
||||||
template <class _Ttype>
|
template<class _Ttype>
|
||||||
class GContainer : public StackContainer<_Ttype>
|
class GContainer : public StackContainer<_Ttype>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -503,7 +503,7 @@ public:
|
||||||
equivalence can have permuted classes by some given
|
equivalence can have permuted classes by some given
|
||||||
permutation. Nothing else is interesting. */
|
permutation. Nothing else is interesting. */
|
||||||
|
|
||||||
template <class _Ttype>
|
template<class _Ttype>
|
||||||
class StackProduct
|
class StackProduct
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -614,7 +614,7 @@ public:
|
||||||
/* Here we only inherit from Kronecker product KronProdAllOptim, only to
|
/* Here we only inherit from Kronecker product KronProdAllOptim, only to
|
||||||
allow for a constructor constructing from StackProduct. */
|
allow for a constructor constructing from StackProduct. */
|
||||||
|
|
||||||
template <class _Ttype>
|
template<class _Ttype>
|
||||||
class KronProdStack : public KronProdAllOptim
|
class KronProdStack : public KronProdAllOptim
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -116,7 +116,7 @@ symiterator::operator++()
|
||||||
|
|
||||||
InducedSymmetries::InducedSymmetries(const Equivalence &e, const Symmetry &s)
|
InducedSymmetries::InducedSymmetries(const Equivalence &e, const Symmetry &s)
|
||||||
{
|
{
|
||||||
for (const auto & i : e)
|
for (const auto &i : e)
|
||||||
emplace_back(s, i);
|
emplace_back(s, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,8 @@ public:
|
||||||
insert(std::make_unique<_Ttype>(first_row, num, *(it.second)));
|
insert(std::make_unique<_Ttype>(first_row, num, *(it.second)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TensorContainer<_Ttype> &operator=(const TensorContainer<_Ttype> &c)
|
TensorContainer<_Ttype> &
|
||||||
|
operator=(const TensorContainer<_Ttype> &c)
|
||||||
{
|
{
|
||||||
n = c.n;
|
n = c.n;
|
||||||
m.clear();
|
m.clear();
|
||||||
|
|
|
@ -101,7 +101,8 @@ public:
|
||||||
struct dummy { using type = T; };
|
struct dummy { using type = T; };
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
const T &getNext()
|
const T &
|
||||||
|
getNext()
|
||||||
{
|
{
|
||||||
return getNext(dummy<T>());
|
return getNext(dummy<T>());
|
||||||
}
|
}
|
||||||
|
@ -128,7 +129,7 @@ private:
|
||||||
See documentation to TensorPolynomial::derivative() and
|
See documentation to TensorPolynomial::derivative() and
|
||||||
TensorPolynomial::evalPartially() for details. */
|
TensorPolynomial::evalPartially() for details. */
|
||||||
|
|
||||||
template <class _Ttype, class _TGStype, class _Stype>
|
template<class _Ttype, class _TGStype, class _Stype>
|
||||||
class TensorPolynomial : public TensorContainer<_Ttype>
|
class TensorPolynomial : public TensorContainer<_Ttype>
|
||||||
{
|
{
|
||||||
int nr;
|
int nr;
|
||||||
|
@ -472,7 +473,7 @@ public:
|
||||||
tensor, with the number of variables equal to the number of variables
|
tensor, with the number of variables equal to the number of variables
|
||||||
of the polynomial plus 1 for ‘1’. */
|
of the polynomial plus 1 for ‘1’. */
|
||||||
|
|
||||||
template <class _Ttype, class _TGStype, class _Stype>
|
template<class _Ttype, class _TGStype, class _Stype>
|
||||||
class CompactPolynomial : public _Ttype
|
class CompactPolynomial : public _Ttype
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -83,7 +83,7 @@
|
||||||
class Tensor : public TwoDMatrix
|
class Tensor : public TwoDMatrix
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum class indor {along_row, along_col};
|
enum class indor { along_row, along_col };
|
||||||
|
|
||||||
/* The index represents n-tuple α₁…αₙ. Since its movement is dependent on the
|
/* The index represents n-tuple α₁…αₙ. Since its movement is dependent on the
|
||||||
underlying tensor (with storage and symmetry), we maintain a reference to
|
underlying tensor (with storage and symmetry), we maintain a reference to
|
||||||
|
|
|
@ -71,8 +71,8 @@ class TLException
|
||||||
{
|
{
|
||||||
const std::string fname;
|
const std::string fname;
|
||||||
int lnum;
|
int lnum;
|
||||||
const std::string message;
|
|
||||||
public:
|
public:
|
||||||
|
const std::string message;
|
||||||
TLException(std::string fname_arg, int lnum_arg, std::string message_arg)
|
TLException(std::string fname_arg, int lnum_arg, std::string message_arg)
|
||||||
: fname{std::move(fname_arg)},
|
: fname{std::move(fname_arg)},
|
||||||
lnum{lnum_arg},
|
lnum{lnum_arg},
|
||||||
|
|
|
@ -142,7 +142,6 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
~TwoDMatrix() override = default;
|
~TwoDMatrix() override = default;
|
||||||
|
|
||||||
TwoDMatrix &operator=(const TwoDMatrix &m) = default;
|
TwoDMatrix &operator=(const TwoDMatrix &m) = default;
|
||||||
|
|
|
@ -42,7 +42,7 @@ class Factory
|
||||||
public:
|
public:
|
||||||
double get();
|
double get();
|
||||||
// This can be used with UGSTensor, FGSTensor
|
// This can be used with UGSTensor, FGSTensor
|
||||||
template <class _Ttype>
|
template<class _Ttype>
|
||||||
std::unique_ptr<_Ttype>
|
std::unique_ptr<_Ttype>
|
||||||
make(int r, const Symmetry &s, const IntSequence &nvs)
|
make(int r, const Symmetry &s, const IntSequence &nvs)
|
||||||
{
|
{
|
||||||
|
@ -53,7 +53,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// This can be used with FFSTensor, UFSTensor, FRTensor, URTensor
|
// This can be used with FFSTensor, UFSTensor, FRTensor, URTensor
|
||||||
template <class _Ttype>
|
template<class _Ttype>
|
||||||
std::unique_ptr<_Ttype>
|
std::unique_ptr<_Ttype>
|
||||||
make(int r, int nv, int dim)
|
make(int r, int nv, int dim)
|
||||||
{
|
{
|
||||||
|
@ -63,7 +63,7 @@ public:
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Ttype, class _Ctype>
|
template<class _Ttype, class _Ctype>
|
||||||
_Ctype
|
_Ctype
|
||||||
makeCont(int r, const IntSequence &nvs, int maxdim)
|
makeCont(int r, const IntSequence &nvs, int maxdim)
|
||||||
{
|
{
|
||||||
|
@ -80,7 +80,7 @@ public:
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Ttype, class _Ptype>
|
template<class _Ttype, class _Ptype>
|
||||||
_Ptype
|
_Ptype
|
||||||
makePoly(int r, int nv, int maxdim)
|
makePoly(int r, int nv, int maxdim)
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,10 +56,10 @@ protected:
|
||||||
template<class _Ttype>
|
template<class _Ttype>
|
||||||
static bool index_forward(const Symmetry &s, const IntSequence &nvs);
|
static bool index_forward(const Symmetry &s, const IntSequence &nvs);
|
||||||
|
|
||||||
template <class _Ttype>
|
template<class _Ttype>
|
||||||
static bool index_backward(const Symmetry &s, const IntSequence &nvs);
|
static bool index_backward(const Symmetry &s, const IntSequence &nvs);
|
||||||
|
|
||||||
template <class _Ttype>
|
template<class _Ttype>
|
||||||
static bool index_offset(const Symmetry &s, const IntSequence &nvs);
|
static bool index_offset(const Symmetry &s, const IntSequence &nvs);
|
||||||
|
|
||||||
static bool fold_unfold(std::unique_ptr<FTensor> folded);
|
static bool fold_unfold(std::unique_ptr<FTensor> folded);
|
||||||
|
@ -122,7 +122,7 @@ TestRunnable::test() const
|
||||||
/****************************************************/
|
/****************************************************/
|
||||||
/* definition of TestRunnable static methods */
|
/* definition of TestRunnable static methods */
|
||||||
/****************************************************/
|
/****************************************************/
|
||||||
template <class _Ttype>
|
template<class _Ttype>
|
||||||
bool
|
bool
|
||||||
TestRunnable::index_forward(const Symmetry &s, const IntSequence &nvs)
|
TestRunnable::index_forward(const Symmetry &s, const IntSequence &nvs)
|
||||||
{
|
{
|
||||||
|
@ -154,7 +154,7 @@ TestRunnable::index_forward(const Symmetry &s, const IntSequence &nvs)
|
||||||
return fails == 0;
|
return fails == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Ttype>
|
template<class _Ttype>
|
||||||
bool
|
bool
|
||||||
TestRunnable::index_backward(const Symmetry &s, const IntSequence &nvs)
|
TestRunnable::index_backward(const Symmetry &s, const IntSequence &nvs)
|
||||||
{
|
{
|
||||||
|
@ -185,7 +185,7 @@ TestRunnable::index_backward(const Symmetry &s, const IntSequence &nvs)
|
||||||
return fails == 0;
|
return fails == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class _Ttype>
|
template<class _Ttype>
|
||||||
bool
|
bool
|
||||||
TestRunnable::index_offset(const Symmetry &s, const IntSequence &nvs)
|
TestRunnable::index_offset(const Symmetry &s, const IntSequence &nvs)
|
||||||
{
|
{
|
||||||
|
|
|
@ -68,7 +68,6 @@ PascalRow::print() const
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace PascalTriangle
|
namespace PascalTriangle
|
||||||
{
|
{
|
||||||
namespace // Anonymous namespace that is a functional equivalent of “private”
|
namespace // Anonymous namespace that is a functional equivalent of “private”
|
||||||
|
@ -127,7 +126,7 @@ namespace PascalTriangle
|
||||||
void
|
void
|
||||||
print()
|
print()
|
||||||
{
|
{
|
||||||
for (const auto & i : tr)
|
for (const auto &i : tr)
|
||||||
i.print();
|
i.print();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,11 +29,10 @@
|
||||||
*
|
*
|
||||||
* Please note that the following copyright notice only applies to this Dynare
|
* Please note that the following copyright notice only applies to this Dynare
|
||||||
* implementation of the model.
|
* implementation of the model.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2013-2016 Dynare Team
|
* Copyright (C) 2013-2020 Dynare Team
|
||||||
*
|
*
|
||||||
* This file is part of Dynare.
|
* This file is part of Dynare.
|
||||||
*
|
*
|
||||||
|
@ -51,72 +50,78 @@
|
||||||
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var d //preference shock
|
var d (long_name='preference shock')
|
||||||
c //consumption
|
c (long_name='consumption')
|
||||||
mu_z //trend growth rate of the economy (from neutral and investment specific technology)
|
mu_z (long_name='trend growth rate of the economy (from neutral and investment specific technology)')
|
||||||
mu_I //growth rate of investment-specific technology growth
|
mu_I (long_name='growth rate of investment-specific technology growth')
|
||||||
mu_A //growth rate of neutral technology
|
mu_A (long_name='growth rate of neutral technology')
|
||||||
lambda //Lagrange multiplier
|
lambda (long_name='Lagrange multiplier')
|
||||||
R //Nominal Interest rate
|
R (long_name='Nominal Interest rate')
|
||||||
PI //Inflation
|
PI (long_name='Inflation')
|
||||||
r //rental rate of capital
|
r (long_name='rental rate of capital')
|
||||||
x //investment
|
x (long_name='investment')
|
||||||
u //capacity utilization
|
u (long_name='capacity utilization')
|
||||||
q //Tobin's marginal q
|
q (long_name='Tobin marginal q')
|
||||||
f //variable for recursive formulation of wage setting
|
f (long_name='variable for recursive formulation of wage setting')
|
||||||
ld //aggregate labor demand
|
ld (long_name='aggregate labor demand')
|
||||||
w //real wage
|
w (long_name='real wage')
|
||||||
wstar //optimal real wage
|
wstar (long_name='optimal real wage')
|
||||||
PIstarw //optimal wage inflation
|
PIstarw (long_name='optimal wage inflation')
|
||||||
PIstar //optimal price inflation
|
PIstar (long_name='optimal price inflation')
|
||||||
g1 //variable 1 for recursive formulation of price setting
|
g1 (long_name='variable 1 for recursive formulation of price setting')
|
||||||
g2 //variable 2 for recursive formulation of price setting
|
g2 (long_name='variable 2 for recursive formulation of price setting')
|
||||||
yd //aggregate output
|
yd (long_name='aggregate output')
|
||||||
mc //marginal costs
|
mc (long_name='marginal costs')
|
||||||
k //capital
|
k (long_name='capital')
|
||||||
vp //price dispersion term
|
vp (long_name='price dispersion term')
|
||||||
vw //wage dispersion term
|
vw (long_name='wage dispersion term')
|
||||||
l //aggregate labor bundle
|
l (long_name='aggregate labor bundle')
|
||||||
phi //labor disutility shock
|
phi (long_name='labor disutility shock')
|
||||||
F; //firm profits
|
F (long_name='firm profits')
|
||||||
|
;
|
||||||
|
|
||||||
varexo epsd epsphi epsmu_I epsA epsm;
|
varexo epsd (long_name='Innovation preference shock')
|
||||||
|
epsphi (long_name='Innovation labor disutility shock')
|
||||||
|
epsmu_I (long_name='Innovation investment-specific technology')
|
||||||
|
epsA (long_name='Innovation neutral technology')
|
||||||
|
epsm (long_name='Innovation monetary policy shock')
|
||||||
|
;
|
||||||
|
|
||||||
predetermined_variables k;
|
predetermined_variables k;
|
||||||
|
|
||||||
parameters h //consumption habits
|
parameters h (long_name='consumption habits')
|
||||||
betta //discount factor
|
betta (long_name='discount factor')
|
||||||
gammma1 //capital utilization, linear term
|
gammma1 (long_name='capital utilization, linear term')
|
||||||
gammma2 //capital utilization, quadratic term
|
gammma2 (long_name='capital utilization, quadratic term')
|
||||||
delta //depreciation rate
|
delta (long_name='depreciation rate')
|
||||||
kappa //capital adjustment costs parameter
|
kappa (long_name='capital adjustment costs parameter')
|
||||||
eta //elasticity of substitution between labor varieties
|
eta (long_name='elasticity of substitution between labor varieties')
|
||||||
epsilon //elasticity of substitution between goods varieties
|
epsilon (long_name='elasticity of substitution between goods varieties')
|
||||||
varpsi //labor disutility parameter
|
varpsi (long_name='labor disutility parameter')
|
||||||
gammma //inverse Frisch elasticity
|
gammma (long_name='inverse Frisch elasticity')
|
||||||
chiw //wage indexation parameter
|
chiw (long_name='wage indexation parameter')
|
||||||
chi //price indexation
|
chi (long_name='price indexation')
|
||||||
thetap //Calvo parameter prices
|
thetap (long_name='Calvo parameter prices')
|
||||||
thetaw //Calvo parameter wages
|
thetaw (long_name='Calvo parameter wages')
|
||||||
alppha //capital share
|
alppha (long_name='capital share')
|
||||||
Rbar //steady state interest rate
|
Rbar (long_name='steady state interest rate')
|
||||||
PIbar //steady state inflation
|
PIbar (long_name='steady state inflation')
|
||||||
gammmaR //interest smoothing coefficient Taylor rule
|
gammmaR (long_name='interest smoothing coefficient Taylor rule')
|
||||||
gammmaPI //feedback coefficient to inflation monetary policy rule
|
gammmaPI (long_name='feedback coefficient to inflation monetary policy rule')
|
||||||
gammmay //feedback coefficient to output growth deviation in monetary policy rule
|
gammmay (long_name='feedback coefficient to output growth deviation in monetary policy rule')
|
||||||
Phi //firms fixed costs
|
Phi (long_name='firms fixed costs')
|
||||||
rhod //autocorrelation preference shock
|
rhod (long_name='autocorrelation preference shock')
|
||||||
rhophi //autocorrelation labor disutility shock
|
rhophi (long_name='autocorrelation labor disutility shock')
|
||||||
Lambdamu //steady state growth rate of investmentment-specific technology
|
Lambdamu (long_name='steady state growth rate of investmentment-specific technology')
|
||||||
LambdaA //steady state neutral technology growth
|
LambdaA (long_name='steady state neutral technology growth')
|
||||||
Lambdax //steady state growth rate of investment
|
Lambdax (long_name='steady state growth rate of investment')
|
||||||
LambdaYd //steady state growth rate of output
|
LambdaYd (long_name='steady state growth rate of output')
|
||||||
sigma_d //standard deviation preference shock
|
sigma_d (long_name='standard deviation preference shock')
|
||||||
sigma_phi //standard deviation labor disutility shock
|
sigma_phi (long_name='standard deviation labor disutility shock')
|
||||||
sigma_mu //standard deviation investment-specific technology
|
sigma_mu (long_name='standard deviation investment-specific technology')
|
||||||
sigma_A //standard deviation neutral technology
|
sigma_A (long_name='standard deviation neutral technology')
|
||||||
sigma_m; //standard deviation preference shock
|
sigma_m (long_name='standard deviation monetary policy shock')
|
||||||
|
;
|
||||||
|
|
||||||
//Note that the parameter naming in FV(2010) differs from FV(2006)
|
//Note that the parameter naming in FV(2010) differs from FV(2006)
|
||||||
//Fixed parameters, taken from FV(2010), Table 2, p. 37
|
//Fixed parameters, taken from FV(2010), Table 2, p. 37
|
||||||
|
@ -177,60 +182,67 @@ FV(2006), p. 20, section 3.2.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
model;
|
model;
|
||||||
//1. FOC consumption
|
[name='FOC consumption']
|
||||||
d*(c-h*c(-1)*mu_z^(-1))^(-1)-h*betta*d(+1)*(c(+1)*mu_z(+1)-h*c)^(-1)=lambda;
|
d*(c-h*c(-1)*mu_z^(-1))^(-1)-h*betta*d(+1)*(c(+1)*mu_z(+1)-h*c)^(-1)=lambda;
|
||||||
//2. Euler equation
|
[name='Euler equation']
|
||||||
lambda=betta*lambda(+1)*mu_z(+1)^(-1)/PI(+1)*R;
|
lambda=betta*lambda(+1)*mu_z(+1)^(-1)/PI(+1)*R;
|
||||||
//3. FOC capital utilization
|
[name='FOC capital utilization']
|
||||||
r=gammma1+gammma2*(u-1);
|
r=gammma1+gammma2*(u-1);
|
||||||
//4. FOC capital
|
[name='FOC capital']
|
||||||
q=betta*lambda(+1)/lambda*mu_z(+1)^(-1)*mu_I(+1)^(-1)*((1-delta)*q(+1)+r(+1)*u(+1)-(gammma1*(u(+1)-1)+gammma2/2*(u(+1)-1)^2));
|
q=betta*lambda(+1)/lambda*mu_z(+1)^(-1)*mu_I(+1)^(-1)*((1-delta)*q(+1)+r(+1)*u(+1)-(gammma1*(u(+1)-1)+gammma2/2*(u(+1)-1)^2));
|
||||||
//5. FOC investment
|
[name='FOC investment']
|
||||||
1=q*(1-(kappa/2*(x/x(-1)*mu_z-Lambdax)^2)-(kappa*(x/x(-1)*mu_z-Lambdax)*x/x(-1)*mu_z))
|
1=q*(1-(kappa/2*(x/x(-1)*mu_z-Lambdax)^2)-(kappa*(x/x(-1)*mu_z-Lambdax)*x/x(-1)*mu_z))
|
||||||
+betta*q(+1)*lambda(+1)/lambda*mu_z(+1)^(-1)*kappa*(x(+1)/x*mu_z(+1)-Lambdax)*(x(+1)/x*mu_z(+1))^2;
|
+betta*q(+1)*lambda(+1)/lambda*mu_z(+1)^(-1)*kappa*(x(+1)/x*mu_z(+1)-Lambdax)*(x(+1)/x*mu_z(+1))^2;
|
||||||
//6-7. Wage setting
|
[name='Wage setting 1']
|
||||||
f=(eta-1)/eta*wstar^(1-eta)*lambda*w^eta*ld+betta*thetaw*(PI^chiw/PI(+1))^(1-eta)*(wstar(+1)/wstar*mu_z(+1))^(eta-1)*f(+1);
|
f=(eta-1)/eta*wstar^(1-eta)*lambda*w^eta*ld+betta*thetaw*(PI^chiw/PI(+1))^(1-eta)*(wstar(+1)/wstar*mu_z(+1))^(eta-1)*f(+1);
|
||||||
|
[name='Wage setting 2']
|
||||||
f=varpsi*d*phi*PIstarw^(-eta*(1+gammma))*ld^(1+gammma)+betta*thetaw*(PI^chiw/PI(+1))^(-eta*(1+gammma))*(wstar(+1)/wstar*mu_z(+1))^(eta*(1+gammma))*f(+1);
|
f=varpsi*d*phi*PIstarw^(-eta*(1+gammma))*ld^(1+gammma)+betta*thetaw*(PI^chiw/PI(+1))^(-eta*(1+gammma))*(wstar(+1)/wstar*mu_z(+1))^(eta*(1+gammma))*f(+1);
|
||||||
|
|
||||||
//8-10. firm's price setting
|
[name='Firm price setting 1']
|
||||||
g1=lambda*mc*yd+betta*thetap*(PI^chi/PI(+1))^(-epsilon)*g1(+1);
|
g1=lambda*mc*yd+betta*thetap*(PI^chi/PI(+1))^(-epsilon)*g1(+1);
|
||||||
|
[name='Firm price setting 2']
|
||||||
g2=lambda*PIstar*yd+betta*thetap*(PI^chi/PI(+1))^(1-epsilon)*PIstar/PIstar(+1)*g2(+1);
|
g2=lambda*PIstar*yd+betta*thetap*(PI^chi/PI(+1))^(1-epsilon)*PIstar/PIstar(+1)*g2(+1);
|
||||||
|
[name='Firm price setting 3']
|
||||||
epsilon*g1=(epsilon-1)*g2;
|
epsilon*g1=(epsilon-1)*g2;
|
||||||
//11-12. optimal inputs
|
[name='Optimal capital labor ratio']
|
||||||
u*k/ld=alppha/(1-alppha)*w/r*mu_z*mu_I;
|
u*k/ld=alppha/(1-alppha)*w/r*mu_z*mu_I;
|
||||||
|
[name='Marginal costs']
|
||||||
mc=(1/(1-alppha))^(1-alppha)*(1/alppha)^alppha*w^(1-alppha)*r^alppha;
|
mc=(1/(1-alppha))^(1-alppha)*(1/alppha)^alppha*w^(1-alppha)*r^alppha;
|
||||||
//13. law of motion wages
|
[name='law of motion wages']
|
||||||
1=thetaw*(PI(-1)^chiw/PI)^(1-eta)*(w(-1)/w*mu_z^(-1))^(1-eta)+(1-thetaw)*PIstarw^(1-eta);
|
1=thetaw*(PI(-1)^chiw/PI)^(1-eta)*(w(-1)/w*mu_z^(-1))^(1-eta)+(1-thetaw)*PIstarw^(1-eta);
|
||||||
//14. law of motion prices
|
[name='law of motion prices']
|
||||||
1=thetap*(PI(-1)^chi/PI)^(1-epsilon)+(1-thetap)*PIstar^(1-epsilon);
|
1=thetap*(PI(-1)^chi/PI)^(1-epsilon)+(1-thetap)*PIstar^(1-epsilon);
|
||||||
|
|
||||||
//15. Taylor Rule
|
[name='Taylor Rule']
|
||||||
R/Rbar=(R(-1)/Rbar)^gammmaR*((PI/PIbar)^gammmaPI*((yd/yd(-1)*mu_z)/exp(LambdaYd))^gammmay)^(1-gammmaR)*exp(epsm);
|
R/Rbar=(R(-1)/Rbar)^gammmaR*((PI/PIbar)^gammmaPI*((yd/yd(-1)*mu_z)/exp(LambdaYd))^gammmay)^(1-gammmaR)*exp(epsm);
|
||||||
|
|
||||||
//16-17. Market clearing
|
[name='Resource constraint']
|
||||||
yd=c+x+mu_z^(-1)*mu_I^(-1)*(gammma1*(u-1)+gammma2/2*(u-1)^2)*k;
|
yd=c+x+mu_z^(-1)*mu_I^(-1)*(gammma1*(u-1)+gammma2/2*(u-1)^2)*k;
|
||||||
|
[name='Aggregate production']
|
||||||
yd=(mu_A*mu_z^(-1)*(u*k)^alppha*ld^(1-alppha)-Phi)/vp;
|
yd=(mu_A*mu_z^(-1)*(u*k)^alppha*ld^(1-alppha)-Phi)/vp;
|
||||||
//18-20. Price and wage dispersion terms
|
[name='Aggregate labor market']
|
||||||
l=vw*ld;
|
l=vw*ld;
|
||||||
|
[name='LOM Price dispersion term']
|
||||||
vp=thetap*(PI(-1)^chi/PI)^(-epsilon)*vp(-1)+(1-thetap)*PIstar^(-epsilon);
|
vp=thetap*(PI(-1)^chi/PI)^(-epsilon)*vp(-1)+(1-thetap)*PIstar^(-epsilon);
|
||||||
|
[name='LOM Wage dispersion term']
|
||||||
vw=thetaw*(w(-1)/w*mu_z^(-1)*PI(-1)^chiw/PI)^(-eta)*vw(-1)+(1-thetaw)*(PIstarw)^(-eta);
|
vw=thetaw*(w(-1)/w*mu_z^(-1)*PI(-1)^chiw/PI)^(-eta)*vw(-1)+(1-thetaw)*(PIstarw)^(-eta);
|
||||||
//21. Law of motion for capital
|
[name='Law of motion for capital']
|
||||||
k(+1)*mu_z*mu_I-(1-delta)*k-mu_z*mu_I*(1-kappa/2*(x/x(-1)*mu_z-Lambdax)^2)*x=0;
|
k(+1)*mu_z*mu_I-(1-delta)*k-mu_z*mu_I*(1-kappa/2*(x/x(-1)*mu_z-Lambdax)^2)*x=0;
|
||||||
//22. Profits
|
[name='Profits']
|
||||||
F=yd-1/(1-alppha)*w*ld;
|
F=yd-1/(1-alppha)*w*ld;
|
||||||
//23. definition optimal wage inflation
|
[name='definition optimal wage inflation']
|
||||||
PIstarw=wstar/w;
|
PIstarw=wstar/w;
|
||||||
|
|
||||||
//exogenous processes
|
//exogenous processes
|
||||||
//24. Preference Shock
|
[name='Preference Shock']
|
||||||
log(d)=rhod*log(d(-1))+epsd;
|
log(d)=rhod*log(d(-1))+epsd;
|
||||||
//25. Labor disutility Shock
|
[name='Labor disutility Shock']
|
||||||
log(phi)=rhophi*log(phi(-1))+epsphi;
|
log(phi)=rhophi*log(phi(-1))+epsphi;
|
||||||
//26. Investment specific technology
|
[name='Investment specific technology']
|
||||||
log(mu_I)=Lambdamu+epsmu_I;
|
log(mu_I)=Lambdamu+epsmu_I;
|
||||||
//27. Neutral technology
|
[name='Neutral technology']
|
||||||
log(mu_A)=LambdaA+epsA;
|
log(mu_A)=LambdaA+epsA;
|
||||||
//28. Defininition composite technology
|
[name='Defininition composite technology']
|
||||||
mu_z=mu_A^(1/(1-alppha))*mu_I^(alppha/(1-alppha));
|
mu_z=mu_A^(1/(1-alppha))*mu_I^(alppha/(1-alppha));
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
|
@ -15,6 +15,23 @@ function [ys,params,check] = NK_baseline_steadystate(ys,exo,M_,options_)
|
||||||
% - check [scalar] set to 0 if steady state computation worked and to
|
% - check [scalar] set to 0 if steady state computation worked and to
|
||||||
% 1 of not (allows to impose restrictions on parameters)
|
% 1 of not (allows to impose restrictions on parameters)
|
||||||
|
|
||||||
|
% Copyright (C) 2013-2020 Dynare Team
|
||||||
|
%
|
||||||
|
% This file is part of Dynare.
|
||||||
|
%
|
||||||
|
% Dynare is free software: you can redistribute it and/or modify
|
||||||
|
% it under the terms of the GNU General Public License as published by
|
||||||
|
% the Free Software Foundation, either version 3 of the License, or
|
||||||
|
% (at your option) any later version.
|
||||||
|
%
|
||||||
|
% Dynare is distributed in the hope that it will be useful,
|
||||||
|
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
% GNU General Public License for more details.
|
||||||
|
%
|
||||||
|
% You should have received a copy of the GNU General Public License
|
||||||
|
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
% read out parameters to access them with their name
|
% read out parameters to access them with their name
|
||||||
NumberOfParameters = M_.param_nbr;
|
NumberOfParameters = M_.param_nbr;
|
||||||
for ii = 1:NumberOfParameters
|
for ii = 1:NumberOfParameters
|
||||||
|
|
|
@ -0,0 +1,239 @@
|
||||||
|
/*
|
||||||
|
* This file replicates the model studied in:
|
||||||
|
* Lawrence J. Christiano, Roberto Motto and Massimo Rostagno (2007):
|
||||||
|
* "Notes on Ramsey-Optimal Monetary Policy", Section 2
|
||||||
|
* The paper is available at http://faculty.wcas.northwestern.edu/~lchrist/d16/d1606/ramsey.pdf
|
||||||
|
*
|
||||||
|
* Notes:
|
||||||
|
* - This mod-files allows to simulate a simple New Keynesian Model with Rotemberg price
|
||||||
|
* adjustment costs under three different monetary policy arrangements:
|
||||||
|
* 1. a Taylor rule with a fixed inflation feedback coefficient alpha
|
||||||
|
* -> set the Optimal_policy switch to 0
|
||||||
|
* 2. a Taylor rule where the inflation feedback coefficient alpha is chosen
|
||||||
|
* optimally to minimize a quadratic loss function (optimal simple rule (OSR))
|
||||||
|
* -> set the Optimal_policy switch to 1 and the Ramsey switch to 0
|
||||||
|
* 3. fully optimal monetary under commitment (Ramsey)
|
||||||
|
* -> set the Optimal_policy switch to 1 and the Ramsey switch to 1
|
||||||
|
*
|
||||||
|
* - The Efficent_steady_state switch can be used to switch from an distorted steady state
|
||||||
|
* due to a monopolistic distortion to one where a labor subsidy counteracts this
|
||||||
|
* distortion. Note that the purely quadratic loss function in the OSR case does not capture
|
||||||
|
* the full welfare losses with a distorted steady state as there would be a linear term
|
||||||
|
* appearing.
|
||||||
|
*
|
||||||
|
* - This files shows how to use a conditional steady state file in the Ramsey case. It takes
|
||||||
|
* the value of the defined instrument R as given and then computes the rest of the steady
|
||||||
|
* state, including the steady state inflation rate, based on this value. The initial value
|
||||||
|
* of the instrument for steady state search must then be defined in an initval-block.
|
||||||
|
*
|
||||||
|
* - The optim_weights in the OSR case are based on a second order approximation to the welfare function
|
||||||
|
* as in Gali (2015). The relative weight between inflation and output gap volatility is essentially
|
||||||
|
* given by the slope of the New Keynesian Phillips Curve. Note that the linear terms that would be
|
||||||
|
* present in case of a distorted steady state need to be dropped for OSR.
|
||||||
|
*
|
||||||
|
* - Due to divine coincidence, the first best policy involves fully stabilizing inflation
|
||||||
|
* and thereby the output gap. As a consequence, the optimal inflation feedback coefficient
|
||||||
|
* in a Taylor rule would be infinity. The OSR command therefore estimates it to be at the
|
||||||
|
* upper bound defined via osr_params_bounds.
|
||||||
|
*
|
||||||
|
* - The mod-file also allows to conduct estimation under Ramsey policy by setting the
|
||||||
|
* Estimation_under_Ramsey switch to 1.
|
||||||
|
*
|
||||||
|
* This implementation was written by Johannes Pfeifer.
|
||||||
|
*
|
||||||
|
* If you spot mistakes, email me at jpfeifer@gmx.de
|
||||||
|
*
|
||||||
|
* Please note that the following copyright notice only applies to this Dynare
|
||||||
|
* implementation of the model.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2019 Dynare Team
|
||||||
|
*
|
||||||
|
* This is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* It is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* For a copy of the GNU General Public License,
|
||||||
|
* see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
//**********Define which monetary policy setup to use ***********
|
||||||
|
|
||||||
|
@#ifndef Optimal_policy
|
||||||
|
@#define Optimal_policy=1
|
||||||
|
@#ifndef Ramsey
|
||||||
|
@#define Ramsey=1
|
||||||
|
@#endif
|
||||||
|
@#endif
|
||||||
|
|
||||||
|
//**********Define whether to use distorted steady state***********
|
||||||
|
|
||||||
|
@#ifndef Efficent_steady_state
|
||||||
|
@#define Efficent_steady_state=0
|
||||||
|
@#endif
|
||||||
|
|
||||||
|
@#ifndef Estimation_under_Ramsey
|
||||||
|
@#define Estimation_under_Ramsey=0
|
||||||
|
@#endif
|
||||||
|
|
||||||
|
var C $C$ (long_name='Consumption')
|
||||||
|
pi $\pi$ (long_name='Gross inflation')
|
||||||
|
h $h$ (long_name='hours worked')
|
||||||
|
Z $Z$ (long_name='TFP')
|
||||||
|
R $R$ (long_name='Net nominal interest rate')
|
||||||
|
log_C ${\ln C}$ (long_name='Log Consumption')
|
||||||
|
log_h ${\ln h}$ (long_name='Log hours worked')
|
||||||
|
pi_ann ${\pi^{ann}}$ (long_name='Annualized net inflation')
|
||||||
|
R_ann ${R^{ann}}$ (long_name='Annualized net nominal interest rate')
|
||||||
|
r_real ${r^{ann,real}}$ (long_name='Annualized net real interest rate')
|
||||||
|
y_nat ${y^{nat}}$ (long_name='Natural (flex price) output')
|
||||||
|
y_gap ${r^{gap}}$ (long_name='Output gap')
|
||||||
|
;
|
||||||
|
|
||||||
|
varexo epsilon ${\varepsilon}$ (long_name='TFP shock')
|
||||||
|
;
|
||||||
|
|
||||||
|
parameters beta ${\beta}$ (long_name='discount factor')
|
||||||
|
theta ${\theta}$ (long_name='substitution elasticity')
|
||||||
|
tau ${\tau}$ (long_name='labor subsidy')
|
||||||
|
chi ${\chi}$ (long_name='labor disutility')
|
||||||
|
phi ${\phi}$ (long_name='price adjustment costs')
|
||||||
|
rho ${\rho}$ (long_name='TFP autocorrelation')
|
||||||
|
@# if !defined(Ramsey) || Ramsey==0
|
||||||
|
pi_star ${\pi^*}$ (long_name='steady state inflation')
|
||||||
|
alpha ${\alpha}$ (long_name='inflation feedback Taylor rule')
|
||||||
|
@# endif
|
||||||
|
;
|
||||||
|
|
||||||
|
beta=0.99;
|
||||||
|
theta=5;
|
||||||
|
phi=100;
|
||||||
|
rho=0.9;
|
||||||
|
@# if !defined(Ramsey) || Ramsey==0
|
||||||
|
alpha=1.5;
|
||||||
|
pi_star=1;
|
||||||
|
@# endif
|
||||||
|
@# if Efficent_steady_state
|
||||||
|
tau=1/(theta-1);
|
||||||
|
@# else
|
||||||
|
tau=0;
|
||||||
|
@# endif
|
||||||
|
chi=1;
|
||||||
|
|
||||||
|
model;
|
||||||
|
[name='Euler equation']
|
||||||
|
1/(1+R)=beta*C/(C(+1)*pi(+1));
|
||||||
|
[name='Firm FOC']
|
||||||
|
(tau-1/(theta-1))*(1-theta)+theta*(chi*h*C/(exp(Z))-1)=phi*(pi-1)*pi-beta*phi*(pi(+1)-1)*pi(+1);
|
||||||
|
[name='Resource constraint']
|
||||||
|
C*(1+phi/2*(pi-1)^2)=exp(Z)*h;
|
||||||
|
[name='TFP process']
|
||||||
|
Z=rho*Z(-1)+epsilon;
|
||||||
|
@#if !defined(Ramsey) || Ramsey==0
|
||||||
|
[name='Taylor rule']
|
||||||
|
R=pi_star/beta-1+alpha*(pi-pi_star);
|
||||||
|
@#endif
|
||||||
|
[name='Definition log consumption']
|
||||||
|
log_C=log(C);
|
||||||
|
[name='Definition log hours worked']
|
||||||
|
log_h=log(h);
|
||||||
|
[name='Definition annualized inflation rate']
|
||||||
|
pi_ann=4*log(pi);
|
||||||
|
[name='Definition annualized nominal interest rate']
|
||||||
|
R_ann=4*R;
|
||||||
|
[name='Definition annualized real interest rate']
|
||||||
|
r_real=4*log((1+R)/pi(+1));
|
||||||
|
[name='Definition natural output']
|
||||||
|
y_nat=exp(Z)*sqrt((theta-1)/theta*(1+tau)/chi);
|
||||||
|
[name='output gap']
|
||||||
|
y_gap=log_C-log(y_nat);
|
||||||
|
end;
|
||||||
|
|
||||||
|
steady_state_model;
|
||||||
|
Z=0;
|
||||||
|
@# if !defined(Ramsey) || Ramsey==0
|
||||||
|
R=pi_star/beta-1; %only set this if not conditional steady state file for Ramsey
|
||||||
|
@# endif
|
||||||
|
pi=(R+1)*beta;
|
||||||
|
C=sqrt((1+1/theta*((1-beta)*(pi-1)*pi-(tau-1/(theta-1))*(1-theta)))/(chi*(1+phi/2*(pi-1)^2)));
|
||||||
|
h=C*(1+phi/2*(pi-1)^2);
|
||||||
|
log_C=log(C);
|
||||||
|
log_h=log(h);
|
||||||
|
pi_ann=4*log(pi);
|
||||||
|
R_ann=4*R;
|
||||||
|
r_real=4*log((1+R)/pi);
|
||||||
|
y_nat=sqrt((theta-1)/theta*(1+tau)/chi);
|
||||||
|
y_gap=log_C-log(y_nat);
|
||||||
|
end;
|
||||||
|
|
||||||
|
@# if defined(Ramsey) && Ramsey==1
|
||||||
|
//define initial value of instrument for Ramsey
|
||||||
|
initval;
|
||||||
|
R=1/beta-1;
|
||||||
|
end;
|
||||||
|
@# endif
|
||||||
|
|
||||||
|
shocks;
|
||||||
|
var epsilon = 0.01^2;
|
||||||
|
end;
|
||||||
|
|
||||||
|
@#if Optimal_policy==0
|
||||||
|
//use Taylor rule
|
||||||
|
stoch_simul(order=2) pi_ann log_h R_ann log_C Z r_real y_nat;
|
||||||
|
@#else
|
||||||
|
@# if !defined(Ramsey) || Ramsey==0
|
||||||
|
//use OSR Taylor rule
|
||||||
|
|
||||||
|
//set weights on (co-)variances for OSR
|
||||||
|
optim_weights;
|
||||||
|
pi theta/((theta-1)/phi);
|
||||||
|
y_gap 1;
|
||||||
|
end;
|
||||||
|
|
||||||
|
//define OSR parameters to be optimized
|
||||||
|
osr_params alpha;
|
||||||
|
|
||||||
|
//starting value for OSR parameter
|
||||||
|
alpha = 1.5;
|
||||||
|
|
||||||
|
//define bounds for OSR during optimization
|
||||||
|
osr_params_bounds;
|
||||||
|
alpha, 0, 100;
|
||||||
|
end;
|
||||||
|
|
||||||
|
//compute OSR and provide output
|
||||||
|
osr(opt_algo=9) pi_ann log_h R_ann log_C Z r_real;
|
||||||
|
|
||||||
|
@# else
|
||||||
|
//use Ramsey optimal policy
|
||||||
|
|
||||||
|
//define planner objective, which corresponds to utility function of agents
|
||||||
|
planner_objective log(C)-chi/2*h^2;
|
||||||
|
|
||||||
|
//set up Ramsey optimal policy problem with interest rate R as the instrument,...
|
||||||
|
// defining the discount factor in the planner objective to be the one of private agents
|
||||||
|
ramsey_model(instruments=(R),planner_discount=beta,planner_discount_latex_name=$\beta$);
|
||||||
|
|
||||||
|
//conduct stochastic simulations of the Ramsey problem
|
||||||
|
stoch_simul(order=1,irf=20,periods=500) pi_ann log_h R_ann log_C Z r_real;
|
||||||
|
evaluate_planner_objective;
|
||||||
|
|
||||||
|
@# if Estimation_under_Ramsey==1
|
||||||
|
datatomfile('ramsey_simulation',{'log_C'})
|
||||||
|
|
||||||
|
estimated_params;
|
||||||
|
rho,0.5,uniform_pdf, , ,0,1;
|
||||||
|
end;
|
||||||
|
varobs log_C;
|
||||||
|
|
||||||
|
estimation(datafile=ramsey_simulation,mode_compute=5);
|
||||||
|
@# endif
|
||||||
|
@# endif
|
||||||
|
@# endif
|
|
@ -1,57 +0,0 @@
|
||||||
module Dynare
|
|
||||||
|
|
||||||
##
|
|
||||||
# Copyright © 2015-2016 Dynare Team
|
|
||||||
#
|
|
||||||
# This file is part of Dynare.
|
|
||||||
#
|
|
||||||
# Dynare is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Dynare is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
##
|
|
||||||
|
|
||||||
export @compile, @dynare
|
|
||||||
|
|
||||||
function compile(modfile)
|
|
||||||
# Add cd to path if not already there
|
|
||||||
if isempty(findin([pwd()], LOAD_PATH))
|
|
||||||
unshift!(LOAD_PATH, pwd())
|
|
||||||
end
|
|
||||||
# Process modfile
|
|
||||||
println(string("Using ", Sys.WORD_SIZE, "-bit preprocessor"))
|
|
||||||
preprocessor = string(dirname(@__FILE__()), "/preprocessor", Sys.WORD_SIZE, "/dynare_m")
|
|
||||||
run(`$preprocessor $modfile language=julia output=dynamic`)
|
|
||||||
end
|
|
||||||
|
|
||||||
macro dynare(modfiles...)
|
|
||||||
ex = Expr(:toplevel)
|
|
||||||
if length(modfiles)>1
|
|
||||||
for modfile in modfiles
|
|
||||||
eval(:(compile($modfile)))
|
|
||||||
basename = split(modfile, ".mod"; keep=false)
|
|
||||||
push!(ex.args, Expr(:import, Symbol(basename[1])))
|
|
||||||
end
|
|
||||||
else
|
|
||||||
eval(:(compile($modfiles)))
|
|
||||||
basename = split(modfiles[1], ".mod"; keep=false)
|
|
||||||
push!(ex.args, Expr(:importall, Symbol(basename[1])))
|
|
||||||
end
|
|
||||||
return ex
|
|
||||||
end
|
|
||||||
|
|
||||||
macro compile(modfiles...)
|
|
||||||
for modfile in modfiles
|
|
||||||
eval(:(compile($modfile)))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,197 +0,0 @@
|
||||||
module DynareModel
|
|
||||||
##
|
|
||||||
# Copyright © 2015-2018 Dynare Team
|
|
||||||
#
|
|
||||||
# This file is part of Dynare.
|
|
||||||
#
|
|
||||||
# Dynare is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Dynare is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
##
|
|
||||||
|
|
||||||
export Model, Endo, Exo, ExoDet, Param, dynare_model
|
|
||||||
|
|
||||||
abstract type Atom end
|
|
||||||
|
|
||||||
immutable Endo <: Atom
|
|
||||||
name::String
|
|
||||||
tex_name::String
|
|
||||||
long_name::String
|
|
||||||
end
|
|
||||||
|
|
||||||
immutable Exo <: Atom
|
|
||||||
name::String
|
|
||||||
tex_name::String
|
|
||||||
long_name::String
|
|
||||||
end
|
|
||||||
|
|
||||||
immutable ExoDet <: Atom
|
|
||||||
name::String
|
|
||||||
tex_name::String
|
|
||||||
long_name::String
|
|
||||||
end
|
|
||||||
|
|
||||||
immutable Param <: Atom
|
|
||||||
name::String
|
|
||||||
tex_name::String
|
|
||||||
long_name::String
|
|
||||||
end
|
|
||||||
|
|
||||||
immutable AuxVars
|
|
||||||
endo_index::Int
|
|
||||||
var_type::Int
|
|
||||||
orig_index::Int
|
|
||||||
orig_lead_lag::Int
|
|
||||||
eq_nbr::Int
|
|
||||||
orig_expr::String
|
|
||||||
end
|
|
||||||
|
|
||||||
immutable PredVars
|
|
||||||
index::Int
|
|
||||||
end
|
|
||||||
|
|
||||||
immutable ObsVars
|
|
||||||
index::Int
|
|
||||||
end
|
|
||||||
|
|
||||||
immutable DetShocks
|
|
||||||
exo_det::Int
|
|
||||||
exo_id::Int
|
|
||||||
multiplicative::Bool
|
|
||||||
periods::Vector{Int}
|
|
||||||
value::Float64
|
|
||||||
end
|
|
||||||
|
|
||||||
immutable EquationTag
|
|
||||||
eq_nbr::Int
|
|
||||||
name::String
|
|
||||||
value::String
|
|
||||||
end
|
|
||||||
|
|
||||||
type Model
|
|
||||||
fname::String
|
|
||||||
dname::String
|
|
||||||
dynare_version::String
|
|
||||||
endo::Vector{Endo}
|
|
||||||
exo::Vector{Exo}
|
|
||||||
exo_det::Vector{ExoDet}
|
|
||||||
param::Vector{Param}
|
|
||||||
aux_vars::Vector{AuxVars}
|
|
||||||
pred_vars::Vector{Int}
|
|
||||||
obs_vars::Vector{Int}
|
|
||||||
state_var::Vector{Int}
|
|
||||||
orig_endo_nbr::Int
|
|
||||||
orig_eq_nbr::Int
|
|
||||||
eq_nbr::Int
|
|
||||||
ramsey_eq_nbr::Int
|
|
||||||
det_shocks::Vector{DetShocks}
|
|
||||||
nstatic::Int
|
|
||||||
nfwrd::Int
|
|
||||||
npred::Int
|
|
||||||
nboth::Int
|
|
||||||
nsfwrd::Int
|
|
||||||
nspred::Int
|
|
||||||
ndynamic::Int
|
|
||||||
maximum_lag::Int
|
|
||||||
maximum_lead::Int
|
|
||||||
maximum_endo_lag::Int
|
|
||||||
maximum_endo_lead::Int
|
|
||||||
maximum_exo_lag::Int
|
|
||||||
maximum_exo_lead::Int
|
|
||||||
orig_maximum_lag::Int
|
|
||||||
orig_maximum_lead::Int
|
|
||||||
orig_maximum_endo_lag::Int
|
|
||||||
orig_maximum_endo_lead::Int
|
|
||||||
orig_maximum_exo_lag::Int
|
|
||||||
orig_maximum_exo_lead::Int
|
|
||||||
orig_maximum_exo_det_lag::Int
|
|
||||||
orig_maximum_exo_det_lead::Int
|
|
||||||
lead_lag_incidence::Matrix{Int}
|
|
||||||
nnzderivatives::Vector{Int}
|
|
||||||
analytical_steady_state::Bool
|
|
||||||
user_written_analytical_steady_state::Bool
|
|
||||||
static_and_dynamic_models_differ::Bool
|
|
||||||
equation_tags::Vector{String}
|
|
||||||
exo_names_orig_ord::Vector{Int}
|
|
||||||
sigma_e::Matrix{Float64}
|
|
||||||
correlation_matrix::Matrix{Float64}
|
|
||||||
h::Matrix{Float64}
|
|
||||||
correlation_matrix_me::Matrix{Float64}
|
|
||||||
sigma_e_is_diagonal::Bool
|
|
||||||
params::Vector{Float64}
|
|
||||||
static::Function
|
|
||||||
static_params_derivs::Function
|
|
||||||
dynamic::Function
|
|
||||||
dynamic_params_derivs::Function
|
|
||||||
steady_state::Function
|
|
||||||
end
|
|
||||||
|
|
||||||
function dynare_model()
|
|
||||||
return Model("", # fname
|
|
||||||
"", # dname
|
|
||||||
"", # dynare_version
|
|
||||||
Vector{Endo}(), # endo
|
|
||||||
Vector{Exo}(), # exo
|
|
||||||
Vector{ExoDet}(), # exo_det
|
|
||||||
Vector{Param}(), # param
|
|
||||||
Vector{AuxVars}(), # aux_vars
|
|
||||||
Vector{Int}(), # pred_vars
|
|
||||||
Vector{Int}(), # obs_vars
|
|
||||||
Vector{Int}(), # state_var
|
|
||||||
0, # orig_endo_nbr
|
|
||||||
0, # orig_eq_nbr
|
|
||||||
0, # eq_nbr
|
|
||||||
0, # ramsey_eq_nbr
|
|
||||||
Vector{DetShocks}(), # det_shocks
|
|
||||||
0, # nstatic
|
|
||||||
0, # nfwrd
|
|
||||||
0, # npred
|
|
||||||
0, # nboth
|
|
||||||
0, # nsfwrd
|
|
||||||
0, # nspred
|
|
||||||
0, # ndynamic
|
|
||||||
0, # maximum_lag
|
|
||||||
0, # maximum_lead
|
|
||||||
0, # maximum_endo_lag
|
|
||||||
0, # maximum_endo_lead
|
|
||||||
0, # maximum_exo_lag
|
|
||||||
0, # maximum_exo_lead
|
|
||||||
0, # orig_maximum_lag
|
|
||||||
0, # orig_maximum_lead
|
|
||||||
0, # orig_maximum_endo_lag
|
|
||||||
0, # orig_maximum_endo_lead
|
|
||||||
0, # orig_maximum_exo_lag
|
|
||||||
0, # orig_maximum_exo_lead
|
|
||||||
0, # orig_maximum_exo_det_lag
|
|
||||||
0, # orig_maximum_exo_det_lead
|
|
||||||
Matrix{Int}(0,0), # lead_lag_incidence
|
|
||||||
zeros(Int64,3), # nnzderivatives
|
|
||||||
false, # analytical_steady_state
|
|
||||||
false, # user_written_analytical_steady_state
|
|
||||||
false, # static_and_dynamic_models_differ
|
|
||||||
Vector{String}(), # equation_tags
|
|
||||||
Vector{Int}(), # exo_names_orig_ord
|
|
||||||
Matrix{Float64}(0,0), # sigma_e (Cov matrix of the structural innovations)
|
|
||||||
Matrix{Float64}(0,0), # correlation_matrix (Corr matrix of the structural innovations)
|
|
||||||
Matrix{Float64}(0,0), # h (Cov matrix of the measurement errors)
|
|
||||||
Matrix{Float64}(0,0), # correlation_matrix_me (Cov matrix of the measurement errors)
|
|
||||||
true, # sigma_e_is_diagonal
|
|
||||||
Vector{Float64}(), # params
|
|
||||||
function()end, # static
|
|
||||||
function()end, # static_params_derivs
|
|
||||||
function()end, # dynamic
|
|
||||||
function()end, # dynamic_params_derivs
|
|
||||||
function()end # steady_state
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,51 +0,0 @@
|
||||||
module DynareOptions
|
|
||||||
##
|
|
||||||
# Copyright © 2015 Dynare Team
|
|
||||||
#
|
|
||||||
# This file is part of Dynare.
|
|
||||||
#
|
|
||||||
# Dynare is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Dynare is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
##
|
|
||||||
|
|
||||||
export Options, dynare_options
|
|
||||||
|
|
||||||
type PFMSolver
|
|
||||||
maxit::Int
|
|
||||||
periods::Int
|
|
||||||
tolx::Float64
|
|
||||||
tolf::Float64
|
|
||||||
end
|
|
||||||
|
|
||||||
function pfmsolver_set_defaults()
|
|
||||||
return PFMSolver(500, # maxit (Maximum number of iterations in Newton algorithm)
|
|
||||||
400, # periods (Number of periods to return to the steady state)
|
|
||||||
1e-6, # tolx (Tolerance criterion on the paths for the endogenous variables)
|
|
||||||
1e-6 # tolf (Tolerance criterion on the stacked non linear equations)
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
type Options
|
|
||||||
dynare_version::String
|
|
||||||
linear::Bool
|
|
||||||
pfmsolver::PFMSolver
|
|
||||||
end
|
|
||||||
|
|
||||||
function dynare_options()
|
|
||||||
return Options("", # dynare_version
|
|
||||||
false, # linear
|
|
||||||
pfmsolver_set_defaults() # pfmsolver
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,36 +0,0 @@
|
||||||
module DynareOutput
|
|
||||||
##
|
|
||||||
# Copyright © 2015-2018 Dynare Team
|
|
||||||
#
|
|
||||||
# This file is part of Dynare.
|
|
||||||
#
|
|
||||||
# Dynare is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Dynare is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
##
|
|
||||||
|
|
||||||
export Ouput, dynare_output
|
|
||||||
|
|
||||||
type Output
|
|
||||||
dynare_version::String
|
|
||||||
steady_state::Vector{Float64}
|
|
||||||
exo_steady_state::Vector{Float64}
|
|
||||||
end
|
|
||||||
|
|
||||||
function dynare_output()
|
|
||||||
return Output("", # dynare_version
|
|
||||||
Vector{Float64}(), # steady_state
|
|
||||||
Vector{Float64}() # exo_steady_state
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,134 +0,0 @@
|
||||||
module PerfectForesightModelSolver
|
|
||||||
|
|
||||||
##
|
|
||||||
# Copyright © 2016 Dynare Team
|
|
||||||
#
|
|
||||||
# This file is part of Dynare.
|
|
||||||
#
|
|
||||||
# Dynare is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Dynare is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
##
|
|
||||||
|
|
||||||
import DynareModel.Model
|
|
||||||
import DynareOutput.Output
|
|
||||||
import DynareOptions.Options
|
|
||||||
|
|
||||||
export simulate_perfect_foresight_model!
|
|
||||||
|
|
||||||
function simulate_perfect_foresight_model!(endogenousvariables::Matrix{Float64}, exogenousvariables::Matrix{Float64}, steadystate::Vector{Float64}, model::Model, options::Options)
|
|
||||||
|
|
||||||
lead_lag_incidence = model.lead_lag_incidence
|
|
||||||
|
|
||||||
nyp = countnz(lead_lag_incidence[1,:])
|
|
||||||
ny0 = countnz(lead_lag_incidence[2,:])
|
|
||||||
nyf = countnz(lead_lag_incidence[3,:])
|
|
||||||
|
|
||||||
ny = length(model.endo)
|
|
||||||
nd = nyp+ny0+nyf
|
|
||||||
|
|
||||||
periods = options.pfmsolver.periods
|
|
||||||
params = model.params
|
|
||||||
|
|
||||||
tmp = lead_lag_incidence[2:3,:]'
|
|
||||||
i_cols_A1 = find(tmp)
|
|
||||||
i_cols_1 = tmp[i_cols_A1]
|
|
||||||
|
|
||||||
tmp = lead_lag_incidence[1:2,:]'
|
|
||||||
i_cols_AT = find(tmp)
|
|
||||||
i_cols_T = tmp[i_cols_AT]
|
|
||||||
|
|
||||||
tmp = lead_lag_incidence[2,:]'
|
|
||||||
i_cols_A0 = find(tmp)
|
|
||||||
i_cols_0 = tmp[i_cols_A0]
|
|
||||||
|
|
||||||
i_cols_j = collect(1:nd)
|
|
||||||
i_upd = ny+collect(1:periods*ny)
|
|
||||||
|
|
||||||
Y = vec(endogenousvariables)
|
|
||||||
z = Y[find(lead_lag_incidence')]
|
|
||||||
|
|
||||||
jacobian = zeros(Float64, ny, length(z)+length(model.exo))
|
|
||||||
residuals = zeros(Float64, ny)
|
|
||||||
|
|
||||||
println("\nMODEL SIMULATION:\n")
|
|
||||||
|
|
||||||
rd = zeros(Float64, periods*ny)
|
|
||||||
|
|
||||||
iA = zeros(Int64, periods*model.nnzderivatives[1])
|
|
||||||
jA = zeros(Int64, periods*model.nnzderivatives[1])
|
|
||||||
vA = zeros(Float64, periods*model.nnzderivatives[1])
|
|
||||||
|
|
||||||
convergence = false
|
|
||||||
iteration = 0
|
|
||||||
|
|
||||||
while !convergence
|
|
||||||
iteration += 1
|
|
||||||
i_rows = collect(1:ny)
|
|
||||||
i_cols_A = find(lead_lag_incidence')
|
|
||||||
i_cols = i_cols_A
|
|
||||||
m = 0
|
|
||||||
for it = 2:(periods+1)
|
|
||||||
model.dynamic(Y[i_cols], exogenousvariables, params, steadystate, it, residuals, jacobian)
|
|
||||||
if it==(periods+1) & it==2
|
|
||||||
(r, c, v) = findnz(jacobian[:,i_cols_0])
|
|
||||||
k = collect(1:length(v))+m
|
|
||||||
iA[k] = i_rows[r]
|
|
||||||
jA[k] = i_cols_A0[c]
|
|
||||||
vA[k] = v
|
|
||||||
elseif it==(periods+1)
|
|
||||||
(r, c, v) = findnz(jacobian[:,i_cols_T])
|
|
||||||
k = collect(1:length(v))+m
|
|
||||||
iA[k] = i_rows[r]
|
|
||||||
jA[k] = i_cols_A[i_cols_T[c]]
|
|
||||||
vA[k] = v
|
|
||||||
elseif it==2
|
|
||||||
(r, c, v) = findnz(jacobian[:,i_cols_1])
|
|
||||||
k = collect(1:length(v))+m
|
|
||||||
iA[k] = i_rows[r]
|
|
||||||
jA[k] = i_cols_A1[c]
|
|
||||||
vA[k] = v
|
|
||||||
else
|
|
||||||
(r, c, v) = findnz(jacobian[:,i_cols_j])
|
|
||||||
k = collect(1:length(v))+m
|
|
||||||
iA[k] = i_rows[r]
|
|
||||||
jA[k] = i_cols_A[c]
|
|
||||||
vA[k] = v
|
|
||||||
end
|
|
||||||
m += length(v)
|
|
||||||
rd[i_rows] = residuals
|
|
||||||
i_rows += ny
|
|
||||||
i_cols += ny
|
|
||||||
if it>2
|
|
||||||
i_cols_A += ny
|
|
||||||
end
|
|
||||||
end
|
|
||||||
err = maximum(abs.(rd))
|
|
||||||
println("Iter. ", iteration, "\t err. ", round(err, 12))
|
|
||||||
if err<options.pfmsolver.tolf
|
|
||||||
iteration -= 1
|
|
||||||
convergence = true
|
|
||||||
end
|
|
||||||
A = sparse(iA[1:m], jA[1:m], vA[1:m])
|
|
||||||
dy = -A\rd
|
|
||||||
Y[i_upd] += dy
|
|
||||||
if maximum(abs.(dy))<options.pfmsolver.tolx
|
|
||||||
convergence = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if convergence
|
|
||||||
println("\nPFM solver converged in ", iteration, " iterations!\n")
|
|
||||||
endogenousvariables = reshape(Y, ny, periods+2)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,100 +0,0 @@
|
||||||
module SteadyState
|
|
||||||
|
|
||||||
##
|
|
||||||
# Copyright © 2016 Dynare Team
|
|
||||||
#
|
|
||||||
# This file is part of Dynare.
|
|
||||||
#
|
|
||||||
# Dynare is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Dynare is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
##
|
|
||||||
|
|
||||||
using NLsolve
|
|
||||||
|
|
||||||
import DynareModel.Model
|
|
||||||
import DynareOutput.Output
|
|
||||||
|
|
||||||
export steady, steady!
|
|
||||||
export steady_state, steady_state!
|
|
||||||
|
|
||||||
function steady(model::Model, oo::Output)
|
|
||||||
if model.analytical_steady_state || model.user_written_analytical_steady_state
|
|
||||||
steadystate = zeros(length(model.endo))
|
|
||||||
model.steady_state(steadystate, oo.exo_steady_state, model.params)
|
|
||||||
return steadystate
|
|
||||||
else
|
|
||||||
error("You have to provide a closed form solution for the steady state, or declare a guess\nfor the steady state as a third input argument.")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function steady!(model::Model, oo::Output)
|
|
||||||
if model.analytical_steady_state || model.user_written_analytical_steady_state
|
|
||||||
model.steady_state(oo.steady_state, oo.exo_steady_state, model.params)
|
|
||||||
return
|
|
||||||
else
|
|
||||||
error("You have to provide a closed form solution for the steady state, or declare a guess\nfor the steady state as a third input argument.")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function steady(model::Model, oo::Output, yinit::Vector{Float64})
|
|
||||||
f!(fval::Vector{Float64}, y::Vector{Float64}) = model.static(y, oo.exo_steady_state, model.params, fval)
|
|
||||||
j!(fjac::Matrix{Float64}, y::Vector{Float64}) = model.static(y, oo.exo_steady_state, model.params, fjac)
|
|
||||||
fj!(fval::Vector{Float64}, fjac::Matrix{Float64}, y::Vector{Float64}) = model.static(y, oo.exo_steady_state, model.params, fval, fjac)
|
|
||||||
r = nlsolve(f!, j!, fj!, yinit, show_trace=false)
|
|
||||||
if converged(r)
|
|
||||||
return r.zero
|
|
||||||
else
|
|
||||||
return fill(NaN, length(yinit))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function steady!(model::Model, oo::Output, yinit::Vector{Float64})
|
|
||||||
f!(fval::Vector{Float64}, y::Vector{Float64}) = model.static(y, oo.exo_steady_state, model.params, fval)
|
|
||||||
j!(fjac::Matrix{Float64}, y::Vector{Float64}) = model.static(y, oo.exo_steady_state, model.params, fjac)
|
|
||||||
fj!(fval::Vector{Float64}, fjac::Matrix{Float64}, y::Vector{Float64}) = model.static(y, oo.exo_steady_state, model.params, fval, fjac)
|
|
||||||
r = nlsolve(f!, j!, fj!, yinit, show_trace=false)
|
|
||||||
if converged(r)
|
|
||||||
oo.steady_state = r.zero
|
|
||||||
else
|
|
||||||
oo.steady_state = fill(NaN, length(yinit))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function steady_state(model::Model, oo::Output)
|
|
||||||
ys = steady(model, oo)
|
|
||||||
display_steady_state(model, oo, ys)
|
|
||||||
end
|
|
||||||
|
|
||||||
function steady_state!(model::Model, oo::Output)
|
|
||||||
steady!(model, oo)
|
|
||||||
display_steady_state(model, oo, oo.steady_state)
|
|
||||||
end
|
|
||||||
|
|
||||||
function display_steady_state(model::Model, oo::Output, ys::Vector{Float64})
|
|
||||||
println("\n\nSTEADY STATE:\n")
|
|
||||||
for i = 1:length(model.endo)
|
|
||||||
println(string(model.endo[i].name, " = ", ys[i]))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function issteadystate(model::Model, oo::Output, ys::Vector{Float64})
|
|
||||||
residuals = zeros(Float64, length(ys))
|
|
||||||
compute_static_model_residuals!(model, oo, ys, residuals)
|
|
||||||
return maximum(abs(residuals))<1e-6
|
|
||||||
end
|
|
||||||
|
|
||||||
function compute_static_model_residuals!(model::Model, oo::Output, ys::Vector{Float64}, residuals::Vector{Float64})
|
|
||||||
model.static(ys, oo.exo_steady_state, model.params, residuals)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,36 +0,0 @@
|
||||||
module Utils
|
|
||||||
##
|
|
||||||
# Copyright © 2015 Dynare Team
|
|
||||||
#
|
|
||||||
# This file is part of Dynare.
|
|
||||||
#
|
|
||||||
# Dynare is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Dynare is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
##
|
|
||||||
|
|
||||||
export get_power_deriv
|
|
||||||
|
|
||||||
function get_power_deriv(x::Float64, p::Real, k::Int)
|
|
||||||
if abs(x)<1e-12 && p>0 && k>p && typeof(p)==Int
|
|
||||||
dxp = .0
|
|
||||||
else
|
|
||||||
dxp = x^(p-k)
|
|
||||||
for i = 0:k-1
|
|
||||||
dxp *= p
|
|
||||||
p -= 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return dxp
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
140
license.txt
140
license.txt
|
@ -1,6 +1,6 @@
|
||||||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||||
Upstream-Name: Dynare
|
Upstream-Name: Dynare
|
||||||
Upstream-Contact: Dynare Team, whose members in 2019 are:
|
Upstream-Contact: Dynare Team, whose members in 2020 are:
|
||||||
- Stéphane Adjemian <stephane.adjemian@univ-lemans.fr>
|
- Stéphane Adjemian <stephane.adjemian@univ-lemans.fr>
|
||||||
- Houtan Bastani <houtan@dynare.org>
|
- Houtan Bastani <houtan@dynare.org>
|
||||||
- Michel Juillard <michel.juillard@mjui.fr>
|
- Michel Juillard <michel.juillard@mjui.fr>
|
||||||
|
@ -22,7 +22,7 @@ Upstream-Contact: Dynare Team, whose members in 2019 are:
|
||||||
Source: https://www.dynare.org
|
Source: https://www.dynare.org
|
||||||
|
|
||||||
Files: *
|
Files: *
|
||||||
Copyright: 1996-2019 Dynare Team
|
Copyright: 1996-2020 Dynare Team
|
||||||
License: GPL-3+
|
License: GPL-3+
|
||||||
|
|
||||||
Files: matlab/AIM/SP*
|
Files: matlab/AIM/SP*
|
||||||
|
@ -53,45 +53,45 @@ Files: matlab/optimization/bfgsi1.m matlab/csolve.m matlab/optimization/csminit1
|
||||||
matlab/bvar_toolbox.m matlab/partial_information/PI_gensys.m matlab/partial_information/qzswitch.m
|
matlab/bvar_toolbox.m matlab/partial_information/PI_gensys.m matlab/partial_information/qzswitch.m
|
||||||
matlab/partial_information/qzdiv.m
|
matlab/partial_information/qzdiv.m
|
||||||
Copyright: 1993-2009 Christopher Sims
|
Copyright: 1993-2009 Christopher Sims
|
||||||
2006-2016 Dynare Team
|
2006-2017 Dynare Team
|
||||||
License: GPL-3+
|
License: GPL-3+
|
||||||
|
|
||||||
Files: matlab/optimization/cmaes.m
|
Files: matlab/optimization/cmaes.m
|
||||||
Copyright: 2001-2012 Nikolaus Hansen
|
Copyright: 2001-2012 Nikolaus Hansen
|
||||||
2012 Dynare Team
|
2012-2017 Dynare Team
|
||||||
License: GPL-3+
|
License: GPL-3+
|
||||||
|
|
||||||
Files: matlab/optimization/solvopt.m
|
Files: matlab/optimization/solvopt.m
|
||||||
Copyright: 1997-2008 Alexei Kuntsevich and Franz Kappel
|
Copyright: 1997-2008 Alexei Kuntsevich and Franz Kappel
|
||||||
2008-2015 Giovanni Lombardo
|
2008-2015 Giovanni Lombardo
|
||||||
2015 Dynare Team
|
2015-2017 Dynare Team
|
||||||
License: GPL-3+
|
License: GPL-3+
|
||||||
|
|
||||||
Files: matlab/optimization/simulated_annealing.m
|
Files: matlab/optimization/simulated_annealing.m
|
||||||
Copyright: 1995 E.G.Tsionas
|
Copyright: 1995 E.G.Tsionas
|
||||||
1995-2002 Thomas Werner
|
1995-2002 Thomas Werner
|
||||||
2002-2015 Giovanni Lombardo
|
2002-2015 Giovanni Lombardo
|
||||||
2015 Dynare Team
|
2015-2017 Dynare Team
|
||||||
License: GPL-3+
|
License: GPL-3+
|
||||||
|
|
||||||
Files: matlab/endogenous_prior.m
|
Files: matlab/endogenous_prior.m
|
||||||
Copyright: 2011 Lawrence J. Christiano, Mathias Trabandt and Karl Walentin
|
Copyright: 2011 Lawrence J. Christiano, Mathias Trabandt and Karl Walentin
|
||||||
2013 Dynare Team
|
2013-2017 Dynare Team
|
||||||
License: GPL-3+
|
License: GPL-3+
|
||||||
|
|
||||||
Files: matlab/trust_region.m
|
Files: matlab/trust_region.m
|
||||||
Copyright: 2008-2012 VZLU Prague, a.s.
|
Copyright: 2008-2012 VZLU Prague, a.s.
|
||||||
2014-2016 Dynare Team
|
2014-2019 Dynare Team
|
||||||
License: GPL-3+
|
License: GPL-3+
|
||||||
|
|
||||||
Files: matlab/one_sided_hp_filter.m
|
Files: matlab/one_sided_hp_filter.m
|
||||||
Copyright: 2010-2015 Alexander Meyer-Gohde
|
Copyright: 2010-2015 Alexander Meyer-Gohde
|
||||||
2015 Dynare Team
|
2015-2017 Dynare Team
|
||||||
License: GPL-3+
|
License: GPL-3+
|
||||||
|
|
||||||
Files: matlab/convergence_diagnostics/raftery_lewis.m
|
Files: matlab/convergence_diagnostics/raftery_lewis.m
|
||||||
Copyright: 2016 Benjamin Born and Johannes Pfeifer
|
Copyright: 2016 Benjamin Born and Johannes Pfeifer
|
||||||
2016 Dynare Team
|
2016-2017 Dynare Team
|
||||||
License: GPL-3+
|
License: GPL-3+
|
||||||
|
|
||||||
Files: matlab/commutation.m matlab/duplication.m
|
Files: matlab/commutation.m matlab/duplication.m
|
||||||
|
@ -99,10 +99,38 @@ Copyright: 1997 Tom Minka <minka@microsoft.com>
|
||||||
2019 Dynare Team
|
2019 Dynare Team
|
||||||
License: GPL-3+
|
License: GPL-3+
|
||||||
|
|
||||||
|
Files: matlab/allVL1.m
|
||||||
|
Copyright: 2007-2010 Bruno Luong <brunoluong@yahoo.com>
|
||||||
|
2019 Dynare Team
|
||||||
|
License: GPL-3+
|
||||||
|
Comment: The original author gave authorization to change
|
||||||
|
the license from BSD-2-clause to GPL-3+ and redistribute
|
||||||
|
it under GPL-3+ with Dynare.
|
||||||
|
|
||||||
|
Files: matlab/uperm.m
|
||||||
|
Copyright: 2014 Bruno Luong <brunoluong@yahoo.com>
|
||||||
|
2019 Dynare Team
|
||||||
|
License: GPL-3+
|
||||||
|
Comment: The original author gave authorization to change
|
||||||
|
the license from BSD-2-clause to GPL-3+ and redistribute
|
||||||
|
it under GPL-3+ with Dynare.
|
||||||
|
|
||||||
|
Files: matlab/prodmom.m matlab/bivmom.m
|
||||||
|
Copyright: 2008-2015 Raymond Kan <kan@chass.utoronto.ca>
|
||||||
|
2019-2020 Dynare Team
|
||||||
|
License: GPL-3+
|
||||||
|
Comment: The author gave authorization to redistribute
|
||||||
|
these functions under GPL-3+ with Dynare and would
|
||||||
|
appreciate acknowledgement of the source by citation
|
||||||
|
of the following paper:
|
||||||
|
Kan, R.: "From moments of sum to moments of product."
|
||||||
|
Journal of Multivariate Analysis, 2008, vol. 99, issue 3,
|
||||||
|
pages 542-554.
|
||||||
|
|
||||||
Files: matlab/gsa/Morris_Measure_Groups.m
|
Files: matlab/gsa/Morris_Measure_Groups.m
|
||||||
matlab/gsa/Sampling_Function_2.m
|
matlab/gsa/Sampling_Function_2.m
|
||||||
Copyright: 2005 European Commission
|
Copyright: 2005 European Commission
|
||||||
2012 Dynare Team
|
2012-2017 Dynare Team
|
||||||
License: GPL-3+
|
License: GPL-3+
|
||||||
Comment: Written by Jessica Cariboni and Francesca Campolongo
|
Comment: Written by Jessica Cariboni and Francesca Campolongo
|
||||||
Joint Research Centre, The European Commission,
|
Joint Research Centre, The European Commission,
|
||||||
|
@ -153,7 +181,7 @@ Comment: This file is part of GLUEWIN.
|
||||||
Files: matlab/optimization/simpsa.m matlab/optimization/simpsaget.m matlab/optimization/simpsaset.m
|
Files: matlab/optimization/simpsa.m matlab/optimization/simpsaget.m matlab/optimization/simpsaset.m
|
||||||
Copyright: 2005 Henning Schmidt, FCC, henning@fcc.chalmers.se
|
Copyright: 2005 Henning Schmidt, FCC, henning@fcc.chalmers.se
|
||||||
2006 Brecht Donckels, BIOMATH, brecht.donckels@ugent.be
|
2006 Brecht Donckels, BIOMATH, brecht.donckels@ugent.be
|
||||||
2013-2016 Dynare Team
|
2013-2017 Dynare Team
|
||||||
License: GPL-3+
|
License: GPL-3+
|
||||||
|
|
||||||
Files: matlab/missing/stats/normpdf.m matlab/missing/stats/gamcdf.m
|
Files: matlab/missing/stats/normpdf.m matlab/missing/stats/gamcdf.m
|
||||||
|
@ -163,22 +191,20 @@ Files: matlab/missing/stats/normpdf.m matlab/missing/stats/gamcdf.m
|
||||||
matlab/missing/stats/betapdf.m matlab/missing/stats/normcdf.m
|
matlab/missing/stats/betapdf.m matlab/missing/stats/normcdf.m
|
||||||
matlab/missing/stats/stdnormal_cdf.m matlab/missing/stats/norminv.m
|
matlab/missing/stats/stdnormal_cdf.m matlab/missing/stats/norminv.m
|
||||||
matlab/missing/stats/stdnormal_pdf.m matlab/missing/stats/betainv.m
|
matlab/missing/stats/stdnormal_pdf.m matlab/missing/stats/betainv.m
|
||||||
matlab/missing/stats-matlab/common_size.m
|
|
||||||
Copyright: 1995-2007 Kurt Hornik
|
Copyright: 1995-2007 Kurt Hornik
|
||||||
2008-2011 Dynare Team
|
2008-2017 Dynare Team
|
||||||
License: GPL-3+
|
License: GPL-3+
|
||||||
|
|
||||||
Files: matlab/missing/stats-matlab/quantile.m
|
Files: matlab/missing/stats/quantile.m
|
||||||
Copyright: 2014-2016 Christopher Hummersone
|
Copyright: 2014-2016 Christopher Hummersone
|
||||||
2016 Dynare Team
|
2016-2017 Dynare Team
|
||||||
License: GPL-3+
|
License: GPL-3+
|
||||||
|
|
||||||
|
Files: matlab/missing/stats/corr.m
|
||||||
Files: matlab/missing/stats-matlab/corr.m
|
|
||||||
Copyright: 1993-1996 Kurt Hornik
|
Copyright: 1993-1996 Kurt Hornik
|
||||||
1996-2015 John W. Eaton
|
1996-2015 John W. Eaton
|
||||||
2013-2015 Julien Bect
|
2013-2015 Julien Bect
|
||||||
2016 Dynare Team
|
2016-2017 Dynare Team
|
||||||
License: GPL-3+
|
License: GPL-3+
|
||||||
|
|
||||||
Files: matlab/missing/strjoin/strjoin.m
|
Files: matlab/missing/strjoin/strjoin.m
|
||||||
|
@ -187,47 +213,35 @@ Copyright: 2013-2019 Ben Abbott
|
||||||
2019 Dynare Team
|
2019 Dynare Team
|
||||||
License: GPL-3+
|
License: GPL-3+
|
||||||
|
|
||||||
Files: matlab/missing/corrcoef/corrcoef.m matlab/missing/corrcoef/sumskipnan.m
|
|
||||||
matlab/missing/corrcoef/flag_implicit_skip_nan.m matlab/missing/corrcoef/tcdf.m
|
|
||||||
Copyright: 2000-2005,2008,2009,2011 by Alois Schloegl <alois.schloegl@gmail.com>
|
|
||||||
2014 Dynare Team
|
|
||||||
License: GPL-3+
|
|
||||||
|
|
||||||
Files: matlab/lmmcp/catstruct.m
|
Files: matlab/lmmcp/catstruct.m
|
||||||
Copyright: 2005 Jos van der Geest <jos@jasen.nl>
|
Copyright: 2005 Jos van der Geest <jos@jasen.nl>
|
||||||
2013 Christophe Gouel
|
2013 Christophe Gouel
|
||||||
2016 Dynare Team
|
2016-2017 Dynare Team
|
||||||
License: BSD-2-clause
|
License: BSD-2-clause
|
||||||
|
|
||||||
Files: matlab/lmmcp/lmmcp.m
|
Files: matlab/lmmcp/lmmcp.m
|
||||||
Copyright: 2005 Christian Kanzow and Stefania Petra
|
Copyright: 2005 Christian Kanzow and Stefania Petra
|
||||||
2013 Christophe Gouel
|
2013 Christophe Gouel
|
||||||
2014 Dynare Team
|
2014-2017 Dynare Team
|
||||||
License: permissive-lmmcp
|
License: permissive-lmmcp
|
||||||
Unlimited permission is granted to everyone to use, copy, modify or
|
Unlimited permission is granted to everyone to use, copy, modify or
|
||||||
distribute this software.
|
distribute this software.
|
||||||
|
|
||||||
Files: matlab/utilities/graphics/distinguishable_colors.m
|
Files: matlab/utilities/graphics/distinguishable_colors.m
|
||||||
Copyright: 2010-2011 Timothy E. Holy
|
Copyright: 2010-2011 Timothy E. Holy
|
||||||
|
2017 Dynare Team
|
||||||
License: BSD-2-clause
|
License: BSD-2-clause
|
||||||
|
|
||||||
Files: matlab/utilities/graphics/colorspace.m
|
Files: matlab/utilities/graphics/colorspace.m
|
||||||
Copyright: 2005-2010 Pascal Getreuer
|
Copyright: 2005-2010 Pascal Getreuer
|
||||||
|
2017 Dynare Team
|
||||||
License: BSD-2-clause
|
License: BSD-2-clause
|
||||||
|
|
||||||
Files: doc/*.rst doc/*.tex doc/*.svg doc/*.pdf doc/*.bib
|
Files: doc/*.rst doc/*.tex doc/*.svg doc/*.pdf doc/*.bib
|
||||||
Copyright: 1996-2019 Dynare Team
|
Copyright: 1996-2020 Dynare Team
|
||||||
License: GFDL-NIV-1.3+
|
License: GFDL-NIV-1.3+
|
||||||
|
|
||||||
Files: doc/macroprocessor/*
|
Files: doc/dr.tex doc/dr.bib doc/bvar-a-la-sims.tex
|
||||||
Copyright: 2008-2015 Dynare Team
|
|
||||||
License: CC-BY-SA-4.0
|
|
||||||
|
|
||||||
Files: doc/preprocessor/*
|
|
||||||
Copyright: 2007-2019 Dynare Team
|
|
||||||
License: CC-BY-SA-4.0
|
|
||||||
|
|
||||||
Files: doc/dr.tex doc/bvar_a_la_sims.tex
|
|
||||||
Copyright: 2007-2011 Sébastien Villemot
|
Copyright: 2007-2011 Sébastien Villemot
|
||||||
License: GFDL-NIV-1.3+
|
License: GFDL-NIV-1.3+
|
||||||
|
|
||||||
|
@ -237,19 +251,13 @@ Copyright: 2004-2011 Ondra Kamenik
|
||||||
License: GPL-3+
|
License: GPL-3+
|
||||||
|
|
||||||
Files: m4/ax_blas.m4 m4/ax_lapack.m4
|
Files: m4/ax_blas.m4 m4/ax_lapack.m4
|
||||||
Copyright: 2008 Steven G. Johnson <stevenj@alum.mit.edu>
|
Copyright: 2008-2009 Steven G. Johnson <stevenj@alum.mit.edu>
|
||||||
License: GPL-3+ with Autoconf exception
|
License: GPL-3+ with Autoconf exception
|
||||||
|
|
||||||
Files: m4/ax_boost_base.m4
|
|
||||||
Copyright: 2008 Thomas Porschberg <thomas@randspringer.de>
|
|
||||||
2009 Peter Adolphs
|
|
||||||
License: FSFAP
|
|
||||||
|
|
||||||
Files: m4/ax_compare_version.m4
|
Files: m4/ax_compare_version.m4
|
||||||
Copyright: 2008 Tim Toolan <toolan@ele.uri.edu>
|
Copyright: 2008 Tim Toolan <toolan@ele.uri.edu>
|
||||||
License: FSFAP
|
License: FSFAP
|
||||||
|
|
||||||
|
|
||||||
Files: m4/ax_cxx_compile_stdcxx.m4
|
Files: m4/ax_cxx_compile_stdcxx.m4
|
||||||
m4/ax_cxx_compile_stdcxx_17.m4
|
m4/ax_cxx_compile_stdcxx_17.m4
|
||||||
Copyright: 2008 Benjamin Kosnik <bkoz@redhat.com>
|
Copyright: 2008 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
|
@ -262,14 +270,14 @@ Copyright: 2008 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
2019 Enji Cooper <yaneurabeya@gmail.com>
|
2019 Enji Cooper <yaneurabeya@gmail.com>
|
||||||
License: FSFAP
|
License: FSFAP
|
||||||
|
|
||||||
Files: m4/ax_latex_class.m4 m4/ax_tex_test.m4
|
Files: m4/ax_latex_class.m4 m4/ax_latex_test.m4
|
||||||
Copyright: 2008 Boretti Mathieu <boretti@eig.unige.ch>
|
Copyright: 2008 Boretti Mathieu <boretti@eig.unige.ch>
|
||||||
2009 Dynare Team
|
2009 Dynare Team
|
||||||
License: LGPL-2.1+
|
License: LGPL-2.1+
|
||||||
|
|
||||||
Files: m4/ax_matlab_arch.m4 m4/ax_matlab.m4 m4/ax_mexext.m4
|
Files: m4/ax_matlab_arch.m4 m4/ax_matlab.m4 m4/ax_mexext.m4
|
||||||
Copyright: 2002-2003 Ralph Schleicher
|
Copyright: 2002-2003 Ralph Schleicher
|
||||||
2009 Dynare Team
|
2009-2019 Dynare Team
|
||||||
License: GPL-2+ with Autoconf exception
|
License: GPL-2+ with Autoconf exception
|
||||||
|
|
||||||
Files: scripts/dynare.el
|
Files: scripts/dynare.el
|
||||||
|
@ -286,18 +294,48 @@ License: GPL-3+
|
||||||
Files: mex/sources/sobol/sobol.hh mex/sources/sobol/initialize_v_array.hh
|
Files: mex/sources/sobol/sobol.hh mex/sources/sobol/initialize_v_array.hh
|
||||||
mex/sources/sobol/initialize_v_array.inc
|
mex/sources/sobol/initialize_v_array.inc
|
||||||
Copyright: 2009 John Burkardt
|
Copyright: 2009 John Burkardt
|
||||||
2010-2011 Dynare Team
|
2010-2017 Dynare Team
|
||||||
License: LGPL-3+
|
License: LGPL-3+
|
||||||
|
|
||||||
Files: macOS/brewfiles/*
|
Files: macOS/brewfiles/*
|
||||||
Copyright: 2009-2019, Homebrew contributors
|
Copyright: 2009-2019 Homebrew contributors
|
||||||
2019 Dynare Team
|
2019 Dynare Team
|
||||||
License: BSD-2-clause
|
License: BSD-2-clause
|
||||||
|
|
||||||
Files: contrib/jsonlab
|
Files: preprocessor/m4/ax_boost_base.m4
|
||||||
|
Copyright: 2008-2009 Thomas Porschberg <thomas@randspringer.de>
|
||||||
|
2009 Peter Adolphs
|
||||||
|
License: FSFAP
|
||||||
|
|
||||||
|
Files: preprocessor/m4/ax_cxx_compile_stdcxx.m4
|
||||||
|
preprocessor/m4/ax_cxx_compile_stdcxx_17.m4
|
||||||
|
Copyright: 2008 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
|
2012 Zack Weinberg <zackw@panix.com>
|
||||||
|
2013 Roy Stogner <roystgnr@ices.utexas.edu>
|
||||||
|
2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com>
|
||||||
|
2015 Paul Norman <penorman@mac.com>
|
||||||
|
2015 Moritz Klammler <moritz@klammler.eu>
|
||||||
|
2016, 2018 Krzesimir Nowak <qdlacz@gmail.com>
|
||||||
|
2019 Enji Cooper <yaneurabeya@gmail.com>
|
||||||
|
License: FSFAP
|
||||||
|
|
||||||
|
Files: preprocessor/m4/ax_latex_class.m4
|
||||||
|
preprocessor/m4/ax_latex_test.m4
|
||||||
|
Copyright: 2008 Boretti Mathieu <boretti@eig.unige.ch>
|
||||||
|
2009 Dynare Team
|
||||||
|
License: LGPL-2.1+
|
||||||
|
|
||||||
|
Files: preprocessor/doc/macroprocessor/*
|
||||||
|
Copyright: 2008-2019 Dynare Team
|
||||||
|
License: CC-BY-SA-4.0
|
||||||
|
|
||||||
|
Files: preprocessor/doc/preprocessor/*
|
||||||
|
Copyright: 2007-2019 Dynare Team
|
||||||
|
License: CC-BY-SA-4.0
|
||||||
|
|
||||||
|
Files: contrib/jsonlab/*
|
||||||
Copyright: 2011-2018 Qianqian Fang <q.fang at neu.edu>
|
Copyright: 2011-2018 Qianqian Fang <q.fang at neu.edu>
|
||||||
License: BSD or GPL-3+
|
License: BSD-2-clause or GPL-3+
|
||||||
Comment: https://www.mathworks.com/matlabcentral/fileexchange/33381-jsonlab-a-toolbox-to-encode-decode-json-files
|
|
||||||
|
|
||||||
Files: contrib/ms-sbvar/utilities_dw/*
|
Files: contrib/ms-sbvar/utilities_dw/*
|
||||||
Copyright: 1996-2011 Daniel Waggoner
|
Copyright: 1996-2011 Daniel Waggoner
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
# ===========================================================================
|
|
||||||
# http://www.nongnu.org/autoconf-archive/ax_latex_test.html
|
|
||||||
# ===========================================================================
|
|
||||||
#
|
|
||||||
# OBSOLETE MACRO
|
|
||||||
#
|
|
||||||
# Deprecated because of licensing issues. The Lesser GPL imposes licensing
|
|
||||||
# restrictions on the generated configure script unless it is augmented
|
|
||||||
# with an Autoconf Exception clause.
|
|
||||||
#
|
|
||||||
# SYNOPSIS
|
|
||||||
#
|
|
||||||
# AX_TEX_TEST(FILEDATA,VARIABLETOSET,[NOCLEAN])
|
|
||||||
#
|
|
||||||
# DESCRIPTION
|
|
||||||
#
|
|
||||||
# This macros execute the pdftex application with FILEDATA as input and set
|
|
||||||
# VARIABLETOSET to yes or no depending on the result. If NOCLEAN is set,
|
|
||||||
# the folder used for the test is not delete after testing.
|
|
||||||
#
|
|
||||||
# The macro assumes that the variable PDFTEX is set.
|
|
||||||
#
|
|
||||||
# Adapted from the macro AX_LATEX_TEST by Sébastien Villemot.
|
|
||||||
#
|
|
||||||
# LICENSE
|
|
||||||
#
|
|
||||||
# Copyright © 2008 Boretti Mathieu <boretti@eig.unige.ch>
|
|
||||||
# Copyright © 2009 Dynare Team
|
|
||||||
#
|
|
||||||
# This library is free software; you can redistribute it and/or modify it
|
|
||||||
# under the terms of the GNU Lesser General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2.1 of the License, or (at
|
|
||||||
# your option) any later version.
|
|
||||||
#
|
|
||||||
# This library is distributed in the hope that it will be useful, but
|
|
||||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
|
|
||||||
# General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
|
||||||
# along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
AC_DEFUN([AX_TEX_TEST],[
|
|
||||||
rm -rf conftest.dir/.acltx
|
|
||||||
AS_MKDIR_P([conftest.dir/.acltx])
|
|
||||||
cd conftest.dir/.acltx
|
|
||||||
m4_ifval([$2],[$2="no"; export $2;])
|
|
||||||
cat > conftest.tex << ACLEOF
|
|
||||||
$1
|
|
||||||
ACLEOF
|
|
||||||
cat conftest.tex | $PDFTEX 2>&1 1>output m4_ifval([$2],[&& $2=yes])
|
|
||||||
cd ..
|
|
||||||
cd ..
|
|
||||||
sed 's/^/| /' conftest.dir/.acltx/conftest.tex >&5
|
|
||||||
echo "$as_me:$LINENO: executing cat conftest.tex | $PDFTEX" >&5
|
|
||||||
sed 's/^/| /' conftest.dir/.acltx/output >&5
|
|
||||||
m4_ifval([$3],,[rm -rf conftest.dir/.acltx])
|
|
||||||
])
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Copyright © 2019 Dynare Team
|
# Copyright © 2019-2020 Dynare Team
|
||||||
#
|
#
|
||||||
# This file is part of Dynare.
|
# This file is part of Dynare.
|
||||||
#
|
#
|
||||||
|
@ -99,7 +99,7 @@ mkdir -p \
|
||||||
if [[ $VERSION == *-unstable* ]]; then
|
if [[ $VERSION == *-unstable* ]]; then
|
||||||
echo "$SHA" > "$PKGFILES"/sha.txt
|
echo "$SHA" > "$PKGFILES"/sha.txt
|
||||||
fi
|
fi
|
||||||
cp -p "$ROOTDIR"/NEWS "$PKGFILES"
|
cp -p "$ROOTDIR"/NEWS.md "$PKGFILES"
|
||||||
cp -p "$ROOTDIR"/COPYING "$PKGFILES"
|
cp -p "$ROOTDIR"/COPYING "$PKGFILES"
|
||||||
cp -p "$ROOTDIR"/VERSION "$PKGFILES"
|
cp -p "$ROOTDIR"/VERSION "$PKGFILES"
|
||||||
cp -p "$ROOTDIR"/license.txt "$PKGFILES"
|
cp -p "$ROOTDIR"/license.txt "$PKGFILES"
|
||||||
|
@ -125,6 +125,7 @@ cp -r "$ROOTDIR"/doc/manual/build/html "$PKGFILES"
|
||||||
cp "$ROOTDIR"/dynare++/doc/*.pdf "$PKGFILES"/doc/dynare++
|
cp "$ROOTDIR"/dynare++/doc/*.pdf "$PKGFILES"/doc/dynare++
|
||||||
|
|
||||||
cp "$ROOTDIR"/dynare++/src/dynare++ "$PKGFILES"/dynare++
|
cp "$ROOTDIR"/dynare++/src/dynare++ "$PKGFILES"/dynare++
|
||||||
|
cp "$ROOTDIR"/dynare++/dynare_simul/dynare_simul.m "$PKGFILES"/dynare++
|
||||||
|
|
||||||
mkdir -p "$PKGFILES"/matlab/modules/dseries/externals/x13/macOS/64
|
mkdir -p "$PKGFILES"/matlab/modules/dseries/externals/x13/macOS/64
|
||||||
cp -p "$ROOTDIR"/macOS/deps/lib64/x13as/x13as "$PKGFILES"/matlab/modules/dseries/externals/x13/macOS/64
|
cp -p "$ROOTDIR"/macOS/deps/lib64/x13as/x13as "$PKGFILES"/matlab/modules/dseries/externals/x13/macOS/64
|
||||||
|
@ -152,15 +153,18 @@ cp -L "$ROOTDIR"/mex/matlab/* "$PKGFILES"
|
||||||
## Create mex for Octave
|
## Create mex for Octave
|
||||||
##
|
##
|
||||||
cd "$ROOTDIR"/mex/build/octave
|
cd "$ROOTDIR"/mex/build/octave
|
||||||
CC=$CC CXX=$CXX ./configure \
|
OCTAVE_VERSION=$(grep OCTAVE_VERSION "$ROOTDIR"/macOS/deps/versions.mk | cut -d'=' -f2 | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
||||||
|
OCTAVE_USR_DIR="/Applications/Octave-$OCTAVE_VERSION.app/Contents/Resources/usr"
|
||||||
|
OCTAVE_BIN_DIR="$OCTAVE_USR_DIR/Cellar/octave-octave-app@$OCTAVE_VERSION/$OCTAVE_VERSION/bin"
|
||||||
|
PATH="$OCTAVE_BIN_DIR:$PATH" CC=$CC CXX=$CXX ./configure \
|
||||||
PACKAGE_VERSION="$VERSION" \
|
PACKAGE_VERSION="$VERSION" \
|
||||||
PACKAGE_STRING="dynare $VERSION" \
|
PACKAGE_STRING="dynare $VERSION" \
|
||||||
CXXFLAGS=-I/usr/local/include \
|
CXXFLAGS=-I/usr/local/include \
|
||||||
LDFLAGS="-static-libgcc -L/usr/local/lib" \
|
LDFLAGS="-static-libgcc -L$OCTAVE_USR_DIR/lib " \
|
||||||
--with-gsl="$LIB64"/gsl \
|
--with-gsl="$LIB64"/gsl \
|
||||||
--with-matio="$LIB64"/matio \
|
--with-matio="$LIB64"/matio \
|
||||||
--with-slicot="$LIB64"/Slicot/with-underscore
|
--with-slicot="$LIB64"/Slicot/with-underscore
|
||||||
make -j"$NTHREADS"
|
PATH="$OCTAVE_BIN_DIR:$PATH" make -j"$NTHREADS"
|
||||||
cp -L "$ROOTDIR"/mex/octave/* "$PKGFILES"/mex/octave
|
cp -L "$ROOTDIR"/mex/octave/* "$PKGFILES"/mex/octave
|
||||||
echo -e "function v = supported_octave_version\nv=\"$(octave --eval "disp(OCTAVE_VERSION)")\";\nend" > "$PKGFILES"/matlab/supported_octave_version.m
|
echo -e "function v = supported_octave_version\nv=\"$(octave --eval "disp(OCTAVE_VERSION)")\";\nend" > "$PKGFILES"/matlab/supported_octave_version.m
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
SLICOT_VERSION = 5.0+20101122
|
SLICOT_VERSION = 5.0+20101122
|
||||||
X13AS_VERSION = 1.1_B39
|
X13AS_VERSION = 1.1_B39
|
||||||
|
OCTAVE_VERSION = 4.4.1
|
||||||
|
|
|
@ -5,18 +5,18 @@
|
||||||
<background-darkAqua file="background.png" scaling="tofit" mime-type="image/png" alignment="topleft" />
|
<background-darkAqua file="background.png" scaling="tofit" mime-type="image/png" alignment="topleft" />
|
||||||
<welcome file="welcome.html" mime-type="text/html" />
|
<welcome file="welcome.html" mime-type="text/html" />
|
||||||
<license file="gpl-3.0-standalone.html" mime-type="text/html" />
|
<license file="gpl-3.0-standalone.html" mime-type="text/html" />
|
||||||
<pkg-ref id="com.cepremap.dynare" />
|
<pkg-ref id="org.dynare" />
|
||||||
<options customize="allow" require-scripts="false" hostArchitectures="x86_64" />
|
<options customize="allow" require-scripts="false" hostArchitectures="x86_64" />
|
||||||
<choices-outline>
|
<choices-outline>
|
||||||
<line choice="com.cepremap.dynare" />
|
<line choice="org.dynare" />
|
||||||
<line choice="com.cepremap.dynare.gcc" />
|
<line choice="org.dynare.gcc" />
|
||||||
</choices-outline>
|
</choices-outline>
|
||||||
<choice id="com.cepremap.dynare" title="Dynare" description="Dynare Required Files" start_enabled="false" enabled="false">
|
<choice id="org.dynare" title="Dynare" description="Dynare Required Files" start_enabled="false" enabled="false">
|
||||||
<pkg-ref id="com.cepremap.dynare" />
|
<pkg-ref id="org.dynare" />
|
||||||
</choice>
|
</choice>
|
||||||
<choice id="com.cepremap.dynare.gcc" title="GCC compiler for use_dll" description="This is necessary for the use of Dynare with the `use_dll` option. NB: This takes a few minutes and requires an active internet connection">
|
<choice id="org.dynare.gcc" title="GCC for `use_dll`" description="This is necessary for the use of Dynare with the `use_dll` option. NB: This takes a few minutes and requires an active internet connection.">
|
||||||
<pkg-ref id="com.cepremap.dynare.gcc" />
|
<pkg-ref id="org.dynare.gcc" />
|
||||||
</choice>
|
</choice>
|
||||||
<pkg-ref id="com.cepremap.dynare" version="VERSION_NO_SPACE">dynare-VERSION_NO_SPACE.pkg</pkg-ref>
|
<pkg-ref id="org.dynare" version="VERSION_NO_SPACE">dynare-VERSION_NO_SPACE.pkg</pkg-ref>
|
||||||
<pkg-ref id="com.cepremap.dynare.gcc" version="VERSION_NO_SPACE">dynare-VERSION_NO_SPACE-gcc.pkg</pkg-ref>
|
<pkg-ref id="org.dynare.gcc" version="VERSION_NO_SPACE">dynare-VERSION_NO_SPACE-gcc.pkg</pkg-ref>
|
||||||
</installer-gui-script>
|
</installer-gui-script>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Copyright © 2019 Dynare Team
|
# Copyright © 2019-2020 Dynare Team
|
||||||
#
|
#
|
||||||
# This file is part of Dynare.
|
# This file is part of Dynare.
|
||||||
#
|
#
|
||||||
|
@ -29,7 +29,12 @@ exec 2>&1
|
||||||
rm -f "$2"/dummy
|
rm -f "$2"/dummy
|
||||||
|
|
||||||
# Test for Internet connection
|
# Test for Internet connection
|
||||||
[[ -z $(curl -s -m 4 www.google.com) ]] && { echo "No internet connection found"; exit 1; }
|
[[ -z $(curl -s -m 4 https://github.com) ]] && \
|
||||||
|
{ \
|
||||||
|
osascript -e 'display alert "Dynare Installation Error" message "Not able to connect to github.com. Either you are not connected to the internet or github.com is blocked where you are.\n\nAccess to GitHub is necessary to make Dynare work with the `use_dll` option on macOS.\n\nIf you cannot establish this connection or do not want to use the `use_dll` option of Dynare, please run the installer again and choose \"Customize\" from the \"Installation Type\" screen and uncheck the `GCC` option." as critical'; \
|
||||||
|
echo "No internet connection to github.com"; \
|
||||||
|
exit 1; \
|
||||||
|
}
|
||||||
|
|
||||||
# Install Command Line Tools
|
# Install Command Line Tools
|
||||||
if [[ -z $(/usr/bin/xcode-select -print-path) ]]; then
|
if [[ -z $(/usr/bin/xcode-select -print-path) ]]; then
|
||||||
|
@ -49,7 +54,20 @@ fi
|
||||||
|
|
||||||
# If CLT installation didn't work, exit
|
# If CLT installation didn't work, exit
|
||||||
[[ -z $(/usr/bin/xcode-select -print-path) ]] && \
|
[[ -z $(/usr/bin/xcode-select -print-path) ]] && \
|
||||||
{ echo "You must install Command Line Tools to proceed with installation of GCC"; exit 1; }
|
{ \
|
||||||
|
osascript -e 'display alert "Dynare Installation Error" message "Not able to find Command Line Tools.\n\nCommand Line Tools is necessary to make Dynare work with the `use_dll` option on macOS.\n\nIf you cannot establish this connection or do not want to use the `use_dll` option of Dynare, please run the installer again and choose \"Customize\" from the \"Installation Type\" screen and uncheck the `GCC` option." as critical'; \
|
||||||
|
echo "Command Line Tools not installed"; \
|
||||||
|
exit 1; \
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ensure git is in the path
|
||||||
|
[[ -z $(which git) ]] && \
|
||||||
|
{ \
|
||||||
|
osascript -e 'display alert "Dynare Installation Error" message "Not able to find Git even though the Command Line Tools have already been installed. This is likely a problem with your PATH environment variable.\n\nGit is necessary to make Dynare work with the `use_dll` option on macOS.\n\nIf you cannot establish this connection or do not want to use the `use_dll` option of Dynare, please run the installer again and choose \"Customize\" from the \"Installation Type\" screen and uncheck the `GCC` option." as critical'; \
|
||||||
|
echo $PATH; \
|
||||||
|
echo "Git not found in PATH"; \
|
||||||
|
exit 1; \
|
||||||
|
}
|
||||||
|
|
||||||
# Install Homebrew
|
# Install Homebrew
|
||||||
BREWDIR="$2"/.brew
|
BREWDIR="$2"/.brew
|
||||||
|
|
|
@ -4,11 +4,11 @@
|
||||||
<p style="text-align: center;">Version VERSION_NO_SPACE</p>
|
<p style="text-align: center;">Version VERSION_NO_SPACE</p>
|
||||||
<p style="text-align: center;">DATE</p>
|
<p style="text-align: center;">DATE</p>
|
||||||
|
|
||||||
<p><b>Just a few things to note</b>. This installation can be customized as you can choose not to install the GNU C Compiler (GCC). Installing GCC is necessary if you want to use the <tt>use_dll</tt> option in Dynare, but otherwise unnecessary.</p>
|
<p><b>Just a few things to note</b>. This installation can be customized as you can choose not to install the GNU Compiler Collection (GCC). Installing GCC is necessary if you want to use the <tt>use_dll</tt> option in Dynare, but otherwise unnecessary.</p>
|
||||||
|
|
||||||
<p>To install GCC we run a script that first installs the XCode Command Line Tools (an Apple product). The script then installs Homebrew, a package manager for macOS and, finally, GCC itself. Both Homebrew and GCC will be installed in your Dynare installation folder. So, when you delete this folder, they too will be deleted.</p>
|
<p>To install GCC we run a script that first installs the XCode Command Line Tools (an Apple product). The script then installs Homebrew, a package manager for macOS and, finally, GCC itself. Both Homebrew and GCC will be installed in your Dynare installation folder. So, when you delete this folder, they too will be deleted.</p>
|
||||||
|
|
||||||
<p>Installing GCC will require an active internet connection and will take a few minutes to a half an hour during the <i>Running package scripts</i> phase of Installation. The time it takes depends on your internet speed, the speed of your computer, and whether or not you already have XCode Command Line Tools installed. The progress bar will not advance during this phase. Please be patient.</p>
|
<p>Installing GCC will require an active internet connection with the ability to connect to the Apple servers and GitHub. The installation will take anywhere from a few minutes to a half an hour during the <i>Running package scripts</i> phase of Installation. The time it takes depends on your internet speed, the speed of your computer, and whether or not you already have XCode Command Line Tools installed. The progress bar will not advance during this phase. Please be patient.</p>
|
||||||
|
|
||||||
<p> You can choose not to install GCC by choosing <i>Customize</i> from the <i>Installation Type</i> screen and deselecting <i>GCC compiler</i>. If you already have <tt>GCC_BINARY</tt> installed under <tt>/usr/local</tt>, you can forgo the installation of GCC here as Dynare will find your system compiler when you use <tt>use_dll</tt>.</p>
|
<p> You can choose not to install GCC by choosing <i>Customize</i> from the <i>Installation Type</i> screen and deselecting <i>GCC compiler</i>. If you already have <tt>GCC_BINARY</tt> installed under <tt>/usr/local</tt>, you can forgo the installation of GCC here as Dynare will find your system compiler when you use <tt>use_dll</tt>.</p>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
function run(json)
|
function read(json)
|
||||||
% function varargout = run(json)
|
% function varargout = read(json)
|
||||||
% Read JSON and run perfect foresight solver. Potentially return output as
|
% Read JSON and run perfect foresight solver. Potentially return output as
|
||||||
% JSON
|
% JSON
|
||||||
%
|
%
|
||||||
|
@ -13,7 +13,7 @@ function run(json)
|
||||||
% SPECIAL REQUIREMENTS
|
% SPECIAL REQUIREMENTS
|
||||||
% none
|
% none
|
||||||
|
|
||||||
% Copyright (C) 2019 Dynare Team
|
% Copyright (C) 2019-2020 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
@ -34,7 +34,6 @@ global M_ options_ oo_
|
||||||
|
|
||||||
%loading JSON
|
%loading JSON
|
||||||
jm = loadjson_(json, 'SimplifyCell', 1);
|
jm = loadjson_(json, 'SimplifyCell', 1);
|
||||||
runflag=1;
|
|
||||||
data2json=struct();
|
data2json=struct();
|
||||||
|
|
||||||
M_.exo_det_length = 0;
|
M_.exo_det_length = 0;
|
||||||
|
@ -67,7 +66,7 @@ options_.order = jm.taylororder;
|
||||||
% options_.k_order_solver = 3;
|
% options_.k_order_solver = 3;
|
||||||
% end
|
% end
|
||||||
var_list_ = char();
|
var_list_ = char();
|
||||||
info = stoch_simul(var_list_);
|
[~, oo_, options_] = stoch_simul(M_, options_, oo_, var_list_);
|
||||||
|
|
||||||
irfnames=fieldnames(oo_.irfs);
|
irfnames=fieldnames(oo_.irfs);
|
||||||
for jj = 1:numel(fieldnames(oo_.irfs))
|
for jj = 1:numel(fieldnames(oo_.irfs))
|
||||||
|
|
|
@ -58,7 +58,7 @@ function [alphahat,etahat,epsilonhat,ahat,SteadyState,trend_coeff,aK,T,R,P,PK,de
|
||||||
% SPECIAL REQUIREMENTS
|
% SPECIAL REQUIREMENTS
|
||||||
% None
|
% None
|
||||||
|
|
||||||
% Copyright (C) 2006-2018 Dynare Team
|
% Copyright (C) 2006-2020 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
@ -185,8 +185,7 @@ elseif options_.lik_init == 3 % Diffuse Kalman filter
|
||||||
end
|
end
|
||||||
[Pstar,Pinf] = compute_Pinf_Pstar(mf,T,R,Q,options_.qz_criterium);
|
[Pstar,Pinf] = compute_Pinf_Pstar(mf,T,R,Q,options_.qz_criterium);
|
||||||
elseif options_.lik_init == 4 % Start from the solution of the Riccati equation.
|
elseif options_.lik_init == 4 % Start from the solution of the Riccati equation.
|
||||||
[err, Pstar] = kalman_steady_state(transpose(T),R*Q*transpose(R),transpose(build_selection_matrix(mf,np,vobs)),H);
|
Pstar = kalman_steady_state(transpose(T),R*Q*transpose(R),transpose(build_selection_matrix(mf,np,vobs)),H);
|
||||||
mexErrCheck('kalman_steady_state',err);
|
|
||||||
Pinf = [];
|
Pinf = [];
|
||||||
if kalman_algo~=2
|
if kalman_algo~=2
|
||||||
kalman_algo = 1;
|
kalman_algo = 1;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue