Merge remote-tracking branch 'community/master' into enterprise
commit
6a89783b65
|
@ -1,5 +1,5 @@
|
|||
variables:
|
||||
GIT_SUBMODULE_STRATEGY: normal
|
||||
GIT_SUBMODULE_STRATEGY: recursive
|
||||
TERM: linux
|
||||
|
||||
# The next stanza creates the version number used for the source tarball and the
|
||||
|
@ -10,11 +10,15 @@ variables:
|
|||
# + if on master: use enterprise-unstable-$TIMESTAMP-$COMMIT
|
||||
# + on another branch: use $BRANCH-$TIMESTAMP-$COMMIT
|
||||
# - if in a personal repository: use $USER-$TIMESTAMP-$COMMIT
|
||||
#
|
||||
# Also sets the path and version of the default MATLAB installation.
|
||||
before_script:
|
||||
- '[[ -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 ]] && 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'
|
||||
- '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:
|
||||
- build
|
||||
|
@ -25,7 +29,7 @@ build_binaries:
|
|||
stage: build
|
||||
script:
|
||||
- autoreconf -si
|
||||
- './configure --with-matlab=$(dirname $(dirname $(readlink -f $(which matlab)))) 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") PACKAGE_VERSION=$VERSION PACKAGE_STRING="dynare $VERSION"'
|
||||
- ./configure --with-matlab=$MATLAB_PATH MATLAB_VERSION=$MATLAB_VERSION PACKAGE_VERSION=$VERSION PACKAGE_STRING="dynare $VERSION"
|
||||
- make -j $(nproc) LN_S="cp -p"
|
||||
artifacts:
|
||||
paths:
|
||||
|
@ -66,7 +70,7 @@ pkg_source:
|
|||
script:
|
||||
- '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
|
||||
- ./configure
|
||||
- ./configure --with-matlab=$MATLAB_PATH MATLAB_VERSION=$MATLAB_VERSION
|
||||
- make dist
|
||||
artifacts:
|
||||
paths:
|
||||
|
@ -138,14 +142,14 @@ test_matlab:
|
|||
extends: .test_matlab_template
|
||||
script:
|
||||
- autoreconf -si
|
||||
- './configure --disable-octave --with-matlab=$(dirname $(dirname $(readlink -f $(which matlab)))) 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")'
|
||||
- ./configure --disable-octave --with-matlab=$MATLAB_PATH MATLAB_VERSION=$MATLAB_VERSION
|
||||
- make -j $(($(nproc) * 3 / 4)) -C tests check-matlab
|
||||
|
||||
test_old_matlab:
|
||||
extends: .test_matlab_template
|
||||
script:
|
||||
- autoreconf -si
|
||||
- './configure --disable-octave --with-matlab=/usr/local/MATLAB/R2009b MATLAB_VERSION=R2009b'
|
||||
- ./configure --disable-octave --with-matlab=/usr/local/MATLAB/R2009b MATLAB_VERSION=R2009b
|
||||
- make -C mex/build/matlab clean
|
||||
- make -j $(nproc) -C mex/build/matlab
|
||||
- make -j $(($(nproc) * 3 / 4)) -C tests check-matlab
|
||||
|
|
|
@ -11,8 +11,8 @@ If something is not clear, don't hesitate to ask if you can't find the answer on
|
|||
Please note that the repositories under the purview of this page are:
|
||||
|
||||
* [Dynare](https://git.dynare.org/Dynare/dynare)
|
||||
* [Preprocessor](https://git.dynare.org/Dynare/preprocessor)
|
||||
* [Particles](https://git.dynare.org/Dynare/particles)
|
||||
* [Dates](https://git.dynare.org/Dynare/dates)
|
||||
* [Dseries](https://git.dynare.org/Dynare/dseries)
|
||||
* [Reporting](https://git.dynare.org/Dynare/reporting)
|
||||
* [Testsuite](https://git.dynare.org/Dynare/testsuite)
|
||||
|
@ -20,17 +20,25 @@ Please note that the repositories under the purview of this page are:
|
|||
|
||||
## Making your Intentions Known
|
||||
|
||||
Before making changes to the codebase, it'd be helpful if you communicated your intentions with us. This will avoid double work and ensure that you don't contribute code that won't be included in Dynare for one reason or another. The way to communicate with us is via [GitHub Issues](https://guides.github.com/features/issues/).
|
||||
Before making changes to the codebase, it'd be helpful if you communicated your intentions with us. This will avoid double work and ensure that you don't contribute code that won't be included in Dynare for one reason or another.
|
||||
|
||||
### Create your account on our GitLab instance
|
||||
|
||||
All the development of Dynare happens in [GitLab](https://about.gitlab.com/), which is an integrated environment for storing code under git, keeping track of issues and milestones, and perform testing. The Dynare Team has its own instance of GitLab.
|
||||
|
||||
In order to work with us, you need to create your account on our GitLab instance on the [register page](https://git.dynare.org/users/sign_in).
|
||||
|
||||
You will also need to register your SSH key in your GitLab profile if you want to contribute code.
|
||||
|
||||
### Issues: Reporting Bugs
|
||||
|
||||
You can report bugs in both the stable and unstable versions of Dynare. Before reporting a bug in the stable version of Dynare, please check the [Known Bugs](http://www.dynare.org/DynareWiki/KnownBugs) page to ensure it has not already been encountered/fixed. If reporting a bug in the unstable version of Dynare, please ensure the bug exists in the latest [unstable Dynare snapshot](http://www.dynare.org/download/dynare-unstable).
|
||||
You can report bugs in both the stable and unstable versions of Dynare. Before reporting a bug in the stable version of Dynare, please check the [Known Bugs](https://git.dynare.org/Dynare/dynare/wikis/Known-bugs-present-in-the-current-stable-version) page to ensure it has not already been encountered/fixed. If reporting a bug in the unstable version of Dynare, please ensure the bug exists in the latest [unstable Dynare snapshot](https://www.dynare.org/download/#snapshot).
|
||||
|
||||
To report a bug in Dynare, simply open a GitHub issue in the repository where the bug resides. For example, to report a bug in Dynare itself, go to the [Dynare repository issue page](https://git.dynare.org/Dynare/dynare/issues) and click on "New Issue."
|
||||
To report a bug in Dynare, simply open a Gitlab issue in the repository where the bug resides. For example, to report a bug in Dynare itself, go to the [Dynare repository issue page](https://git.dynare.org/Dynare/dynare/issues) and click on "New Issue."
|
||||
|
||||
The minimal information to add is a subject and a description of the steps needed to reproduce the bug. However, the most helpful description would also provide the code to reproduce the bug (often times a `.mod` file). The most helpful `.mod` file is a minimal, quick-running example that reproduces the bug, but we'll take anything that will help us squash a bug.
|
||||
|
||||
To include short amounts of code, please paste it into the description box, using the appropriate [GitHub markdown](https://help.github.com/articles/github-flavored-markdown/) code. For larger amounds of code like `.mod` files, please create a new [GitHub Gist](https://gist.github.com) and provide the link in the description box.
|
||||
To include short amounts of code, please paste it into the description box, using the appropriate [GitLab Flavored Markdown](https://docs.gitlab.com/ee/user/markdown.html) code. For larger amounds of code like `.mod` files, please create a new [GitLab snippet](https://git.dynare.org/dashboard/snippets) and provide the link in the description box.
|
||||
|
||||
### Issues: Enhancements
|
||||
|
||||
|
@ -40,19 +48,19 @@ Though our development priorities lay with those who finance Dynare and with wha
|
|||
|
||||
## Get to Coding!
|
||||
|
||||
So, now you've reported the bug or asked for an enhancemnt by creating a GitHub issue. That's already a great help. Thank you!
|
||||
So, now you've reported the bug or asked for an enhancemnt by creating a GitLab issue. That's already a great help. Thank you!
|
||||
|
||||
Now, if you want to go the extra mile, you'll volunteer to contribute code to fix the GitHub issue you created above. Once we've agreed that you'll do it, please do the following:
|
||||
Now, if you want to go the extra mile, you'll volunteer to contribute code to fix the GitLab issue you created above. Once we've agreed that you'll do it, please do the following:
|
||||
|
||||
1. Clone the Dynare repository:
|
||||
* `git clone --recurse-submodules https://git.dynare.org/Dynare/dynare.git`
|
||||
1. [Fork the Dynare repository](https://help.github.com/articles/fork-a-repo)
|
||||
1. [Fork the Dynare repository](https://docs.gitlab.com/ee/gitlab-basics/fork-project.html)
|
||||
1. Change into the `dynare` folder and add the forked repository as a remote:
|
||||
* `cd dynare`
|
||||
* `git remote add personal https://github.com/<<GitHub username>>/dynare.git`
|
||||
* `git remote add personal git@git.dynare.org:<<GitLab username>>/dynare.git`
|
||||
1. Create a branch to work on
|
||||
* `git checkout -b <<descriptive branch name>>`
|
||||
1. Do your work, all the while respecting the [Dynare Coding Standards](http://www.dynare.org/DynareWiki/CodingStandards)
|
||||
1. Do your work, all the while respecting the [Dynare Coding Standards](https://archives.dynare.org/DynareWiki/CodingStandards)
|
||||
|
||||
As you work, your forked repository will likely fall out of sync with the main Dynare repository as we'll be working in parallel. No matter. Follow these steps to ensure your changes will be merge-able when they're done:
|
||||
|
||||
|
@ -70,14 +78,16 @@ Once you've made the changes necessary to fix the bug or add an enhancement, ens
|
|||
1. Get the latest changes from Dynare and rebase your branch on top of them (see above)
|
||||
1. Commit your changes:
|
||||
* `git add <<files to commit>>`
|
||||
* `git commit -m "<<descriptive commit message.>> Closes #<<Ref. to GitHub issue number fixed by this commit>>"`
|
||||
* `git commit -m "<<descriptive commit message.>> Closes: #<<Ref. to GitLab issue number fixed by this commit>>"`
|
||||
1. Push to your forked Dynare repository
|
||||
* `git push personal <<descriptive branch name>>`
|
||||
1. Create a [Pull Request](https://help.github.com/articles/creating-a-pull-request/) from the branch in your forked Dynare repository
|
||||
1. Create a [Merge Request](https://docs.gitlab.com/ee/gitlab-basics/add-merge-request.html) from the branch in your forked Dynare repository
|
||||
|
||||
## Tests
|
||||
|
||||
The Dynare Test Suite runs nightly. It's how we quickly catch bugs that may have been introduced by changes made during the day. The output from the test suite can be found here: [http://www.dynare.org/testsuite/master/](http://www.dynare.org/testsuite/master/). This is also a good place to start fixing bugs. If you see a `.mod` file that doesn't run in the test suite and think you can fix it, create an issue and once you have the go ahead, go for it!
|
||||
The Dynare testsuite runs every time a commit is pushed, either in the official repository or in your personal repository, through [GitLab Continuous Integration](https://docs.gitlab.com/ee/ci/). It's how we quickly catch bugs that may have been introduced by changes made.
|
||||
|
||||
The output from the latest run of the test suite can be found in the `test_matlab` job associated to the [latest pipeline](https://git.dynare.org/Dynare/dynare/pipelines). This is also a good place to start fixing bugs. If you see a `.mod` file that doesn't run in the test suite and think you can fix it, create an issue and once you have the go ahead, go for it!
|
||||
|
||||
### Test `.mod` File
|
||||
|
||||
|
@ -88,6 +98,4 @@ It's useful to contribute `.mod` files that test some aspect of Dynare that is n
|
|||
1. Add and commit your test file and `tests/Makefile.am` as described above
|
||||
1. Push and create a pull request as described above
|
||||
|
||||
NB: Please do not contribute non-text files (e.g. `.xls`). If you absolutely need such a file for your test to run, please contact us to see how to go about contributing it.
|
||||
|
||||
### Unitary Tests
|
||||
|
|
10
Makefile.am
10
Makefile.am
|
@ -1,14 +1,9 @@
|
|||
SUBDIRS = preprocessor doc tests mex/sources
|
||||
|
||||
if HAVE_BLAS
|
||||
if HAVE_LAPACK
|
||||
if HAVE_MATIO
|
||||
if ENABLE_DYNAREPLUSPLUS
|
||||
SUBDIRS += dynare++
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# MEX must be built after dynare++ (because of kordepert)
|
||||
if ENABLE_MATLAB
|
||||
SUBDIRS += mex/build/matlab
|
||||
endif
|
||||
|
@ -26,8 +21,7 @@ EXTRA_DIST = \
|
|||
README.md \
|
||||
COPYING \
|
||||
CONTRIBUTING.md \
|
||||
windows/dynare.nsi \
|
||||
windows/README.txt \
|
||||
windows \
|
||||
macOS \
|
||||
examples \
|
||||
scripts \
|
||||
|
|
219
configure.ac
219
configure.ac
|
@ -73,40 +73,116 @@ if test -z "$YACC"; then
|
|||
AM_MISSING_PROG([YACC], [bison])
|
||||
fi
|
||||
|
||||
# Check for libmatio, needed by Dynare++
|
||||
AX_MATIO
|
||||
AM_CONDITIONAL([HAVE_MATIO], [test "$has_matio" = yes])
|
||||
# Define optional components and their corresponding flags and Automake conditionals
|
||||
AC_ARG_ENABLE([doc], AS_HELP_STRING([--disable-doc], [disable compilation of documentation]), [], [enable_doc=yes])
|
||||
AM_CONDITIONAL([ENABLE_DOC], [test "$enable_doc" = yes])
|
||||
|
||||
AC_CHECK_PROG([PDFLATEX], [pdflatex], [pdflatex])
|
||||
AM_CONDITIONAL([HAVE_PDFLATEX], [test -n "$PDFLATEX"])
|
||||
AC_ARG_ENABLE([dynare++], AS_HELP_STRING([--disable-dynare++], [disable compilation of Dynare++]), [], [enable_dynareplusplus=yes])
|
||||
AM_CONDITIONAL([ENABLE_DYNAREPLUSPLUS], [test "$enable_dynareplusplus" = yes])
|
||||
|
||||
AC_CHECK_PROG([BIBTEX], [bibtex], [bibtex])
|
||||
AM_CONDITIONAL([HAVE_BIBTEX], [test -n "$BIBTEX"])
|
||||
AC_ARG_ENABLE([matlab], AS_HELP_STRING([--disable-matlab], [disable compilation of MEX files for MATLAB]), [], [enable_matlab=yes])
|
||||
AM_CONDITIONAL([ENABLE_MATLAB], [test "$enable_matlab" = yes])
|
||||
|
||||
AC_CHECK_PROG([SPHINXBUILD], [sphinx-build], [sphinx-build])
|
||||
AM_CONDITIONAL([HAVE_SPHINXBUILD], [test -n "$SPHINXBUILD"])
|
||||
AC_ARG_ENABLE([octave], AS_HELP_STRING([--disable-octave], [disable compilation of MEX files for Octave]), [], [enable_octave=yes])
|
||||
AM_CONDITIONAL([ENABLE_OCTAVE], [test "$enable_octave" = yes])
|
||||
|
||||
if test -n "$PDFLATEX" -a -n "$BIBTEX"; then
|
||||
AX_LATEX_CLASS([beamer], [ax_latex_have_beamer])
|
||||
AC_ARG_ENABLE([org-export], AS_HELP_STRING([--enable-org-export], [enable exporting of Org files (requires Emacs, org-mode and other external programs)]))
|
||||
AM_CONDITIONAL([ENABLE_ORG_EXPORT], [test -n "$enable_org_export"])
|
||||
|
||||
# Check utilities needed for documentation
|
||||
if test "$enable_doc" = yes; then
|
||||
AC_CHECK_PROG([PDFLATEX], [pdflatex], [pdflatex], [no])
|
||||
test "$PDFLATEX" = no && AC_MSG_ERROR([pdflatex cannot be found. If you want to skip the compilation of the documentation, pass the --disable-doc flag.])
|
||||
AC_CHECK_PROG([BIBTEX], [bibtex], [bibtex], [no])
|
||||
test "$BIBTEX" = no && AC_MSG_ERROR([bibtex cannot be found. If you want to skip the compilation of the documentation, pass the --disable-doc flag.])
|
||||
AC_CHECK_PROG([SPHINXBUILD], [sphinx-build], [sphinx-build], [no])
|
||||
test "$SPHINXBUILD" = no && AC_MSG_ERROR([sphinx-build cannot be found. If you want to skip the compilation of the documentation, pass the --disable-doc flag.])
|
||||
AX_LATEX_CLASS([beamer], [ax_latex_have_beamer], [], [AC_MSG_ERROR([beamer cannot be found. If you want to skip the compilation of the documentation, pass the --disable-doc flag.])])
|
||||
fi
|
||||
AM_CONDITIONAL([HAVE_BEAMER], [test "$ax_latex_have_beamer" = yes])
|
||||
|
||||
AC_PROG_F77
|
||||
AC_F77_LIBRARY_LDFLAGS
|
||||
case ${host_os} in
|
||||
*darwin*)
|
||||
# * OS X doesn't need to link against the Fortran libraries because
|
||||
# everything is contained within the vecLib framework.
|
||||
FLIBS=''
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -n "$F77"; then
|
||||
AX_BLAS
|
||||
AX_LAPACK
|
||||
# Check for BLAS, LAPACK and MATIO, needed by Dynare++
|
||||
if test "$enable_dynareplusplus" = yes; then
|
||||
AC_PROG_F77
|
||||
AC_F77_LIBRARY_LDFLAGS
|
||||
case ${host_os} in
|
||||
*darwin*)
|
||||
# * OS X doesn't need to link against the Fortran libraries because
|
||||
# everything is contained within the vecLib framework.
|
||||
FLIBS=''
|
||||
;;
|
||||
esac
|
||||
AX_BLAS
|
||||
AX_LAPACK
|
||||
AX_MATIO
|
||||
if test "$ax_blas_ok" != yes -o "$ax_lapack_ok" != yes -o "$has_matio" != yes; then
|
||||
AC_MSG_ERROR([Some dependencies of Dynare++ cannot be found. If you want to skip the compilation of Dynare++, pass the --disable-dynare++ flag.])
|
||||
fi
|
||||
fi
|
||||
AM_CONDITIONAL([HAVE_BLAS], [test "$ax_blas_ok" = yes])
|
||||
AM_CONDITIONAL([HAVE_LAPACK], [test "$ax_lapack_ok" = yes])
|
||||
|
||||
# Check for MATLAB
|
||||
if test "$enable_matlab" = yes; then
|
||||
AC_CONFIG_SUBDIRS([mex/build/matlab])
|
||||
AX_MATLAB
|
||||
AX_MATLAB_BATCH_OPTIONS
|
||||
test "$ax_enable_matlab" != yes && AC_MSG_ERROR([MATLAB cannot be found. If you want to compile Dynare without MATLAB support, pass the --disable-matlab flag.])
|
||||
fi
|
||||
|
||||
# Check for Octave
|
||||
if test "$enable_octave" = yes; then
|
||||
AC_CONFIG_SUBDIRS([mex/build/octave])
|
||||
AC_CHECK_PROG([OCTAVE], [octave], [octave], [no])
|
||||
test "$OCTAVE" = no && AC_MSG_ERROR([Octave cannot be found. If you want to compile Dynare without Octave support, pass the --disable-octave flag.])
|
||||
fi
|
||||
|
||||
# Construct final output message
|
||||
if test "$enable_dynareplusplus" = yes; then
|
||||
BUILD_DYNAREPLUSPLUS="yes"
|
||||
TESTSUITE_DYNAREPLUSPLUS="yes"
|
||||
else
|
||||
BUILD_DYNAREPLUSPLUS="no"
|
||||
TESTSUITE_DYNAREPLUSPLUS="no"
|
||||
fi
|
||||
|
||||
if test "$enable_doc" = yes; then
|
||||
BUILD_DOC="yes"
|
||||
else
|
||||
BUILD_DOC="no"
|
||||
fi
|
||||
|
||||
if test -n "$enable_org_export"; then
|
||||
BUILD_INTERNAL_DOC="yes"
|
||||
else
|
||||
BUILD_INTERNAL_DOC="no"
|
||||
fi
|
||||
|
||||
if test "$enable_matlab" = yes; then
|
||||
TESTSUITE_MATLAB="yes"
|
||||
else
|
||||
TESTSUITE_MATLAB="no"
|
||||
fi
|
||||
|
||||
if test "$enable_octave" = yes; then
|
||||
TESTSUITE_OCTAVE="yes"
|
||||
else
|
||||
TESTSUITE_OCTAVE="no"
|
||||
fi
|
||||
|
||||
AC_MSG_NOTICE([
|
||||
|
||||
Dynare is now configured for building the following components...
|
||||
|
||||
Binaries (with "make"):
|
||||
Dynare++: $BUILD_DYNAREPLUSPLUS
|
||||
|
||||
Documentation (with "make html pdf"):
|
||||
Manual and other documents $BUILD_DOC
|
||||
Dynare internal doc: $BUILD_INTERNAL_DOC
|
||||
|
||||
Testsuites (run with "make check"):
|
||||
Dynare for MATLAB: $TESTSUITE_MATLAB
|
||||
Dynare for Octave: $TESTSUITE_OCTAVE
|
||||
Dynare++: $TESTSUITE_DYNAREPLUSPLUS
|
||||
])
|
||||
|
||||
AC_CONFIG_FILES([Makefile
|
||||
VERSION
|
||||
|
@ -139,93 +215,4 @@ AC_CONFIG_FILES([Makefile
|
|||
mex/sources/Makefile
|
||||
])
|
||||
|
||||
AC_ARG_ENABLE([matlab], AS_HELP_STRING([--disable-matlab], [disable compilation of MEX files for MATLAB]), [], [enable_matlab=yes])
|
||||
if test "$enable_matlab" = yes; then
|
||||
AC_CONFIG_SUBDIRS([mex/build/matlab])
|
||||
AX_MATLAB
|
||||
AX_MATLAB_BATCH_OPTIONS
|
||||
fi
|
||||
AM_CONDITIONAL([ENABLE_MATLAB], [test "$enable_matlab" = yes])
|
||||
AM_CONDITIONAL([HAVE_MATLAB], [test "$ax_enable_matlab" = yes])
|
||||
|
||||
AC_ARG_ENABLE([octave], AS_HELP_STRING([--disable-octave], [disable compilation of MEX files for Octave]), [], [enable_octave=yes])
|
||||
if test "$enable_octave" = yes; then
|
||||
AC_CONFIG_SUBDIRS([mex/build/octave])
|
||||
AC_CHECK_PROG([OCTAVE], [octave], [octave])
|
||||
fi
|
||||
AM_CONDITIONAL([ENABLE_OCTAVE], [test "$enable_octave" = yes])
|
||||
AM_CONDITIONAL([HAVE_OCTAVE], [test "$enable_octave" = yes -a -n "$OCTAVE"])
|
||||
|
||||
# Enable exporting of Org files
|
||||
# The clean way would be to test for Emacs, Org-mode, latex, dvipng...
|
||||
AC_ARG_ENABLE([org-export], AS_HELP_STRING([--enable-org-export], [enable exporting of Org files (requires Emacs, org-mode and other external programs)]))
|
||||
AM_CONDITIONAL([ENABLE_ORG_EXPORT], [test -n "$enable_org_export"])
|
||||
|
||||
# Construct final output message
|
||||
|
||||
if test "$ax_blas_ok" = yes -a "$ax_lapack_ok" = yes -a "$has_matio" = yes; then
|
||||
BUILD_DYNAREPLUSPLUS="yes"
|
||||
else
|
||||
BUILD_DYNAREPLUSPLUS="no (missing one of: BLAS, LAPACK, MatIO)"
|
||||
fi
|
||||
|
||||
if test -n "$PDFLATEX" -a "$ax_latex_have_beamer" = yes; then
|
||||
BUILD_BEAMER_DOC="yes"
|
||||
else
|
||||
BUILD_BEAMER_DOC="no (missing one of: pdflatex, beamer)"
|
||||
fi
|
||||
|
||||
if test "x$PDFLATEX" != "x"; then
|
||||
BUILD_OTHER_PDF_DOC="yes"
|
||||
else
|
||||
BUILD_OTHER_PDF_DOC="no (missing pdflatex)"
|
||||
fi
|
||||
|
||||
if test -n "$enable_org_export"; then
|
||||
BUILD_DYNARE_INTERNAL_DOC="yes"
|
||||
else
|
||||
BUILD_DYNARE_INTERNAL_DOC="no (Org export not enabled)"
|
||||
fi
|
||||
|
||||
if test -n "$SPHINXBUILD"; then
|
||||
BUILD_DYNARE_HTML_MANUAL="yes"
|
||||
BUILD_DYNARE_PDF_MANUAL="yes"
|
||||
else
|
||||
BUILD_DYNARE_HTML_MANUAL="no (missing sphinx-build)"
|
||||
BUILD_DYNARE_PDF_MANUAL="no (missing sphinx-build)"
|
||||
fi
|
||||
|
||||
if test -n "$OCTAVE"; then
|
||||
TESTSUITE_OCTAVE="yes"
|
||||
else
|
||||
TESTSUITE_OCTAVE="no"
|
||||
fi
|
||||
|
||||
if test "$ax_blas_ok" = yes -a "$ax_lapack_ok" = yes; then
|
||||
TESTSUITE_DYNAREPLUSPLUS="yes"
|
||||
else
|
||||
TESTSUITE_DYNAREPLUSPLUS="no"
|
||||
fi
|
||||
|
||||
AC_MSG_NOTICE([
|
||||
|
||||
Dynare is now configured for building the following components...
|
||||
|
||||
Binaries (with "make"):
|
||||
Dynare++: $BUILD_DYNAREPLUSPLUS
|
||||
|
||||
PDF documentation (with "make pdf"):
|
||||
Dynare reference manual: $BUILD_DYNARE_PDF_MANUAL
|
||||
Beamer presentations: $BUILD_BEAMER_DOC
|
||||
Various other documents: $BUILD_OTHER_PDF_DOC
|
||||
|
||||
HTML documentation (with "make html"):
|
||||
Dynare reference manual: $BUILD_DYNARE_HTML_MANUAL
|
||||
Dynare internal doc: $BUILD_DYNARE_INTERNAL_DOC
|
||||
|
||||
Testsuites (run with "make check"):
|
||||
Dynare for Octave: $TESTSUITE_OCTAVE
|
||||
Dynare++: $TESTSUITE_DYNAREPLUSPLUS
|
||||
])
|
||||
|
||||
AC_OUTPUT
|
||||
|
|
|
@ -1,20 +1,10 @@
|
|||
SUBDIRS = parallel internals gsa dseries-and-reporting
|
||||
|
||||
if HAVE_SPHINXBUILD
|
||||
if ENABLE_DOC
|
||||
SUBDIRS += manual
|
||||
pdf-local: guide.pdf bvar-a-la-sims.pdf dr.pdf
|
||||
endif
|
||||
|
||||
PDF_TARGETS =
|
||||
|
||||
if HAVE_PDFLATEX
|
||||
PDF_TARGETS += guide.pdf bvar-a-la-sims.pdf
|
||||
if HAVE_BIBTEX
|
||||
PDF_TARGETS += dr.pdf
|
||||
endif
|
||||
endif
|
||||
|
||||
pdf-local: $(PDF_TARGETS)
|
||||
|
||||
EXTRA_DIST = guide.tex guide.bbl bibmad.sty bvar-a-la-sims.tex dr.tex dr.bib dynare.plots
|
||||
|
||||
guide.pdf: guide.tex guide.bbl bibmad.sty
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
if HAVE_PDFLATEX
|
||||
if HAVE_BEAMER
|
||||
if ENABLE_DOC
|
||||
pdf-local: dseriesReporting.pdf
|
||||
endif
|
||||
endif
|
||||
|
||||
SRC = dseriesReporting.tex
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
if HAVE_PDFLATEX
|
||||
if HAVE_BIBTEX
|
||||
if ENABLE_DOC
|
||||
pdf-local: gsa.pdf
|
||||
endif
|
||||
endif
|
||||
|
||||
SRC = gsa.tex marco.bib
|
||||
|
||||
|
|
|
@ -9,3 +9,7 @@
|
|||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
<hr />
|
||||
<ul>
|
||||
<li class="toctree-l1"><a href="{{pathto('genindex.html', 1)}}">Index</a></li>
|
||||
</ul>
|
||||
|
|
|
@ -1,18 +1,29 @@
|
|||
The Dynare Reference Manual, version 4.6-unstable.
|
||||
==================================================
|
||||
The Dynare Reference Manual, version |version|
|
||||
==============================================
|
||||
|
||||
Currently the development team of Dynare is composed of:
|
||||
|
||||
* Stéphane Adjemian
|
||||
* Houtan Bastani
|
||||
* Michel Juillard
|
||||
* Frédéric Karamé
|
||||
* Junior Maih
|
||||
* Ferhat Mihoubi
|
||||
* Willi Mutschler
|
||||
* Johannes Pfeifer
|
||||
* Marco Ratto
|
||||
* Sébastien Villemot
|
||||
* Stéphane Adjemian (Université du Maine, Gains)
|
||||
* Houtan Bastani (CEPREMAP)
|
||||
* Michel Juillard (Banque de France)
|
||||
* Sumudu Kankanamge (Toulouse School of Economics)
|
||||
* Frédéric Karamé (Université du Maine, Gains and CEPREMAP)
|
||||
* Dóra Kocsis (CEPREMAP)
|
||||
* Junior Maih (Norges Bank)
|
||||
* Ferhat Mihoubi (Université Paris-Est Créteil, Érudite and CEPREMAP)
|
||||
* Willi Mutschler (University of Münster)
|
||||
* Johannes Pfeifer (University of Cologne)
|
||||
* Marco Ratto (European Commission, Joint Research Centre - JRC)
|
||||
* Sébastien Villemot (CEPREMAP)
|
||||
|
||||
The following people used to be members of the team:
|
||||
|
||||
* Abdeljabar Benzougar
|
||||
* Alejandro Buesa
|
||||
* Fabrice Collard
|
||||
* Assia Ezzeroug
|
||||
* Stéphane Lhuissier
|
||||
* George Perendia
|
||||
|
||||
Copyright © 1996-2019, Dynare Team.
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ are necessary in that case.
|
|||
In order to run Dynare, you need one of the following:
|
||||
|
||||
* MATLAB version 7.9 (R2009b) or above;
|
||||
* GNU Octave version 4.2.1 or above, with the statistics package from `Octave-Forge`_.
|
||||
* Octave version 4.2.1 or above, with the statistics package from `Octave-Forge`_.
|
||||
|
||||
The following optional extensions are also useful to benefit from
|
||||
extra features, but are in no way required:
|
||||
|
@ -23,7 +23,7 @@ extra features, but are in no way required:
|
|||
* If under MATLAB: the Optimization Toolbox, the Statistics Toolbox,
|
||||
the Control System Toolbox;
|
||||
|
||||
* If under GNU Octave, the following `Octave-Forge`_ packages: ``optim, io,
|
||||
* If under Octave, the following `Octave-Forge`_ packages: ``optim, io,
|
||||
control``.
|
||||
|
||||
|
||||
|
@ -192,8 +192,8 @@ installation to MATLAB path. You have two options for doing that:
|
|||
MATLAB will remember this setting next time you run it.
|
||||
|
||||
|
||||
For GNU Octave
|
||||
--------------
|
||||
For Octave
|
||||
----------
|
||||
|
||||
You need to add the ``matlab`` subdirectory of your Dynare
|
||||
installation to Octave path, using the ``addpath`` at the Octave
|
||||
|
|
|
@ -55,21 +55,14 @@ manual. Part of Dynare is programmed in C++, while the rest is written
|
|||
using the `MATLAB`_ programming language. The latter implies that
|
||||
commercially-available MATLAB software is required in order to run
|
||||
Dynare. However, as an alternative to MATLAB, Dynare is also able to
|
||||
run on top of `GNU Octave`_ (basically a free clone of MATLAB): this
|
||||
run on top of `Octave`_ (basically a free clone of MATLAB): this
|
||||
possibility is particularly interesting for students or institutions
|
||||
who cannot afford, or do not want to pay for, MATLAB and are willing
|
||||
to bear the concomitant performance loss.
|
||||
|
||||
The development of Dynare is mainly done at `CEPREMAP`_ by a core team
|
||||
of researchers who devote part of their time to software
|
||||
development. Currently the development team of Dynare is composed of
|
||||
Stéphane Adjemian (Université du Maine, Gains and CEPREMAP), Houtan
|
||||
Bastani (CEPREMAP), Michel Juillard (Banque de France), Frédéric
|
||||
Karamé (Université du Maine, Gains and CEPREMAP), Junior Maih (Norges
|
||||
Bank), Ferhat Mihoubi (Université Paris-Est Créteil, Érudite and
|
||||
CEPREMAP), Johannes Pfeifer (University of Cologne), Marco Ratto
|
||||
(European Commission, Joint Research Centre - JRC) and Sébastien
|
||||
Villemot (CEPREMAP). Increasingly, the developer base is expanding, as
|
||||
development. Increasingly, the developer base is expanding, as
|
||||
tools developed by researchers outside of CEPREMAP are integrated into
|
||||
Dynare. Financial support is provided by CEPREMAP, Banque de France
|
||||
and DSGE-net (an international research network for DSGE modeling).
|
||||
|
@ -111,10 +104,11 @@ For convenience, you can copy and paste the following into your BibTeX file:
|
|||
.. code-block:: bibtex
|
||||
|
||||
@TechReport{Adjemianetal2011,
|
||||
author = {Adjemian, St\'ephane and Bastani, Houtan and Juillard, Michel and
|
||||
Karam\'e, Fr\'ederic and Maih, Junior and Mihoubi, Ferhat and
|
||||
Perendia, George and Pfeifer, Johannes and Ratto, Marco and
|
||||
Villemot, S\'ebastien},
|
||||
author = {Adjemian, St\'ephane and Bastani, Houtan and
|
||||
Juillard, Michel and Karam\'e, Fr\'ederic and
|
||||
Maih, Junior and Mihoubi, Ferhat and
|
||||
Perendia, George and Pfeifer, Johannes and
|
||||
Ratto, Marco and Villemot, S\'ebastien},
|
||||
title = {Dynare: Reference Manual Version 4},
|
||||
year = {2011},
|
||||
institution = {CEPREMAP},
|
||||
|
@ -127,11 +121,11 @@ https://www.dynare.org.
|
|||
|
||||
|
||||
|
||||
.. _MATLAB: http://www.mathworks.com/products/matlab/
|
||||
.. _GNU Octave: http://www.octave.org/
|
||||
.. _CEPREMAP: http://www.cepremap.fr/
|
||||
.. _MATLAB: https://www.mathworks.com/products/matlab/
|
||||
.. _Octave: https://www.octave.org/
|
||||
.. _CEPREMAP: https://www.cepremap.fr/
|
||||
.. _web forum: https://forum.dynare.org/
|
||||
.. _official Dynare website: http://www.dynare.org/
|
||||
.. _official Dynare website: https://www.dynare.org/
|
||||
.. _Dynare wiki: https://git.dynare.org/Dynare/dynare/wikis
|
||||
.. _Dynare forums: https://forum.dynare.org/
|
||||
.. _Git repository: https://git.dynare.org/Dynare/dynare
|
||||
|
|
|
@ -88,6 +88,11 @@ and a clarifying example.
|
|||
The valid :math:`\text{\LaTeX}` code to be included in the report before
|
||||
``\begin{document}``. Default: ``empty``.
|
||||
|
||||
.. option:: maketoc, BOOLEAN
|
||||
|
||||
Whether or not to make the table of contents. One entry is made per
|
||||
page containing a title. Default: ``false``.
|
||||
|
||||
.. option:: margin, DOUBLE
|
||||
|
||||
The margin size. Default: ``2.5``.
|
||||
|
@ -104,6 +109,15 @@ and a clarifying example.
|
|||
|
||||
Paper size. Default: ```a4'``.
|
||||
|
||||
.. option:: reportDirName, FILENAME
|
||||
|
||||
The name of the folder in which to store the component parts of the
|
||||
report (preamble, document, end). Default: ``tmpRepDir``.
|
||||
|
||||
.. option:: showDate, BOOLEAN
|
||||
|
||||
Display the date and time when the report was compiled. Default: true.
|
||||
|
||||
.. option:: showOutput, BOOLEAN
|
||||
|
||||
Print report creation progress to screen. Shows you the page
|
||||
|
|
|
@ -22,7 +22,7 @@ command at the MATLAB or Octave prompt (with the filename of the
|
|||
In practice, the handling of the model file is done in two steps: in
|
||||
the first one, the model and the processing instructions written by
|
||||
the user in a *model file* are interpreted and the proper MATLAB or
|
||||
GNU Octave instructions are generated; in the second step, the program
|
||||
Octave instructions are generated; in the second step, the program
|
||||
actually runs the computations. Both steps are triggered automatically
|
||||
by the ``dynare`` command.
|
||||
|
||||
|
|
|
@ -430,7 +430,7 @@ variable to be declared (``endogenous``, ``exogenous``, or
|
|||
quotes. Hence, to declare a variable ``c`` as endogenous in an equation tag,
|
||||
you can type ``[endogenous='c']``.
|
||||
|
||||
To perform on-the-fly variable declaration in an equtaion, simply follow the
|
||||
To perform on-the-fly variable declaration in an equation, simply follow the
|
||||
symbol name with a vertical line (``|``, pipe character) and either an ``e``, an
|
||||
``x``, or a ``p``. For example, to declare a parameter named
|
||||
``alphaa`` in the model block, you could write ``alphaa|p`` directly in
|
||||
|
@ -578,6 +578,9 @@ not in EXPRESSION):
|
|||
you may want to use the value of GDP at steady state to compute
|
||||
the output gap.
|
||||
|
||||
Exogenous and exogenous deterministic variables may not appear in
|
||||
MODEL_EXPRESSION.
|
||||
|
||||
.. operator:: EXPECTATION (INTEGER) (MODEL_EXPRESSION)
|
||||
|
||||
This operator is used to take the expectation of some expression
|
||||
|
@ -806,6 +809,11 @@ Internally, the parameter values are stored in ``M_.params``:
|
|||
order that was used in the ``parameters`` command, hence ordered as
|
||||
in ``M_.param_names``.
|
||||
|
||||
The parameter names are stored in ``M_.param_names``:
|
||||
|
||||
.. matvar:: M_.param_names
|
||||
|
||||
Cell array containing the names of the model parameters.
|
||||
|
||||
.. _model-decl:
|
||||
|
||||
|
@ -997,6 +1005,13 @@ The model is declared inside a ``model`` block:
|
|||
slave nodes when doing a parallel computation (see
|
||||
:ref:`paral-conf`).
|
||||
|
||||
.. option:: balanced_growth_test_tol = DOUBLE
|
||||
|
||||
Tolerance used for determining whether cross-derivatives are zero in
|
||||
the test for balanced growth path (the latter is documented on
|
||||
`<https://archives.dynare.org/DynareWiki/RemovingTrends>`__). Default:
|
||||
``1e-6``
|
||||
|
||||
*Example* (Elementary RBC model)
|
||||
|
||||
::
|
||||
|
@ -3296,7 +3311,7 @@ Computing the stochastic solution
|
|||
command. Note that if ``varobs`` is not present or contains all
|
||||
endogenous variables, then this is the full information case
|
||||
and this option has no effect. More references can be found
|
||||
`here <http://www.dynare.org/DynareWiki/PartialInformation>`__ .
|
||||
`here <https://archives.dynare.org/DynareWiki/PartialInformation>`__ .
|
||||
|
||||
.. option:: sylvester = OPTION
|
||||
|
||||
|
@ -3308,7 +3323,7 @@ Computing the stochastic solution
|
|||
Uses the default solver for Sylvester equations
|
||||
(``gensylv``) based on Ondra Kamenik’s algorithm (see
|
||||
`here
|
||||
<http://www.dynare.org/documentation-and-support/dynarepp/sylvester.pdf/at_download/file>`__
|
||||
<https://www.dynare.org/assets/dynare++/sylvester.pdf>`__
|
||||
for more information).
|
||||
|
||||
``fixed_point``
|
||||
|
@ -3629,6 +3644,11 @@ state of the model and shocks observed at the beginning of the
|
|||
period. The decision rules are stored in the structure ``oo_.dr``
|
||||
which is described below.
|
||||
|
||||
.. matvar:: oo_.dr
|
||||
|
||||
Structure storing the decision rules. The subfields for different
|
||||
orders of approximation are explained below.
|
||||
|
||||
.. command:: extended_path ;
|
||||
extended_path (OPTIONS...);
|
||||
|
||||
|
@ -3718,6 +3738,13 @@ lag. We therefore have the following identity:
|
|||
|
||||
M_.npred + M_.both + M_.nfwrd + M_.nstatic = M_.endo_nbr
|
||||
|
||||
.. matvar:: M_.state_var
|
||||
|
||||
Vector of numerical indices identifying the state variables in the
|
||||
vector of declared variables. ``M_.endo_names(M_.state_var)``
|
||||
therefore yields the name of all variables that are states in
|
||||
the model declaration, i.e. that show up with a lag.
|
||||
|
||||
Internally, Dynare uses two orderings of the endogenous variables: the
|
||||
order of declaration (which is reflected in ``M_.endo_names``), and an
|
||||
order based on the four types described above, which we will call the
|
||||
|
@ -3730,9 +3757,15 @@ purely backward variables, then mixed variables, and finally purely
|
|||
forward variables. Inside each category, variables are arranged
|
||||
according to the declaration order.
|
||||
|
||||
Variable ``oo_.dr.order_var`` maps DR-order to declaration order, and
|
||||
variable ``oo_.dr.inv_order_var`` contains the inverse map. In other
|
||||
words, the k-th variable in the DR-order corresponds to the endogenous
|
||||
.. matvar:: oo_.dr.order_var
|
||||
|
||||
This variables maps DR-order to declaration order.
|
||||
|
||||
.. matvar:: oo_.dr.inv_order_var
|
||||
|
||||
This variable contains the inverse map.
|
||||
|
||||
In other words, the k-th variable in the DR-order corresponds to the endogenous
|
||||
variable numbered ``oo_.dr.order_var(k)`` in declaration
|
||||
order. Conversely, k-th declared variable is numbered
|
||||
``oo_.dr.inv_order_var(k)`` in DR-order.
|
||||
|
@ -3757,6 +3790,15 @@ The approximation has the stylized form:
|
|||
where :math:`y^s` is the steady state value of :math:`y` and
|
||||
:math:`y^h_t=y_t-y^s`.
|
||||
|
||||
.. matvar:: oo.dr.state_var
|
||||
|
||||
Vector of numerical indices identifying the state variables in the
|
||||
vector of declared variables, *given the current parameter values*
|
||||
for which the decision rules have been computed. It may differ from
|
||||
``M_.state_var`` in case a state variable drops from the model given
|
||||
the current parameterization, because it only gets 0 coefficients in
|
||||
the decision rules. See :mvar:`M_.state_var`.
|
||||
|
||||
The coefficients of the decision rules are stored as follows:
|
||||
|
||||
* :math:`y^s` is stored in ``oo_.dr.ys``. The vector rows correspond
|
||||
|
@ -7204,6 +7246,10 @@ Shock Decomposition
|
|||
|
||||
See :opt:`nodisplay`.
|
||||
|
||||
.. option:: nograph
|
||||
|
||||
See :opt:`nograph`.
|
||||
|
||||
.. option:: graph_format = FORMAT
|
||||
graph_format = ( FORMAT, FORMAT... )
|
||||
|
||||
|
@ -7629,9 +7675,7 @@ the :comm:`bvar_forecast` command.
|
|||
|
||||
*Output*
|
||||
|
||||
The results are not stored in the ``oo_`` structure but in a
|
||||
separate structure ``forecasts``, described below, saved to the
|
||||
hard disk into a file called ``conditional_forecasts.mat.``
|
||||
The results are stored in ``oo_.conditional_forecast``, which is described below.
|
||||
|
||||
*Example*
|
||||
|
||||
|
@ -7656,7 +7700,7 @@ the :comm:`bvar_forecast` command.
|
|||
plot_conditional_forecast(periods = 10) a y;
|
||||
|
||||
|
||||
.. matvar:: forecasts.cond
|
||||
.. matvar:: oo_.conditional_forecast.cond
|
||||
|
||||
Variable set by the ``conditional_forecast`` command. It
|
||||
stores the conditional forecasts. Fields are ``periods+1`` by
|
||||
|
@ -7664,7 +7708,7 @@ the :comm:`bvar_forecast` command.
|
|||
subsequent ``periods`` forecasts periods. Fields are of the
|
||||
form::
|
||||
|
||||
forecasts.cond.FORECAST_MOMENT.VARIABLE_NAME
|
||||
oo_.conditional_forecast.cond.FORECAST_MOMENT.VARIABLE_NAME
|
||||
|
||||
where FORECAST_MOMENT is one of the following:
|
||||
|
||||
|
@ -7678,12 +7722,12 @@ the :comm:`bvar_forecast` command.
|
|||
distribution. The size corresponds to ``conf_sig``.
|
||||
|
||||
|
||||
.. matvar:: forecasts.uncond
|
||||
.. matvar:: oo_.conditional_forecast.uncond
|
||||
|
||||
Variable set by the ``conditional_forecast`` command. It stores
|
||||
the unconditional forecasts. Fields are of the form::
|
||||
|
||||
forecasts.uncond.FORECAST_MOMENT.VARIABLE_NAME
|
||||
oo_.conditional_forecast.uncond.FORECAST_MOMENT.VARIABLE_NAME
|
||||
|
||||
|
||||
.. matvar:: forecasts.instruments
|
||||
|
@ -7692,14 +7736,14 @@ the :comm:`bvar_forecast` command.
|
|||
the names of the exogenous instruments.
|
||||
|
||||
|
||||
.. matvar:: forecasts.controlled_variables
|
||||
.. matvar:: oo_.conditional_forecast.controlled_variables
|
||||
|
||||
Variable set by the ``conditional_forecast`` command. Stores
|
||||
the position of the constrained endogenous variables in
|
||||
declaration order.
|
||||
|
||||
|
||||
.. matvar:: forecasts.controlled_exo_variables
|
||||
.. matvar:: oo_.conditional_forecast.controlled_exo_variables
|
||||
|
||||
Variable set by the ``conditional_forecast`` command. Stores
|
||||
the values of the controlled exogenous variables underlying
|
||||
|
@ -7707,9 +7751,9 @@ the :comm:`bvar_forecast` command.
|
|||
endogenous variables. Fields are ``[number of constrained
|
||||
periods]`` by ``1`` vectors and are of the form::
|
||||
|
||||
forecasts.controlled_exo_variables.FORECAST_MOMENT.SHOCK_NAME
|
||||
oo_.conditional_forecast.controlled_exo_variables.FORECAST_MOMENT.SHOCK_NAME
|
||||
|
||||
.. matvar:: forecasts.graphs
|
||||
.. matvar:: oo_.conditional_forecast.graphs
|
||||
|
||||
Variable set by the ``conditional_forecast`` command. Stores
|
||||
the information for generating the conditional forecast plots.
|
||||
|
@ -9616,7 +9660,7 @@ below.
|
|||
RESTRICTION EQUATION INTEGER, EXPRESSION = EXPRESSION;
|
||||
|
||||
To be documented. For now, see the wiki:
|
||||
`<http://www.dynare.org/DynareWiki/MarkovSwitchingInterface>`__
|
||||
`<https://archives.dynare.org/DynareWiki/MarkovSwitchingInterface>`__
|
||||
|
||||
|
||||
.. command:: ms_estimation (OPTIONS...);
|
||||
|
@ -11206,9 +11250,9 @@ Misc commands
|
|||
and ``morefloats``.
|
||||
|
||||
|
||||
.. _Dynare wiki: http://www.dynare.org/DynareWiki/EquationsTags
|
||||
.. _Dynare wiki: https://archives.dynare.org/DynareWiki/EquationsTags
|
||||
.. _io: https://octave.sourceforge.io/io/
|
||||
.. _AIM website: http://www.federalreserve.gov/Pubs/oss/oss4/aimindex.html
|
||||
.. _AIM website: https://www.federalreserve.gov/econres/ama-index.htm
|
||||
|
||||
.. rubric:: Footnotes
|
||||
|
||||
|
|
|
@ -849,6 +849,13 @@ The dseries class
|
|||
elements *RANGE_OF_DATES* or be equal to one (in which case
|
||||
the single observation is replicated).
|
||||
|
||||
.. construct:: dseries (TABLE)
|
||||
|
||||
Creates a ``dseries`` object given the MATLAB Table provided as the sole
|
||||
argument. It is assumed that the first column of the table contains the
|
||||
dates of the ``dseries`` and the first row contains the names. NB: This
|
||||
feature is not available under Octave or MATLAB R2013a or earlier.
|
||||
|
||||
*Example*
|
||||
|
||||
Various ways to create a ``dseries`` object::
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
if HAVE_PDFLATEX
|
||||
if HAVE_BIBTEX
|
||||
if ENABLE_DOC
|
||||
pdf-local: parallel.pdf
|
||||
endif
|
||||
endif
|
||||
|
||||
SRC = AvenueParadigm.pdf iVaNo_gain.pdf iVaNo_time_comp.pdf marco.bib \
|
||||
netbook_complete_comp.pdf netbook_complete_openclose.pdf \
|
||||
|
|
|
@ -6,7 +6,7 @@ EXTRA_DIST = \
|
|||
changelog-old.html \
|
||||
changelog-sylv-old.html
|
||||
|
||||
if HAVE_PDFLATEX
|
||||
if ENABLE_DOC
|
||||
pdf-local: dynare++-ramsey.pdf dynare++-tutorial.pdf sylvester.pdf tl.pdf
|
||||
endif
|
||||
|
||||
|
|
|
@ -87,9 +87,6 @@ Approximation::approxAtSteady()
|
|||
FirstOrder fo(model.nstat(), model.npred(), model.nboth(), model.nforw(),
|
||||
model.nexog(), model.getModelDerivatives().get(Symmetry{1}),
|
||||
journal, qz_criterium);
|
||||
KORD_RAISE_IF_X(!fo.isStable(),
|
||||
"The model is not Blanchard-Kahn stable",
|
||||
KORD_MD_NOT_STABLE);
|
||||
|
||||
if (model.order() >= 2)
|
||||
{
|
||||
|
|
|
@ -247,6 +247,9 @@ FirstOrder::solve(const TwoDMatrix &fd)
|
|||
|
||||
journalEigs();
|
||||
|
||||
KORD_RAISE_IF_X(!bk_cond,
|
||||
"The model is not Blanchard-Kahn stable",
|
||||
KORD_MD_NOT_STABLE);
|
||||
if (!gy.isFinite() || !gu.isFinite())
|
||||
throw KordException(__FILE__, __LINE__,
|
||||
"NaN or Inf asserted in first order derivatives in FirstOrder::solve()");
|
||||
|
|
|
@ -71,11 +71,6 @@ public:
|
|||
{
|
||||
solve(FFSTensor(f));
|
||||
}
|
||||
bool
|
||||
isStable() const
|
||||
{
|
||||
return bk_cond;
|
||||
}
|
||||
const TwoDMatrix &
|
||||
getGy() const
|
||||
{
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
function [ys,check] = NK_baseline_steadystate(ys,exo)
|
||||
% function [ys,check] = NK_baseline_steadystate(ys,exo)
|
||||
function [ys,params,check] = NK_baseline_steadystate(ys,exo,M_,options_)
|
||||
% function [ys,params,check] = NK_baseline_steadystate(ys,exo,M_,options_)
|
||||
% computes the steady state for the NK_baseline.mod and uses a numerical
|
||||
% solver to do so
|
||||
% Inputs:
|
||||
% - ys [vector] vector of initial values for the steady state of
|
||||
% the endogenous variables
|
||||
% - exo [vector] vector of values for the exogenous variables
|
||||
% - M_ [structure] Dynare model structure
|
||||
% - options [structure] Dynare options structure
|
||||
%
|
||||
% Output:
|
||||
% - ys [vector] vector of steady state values for the the endogenous variables
|
||||
% - params [vector] vector of parameter values
|
||||
% - check [scalar] set to 0 if steady state computation worked and to
|
||||
% 1 of not (allows to impose restrictions on parameters)
|
||||
|
||||
global M_
|
||||
|
||||
% read out parameters to access them with their name
|
||||
NumberOfParameters = M_.param_nbr;
|
||||
for ii = 1:NumberOfParameters
|
||||
|
@ -95,8 +96,9 @@ g2=epsilon/(epsilon-1)*g1;
|
|||
|
||||
%% end own model equations
|
||||
|
||||
params=NaN(NumberOfParameters,1);
|
||||
for iter = 1:length(M_.params) %update parameters set in the file
|
||||
eval([ 'M_.params(' num2str(iter) ') = ' M_.param_names{iter} ';' ])
|
||||
eval([ 'params(' num2str(iter) ') = ' M_.param_names{iter} ';' ])
|
||||
end
|
||||
|
||||
NumberOfEndogenousVariables = M_.orig_endo_nbr; %auxiliary variables are set automatically
|
||||
|
|
33
license.txt
33
license.txt
|
@ -1,16 +1,24 @@
|
|||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: Dynare
|
||||
Upstream-Contact: Dynare Team, whose members in 2019 are:
|
||||
Stéphane Adjemian <stephane.adjemian@univ-lemans.fr>
|
||||
Houtan Bastani <houtan@dynare.org>
|
||||
Michel Juillard <michel.juillard@mjui.fr>
|
||||
Frédéric Karamé <frederic.karame@univ-lemans.fr>
|
||||
Junior Maih <junior.maih@gmail.com>
|
||||
Ferhat Mihoubi <fmihoubi@univ-evry.fr>
|
||||
Willi Mutschler <willi@mutschler.eu>
|
||||
Johannes Pfeifer <jpfeifer@gmx.de>
|
||||
Marco Ratto <marco.ratto@ec.europa.eu>
|
||||
Sébastien Villemot <sebastien@dynare.org>
|
||||
- Stéphane Adjemian <stephane.adjemian@univ-lemans.fr>
|
||||
- Houtan Bastani <houtan@dynare.org>
|
||||
- Michel Juillard <michel.juillard@mjui.fr>
|
||||
- Frédéric Karamé <frederic.karame@univ-lemans.fr>
|
||||
- Dóra Kocsis <dora@dynare.org>
|
||||
- Junior Maih <junior.maih@gmail.com>
|
||||
- Ferhat Mihoubi <fmihoubi@univ-evry.fr>
|
||||
- Willi Mutschler <willi@mutschler.eu>
|
||||
- Johannes Pfeifer <jpfeifer@gmx.de>
|
||||
- Marco Ratto <marco.ratto@ec.europa.eu>
|
||||
- Sébastien Villemot <sebastien@dynare.org>
|
||||
Former Dynare Team members include:
|
||||
- Abdeljabar Benzougar
|
||||
- Alejandro Buesa
|
||||
- Fabrice Collard
|
||||
- Assia Ezzeroug
|
||||
- Stéphane Lhuissier
|
||||
- George Perendia
|
||||
Source: https://www.dynare.org
|
||||
|
||||
Files: *
|
||||
|
@ -281,6 +289,11 @@ Copyright: 2009 John Burkardt
|
|||
2010-2011 Dynare Team
|
||||
License: LGPL-3+
|
||||
|
||||
Files: macOS/brewfiles/*
|
||||
Copyright: 2009-2019, Homebrew contributors
|
||||
2019 Dynare Team
|
||||
License: BSD-2-clause
|
||||
|
||||
Files: contrib/jsonlab
|
||||
Copyright: 2011-2018 Qianqian Fang <q.fang at neu.edu>
|
||||
License: BSD or GPL-3+
|
||||
|
|
|
@ -22,7 +22,13 @@ AC_REQUIRE([AX_MATLAB_ARCH])
|
|||
AC_REQUIRE([AX_MATLAB_VERSION])
|
||||
|
||||
AX_COMPARE_VERSION([$MATLAB_VERSION], [ge], [9.6],
|
||||
[MATLAB_BATCH_OPTIONS='-noFigureWindows -batch'],
|
||||
[
|
||||
if test "${MATLAB_ARCH}" = win32 -o "${MATLAB_ARCH}" = win64; then
|
||||
MATLAB_BATCH_OPTIONS='-noFigureWindows -batch'
|
||||
else
|
||||
MATLAB_BATCH_OPTIONS='-nodisplay -batch'
|
||||
fi
|
||||
],
|
||||
[
|
||||
if test "${MATLAB_ARCH}" = win32 -o "${MATLAB_ARCH}" = win64; then
|
||||
MATLAB_BATCH_OPTIONS='-nosplash -automation -wait -sd "$(CURDIR)" -r'
|
||||
|
|
|
@ -0,0 +1,161 @@
|
|||
class Gcc < Formula
|
||||
desc "GNU compiler collection"
|
||||
homepage "https://gcc.gnu.org/"
|
||||
url "https://ftp.gnu.org/gnu/gcc/gcc-9.2.0/gcc-9.2.0.tar.xz"
|
||||
mirror "https://ftpmirror.gnu.org/gcc/gcc-9.2.0/gcc-9.2.0.tar.xz"
|
||||
sha256 "ea6ef08f121239da5695f76c9b33637a118dcf63e24164422231917fa61fb206"
|
||||
revision 2
|
||||
head "https://gcc.gnu.org/git/gcc.git"
|
||||
|
||||
bottle do
|
||||
root_url "https://homebrew.bintray.com/bottles"
|
||||
cellar :any
|
||||
sha256 "1564397f461f629f3811f1ececc7f2bb614f7520242743fc41348d190d8b6aa9" => :catalina
|
||||
sha256 "5012d43ce3ff9b31fc21f9df1075b9d5e205d1a727b75f6dbd098654aff0f0f2" => :mojave
|
||||
sha256 "cc0e6c6a7f7ce5823d0578cf57a6e201727238905aa8a4726e5f90dbc252d94b" => :high_sierra
|
||||
end
|
||||
|
||||
# The bottles are built on systems with the CLT installed, and do not work
|
||||
# out of the box on Xcode-only systems due to an incorrect sysroot.
|
||||
pour_bottle? do
|
||||
reason "The bottle needs the Xcode CLT to be installed."
|
||||
satisfy { MacOS::CLT.installed? }
|
||||
end
|
||||
|
||||
depends_on "gmp"
|
||||
depends_on "isl"
|
||||
depends_on "libmpc"
|
||||
depends_on "mpfr"
|
||||
|
||||
# GCC bootstraps itself, so it is OK to have an incompatible C++ stdlib
|
||||
cxxstdlib_check :skip
|
||||
|
||||
# Fix system headers for Catalina SDK
|
||||
# (otherwise __OSX_AVAILABLE_STARTING ends up undefined)
|
||||
if DevelopmentTools.clang_build_version >= 1100
|
||||
patch do
|
||||
url "https://raw.githubusercontent.com/Homebrew/formula-patches/b8b8e65e/gcc/9.2.0-catalina.patch"
|
||||
sha256 "0b8d14a7f3c6a2f0d2498526e86e088926671b5da50a554ffa6b7f73ac4f132b"
|
||||
end
|
||||
end
|
||||
|
||||
def version_suffix
|
||||
if build.head?
|
||||
"HEAD"
|
||||
else
|
||||
version.to_s.slice(/\d/)
|
||||
end
|
||||
end
|
||||
|
||||
def install
|
||||
# GCC will suffer build errors if forced to use a particular linker.
|
||||
ENV.delete "LD"
|
||||
|
||||
# We avoiding building:
|
||||
# - Ada, which requires a pre-existing GCC Ada compiler to bootstrap
|
||||
# - Go, currently not supported on macOS
|
||||
# - BRIG
|
||||
languages = %w[c c++ objc obj-c++ fortran]
|
||||
|
||||
osmajor = `uname -r`.split(".").first
|
||||
pkgversion = "Homebrew GCC #{pkg_version} #{build.used_options*" "}".strip
|
||||
|
||||
args = %W[
|
||||
--build=x86_64-apple-darwin#{osmajor}
|
||||
--prefix=#{prefix}
|
||||
--libdir=#{lib}/gcc/#{version_suffix}
|
||||
--disable-nls
|
||||
--enable-checking=release
|
||||
--enable-languages=#{languages.join(",")}
|
||||
--program-suffix=-#{version_suffix}
|
||||
--with-gmp=#{Formula["gmp"].opt_prefix}
|
||||
--with-mpfr=#{Formula["mpfr"].opt_prefix}
|
||||
--with-mpc=#{Formula["libmpc"].opt_prefix}
|
||||
--with-isl=#{Formula["isl"].opt_prefix}
|
||||
--with-system-zlib
|
||||
--with-pkgversion=#{pkgversion}
|
||||
--with-bugurl=https://github.com/Homebrew/homebrew-core/issues
|
||||
]
|
||||
|
||||
# Xcode 10 dropped 32-bit support
|
||||
args << "--disable-multilib" if DevelopmentTools.clang_build_version >= 1000
|
||||
|
||||
# Ensure correct install names when linking against libgcc_s;
|
||||
# see discussion in https://github.com/Homebrew/legacy-homebrew/pull/34303
|
||||
inreplace "libgcc/config/t-slibgcc-darwin", "@shlib_slibdir@", "#{HOMEBREW_PREFIX}/lib/gcc/#{version_suffix}"
|
||||
|
||||
mkdir "build" do
|
||||
if !MacOS::CLT.installed?
|
||||
# For Xcode-only systems, we need to tell the sysroot path
|
||||
args << "--with-native-system-header-dir=/usr/include"
|
||||
args << "--with-sysroot=#{MacOS.sdk_path}"
|
||||
elsif MacOS.version >= :mojave
|
||||
# System headers are no longer located in /usr/include
|
||||
args << "--with-native-system-header-dir=/usr/include"
|
||||
args << "--with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX#{MacOS.version}.sdk"
|
||||
end
|
||||
|
||||
system "../configure", *args
|
||||
|
||||
# Use -headerpad_max_install_names in the build,
|
||||
# otherwise updated load commands won't fit in the Mach-O header.
|
||||
# This is needed because `gcc` avoids the superenv shim.
|
||||
system "make", "BOOT_LDFLAGS=-Wl,-headerpad_max_install_names"
|
||||
system "make", "install"
|
||||
|
||||
bin.install_symlink bin/"gfortran-#{version_suffix}" => "gfortran"
|
||||
end
|
||||
|
||||
# Handle conflicts between GCC formulae and avoid interfering
|
||||
# with system compilers.
|
||||
# Rename man7.
|
||||
Dir.glob(man7/"*.7") { |file| add_suffix file, version_suffix }
|
||||
# Even when we disable building info pages some are still installed.
|
||||
info.rmtree
|
||||
end
|
||||
|
||||
def add_suffix(file, suffix)
|
||||
dir = File.dirname(file)
|
||||
ext = File.extname(file)
|
||||
base = File.basename(file, ext)
|
||||
File.rename file, "#{dir}/#{base}-#{suffix}#{ext}"
|
||||
end
|
||||
|
||||
test do
|
||||
(testpath/"hello-c.c").write <<~EOS
|
||||
#include <stdio.h>
|
||||
int main()
|
||||
{
|
||||
puts("Hello, world!");
|
||||
return 0;
|
||||
}
|
||||
EOS
|
||||
system "#{bin}/gcc-#{version_suffix}", "-o", "hello-c", "hello-c.c"
|
||||
assert_equal "Hello, world!\n", `./hello-c`
|
||||
|
||||
(testpath/"hello-cc.cc").write <<~EOS
|
||||
#include <iostream>
|
||||
int main()
|
||||
{
|
||||
std::cout << "Hello, world!" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
EOS
|
||||
system "#{bin}/g++-#{version_suffix}", "-o", "hello-cc", "hello-cc.cc"
|
||||
assert_equal "Hello, world!\n", `./hello-cc`
|
||||
|
||||
(testpath/"test.f90").write <<~EOS
|
||||
integer,parameter::m=10000
|
||||
real::a(m), b(m)
|
||||
real::fact=0.5
|
||||
|
||||
do concurrent (i=1:m)
|
||||
a(i) = a(i) + fact*b(i)
|
||||
end do
|
||||
write(*,"(A)") "Done"
|
||||
end
|
||||
EOS
|
||||
system "#{bin}/gfortran", "-o", "test", "test.f90"
|
||||
assert_equal "Done\n", `./test`
|
||||
end
|
||||
end
|
|
@ -0,0 +1,56 @@
|
|||
class Gmp < Formula
|
||||
desc "GNU multiple precision arithmetic library"
|
||||
homepage "https://gmplib.org/"
|
||||
url "https://gmplib.org/download/gmp/gmp-6.1.2.tar.xz"
|
||||
mirror "https://ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.xz"
|
||||
sha256 "87b565e89a9a684fe4ebeeddb8399dce2599f9c9049854ca8c0dfbdea0e21912"
|
||||
revision 2
|
||||
|
||||
bottle do
|
||||
root_url "https://homebrew.bintray.com/bottles"
|
||||
cellar :any
|
||||
rebuild 1
|
||||
sha256 "2409417943fceda33eac12a8229fbf7b990eee18ee341b543be575550a077bb0" => :catalina
|
||||
sha256 "84f74594086bccc53bdb141f4d06d7847680374e255ebe016654da1e47db2dfc" => :mojave
|
||||
sha256 "a536c51149806b73b2e1178be94300832b6b151455006bc7f2a32b9dc493c7a3" => :high_sierra
|
||||
sha256 "ada22a8bbfe8532d71f2b565e00b1643beaf72bff6b36064cbad0cd7436e4948" => :sierra
|
||||
end
|
||||
|
||||
def install
|
||||
# Work around macOS Catalina / Xcode 11 code generation bug
|
||||
# (test failure t-toom53, due to wrong code in mpn/toom53_mul.o)
|
||||
ENV.append_to_cflags "-fno-stack-check"
|
||||
|
||||
# Enable --with-pic to avoid linking issues with the static library
|
||||
args = %W[--prefix=#{prefix} --enable-cxx --with-pic]
|
||||
args << "--build=#{Hardware.oldest_cpu}-apple-darwin#{`uname -r`.to_i}"
|
||||
system "./configure", *args
|
||||
system "make"
|
||||
system "make", "check"
|
||||
system "make", "install"
|
||||
end
|
||||
|
||||
test do
|
||||
(testpath/"test.c").write <<~EOS
|
||||
#include <gmp.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main() {
|
||||
mpz_t i, j, k;
|
||||
mpz_init_set_str (i, "1a", 16);
|
||||
mpz_init (j);
|
||||
mpz_init (k);
|
||||
mpz_sqrtrem (j, k, i);
|
||||
if (mpz_get_si (j) != 5 || mpz_get_si (k) != 1) abort();
|
||||
return 0;
|
||||
}
|
||||
EOS
|
||||
|
||||
system ENV.cc, "test.c", "-L#{lib}", "-lgmp", "-o", "test"
|
||||
system "./test"
|
||||
|
||||
# Test the static library to catch potential linking issues
|
||||
system ENV.cc, "test.c", "#{lib}/libgmp.a", "-o", "test"
|
||||
system "./test"
|
||||
end
|
||||
end
|
|
@ -0,0 +1,59 @@
|
|||
class Isl < Formula
|
||||
desc "Integer Set Library for the polyhedral model"
|
||||
homepage "https://isl.gforge.inria.fr/"
|
||||
# Note: Always use tarball instead of git tag for stable version.
|
||||
#
|
||||
# Currently isl detects its version using source code directory name
|
||||
# and update isl_version() function accordingly. All other names will
|
||||
# result in isl_version() function returning "UNKNOWN" and hence break
|
||||
# package detection.
|
||||
url "http://isl.gforge.inria.fr/isl-0.21.tar.xz"
|
||||
mirror "https://deb.debian.org/debian/pool/main/i/isl/isl_0.21.orig.tar.xz"
|
||||
sha256 "777058852a3db9500954361e294881214f6ecd4b594c00da5eee974cd6a54960"
|
||||
|
||||
bottle do
|
||||
root_url "https://homebrew.bintray.com/bottles"
|
||||
cellar :any
|
||||
sha256 "1f42c08dd84a2f418c8446be2679f027d8b1250d337b5e3135c401eba578cbb7" => :catalina
|
||||
sha256 "f9188b5d486b2a835cd865f219be1a9848ce3926e27089a1538ee989db65447d" => :mojave
|
||||
sha256 "d997d49958218e521bc4f73369414ff9fad040d28601d94012e4c68cd090ea93" => :high_sierra
|
||||
sha256 "d5dc353916cd98da04552a3d7cb86a3203612df422c4e9389e13e12f86945865" => :sierra
|
||||
end
|
||||
|
||||
head do
|
||||
url "https://repo.or.cz/isl.git"
|
||||
|
||||
depends_on "autoconf" => :build
|
||||
depends_on "automake" => :build
|
||||
depends_on "libtool" => :build
|
||||
end
|
||||
|
||||
depends_on "gmp"
|
||||
|
||||
def install
|
||||
system "./autogen.sh" if build.head?
|
||||
system "./configure", "--disable-dependency-tracking",
|
||||
"--disable-silent-rules",
|
||||
"--prefix=#{prefix}",
|
||||
"--with-gmp=system",
|
||||
"--with-gmp-prefix=#{Formula["gmp"].opt_prefix}"
|
||||
system "make", "check"
|
||||
system "make", "install"
|
||||
(share/"gdb/auto-load").install Dir["#{lib}/*-gdb.py"]
|
||||
end
|
||||
|
||||
test do
|
||||
(testpath/"test.c").write <<~EOS
|
||||
#include <isl/ctx.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
isl_ctx* ctx = isl_ctx_alloc();
|
||||
isl_ctx_free(ctx);
|
||||
return 0;
|
||||
}
|
||||
EOS
|
||||
system ENV.cc, "test.c", "-L#{lib}", "-lisl", "-o", "test"
|
||||
system "./test"
|
||||
end
|
||||
end
|
|
@ -0,0 +1,55 @@
|
|||
class Libmpc < Formula
|
||||
desc "C library for the arithmetic of high precision complex numbers"
|
||||
homepage "http://www.multiprecision.org/mpc/"
|
||||
url "https://ftp.gnu.org/gnu/mpc/mpc-1.1.0.tar.gz"
|
||||
sha256 "6985c538143c1208dcb1ac42cedad6ff52e267b47e5f970183a3e75125b43c2e"
|
||||
|
||||
bottle do
|
||||
root_url "https://homebrew.bintray.com/bottles"
|
||||
cellar :any
|
||||
sha256 "b9491bbc04d1e52dfb8311dc9aa0081fd3041cb6b2f6b59a4104d712d341979d" => :catalina
|
||||
sha256 "1cb3a09238830d45d64a87f520f06122d24a020403fac1800c831d15c605282e" => :mojave
|
||||
sha256 "3b28ec506ab53ef5f3163e87fb72ae735b7f91ee2fc20fe184cf1241481b72a5" => :high_sierra
|
||||
sha256 "18d620a1612bc51b1fbd1b3b62c9c73766b90549c746740c5a27d2ab1ec5ede7" => :sierra
|
||||
sha256 "6f19f936781dae0db248abdd84a72c3e25451c44379706bc3800760f0aa43888" => :el_capitan
|
||||
end
|
||||
|
||||
depends_on "gmp"
|
||||
depends_on "mpfr"
|
||||
|
||||
def install
|
||||
args = %W[
|
||||
--prefix=#{prefix}
|
||||
--disable-dependency-tracking
|
||||
--with-gmp=#{Formula["gmp"].opt_prefix}
|
||||
--with-mpfr=#{Formula["mpfr"].opt_prefix}
|
||||
]
|
||||
|
||||
system "./configure", *args
|
||||
system "make"
|
||||
system "make", "check"
|
||||
system "make", "install"
|
||||
end
|
||||
|
||||
test do
|
||||
(testpath/"test.c").write <<~EOS
|
||||
#include <mpc.h>
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
|
||||
int main() {
|
||||
mpc_t x;
|
||||
mpc_init2 (x, 256);
|
||||
mpc_set_d_d (x, 1., INFINITY, MPC_RNDNN);
|
||||
mpc_tanh (x, x, MPC_RNDNN);
|
||||
assert (mpfr_nan_p (mpc_realref (x)) && mpfr_nan_p (mpc_imagref (x)));
|
||||
mpc_clear (x);
|
||||
return 0;
|
||||
}
|
||||
EOS
|
||||
system ENV.cc, "test.c", "-L#{lib}", "-L#{Formula["mpfr"].opt_lib}",
|
||||
"-L#{Formula["gmp"].opt_lib}", "-lmpc", "-lmpfr",
|
||||
"-lgmp", "-o", "test"
|
||||
system "./test"
|
||||
end
|
||||
end
|
|
@ -0,0 +1,53 @@
|
|||
class Mpfr < Formula
|
||||
desc "C library for multiple-precision floating-point computations"
|
||||
homepage "https://www.mpfr.org/"
|
||||
url "https://ftp.gnu.org/gnu/mpfr/mpfr-4.0.2.tar.xz"
|
||||
mirror "https://ftpmirror.gnu.org/mpfr/mpfr-4.0.2.tar.xz"
|
||||
sha256 "1d3be708604eae0e42d578ba93b390c2a145f17743a744d8f3f8c2ad5855a38a"
|
||||
|
||||
bottle do
|
||||
root_url "https://homebrew.bintray.com/bottles"
|
||||
cellar :any
|
||||
sha256 "140d29bfee0c8cf356fbb5391465f781df559e6076988de3ea8bcfd812f3c5bd" => :catalina
|
||||
sha256 "cfce7ab866e98360c9364cd924da620ae7936d3a224d686aacc209c2107d19aa" => :mojave
|
||||
sha256 "bf5d21e7e8e549f7e8d07791a90f44a487f4c7151897b7c64d02928b5bd73520" => :high_sierra
|
||||
sha256 "4fb1860a481e24c70eefc8e5782030612840f1bb8f50586ca76a4c6c53629deb" => :sierra
|
||||
end
|
||||
|
||||
depends_on "gmp"
|
||||
|
||||
def install
|
||||
# Work around macOS Catalina / Xcode 11 code generation bug
|
||||
# (test failure t-toom53, due to wrong code in mpn/toom53_mul.o)
|
||||
ENV.append_to_cflags "-fno-stack-check"
|
||||
|
||||
system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}",
|
||||
"--disable-silent-rules"
|
||||
system "make"
|
||||
system "make", "check"
|
||||
system "make", "install"
|
||||
end
|
||||
|
||||
test do
|
||||
(testpath/"test.c").write <<~EOS
|
||||
#include <mpfr.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main() {
|
||||
mpfr_t x, y;
|
||||
mpfr_inits2 (256, x, y, NULL);
|
||||
mpfr_set_ui (x, 2, MPFR_RNDN);
|
||||
mpfr_root (y, x, 2, MPFR_RNDN);
|
||||
mpfr_pow_si (x, y, 4, MPFR_RNDN);
|
||||
mpfr_add_si (y, x, -4, MPFR_RNDN);
|
||||
mpfr_abs (y, y, MPFR_RNDN);
|
||||
if (fabs(mpfr_get_d (y, MPFR_RNDN)) > 1.e-30) abort();
|
||||
return 0;
|
||||
}
|
||||
EOS
|
||||
system ENV.cc, "test.c", "-L#{lib}", "-L#{Formula["gmp"].opt_lib}",
|
||||
"-lgmp", "-lmpfr", "-o", "test"
|
||||
system "./test"
|
||||
end
|
||||
end
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
set -ex
|
||||
|
||||
ROOTDIR=$(pwd)/..
|
||||
|
||||
# Set the compilers
|
||||
CC=gcc-9
|
||||
CXX=g++-9
|
||||
|
@ -26,21 +28,35 @@ CXX=g++-9
|
|||
# Set the number of threads
|
||||
NTHREADS=$(nproc)
|
||||
|
||||
# Set dependency directory
|
||||
LIB64="$ROOTDIR"/macOS/deps/lib64
|
||||
|
||||
|
||||
##
|
||||
## Find Dynare Version
|
||||
##
|
||||
ROOTDIR=$(pwd)/..
|
||||
DATE=$(date +%Y-%m-%d-%H%M)
|
||||
DATELONG=$(date '+%d %B %Y')
|
||||
if [[ -d ../.git/ ]]; then
|
||||
SHA=$(git rev-parse HEAD)
|
||||
SHASHORT=$(git rev-parse --short HEAD)
|
||||
fi
|
||||
|
||||
if [[ -z $VERSION ]]; then
|
||||
VERSION=$(grep '^AC_INIT(' ../configure.ac | sed 's/AC_INIT(\[dynare\], \[\(.*\)\])/\1/')
|
||||
if [[ -d ../.git/ ]]; then
|
||||
SHA=$(git rev-parse --short HEAD)
|
||||
VERSION_READ="$VERSION-$SHA"
|
||||
VERSION=$VERSION-$(date +%Y-%m-%d-%H%M)-"$SHA"
|
||||
VERSION="$VERSION"-"$SHASHORT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Set dependency directory
|
||||
LIB64="$ROOTDIR"/macOS/deps/lib64
|
||||
# Install location must be truncated for installation of `gcc`
|
||||
# If it's too long, the headers of the compiled libraries cannot be modified
|
||||
# obliging recompilation on the user's system. Truncate to 5 characters
|
||||
# To allow for distribution version to appear
|
||||
LOCATION=$(echo "$VERSION" | cut -f1 -d"-" | cut -c 1-5)
|
||||
if [[ "$VERSION" == *-unstable* || "$VERSION" == [a-zA-Z]* ]]; then
|
||||
LOCATION="$LOCATION"-"$DATE"
|
||||
fi
|
||||
|
||||
|
||||
##
|
||||
|
@ -71,14 +87,18 @@ make -j"$NTHREADS"
|
|||
##
|
||||
NAME=dynare-"$VERSION"
|
||||
PKGFILES="$ROOTDIR"/macOS/pkg/"$NAME"
|
||||
mkdir -p "$PKGFILES"/mex/matlab/maci64-7.9-9.3
|
||||
mkdir "$PKGFILES"/mex/matlab/maci64-9.4-9.7
|
||||
mkdir "$PKGFILES"/mex/octave
|
||||
mkdir -p "$PKGFILES"/doc/dynare++
|
||||
mkdir "$PKGFILES"/dynare++
|
||||
mkdir "$PKGFILES"/scripts
|
||||
mkdir -p "$PKGFILES"/contrib/ms-sbvar/TZcode
|
||||
mkdir -p \
|
||||
"$PKGFILES"/mex/matlab/maci64-7.9-9.3 \
|
||||
"$PKGFILES"/mex/matlab/maci64-9.4-9.7 \
|
||||
"$PKGFILES"/mex/octave \
|
||||
"$PKGFILES"/doc/dynare++ \
|
||||
"$PKGFILES"/dynare++ \
|
||||
"$PKGFILES"/scripts \
|
||||
"$PKGFILES"/contrib/ms-sbvar/TZcode
|
||||
|
||||
if [[ $VERSION == *-unstable* ]]; then
|
||||
echo "$SHA" > "$PKGFILES"/sha.txt
|
||||
fi
|
||||
cp -p "$ROOTDIR"/NEWS "$PKGFILES"
|
||||
cp -p "$ROOTDIR"/COPYING "$PKGFILES"
|
||||
cp -p "$ROOTDIR"/VERSION "$PKGFILES"
|
||||
|
@ -149,12 +169,32 @@ echo -e "function v = supported_octave_version\nv=\"$(octave --eval "disp(OCTAVE
|
|||
## Make package
|
||||
##
|
||||
cd "$ROOTDIR"/macOS/pkg
|
||||
pkgbuild --root "$PKGFILES" --identifier com.cepremap.dynare --version "$VERSION" --install-location /Applications/Dynare/"$VERSION" "$NAME".pkg
|
||||
sed "s/VERSION_READ/$VERSION_READ/g" "$ROOTDIR"/macOS/distribution_template.xml > distribution_tmp.xml
|
||||
|
||||
# Dynare option
|
||||
pkgbuild --root "$PKGFILES" --identifier com.cepremap.dynare --version "$VERSION" --install-location /Applications/Dynare/"$LOCATION" "$NAME".pkg
|
||||
|
||||
# GCC option
|
||||
# Create dummy payload for GCC package; otherwise the size is displayed as 0 bytes in the installer
|
||||
dd if=/dev/zero of="$ROOTDIR"/macOS/brewfiles/dummy bs=1m count=800
|
||||
pkgbuild --root "$ROOTDIR"/macOS/brewfiles --identifier com.cepremap.dynare.gcc --version "$VERSION" --scripts "$ROOTDIR"/macOS/scripts --install-location /Applications/Dynare/"$LOCATION" "$NAME"-gcc.pkg
|
||||
|
||||
# Replace variables in displayed files
|
||||
sed "s/VERSION_READ/$VERSION/g" "$ROOTDIR"/macOS/distribution_template.xml > distribution_tmp.xml
|
||||
sed "s/VERSION_NO_SPACE/$VERSION/g" distribution_tmp.xml > distribution.xml
|
||||
ln -s "$ROOTDIR"/COPYING "$ROOTDIR"/macOS/
|
||||
sed "s/GCC_BINARY/$CC/g" "$ROOTDIR"/macOS/welcome_template.html > "$ROOTDIR"/macOS/welcome.html
|
||||
sed "s/VERSION_NO_SPACE/$VERSION/g" "$ROOTDIR"/macOS/welcome.html > "$ROOTDIR"/macOS/welcome_tmp.html
|
||||
sed "s/DATE/$DATELONG/g" "$ROOTDIR"/macOS/welcome_tmp.html > "$ROOTDIR"/macOS/welcome.html
|
||||
|
||||
# Create installer
|
||||
productbuild --distribution distribution.xml --resources "$ROOTDIR"/macOS --package-path ./"$NAME".pkg "$NAME"-new.pkg
|
||||
|
||||
# cleanup
|
||||
rm -f ./*.xml
|
||||
rm -rf "$PKGFILES"
|
||||
rm "$ROOTDIR"/macOS/COPYING
|
||||
rm -f "$NAME"-gcc.pkg
|
||||
rm -f "$ROOTDIR"/macOS/brewfiles/dummy
|
||||
rm -f "$ROOTDIR"/macOS/welcome.html
|
||||
rm -f "$ROOTDIR"/macOS/welcome_tmp.html
|
||||
|
||||
# Final pkg
|
||||
mv "$NAME"-new.pkg "$NAME".pkg
|
||||
|
|
|
@ -1,19 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<installer-gui-script minSpecVersion="1">
|
||||
<pkg-ref id="com.cepremap.dynare"/>
|
||||
<options customize="never" require-scripts="false"/>
|
||||
<choices-outline>
|
||||
<line choice="default">
|
||||
<line choice="com.cepremap.dynare"/>
|
||||
</line>
|
||||
</choices-outline>
|
||||
<choice id="default"/>
|
||||
<choice id="com.cepremap.dynare" visible="false">
|
||||
<pkg-ref id="com.cepremap.dynare"/>
|
||||
</choice>
|
||||
<pkg-ref id="com.cepremap.dynare" version="VERSION_NO_SPACE" onConclusion="none">dynare-VERSION_NO_SPACE.pkg</pkg-ref>
|
||||
<title>Dynare VERSION_READ</title>
|
||||
<background file="background.png" scaling="tofit" mime-type="image/png" alignment="topleft" />
|
||||
<background-darkAqua file="background.png" scaling="tofit" mime-type="image/png" alignment="topleft" />
|
||||
<license file="COPYING" mime-type="text/plain" />
|
||||
<title>Dynare VERSION_READ</title>
|
||||
<background 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" />
|
||||
<license file="gpl-3.0-standalone.html" mime-type="text/html" />
|
||||
<pkg-ref id="com.cepremap.dynare" />
|
||||
<options customize="allow" require-scripts="false" hostArchitectures="x86_64" />
|
||||
<choices-outline>
|
||||
<line choice="com.cepremap.dynare" />
|
||||
<line choice="com.cepremap.dynare.gcc" />
|
||||
</choices-outline>
|
||||
<choice id="com.cepremap.dynare" title="Dynare" description="Dynare Required Files" start_enabled="false" enabled="false">
|
||||
<pkg-ref id="com.cepremap.dynare" />
|
||||
</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">
|
||||
<pkg-ref id="com.cepremap.dynare.gcc" />
|
||||
</choice>
|
||||
<pkg-ref id="com.cepremap.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>
|
||||
</installer-gui-script>
|
||||
|
|
|
@ -0,0 +1,693 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>GNU General Public License v3.0 - GNU Project - Free Software Foundation (FSF)</title>
|
||||
<link rel="alternate" type="application/rdf+xml" href="http://www.gnu.org/licenses/gpl-3.0.rdf">
|
||||
</head>
|
||||
<body>
|
||||
<h3 style="text-align: center;">GNU GENERAL PUBLIC LICENSE</h3>
|
||||
<p style="text-align: center;">Version 3, 29 June 2007</p>
|
||||
|
||||
<p>Copyright © 2007 Free Software Foundation, Inc.
|
||||
<<a href="https://fsf.org/">https://fsf.org/</a>></p><p>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.</p>
|
||||
|
||||
<h3><a name="preamble"></a>Preamble</h3>
|
||||
|
||||
<p>The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.</p>
|
||||
|
||||
<p>The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.</p>
|
||||
|
||||
<p>When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.</p>
|
||||
|
||||
<p>To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.</p>
|
||||
|
||||
<p>For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.</p>
|
||||
|
||||
<p>Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.</p>
|
||||
|
||||
<p>For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.</p>
|
||||
|
||||
<p>Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.</p>
|
||||
|
||||
<p>Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.</p>
|
||||
|
||||
<p>The precise terms and conditions for copying, distribution and
|
||||
modification follow.</p>
|
||||
|
||||
<h3><a name="terms"></a>TERMS AND CONDITIONS</h3>
|
||||
|
||||
<h4><a name="section0"></a>0. Definitions.</h4>
|
||||
|
||||
<p>“This License” refers to version 3 of the GNU General Public License.</p>
|
||||
|
||||
<p>“Copyright” also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.</p>
|
||||
|
||||
<p>“The Program” refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as “you”. “Licensees” and
|
||||
“recipients” may be individuals or organizations.</p>
|
||||
|
||||
<p>To “modify” a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a “modified version” of the
|
||||
earlier work or a work “based on” the earlier work.</p>
|
||||
|
||||
<p>A “covered work” means either the unmodified Program or a work based
|
||||
on the Program.</p>
|
||||
|
||||
<p>To “propagate” a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.</p>
|
||||
|
||||
<p>To “convey” a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.</p>
|
||||
|
||||
<p>An interactive user interface displays “Appropriate Legal Notices”
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.</p>
|
||||
|
||||
<h4><a name="section1"></a>1. Source Code.</h4>
|
||||
|
||||
<p>The “source code” for a work means the preferred form of the work
|
||||
for making modifications to it. “Object code” means any non-source
|
||||
form of a work.</p>
|
||||
|
||||
<p>A “Standard Interface” means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.</p>
|
||||
|
||||
<p>The “System Libraries” of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
“Major Component”, in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.</p>
|
||||
|
||||
<p>The “Corresponding Source” for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.</p>
|
||||
|
||||
<p>The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.</p>
|
||||
|
||||
<p>The Corresponding Source for a work in source code form is that
|
||||
same work.</p>
|
||||
|
||||
<h4><a name="section2"></a>2. Basic Permissions.</h4>
|
||||
|
||||
<p>All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.</p>
|
||||
|
||||
<p>You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.</p>
|
||||
|
||||
<p>Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.</p>
|
||||
|
||||
<h4><a name="section3"></a>3. Protecting Users' Legal Rights From Anti-Circumvention Law.</h4>
|
||||
|
||||
<p>No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.</p>
|
||||
|
||||
<p>When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.</p>
|
||||
|
||||
<h4><a name="section4"></a>4. Conveying Verbatim Copies.</h4>
|
||||
|
||||
<p>You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.</p>
|
||||
|
||||
<p>You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.</p>
|
||||
|
||||
<h4><a name="section5"></a>5. Conveying Modified Source Versions.</h4>
|
||||
|
||||
<p>You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:</p>
|
||||
|
||||
<ul>
|
||||
<li>a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.</li>
|
||||
|
||||
<li>b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
“keep intact all notices”.</li>
|
||||
|
||||
<li>c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.</li>
|
||||
|
||||
<li>d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.</li>
|
||||
</ul>
|
||||
|
||||
<p>A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
“aggregate” if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.</p>
|
||||
|
||||
<h4><a name="section6"></a>6. Conveying Non-Source Forms.</h4>
|
||||
|
||||
<p>You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:</p>
|
||||
|
||||
<ul>
|
||||
<li>a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.</li>
|
||||
|
||||
<li>b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.</li>
|
||||
|
||||
<li>c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.</li>
|
||||
|
||||
<li>d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.</li>
|
||||
|
||||
<li>e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.</li>
|
||||
</ul>
|
||||
|
||||
<p>A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.</p>
|
||||
|
||||
<p>A “User Product” is either (1) a “consumer product”, which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, “normally used” refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.</p>
|
||||
|
||||
<p>“Installation Information” for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.</p>
|
||||
|
||||
<p>If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).</p>
|
||||
|
||||
<p>The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.</p>
|
||||
|
||||
<p>Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.</p>
|
||||
|
||||
<h4><a name="section7"></a>7. Additional Terms.</h4>
|
||||
|
||||
<p>“Additional permissions” are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.</p>
|
||||
|
||||
<p>When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.</p>
|
||||
|
||||
<p>Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:</p>
|
||||
|
||||
<ul>
|
||||
<li>a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or</li>
|
||||
|
||||
<li>b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or</li>
|
||||
|
||||
<li>c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or</li>
|
||||
|
||||
<li>d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or</li>
|
||||
|
||||
<li>e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or</li>
|
||||
|
||||
<li>f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.</li>
|
||||
</ul>
|
||||
|
||||
<p>All other non-permissive additional terms are considered “further
|
||||
restrictions” within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.</p>
|
||||
|
||||
<p>If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.</p>
|
||||
|
||||
<p>Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.</p>
|
||||
|
||||
<h4><a name="section8"></a>8. Termination.</h4>
|
||||
|
||||
<p>You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).</p>
|
||||
|
||||
<p>However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.</p>
|
||||
|
||||
<p>Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.</p>
|
||||
|
||||
<p>Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.</p>
|
||||
|
||||
<h4><a name="section9"></a>9. Acceptance Not Required for Having Copies.</h4>
|
||||
|
||||
<p>You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.</p>
|
||||
|
||||
<h4><a name="section10"></a>10. Automatic Licensing of Downstream Recipients.</h4>
|
||||
|
||||
<p>Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.</p>
|
||||
|
||||
<p>An “entity transaction” is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.</p>
|
||||
|
||||
<p>You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.</p>
|
||||
|
||||
<h4><a name="section11"></a>11. Patents.</h4>
|
||||
|
||||
<p>A “contributor” is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's “contributor version”.</p>
|
||||
|
||||
<p>A contributor's “essential patent claims” are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, “control” includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.</p>
|
||||
|
||||
<p>Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.</p>
|
||||
|
||||
<p>In the following three paragraphs, a “patent license” is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To “grant” such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.</p>
|
||||
|
||||
<p>If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. “Knowingly relying” means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.</p>
|
||||
|
||||
<p>If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.</p>
|
||||
|
||||
<p>A patent license is “discriminatory” if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.</p>
|
||||
|
||||
<p>Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.</p>
|
||||
|
||||
<h4><a name="section12"></a>12. No Surrender of Others' Freedom.</h4>
|
||||
|
||||
<p>If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.</p>
|
||||
|
||||
<h4><a name="section13"></a>13. Use with the GNU Affero General Public License.</h4>
|
||||
|
||||
<p>Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.</p>
|
||||
|
||||
<h4><a name="section14"></a>14. Revised Versions of this License.</h4>
|
||||
|
||||
<p>The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.</p>
|
||||
|
||||
<p>Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License “or any later version” applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.</p>
|
||||
|
||||
<p>If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.</p>
|
||||
|
||||
<p>Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.</p>
|
||||
|
||||
<h4><a name="section15"></a>15. Disclaimer of Warranty.</h4>
|
||||
|
||||
<p>THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</p>
|
||||
|
||||
<h4><a name="section16"></a>16. Limitation of Liability.</h4>
|
||||
|
||||
<p>IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.</p>
|
||||
|
||||
<h4><a name="section17"></a>17. Interpretation of Sections 15 and 16.</h4>
|
||||
|
||||
<p>If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.</p>
|
||||
|
||||
<p>END OF TERMS AND CONDITIONS</p>
|
||||
|
||||
<h3><a name="howto"></a>How to Apply These Terms to Your New Programs</h3>
|
||||
|
||||
<p>If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.</p>
|
||||
|
||||
<p>To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the “copyright” line and a pointer to where the full notice is found.</p>
|
||||
|
||||
<pre> <one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program 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.
|
||||
|
||||
This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
</pre>
|
||||
|
||||
<p>Also add information on how to contact you by electronic and paper mail.</p>
|
||||
|
||||
<p>If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:</p>
|
||||
|
||||
<pre> <program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
</pre>
|
||||
|
||||
<p>The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an “about box”.</p>
|
||||
|
||||
<p>You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a “copyright disclaimer” for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<<a href="https://www.gnu.org/licenses/">https://www.gnu.org/licenses/</a>>.</p>
|
||||
|
||||
<p>The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<<a href="https://www.gnu.org/licenses/why-not-lgpl.html">https://www.gnu.org/licenses/why-not-lgpl.html</a>>.</p>
|
||||
|
||||
|
||||
</body></html>
|
|
@ -0,0 +1,77 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright © 2019 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/>.
|
||||
|
||||
set -ex
|
||||
|
||||
set -o errexit
|
||||
readonly LOG_FILE="$2"/install.log
|
||||
sudo touch "$LOG_FILE"
|
||||
exec 1>"$LOG_FILE"
|
||||
exec 2>&1
|
||||
|
||||
# Remove dummy payload
|
||||
rm -f "$2"/dummy
|
||||
|
||||
# Test for Internet connection
|
||||
[[ -z $(curl -s -m 4 www.google.com) ]] && { echo "No internet connection found"; exit 1; }
|
||||
|
||||
# Install Command Line Tools
|
||||
if [[ -z $(/usr/bin/xcode-select -print-path) ]]; then
|
||||
touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress;
|
||||
SUC=$(softwareupdate -l |
|
||||
grep "\*.*Command Line" |
|
||||
grep -m1 "" |
|
||||
awk -F"*" '{print $2}' |
|
||||
sed -e 's/^ *//' |
|
||||
tr -d '\n')
|
||||
# On macOS 10.15 softwareupdate output is preceded by "Label: "
|
||||
[[ $SUC == Label:* ]] && SUC=${SUC#"Label: "}
|
||||
softwareupdate -i "$SUC" --verbose;
|
||||
rm -f /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress;
|
||||
softwareupdate -l
|
||||
fi
|
||||
|
||||
# If CLT installation didn't work, exit
|
||||
[[ -z $(/usr/bin/xcode-select -print-path) ]] && \
|
||||
{ echo "You must install Command Line Tools to proceed with installation of GCC"; exit 1; }
|
||||
|
||||
# Install Homebrew
|
||||
BREWDIR="$2"/.brew
|
||||
[ -d "$BREWDIR" ] || mkdir -p "$BREWDIR"
|
||||
|
||||
BREW_URL="https://github.com/Homebrew/brew"
|
||||
BREW_BRANCH="master"
|
||||
|
||||
curl -\# -L "$BREW_URL"/tarball/"$BREW_BRANCH" | tar xz -m --strip 1 -C "$BREWDIR"
|
||||
|
||||
# Change ownership of Dynare directory
|
||||
chown -R "$USER":staff "$2"
|
||||
|
||||
sudo -u "$USER" "$BREWDIR"/bin/brew tap homebrew/core
|
||||
HOMEBREW_CACHE="$HOME"/Library/Caches/Homebrew-Dynare
|
||||
HOMEBREW_NO_AUTO_UPDATE=1
|
||||
[[ -z "${HOMEBREW_NO_ANALYTICS}" ]] && HOMEBREW_NO_ANALYTICS=1
|
||||
|
||||
# Move modified formulas to Homebrew Formula directory
|
||||
mv "$2"/*.rb "$BREWDIR"/Library/Taps/homebrew/homebrew-core/Formula
|
||||
|
||||
# Install GCC & deps
|
||||
sudo -u "$USER" "$BREWDIR"/bin/brew install gcc -v --force-bottle
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,15 @@
|
|||
<html lang="en">
|
||||
<body>
|
||||
<h3 style="text-align: center;">Welcome to Dynare</h3>
|
||||
<p style="text-align: center;">Version VERSION_NO_SPACE</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>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> 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>
|
||||
</html>
|
|
@ -40,15 +40,6 @@ fprintf(fid,'%s \n','\usepackage{breqn}');
|
|||
fprintf(fid,'%s \n','\usepackage{float,morefloats,caption}');
|
||||
fprintf(fid,'%s \n','\begin{document}');
|
||||
|
||||
%% Include LaTeX files from root directory
|
||||
TeX_Files=dir([M_.fname,'*.tex']);
|
||||
for ii=1:length(TeX_Files)
|
||||
[pathstr,f_name,ext] = fileparts(TeX_Files(ii).name);
|
||||
if ~strcmp(TeX_Files(ii).name,f_name_binder)
|
||||
fprintf(fid,'%s \n',['\include{',f_name,'}']);
|
||||
end
|
||||
end
|
||||
|
||||
%% Include LaTeX files from <fname>/latex/ directory, except the standalone ones
|
||||
TeX_Files=dir([M_.dname filesep 'latex' filesep '*.tex']);
|
||||
for ii=1:length(TeX_Files)
|
||||
|
|
|
@ -1,192 +0,0 @@
|
|||
function oo_ = convert_dyn_45_to_44(M_, options_, oo_,bayestopt_)
|
||||
%function oo_ = convert_dyn_45_to_44(M_, options_, oo_,bayestopt_)
|
||||
% Converts oo_ from 4.5 to 4.4
|
||||
%
|
||||
% INPUTS
|
||||
% M_ [struct] dynare model struct
|
||||
% options_ [struct] dynare options struct
|
||||
% oo_ [struct] dynare output struct
|
||||
% bayestopt_ [struct] structure storing information about priors
|
||||
% OUTPUTS
|
||||
% oo_ [struct] dynare output struct
|
||||
%
|
||||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2015-2017 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/>.
|
||||
|
||||
%% add initial conditions to Bayesian forecasts
|
||||
if isfield(oo_,'PointForecast')
|
||||
var_names=fieldnames(oo_.PointForecast.HPDinf);
|
||||
moment_names=fieldnames(oo_.PointForecast);
|
||||
for moment_iter=1:length(moment_names)
|
||||
for var_iter=1:length(var_names)
|
||||
if strcmp(moment_names{moment_iter},'deciles')
|
||||
oo_.MeanForecast.(moment_names{moment_iter}).(var_names{var_iter})=...
|
||||
[oo_.SmoothedVariables.(moment_names{moment_iter}).(var_names{var_iter})(:,end)*ones(M_.maximum_endo_lag,1) oo_.MeanForecast.(moment_names{moment_iter}).(var_names{var_iter})];
|
||||
oo_.PointForecast.(moment_names{moment_iter}).(var_names{var_iter})=...
|
||||
[oo_.SmoothedVariables.(moment_names{moment_iter}).(var_names{var_iter})(:,end)*ones(M_.maximum_endo_lag,1) oo_.PointForecast.(moment_names{moment_iter}).(var_names{var_iter})];
|
||||
else
|
||||
oo_.MeanForecast.(moment_names{moment_iter}).(var_names{var_iter})=...
|
||||
[oo_.SmoothedVariables.(moment_names{moment_iter}).(var_names{var_iter})(end)*ones(M_.maximum_endo_lag,1); oo_.MeanForecast.(moment_names{moment_iter}).(var_names{var_iter})];
|
||||
oo_.PointForecast.(moment_names{moment_iter}).(var_names{var_iter})=...
|
||||
[oo_.SmoothedVariables.(moment_names{moment_iter}).(var_names{var_iter})(end)*ones(M_.maximum_endo_lag,1); oo_.PointForecast.(moment_names{moment_iter}).(var_names{var_iter})];
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
%% change HPD-fields back to row vectors
|
||||
if isfield(oo_,'PointForecast') && isfield(oo_.PointForecast,'HPDinf')
|
||||
names=fieldnames(oo_.PointForecast.HPDinf);
|
||||
for ii=1:length(names)
|
||||
oo_.PointForecast.HPDinf.(names{ii})=oo_.PointForecast.HPDinf.(names{ii})';
|
||||
oo_.PointForecast.HPDsup.(names{ii})=oo_.PointForecast.HPDsup.(names{ii})';
|
||||
end
|
||||
end
|
||||
|
||||
if isfield(oo_,'MeanForecast') && isfield(oo_.MeanForecast,'HPDinf')
|
||||
names=fieldnames(oo_.MeanForecast.HPDinf);
|
||||
for ii=1:length(names)
|
||||
oo_.MeanForecast.HPDinf.(names{ii})=oo_.MeanForecast.HPDinf.(names{ii})';
|
||||
oo_.MeanForecast.HPDsup.(names{ii})=oo_.MeanForecast.HPDsup.(names{ii})';
|
||||
end
|
||||
end
|
||||
|
||||
if isfield(oo_,'UpdatedVariables') && isfield(oo_.UpdatedVariables,'HPDinf')
|
||||
names=fieldnames(oo_.UpdatedVariables.HPDinf);
|
||||
for ii=1:length(names)
|
||||
oo_.UpdatedVariables.HPDinf.(names{ii})=oo_.UpdatedVariables.HPDinf.(names{ii})';
|
||||
oo_.UpdatedVariables.HPDsup.(names{ii})=oo_.UpdatedVariables.HPDsup.(names{ii})';
|
||||
end
|
||||
end
|
||||
|
||||
if isfield(oo_,'SmoothedVariables') && isfield(oo_.SmoothedVariables,'HPDinf')
|
||||
names=fieldnames(oo_.SmoothedVariables.HPDinf);
|
||||
for ii=1:length(names)
|
||||
oo_.SmoothedVariables.HPDinf.(names{ii})=oo_.SmoothedVariables.HPDinf.(names{ii})';
|
||||
oo_.SmoothedVariables.HPDsup.(names{ii})=oo_.SmoothedVariables.HPDsup.(names{ii})';
|
||||
end
|
||||
end
|
||||
|
||||
if isfield(oo_,'FilteredVariables') && isfield(oo_.FilteredVariables,'HPDinf')
|
||||
names=fieldnames(oo_.FilteredVariables.HPDinf);
|
||||
for ii=1:length(names)
|
||||
oo_.FilteredVariables.HPDinf.(names{ii})=oo_.FilteredVariables.HPDinf.(names{ii})';
|
||||
oo_.FilteredVariables.HPDsup.(names{ii})=oo_.FilteredVariables.HPDsup.(names{ii})';
|
||||
end
|
||||
end
|
||||
|
||||
if isfield(oo_,'SmoothedShocks') && isfield(oo_.SmoothedShocks,'HPDinf')
|
||||
names=fieldnames(oo_.SmoothedShocks.HPDinf);
|
||||
for ii=1:length(names)
|
||||
oo_.SmoothedShocks.HPDinf.(names{ii})=oo_.SmoothedShocks.HPDinf.(names{ii})';
|
||||
oo_.SmoothedShocks.HPDsup.(names{ii})=oo_.SmoothedShocks.HPDsup.(names{ii})';
|
||||
end
|
||||
end
|
||||
|
||||
%% subtract mean from classical Updated variables
|
||||
if isfield(oo_,'UpdatedVariables')
|
||||
names=fieldnames(oo_.UpdatedVariables);
|
||||
for ii=1:length(names)
|
||||
%make sure Bayesian fields are not affected
|
||||
if ~strcmp(names{ii},'Mean') && ~strcmp(names{ii},'Median') && ~strcmp(names{ii},'deciles') ...
|
||||
&& ~strcmp(names{ii},'Var') && ~strcmp(names{ii},'HPDinf') && ~strcmp(names{ii},'HPDsup')
|
||||
current_var_index=find(strmatch(names{ii},deblank(M_.endo_names),'exact'));
|
||||
if options_.loglinear == 1 %logged steady state must be used
|
||||
constant_current_variable=log(oo_.dr.ys(current_var_index));
|
||||
elseif options_.loglinear == 0 %unlogged steady state must be used
|
||||
constant_current_variable=oo_.dr.ys(current_var_index);
|
||||
end
|
||||
oo_.UpdatedVariables.(names{ii})=oo_.UpdatedVariables.(names{ii})-constant_current_variable;
|
||||
if isfield(oo_.Smoother,'Trend') && isfield(oo_.Smoother.Trend,names{ii})
|
||||
oo_.UpdatedVariables.(names{ii})=oo_.UpdatedVariables.(names{ii})-oo_.Smoother.Trend.(names{ii});
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
%% padd classical filtered variables with redundant zeros and subtract mean
|
||||
if isfield(oo_,'FilteredVariables')
|
||||
names=fieldnames(oo_.FilteredVariables);
|
||||
for ii=1:length(names)
|
||||
%make sure Bayesian fields are not affected
|
||||
if ~strcmp(names{ii},'Mean') && ~strcmp(names{ii},'Median') && ~strcmp(names{ii},'deciles') ...
|
||||
&& ~strcmp(names{ii},'Var') && ~strcmp(names{ii},'HPDinf') && ~strcmp(names{ii},'HPDsup')
|
||||
current_var_index=find(strmatch(names{ii},deblank(M_.endo_names),'exact'));
|
||||
if options_.loglinear == 1 %logged steady state must be used
|
||||
constant_current_variable=log(oo_.dr.ys(current_var_index));
|
||||
elseif options_.loglinear == 0 %unlogged steady state must be used
|
||||
constant_current_variable=oo_.dr.ys(current_var_index);
|
||||
end
|
||||
oo_.FilteredVariables.(names{ii})=oo_.FilteredVariables.(names{ii})-constant_current_variable;
|
||||
if isfield(oo_.Smoother,'Trend') && isfield(oo_.Smoother.Trend,names{ii})
|
||||
oo_.FilteredVariables.(names{ii})=oo_.FilteredVariables.(names{ii})-oo_.Smoother.Trend.(names{ii});
|
||||
end
|
||||
oo_.FilteredVariables.(names{ii})=[0; oo_.FilteredVariables.(names{ii}); zeros(options_.nk-1,1)];
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
%% resort fields that are in declaration order to decision rule order (previous undocumented behavior)
|
||||
if ~isempty(options_.nk) && options_.nk ~= 0 && ~isempty(bayestopt_)
|
||||
if ~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.pshape> 0) && options_.load_mh_file)) %no Bayesian estimation
|
||||
positions_in_decision_order=oo_.dr.inv_order_var(bayestopt_.smoother_var_list(bayestopt_.smoother_saved_var_list));
|
||||
if options_.loglinear == 1 %logged steady state must be used
|
||||
constant_all_variables=log(oo_.dr.ys(bayestopt_.smoother_var_list(bayestopt_.smoother_saved_var_list)));
|
||||
elseif options_.loglinear == 0 %unlogged steady state must be used
|
||||
constant_all_variables=oo_.dr.ys(bayestopt_.smoother_var_list(bayestopt_.smoother_saved_var_list));
|
||||
end
|
||||
if ~(options_.selected_variables_only && ~(options_.forecast > 0)) %happens only when selected_variables_only is not used
|
||||
oo_.FilteredVariablesKStepAhead(:,positions_in_decision_order,:)=oo_.FilteredVariablesKStepAhead-constant_all_variables;
|
||||
if ~isempty(PK) %get K-step ahead variances
|
||||
oo_.FilteredVariablesKStepAheadVariances(:,positions_in_decision_order,positions_in_decision_order,:)=oo_.FilteredVariablesKStepAheadVariances;
|
||||
end
|
||||
if ~isempty(decomp)
|
||||
oo_.FilteredVariablesShockDecomposition(:,positions_in_decision_order,:,:)=oo_.FilteredVariablesShockDecomposition;
|
||||
end
|
||||
else
|
||||
fprintf('\nconvert_dyn_45_to_44:: Due to a bug in Dynare 4.4.3 with the selected_variables_only option, the previous behavior\n')
|
||||
fprintf('convert_dyn_45_to_44:: cannot be restored for FilteredVariablesKStepAhead, FilteredVariablesKStepAheadVariances, and\n')
|
||||
fprintf('convert_dyn_45_to_44:: FilteredVariablesShockDecomposition\n')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if options_.filter_covariance
|
||||
oo_.Smoother.Variance(oo_.dr.inv_order_var,oo_.dr.inv_order_var,:)=oo_.Smoother.Variance;
|
||||
end
|
||||
|
||||
|
||||
%% set old field posterior_std and remove new field posterior_std_at_mode
|
||||
if isfield(oo_,'posterior_std_at_mode')
|
||||
oo_.posterior_std=oo_.posterior_std_at_mode;
|
||||
oo_=rmfield(oo_,'posterior_std_at_mode');
|
||||
end
|
||||
|
||||
|
||||
%Deal with OSR
|
||||
if ~isempty(M_.osr.variable_weights)
|
||||
evalin('base','optim_weights_=M_.osr.variable_weights')
|
||||
end
|
||||
if ~isempty(M_.osr.variable_indices)
|
||||
evalin('base','obj_var_=M_.osr.variable_indices')
|
||||
end
|
||||
if ~isempty(M_.osr.param_names)
|
||||
evalin('base','osr_params_=char(M_.osr.param_names)')
|
||||
end
|
|
@ -1,85 +0,0 @@
|
|||
function oo_ = convert_oo_(M_, options_, oo_, from_ver, to_ver)
|
||||
%function oo_ = convert_oo_(M_, options_, oo_, from_ver, to_ver)
|
||||
% Converts oo_ from oo_.dynare_version to ver
|
||||
%
|
||||
% INPUTS
|
||||
% M_ [struct] dynare model struct
|
||||
% options_ [struct] dynare options struct
|
||||
% oo_ [struct] dynare output struct
|
||||
% from_ver [string] original oo_ output version
|
||||
% to_ver [string] desired oo_ output version
|
||||
%
|
||||
% OUTPUTS
|
||||
% oo_ [struct] dynare output struct
|
||||
%
|
||||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2015-2017 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/>.
|
||||
|
||||
check_valid_ver(to_ver);
|
||||
check_valid_ver(from_ver);
|
||||
|
||||
MIN_VER = '4.4';
|
||||
MAX_VER = '4.5';
|
||||
|
||||
if ver_less_than(to_ver, MIN_VER)
|
||||
error(['Can only convert as far back as Dynare ' MIN_VER
|
||||
'. All versions before have the same oo_ structure.']);
|
||||
end
|
||||
|
||||
if ver_greater_than(to_ver, MAX_VER)
|
||||
error(['Can only convert up to Dynare ' MAX_VER]);
|
||||
end
|
||||
|
||||
min_ver = strsplit(MIN_VER, {'.', '-'});
|
||||
max_ver = strsplit(MAX_VER, {'.', '-'});
|
||||
from_ver_split = strsplit(from_ver, {'.', '-'});
|
||||
to_ver_split = strsplit(to_ver, {'.', '-'});
|
||||
|
||||
if length(from_ver_split) ~= 2 || length(to_ver_split) ~= 2
|
||||
error('The version numbers may only be of the form X.Y');
|
||||
end
|
||||
|
||||
if to_ver_split{2} > from_ver_split{2}
|
||||
new_to_ver = [to_ver_split{1} '.' num2str(str2double(to_ver_split{2})-1)];
|
||||
else
|
||||
new_to_ver = [to_ver_split{1} '.' num2str(str2double(to_ver_split{2})+1)];
|
||||
end
|
||||
|
||||
if strcmp(from_ver, to_ver)
|
||||
return
|
||||
end
|
||||
|
||||
if ver_greater_than(to_ver, from_ver)
|
||||
moving_up = 1;
|
||||
else
|
||||
moving_up = -1;
|
||||
end
|
||||
|
||||
oo_ = convert_oo_(M_, options_, oo_, from_ver, new_to_ver)
|
||||
|
||||
if abs(to_ver_split{2} - (from_ver_split{2} - moving_up)) > 1
|
||||
new_from_ver = [to_ver_split{1} '.' num2str(str2double(to_ver_split{2}) - moving_up)];
|
||||
else
|
||||
new_from_ver = from_ver;
|
||||
end
|
||||
|
||||
eval(['oo_ = convert_dyn_' strrep(new_from_ver, '.', '') '_to_' ...
|
||||
strrep(to_ver, '.', '') '(M_, options_, oo_);']);
|
||||
end
|
|
@ -131,6 +131,7 @@ options_.nodisplay = false;
|
|||
options_.nograph = false;
|
||||
options_.no_graph.posterior = false;
|
||||
options_.no_graph.shock_decomposition = false;
|
||||
options_.no_graph.plot_shock_decomposition = false;
|
||||
options_.XTick = [];
|
||||
options_.XTickLabel = [];
|
||||
options_.console_mode = false;
|
||||
|
|
|
@ -205,7 +205,7 @@ end
|
|||
%$ density = @(x) exp(lpdfgweibull(x,shape,scale));
|
||||
%$
|
||||
%$ try
|
||||
%$ if isoctave
|
||||
%$ if isoctave || matlab_ver_less_than('7.14')
|
||||
%$ s = quadl(density, .0000000001, 100000, 1e-10);
|
||||
%$ else
|
||||
%$ s = integral(density, 0, 100000);
|
||||
|
@ -228,7 +228,7 @@ end
|
|||
%$ density = @(x) exp(lpdfgweibull(x,shape,scale));
|
||||
%$
|
||||
%$ try
|
||||
%$ if isoctave
|
||||
%$ if isoctave || matlab_ver_less_than('7.14')
|
||||
%$ s = quadl(density, .0000000001, 100000, 1e-10);
|
||||
%$ else
|
||||
%$ s = integral(density, 0, 100000);
|
||||
|
@ -251,7 +251,7 @@ end
|
|||
%$ density = @(x) exp(lpdfgweibull(x,shape,scale));
|
||||
%$
|
||||
%$ try
|
||||
%$ if isoctave
|
||||
%$ if isoctave || matlab_ver_less_than('7.14')
|
||||
%$ s = quadl(density, .0000000001, 100000, 1e-10);
|
||||
%$ else
|
||||
%$ s = integral(density, 0, 100000);
|
||||
|
@ -262,7 +262,7 @@ end
|
|||
%$ end
|
||||
%$
|
||||
%$ if t(1)
|
||||
%$ if isoctave()
|
||||
%$ if isoctave || matlab_ver_less_than('7.14')
|
||||
%$ t(2) = abs(s-1)<5e-5;
|
||||
%$ else
|
||||
%$ t(2) = abs(s-1)<1e-6;
|
||||
|
@ -280,6 +280,8 @@ end
|
|||
%$ try
|
||||
%$ if isoctave
|
||||
%$ s = quadgk(xdens, .0000000001, 100000, 1e-10);
|
||||
%$ elseif matlab_ver_less_than('7.14')
|
||||
%$ s = quadgk(xdens, .0000000001, 100000, 'AbsTol', 1e-10);
|
||||
%$ else
|
||||
%$ s = integral(xdens, 0, 100000);
|
||||
%$ end
|
||||
|
@ -301,7 +303,7 @@ end
|
|||
%$ xdens = @(x) x.*exp(lpdfgweibull(x,shape,scale));
|
||||
%$
|
||||
%$ try
|
||||
%$ if isoctave
|
||||
%$ if isoctave || matlab_ver_less_than('7.14')
|
||||
%$ s = quadl(xdens, .0000000001, 100000, 1e-10);
|
||||
%$ else
|
||||
%$ s = integral(xdens, 0, 100000);
|
||||
|
@ -324,7 +326,7 @@ end
|
|||
%$ xdens = @(x) x.*exp(lpdfgweibull(x,shape,scale));
|
||||
%$
|
||||
%$ try
|
||||
%$ if isoctave
|
||||
%$ if isoctave || matlab_ver_less_than('7.14')
|
||||
%$ s = quadl(xdens, .0000000001, 100000, 1e-10);
|
||||
%$ else
|
||||
%$ s = integral(xdens, 0, 100000);
|
||||
|
@ -350,7 +352,7 @@ end
|
|||
%$ try
|
||||
%$ s = NaN(n, 1);
|
||||
%$ for i=1:n
|
||||
%$ if isoctave()
|
||||
%$ if isoctave || matlab_ver_less_than('7.14')
|
||||
%$ s(i) = quadl(density, .0000000001, .1*i, 1e-10);
|
||||
%$ else
|
||||
%$ s(i) = integral(density, 0, .1*i);
|
||||
|
@ -381,7 +383,7 @@ end
|
|||
%$ try
|
||||
%$ s = NaN(n, 1);
|
||||
%$ for i=1:n
|
||||
%$ if isoctave()
|
||||
%$ if isoctave || matlab_ver_less_than('7.14')
|
||||
%$ s(i) = quadl(density, .0000000001, .1*i, 1e-10);
|
||||
%$ else
|
||||
%$ s(i) = integral(density, 0, .1*i);
|
||||
|
@ -412,7 +414,7 @@ end
|
|||
%$ try
|
||||
%$ s = NaN(n, 1);
|
||||
%$ for i=1:n
|
||||
%$ if isoctave()
|
||||
%$ if isoctave || matlab_ver_less_than('7.14')
|
||||
%$ s(i) = quadl(density, .0000000001, .1*i, 1e-10);
|
||||
%$ else
|
||||
%$ s(i) = integral(density, 0, .1*i);
|
||||
|
@ -427,7 +429,7 @@ end
|
|||
%$ for i=1:n
|
||||
%$ x = .1*i;
|
||||
%$ q = 1-exp(-(x/scale)^shape);
|
||||
%$ if isoctave()
|
||||
%$ if isoctave || matlab_ver_less_than('7.14')
|
||||
%$ t(i+1) = abs(s(i)-q)<5e-5;
|
||||
%$ else
|
||||
%$ t(i+1) = abs(s(i)-q)<1e-6;
|
||||
|
@ -436,4 +438,4 @@ end
|
|||
%$ end
|
||||
%$
|
||||
%$ T = all(t);
|
||||
%@eof:16
|
||||
%@eof:16
|
||||
|
|
|
@ -127,6 +127,12 @@ if ~isoctave && matlab_ver_less_than('8.1')
|
|||
p{end+1} = '/missing/strjoin';
|
||||
end
|
||||
|
||||
% contains and splitlines don't exist in Octave and in MATLAB < R2016b
|
||||
if isoctave || matlab_ver_less_than('9.1')
|
||||
p{end+1} = '/missing/contains';
|
||||
p{end+1} = '/missing/splitlines';
|
||||
end
|
||||
|
||||
% isrow, iscolumn and ismatrix are missing in Matlab<R2010b
|
||||
if ~isoctave && matlab_ver_less_than('7.11')
|
||||
p{end+1} = '/missing/is-row-column-matrix';
|
||||
|
|
|
@ -365,9 +365,13 @@ if any(bayestopt_.pshape > 0) && ~options_.mh_posterior_mode_estimation
|
|||
% Laplace approximation to the marginal log density:
|
||||
if options_.cova_compute
|
||||
estim_params_nbr = size(xparam1,1);
|
||||
log_det_invhess = log(det(invhess./(stdh*stdh')))+2*sum(log(stdh));
|
||||
likelihood = feval(objective_function,xparam1,dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,bounds,oo_);
|
||||
oo_.MarginalDensity.LaplaceApproximation = .5*estim_params_nbr*log(2*pi) + .5*log_det_invhess - likelihood;
|
||||
if ispd(invhess)
|
||||
log_det_invhess = log(det(invhess./(stdh*stdh')))+2*sum(log(stdh));
|
||||
likelihood = feval(objective_function,xparam1,dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,bounds,oo_);
|
||||
oo_.MarginalDensity.LaplaceApproximation = .5*estim_params_nbr*log(2*pi) + .5*log_det_invhess - likelihood;
|
||||
else
|
||||
oo_.MarginalDensity.LaplaceApproximation = NaN;
|
||||
end
|
||||
skipline()
|
||||
disp(sprintf('Log data density [Laplace approximation] is %f.',oo_.MarginalDensity.LaplaceApproximation))
|
||||
skipline()
|
||||
|
@ -556,8 +560,11 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
|
|||
|
||||
if ~options_.nograph
|
||||
[nbplt,nr,nc,lr,lc,nstar] = pltorg(M_.exo_nbr);
|
||||
if ~exist([M_.fname '/graphs'],'dir')
|
||||
mkdir(M_.fname,'graphs');
|
||||
end
|
||||
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
|
||||
fidTeX = fopen([M_.fname '_SmoothedShocks.tex'],'w');
|
||||
fidTeX = fopen([M_.fname, '/graphs/' M_.fname '_SmoothedShocks.tex'],'w');
|
||||
fprintf(fidTeX,'%% TeX eps-loader file generated by dynare_estimation_1.m (Dynare).\n');
|
||||
fprintf(fidTeX,['%% ' datestr(now,0) '\n']);
|
||||
fprintf(fidTeX,' \n');
|
||||
|
@ -604,14 +611,14 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
|
|||
end
|
||||
title(name,'Interpreter','none')
|
||||
end
|
||||
dyn_saveas(fh,[M_.fname '_SmoothedShocks' int2str(plt)],options_.nodisplay,options_.graph_format);
|
||||
dyn_saveas(fh,[M_.fname, '/graphs/' M_.fname '_SmoothedShocks' int2str(plt)],options_.nodisplay,options_.graph_format);
|
||||
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
|
||||
fprintf(fidTeX,'\\begin{figure}[H]\n');
|
||||
for jj = 1:nstar0
|
||||
fprintf(fidTeX,'\\psfrag{%s}[1][][0.5][0]{%s}\n',deblank(NAMES(jj,:)),deblank(TeXNAMES(jj,:)));
|
||||
end
|
||||
fprintf(fidTeX,'\\centering \n');
|
||||
fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_SmoothedShocks%s}\n',options_.figures.textwidth*min(i/nc,1),M_.fname,int2str(plt));
|
||||
fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_SmoothedShocks%s}\n',options_.figures.textwidth*min(i/nc,1),[M_.fname, '/graphs/' M_.fname],int2str(plt));
|
||||
fprintf(fidTeX,'\\caption{Smoothed shocks.}');
|
||||
fprintf(fidTeX,'\\label{Fig:SmoothedShocks:%s}\n',int2str(plt));
|
||||
fprintf(fidTeX,'\\end{figure}\n');
|
||||
|
@ -636,7 +643,7 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
|
|||
if ~options_.nograph
|
||||
[nbplt,nr,nc,lr,lc,nstar] = pltorg(number_of_plots_to_draw);
|
||||
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
|
||||
fidTeX = fopen([M_.fname '_SmoothedObservationErrors.tex'],'w');
|
||||
fidTeX = fopen([M_.fname, '/graphs/' M_.fname '_SmoothedObservationErrors.tex'],'w');
|
||||
fprintf(fidTeX,'%% TeX eps-loader file generated by dynare_estimation_1.m (Dynare).\n');
|
||||
fprintf(fidTeX,['%% ' datestr(now,0) '\n']);
|
||||
fprintf(fidTeX,' \n');
|
||||
|
@ -684,14 +691,14 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
|
|||
end
|
||||
title(name,'Interpreter','none')
|
||||
end
|
||||
dyn_saveas(fh,[M_.fname '_SmoothedObservationErrors' int2str(plt)],options_.nodisplay,options_.graph_format);
|
||||
dyn_saveas(fh,[M_.fname, '/graphs/' M_.fname '_SmoothedObservationErrors' int2str(plt)],options_.nodisplay,options_.graph_format);
|
||||
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
|
||||
fprintf(fidTeX,'\\begin{figure}[H]\n');
|
||||
for jj = 1:nstar0
|
||||
fprintf(fidTeX,'\\psfrag{%s}[1][][0.5][0]{%s}\n',deblank(NAMES(jj,:)),deblank(TeXNAMES(jj,:)));
|
||||
end
|
||||
fprintf(fidTeX,'\\centering \n');
|
||||
fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_SmoothedObservationErrors%s}\n',options_.figures.textwidth*min(i/nc,1),M_.fname,int2str(plt));
|
||||
fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_SmoothedObservationErrors%s}\n',options_.figures.textwidth*min(i/nc,1),[M_.fname, '/graphs/' M_.fname],int2str(plt));
|
||||
fprintf(fidTeX,'\\caption{Smoothed observation errors.}');
|
||||
fprintf(fidTeX,'\\label{Fig:SmoothedObservationErrors:%s}\n',int2str(plt));
|
||||
fprintf(fidTeX,'\\end{figure}\n');
|
||||
|
@ -711,7 +718,7 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
|
|||
if ~options_.nograph
|
||||
[nbplt,nr,nc,lr,lc,nstar] = pltorg(n_varobs);
|
||||
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
|
||||
fidTeX = fopen([M_.fname '_HistoricalAndSmoothedVariables.tex'],'w');
|
||||
fidTeX = fopen([M_.fname, '/graphs/' M_.fname '_HistoricalAndSmoothedVariables.tex'],'w');
|
||||
fprintf(fidTeX,'%% TeX eps-loader file generated by dynare_estimation_1.m (Dynare).\n');
|
||||
fprintf(fidTeX,['%% ' datestr(now,0) '\n']);
|
||||
fprintf(fidTeX,' \n');
|
||||
|
@ -759,14 +766,14 @@ if (~((any(bayestopt_.pshape > 0) && options_.mh_replic) || (any(bayestopt_.psha
|
|||
end
|
||||
title(name,'Interpreter','none')
|
||||
end
|
||||
dyn_saveas(fh,[M_.fname '_HistoricalAndSmoothedVariables' int2str(plt)],options_.nodisplay,options_.graph_format);
|
||||
dyn_saveas(fh,[M_.fname, '/graphs/' M_.fname '_HistoricalAndSmoothedVariables' int2str(plt)],options_.nodisplay,options_.graph_format);
|
||||
if options_.TeX && any(strcmp('eps',cellstr(options_.graph_format)))
|
||||
fprintf(fidTeX,'\\begin{figure}[H]\n');
|
||||
for jj = 1:nstar0
|
||||
fprintf(fidTeX,'\\psfrag{%s}[1][][0.5][0]{%s}\n',deblank(NAMES(jj,:)),deblank(TeXNAMES(jj,:)));
|
||||
end
|
||||
fprintf(fidTeX,'\\centering \n');
|
||||
fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_HistoricalAndSmoothedVariables%s}\n',options_.figures.textwidth*min(i/nc,1),M_.fname,int2str(plt));
|
||||
fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_HistoricalAndSmoothedVariables%s}\n',options_.figures.textwidth*min(i/nc,1),[M_.fname, '/graphs/' M_.fname],int2str(plt));
|
||||
fprintf(fidTeX,'\\caption{Historical and smoothed variables.}');
|
||||
fprintf(fidTeX,'\\label{Fig:HistoricalAndSmoothedVariables:%s}\n',int2str(plt));
|
||||
fprintf(fidTeX,'\\end{figure}\n');
|
||||
|
|
|
@ -27,10 +27,10 @@ ny = pfm.ny;
|
|||
periods = pfm.periods;
|
||||
dynamic_model = pfm.dynamic_model;
|
||||
lead_lag_incidence = pfm.lead_lag_incidence;
|
||||
lead_lag_incidence_t = transpose(lead_lag_incidence);
|
||||
nyp = pfm.nyp;
|
||||
nyf = pfm.nyf;
|
||||
i_cols_1 = pfm.i_cols_1;
|
||||
i_cols_A1 = pfm.i_cols_A1;
|
||||
i_cols_j = pfm.i_cols_j;
|
||||
i_cols_T = nonzeros(lead_lag_incidence(1:2,:)');
|
||||
|
||||
|
@ -45,7 +45,7 @@ number_of_shocks = size(exo_simul,2);
|
|||
if number_of_shocks>1
|
||||
nodes = repmat(nodes,1,number_of_shocks)*chol(pfm.Sigma);
|
||||
% to be fixed for Sigma ~= I
|
||||
for i=1:number_of_shocks
|
||||
for i=number_of_shocks:-1:1
|
||||
rr(i) = {nodes(:,i)};
|
||||
ww(i) = {weights};
|
||||
end
|
||||
|
@ -56,16 +56,14 @@ else
|
|||
nodes = nodes*sqrt(pfm.Sigma);
|
||||
end
|
||||
|
||||
innovations = zeros(periods+2,number_of_shocks);
|
||||
|
||||
if verbose
|
||||
disp ([' -----------------------------------------------------']);
|
||||
disp (['MODEL SIMULATION :']);
|
||||
disp (' -----------------------------------------------------');
|
||||
disp ('MODEL SIMULATION :');
|
||||
fprintf('\n');
|
||||
end
|
||||
|
||||
z = endo_simul(find(lead_lag_incidence'));
|
||||
[d1,jacobian] = dynamic_model(z,exo_simul,params,steady_state,2);
|
||||
z = endo_simul(lead_lag_incidence_t(:)>0);
|
||||
[~, jacobian] = dynamic_model(z, exo_simul, params,steady_state, 2);
|
||||
|
||||
% Each column of Y represents a different world
|
||||
% The upper right cells are unused
|
||||
|
@ -92,7 +90,6 @@ else
|
|||
n1 = ny+1;
|
||||
n2 = 2*ny;
|
||||
for i=2:periods
|
||||
k = n1:n2;
|
||||
for j=1:nnodes^min(i-1,order)
|
||||
i_upd_r(i1:i2) = (n1:n2)+(j-1)*ny*periods;
|
||||
i_upd_y(i1:i2) = (n1:n2)+ny+(j-1)*ny*(periods+2);
|
||||
|
@ -115,7 +112,6 @@ else
|
|||
end
|
||||
h1 = clock;
|
||||
for iter = 1:maxit
|
||||
h2 = clock;
|
||||
A1 = sparse([],[],[],ny*(sum(nnodes.^(0:order-1),2)+1),dimension,(order+1)*world_nbr*nnz(jacobian));
|
||||
res = zeros(ny,periods,world_nbr);
|
||||
i_rows = 1:ny;
|
||||
|
@ -123,7 +119,6 @@ for iter = 1:maxit
|
|||
i_cols_p = i_cols(1:nyp);
|
||||
i_cols_s = i_cols(nyp+(1:ny));
|
||||
i_cols_f = i_cols(nyp+ny+(1:nyf));
|
||||
i_cols_A = i_cols;
|
||||
i_cols_Ap = i_cols_p;
|
||||
i_cols_As = i_cols_s;
|
||||
i_cols_Af = i_cols_f - ny;
|
||||
|
@ -212,13 +207,11 @@ for iter = 1:maxit
|
|||
fprintf('\n') ;
|
||||
disp([' Total time of simulation :' num2str(etime(clock,h1))]) ;
|
||||
fprintf('\n') ;
|
||||
disp([' Convergency obtained.']) ;
|
||||
disp(' Convergency obtained.') ;
|
||||
fprintf('\n') ;
|
||||
end
|
||||
flag = 0;% Convergency obtained.
|
||||
endo_simul = reshape(Y(:,1),ny,periods+2);%Y(ny+(1:ny),1);
|
||||
% figure;plot(Y(16:ny:(periods+2)*ny,:))
|
||||
% pause
|
||||
endo_simul = reshape(Y(:,1),ny,periods+2);
|
||||
break
|
||||
end
|
||||
A2 = [nzA{:}]';
|
||||
|
@ -232,12 +225,12 @@ if ~stop
|
|||
fprintf('\n') ;
|
||||
disp([' Total time of simulation :' num2str(etime(clock,h1))]) ;
|
||||
fprintf('\n') ;
|
||||
disp(['WARNING : maximum number of iterations is reached (modify options_.simul.maxit).']) ;
|
||||
disp('WARNING : maximum number of iterations is reached (modify options_.simul.maxit).') ;
|
||||
fprintf('\n') ;
|
||||
end
|
||||
flag = 1;% more iterations are needed.
|
||||
endo_simul = 1;
|
||||
end
|
||||
if verbose
|
||||
disp (['-----------------------------------------------------']) ;
|
||||
disp ('-----------------------------------------------------') ;
|
||||
end
|
||||
|
|
|
@ -46,8 +46,7 @@ if options.steadystate_flag == 1
|
|||
assignin('base','tmp_00_',params);
|
||||
evalin('base','M_.params=tmp_00_; clear(''tmp_00_'')');
|
||||
h_steadystate = str2func([fname '_steadystate']);
|
||||
[ys,check] = h_steadystate(ys_init, exo_ss);
|
||||
params1 = evalin('base','M_.params');
|
||||
[ys,params1,check] = h_steadystate(ys_init, exo_ss,M,options);
|
||||
else % steadystate_flag == 2
|
||||
% new format
|
||||
h_steadystate = str2func([fname '.steadystate']);
|
||||
|
|
|
@ -25,10 +25,10 @@ function imcforecast(constrained_paths, constrained_vars, options_cond_fcst)
|
|||
% This routine has to be called after an estimation statement or an estimated_params block.
|
||||
%
|
||||
% REMARKS
|
||||
% [1] Results are stored in a structure which is saved in a mat file called conditional_forecasts.mat.
|
||||
% [1] Results are stored in oo_.conditional_forecast.
|
||||
% [2] Use the function plot_icforecast to plot the results.
|
||||
|
||||
% Copyright (C) 2006-2018 Dynare Team
|
||||
% Copyright (C) 2006-2019 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -310,5 +310,4 @@ forecasts.graph.fname = M_.fname;
|
|||
|
||||
%reset qz_criterium
|
||||
options_.qz_criterium=qz_criterium_old;
|
||||
|
||||
save('conditional_forecasts.mat','forecasts');
|
||||
oo_.conditional_forecast = forecasts;
|
||||
|
|
|
@ -97,13 +97,14 @@ fclose(fid);
|
|||
% Define a set of variables to be loaded.
|
||||
listofvariablestobeloaded = {'b'; 'a'};
|
||||
% Test if we can load the data.
|
||||
exist('example1.m', 'file'); % To force the detection of the new file under old MATLAB
|
||||
try
|
||||
data = load_m_file_data_legacy('example1.m', listofvariablestobeloaded);
|
||||
delete('example1.m');
|
||||
t(1) = 1;
|
||||
catch
|
||||
t(1) = 0;
|
||||
end
|
||||
delete('example1.m');
|
||||
T = all(t);
|
||||
%@eof:1
|
||||
|
||||
|
@ -124,13 +125,14 @@ fclose(fid);
|
|||
% Define a set of variables to be loaded.
|
||||
listofvariablestobeloaded = {'e'; 'a'};
|
||||
% Test if we can load the data.
|
||||
exist('example2.m', 'file'); % To force the detection of the new file under old MATLAB
|
||||
try
|
||||
data = load_m_file_data_legacy('example2.m', listofvariablestobeloaded);
|
||||
delete('example2.m');
|
||||
t(1) = 0;
|
||||
catch
|
||||
t(1) = 1;
|
||||
end
|
||||
delete('example2.m');
|
||||
T = all(t);
|
||||
%@eof:2
|
||||
|
||||
|
@ -151,12 +153,13 @@ fclose(fid);
|
|||
% Define a set of variables to be loaded.
|
||||
listofvariablestobeloaded = {'c'; 'a'};
|
||||
% Test if we can load the data.
|
||||
exist('example3.m', 'file'); % To force the detection of the new file under old MATLAB
|
||||
try
|
||||
data = load_m_file_data_legacy('example3.m', listofvariablestobeloaded);
|
||||
delete('example3.m');
|
||||
t(1) = 1;
|
||||
catch
|
||||
t(1) = 0;
|
||||
end
|
||||
delete('example3.m');
|
||||
T = all(t);
|
||||
%@eof:3
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
function tf = contains(string, pattern, varargin)
|
||||
|
||||
% CONTAINS Returns 1 if the pattern is found in string, and 0 otherwise.
|
||||
%
|
||||
% INPUTS
|
||||
% - string [string, char, cell(str)] String to be searhced.
|
||||
% - pattern [string, char, cell(str)] The searched pattern.
|
||||
%
|
||||
% If 'IgnoreCase',IGNORE is provided, the function ignores case if IGNORE is true.
|
||||
% The default value is false.
|
||||
%
|
||||
% OUTPUT
|
||||
% - tf [logical]
|
||||
%
|
||||
% Copyright (C) 2019 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/>.
|
||||
|
||||
if mod(nargin,2) ~= 0
|
||||
error('contains: inputs should be a text, followed by the queried patterns, then Name-Value pair arguments.');
|
||||
end
|
||||
|
||||
if ~((ischar(string) || isstring(string) || iscellstr(string)) && (ischar(pattern) || isstring(pattern) || iscellstr(pattern)))
|
||||
error('contains: first and second input arguments must be a string array, char array or cell array');
|
||||
end
|
||||
|
||||
if ~isempty(varargin)
|
||||
if ~ischar(varargin{1})
|
||||
error('The #%d and #%d inputs must be a Name-Value pair.', nargin-1, nargin);
|
||||
end
|
||||
parameters = {'ignorecase', 'caseignore','insensitivecase', 'caseinsensitive','insensitive','ignore',...
|
||||
'casesensitive', 'sensitive', 'sensitivecase'};
|
||||
if ~cellfun('isempty',(cellfun(@(s)strcmpi(varargin{1}, s), parameters, 'uni', 0)))
|
||||
case_ignore = varargin{end};
|
||||
else
|
||||
error('Unsupported parameter "%s".', varargin{1});
|
||||
end
|
||||
else
|
||||
case_ignore = false;
|
||||
end
|
||||
|
||||
string = cellstr(string);
|
||||
pattern = cellstr(pattern);
|
||||
|
||||
if case_ignore
|
||||
string = lower(string);
|
||||
pattern = lower(pattern);
|
||||
end
|
||||
|
||||
tf = false(size(string));
|
||||
for ii = 1:numel(pattern)
|
||||
idx = regexp(string, pattern{ii});
|
||||
for jj = 1:numel(string)
|
||||
tf(jj) = tf(jj) || ~isempty(idx{jj});
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,32 @@
|
|||
function s = splitlines(string)
|
||||
|
||||
% SPLITLINES splits strings at newline characters into a string array.
|
||||
%
|
||||
% INPUT
|
||||
% - string [string] String to be splitted with newline characters.
|
||||
%
|
||||
% OUTPUT
|
||||
% - s [string]
|
||||
%
|
||||
% Copyright (C) 2019 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/>.
|
||||
|
||||
assert(ischar(string) && ndims(string)==2 && size(string,1)<=1, 'The first argument has to be a row char array!');
|
||||
|
||||
s = strsplit(string, '\n');
|
||||
s = reshape(s,size(s, 2), size(s,1));
|
||||
end
|
|
@ -147,7 +147,7 @@ t = exp(log(scale)+log(-log(1-proba))/shape);
|
|||
%$ if debug
|
||||
%$ [shape, scale, x(k-1)]
|
||||
%$ end
|
||||
%$ if isoctave
|
||||
%$ if isoctave || matlab_ver_less_than('7.14')
|
||||
%$ s = quadv(density, 0, x(k-1),1e-10);
|
||||
%$ else
|
||||
%$ s = integral(density, 0, x(k-1));
|
||||
|
@ -155,8 +155,8 @@ t = exp(log(scale)+log(-log(1-proba))/shape);
|
|||
%$ if debug
|
||||
%$ [s, abs(p-s)]
|
||||
%$ end
|
||||
%$ if isoctave
|
||||
%$ t(k) = abs(p-s)<1e-10;
|
||||
%$ if isoctave || matlab_ver_less_than('7.14')
|
||||
%$ t(k) = abs(p-s)<1e-9;
|
||||
%$ else
|
||||
%$ t(k) = abs(p-s)<1e-12;
|
||||
%$ end
|
||||
|
|
|
@ -77,8 +77,11 @@ end
|
|||
|
||||
[nbplt,nr,nc,lr,lc,nstar] = pltorg(length(x));
|
||||
|
||||
if ~exist([Model.fname filesep 'graphs'],'dir')
|
||||
mkdir(Model.fname,'graphs');
|
||||
end
|
||||
if TeX && any(strcmp('eps',cellstr(DynareOptions.graph_format)))
|
||||
fidTeX = fopen([Model.fname '_CheckPlots.tex'],'w');
|
||||
fidTeX = fopen([Model.fname, '/graphs/', Model.fname '_CheckPlots.tex'],'w');
|
||||
fprintf(fidTeX,'%% TeX eps-loader file generated by mode_check.m (Dynare).\n');
|
||||
fprintf(fidTeX,['%% ' datestr(now,0) '\n']);
|
||||
fprintf(fidTeX,' \n');
|
||||
|
@ -202,7 +205,7 @@ for plt = 1:nbplt
|
|||
text(0.25,0.5,'log-post')
|
||||
text(0.69,0.5,'log-lik kernel')
|
||||
end
|
||||
dyn_saveas(hh,[ Model.fname '_CheckPlots' int2str(plt) ],DynareOptions.nodisplay,DynareOptions.graph_format);
|
||||
dyn_saveas(hh,[Model.fname, '/graphs/', Model.fname '_CheckPlots' int2str(plt) ],DynareOptions.nodisplay,DynareOptions.graph_format);
|
||||
if TeX && any(strcmp('eps',cellstr(DynareOptions.graph_format)))
|
||||
% TeX eps loader file
|
||||
fprintf(fidTeX,'\\begin{figure}[H]\n');
|
||||
|
@ -210,7 +213,7 @@ for plt = 1:nbplt
|
|||
fprintf(fidTeX,'\\psfrag{%s}[1][][0.5][0]{%s}\n',deblank(NAMES(jj,:)),deblank(TeXNAMES(jj,:)));
|
||||
end
|
||||
fprintf(fidTeX,'\\centering \n');
|
||||
fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_CheckPlots%s}\n',DynareOptions.figures.textwidth*min(k/nc,1),Model.fname,int2str(plt));
|
||||
fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_CheckPlots%s}\n',DynareOptions.figures.textwidth*min(k/nc,1),[Model.fname, '/graphs/',Model.fname],int2str(plt));
|
||||
fprintf(fidTeX,'\\caption{Check plots.}');
|
||||
fprintf(fidTeX,'\\label{Fig:CheckPlots:%s}\n',int2str(plt));
|
||||
fprintf(fidTeX,'\\end{figure}\n');
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit f2fd7524d73b240e5c1764f33b37ed92c03484fe
|
||||
Subproject commit a25d3abdb6312d619352a7b276c70ec98b3d5f00
|
|
@ -39,7 +39,7 @@ end
|
|||
%We have to get an initial guess for the conditional forecast
|
||||
% and terminal conditions for the non-stationary variables, we
|
||||
% use the first order approximation of the rational expectation solution.
|
||||
if ~isfield(oo_,'dr') || (isempty(oo_.dr))
|
||||
if ~isfield(oo_,'dr') || ~isfield(oo_.dr,'ghx')
|
||||
fprintf('computing the first order solution of the model as initial guess...');
|
||||
dr = struct();
|
||||
oo_.dr=set_state_space(dr,M_,options_);
|
||||
|
|
|
@ -42,7 +42,7 @@ for it = 2:options.periods+1
|
|||
yb = endogenousvariables(:,it-1); % Values at previous period, also used as guess value for current period
|
||||
yb1 = yb(iyb);
|
||||
[tmp, check] = solve1(dynamicmodel, [yb1; yb], 1:M.endo_nbr, nyb+1:nyb+M.endo_nbr, ...
|
||||
1, options.gstep, options.solve_tolf, options.solve_tolx, ...
|
||||
1, options.gstep, options.dynatol.f, options.dynatol.x, ...
|
||||
options.simul.maxit, options.debug, exogenousvariables, ...
|
||||
M.params, steadystate, it+M.maximum_lag-1);
|
||||
if check
|
||||
|
|
|
@ -33,8 +33,8 @@ for it = options.periods:-1:1
|
|||
yf = endogenousvariables(:,it+1); % Values at next period, also used as guess value for current period
|
||||
yf1 = yf(iyf);
|
||||
[tmp, check] = solve1(dynamicmodel, [yf; yf1], 1:M.endo_nbr, 1:M.endo_nbr, ...
|
||||
1, options.gstep, options.solve_tolf, ...
|
||||
options.solve_tolx, options.simul.maxit, ...
|
||||
1, options.gstep, options.dynatol.f, ...
|
||||
options.dynatol.x, options.simul.maxit, ...
|
||||
options.debug, exogenousvariables, M.params, steadystate, ...
|
||||
it+M.maximum_lag);
|
||||
if check
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
function plot_icforecast(Variables,periods,options_)
|
||||
function plot_icforecast(Variables,periods,options_,oo_)
|
||||
% Build plots for the conditional forecasts.
|
||||
%
|
||||
% INPUTS
|
||||
% o Variables [cell] names of the endogenous variables to be plotted.
|
||||
% o Variables [cell] Names of the endogenous variables to be plotted.
|
||||
% o periods [int] Number of periods to be plotted.
|
||||
% o options_ [structure] Options.
|
||||
% o oo_ [structure] Storage of results.
|
||||
%
|
||||
% OUTPUTS
|
||||
% None.
|
||||
|
@ -10,7 +13,7 @@ function plot_icforecast(Variables,periods,options_)
|
|||
% SPECIAL REQUIREMENTS
|
||||
% This routine has to be called after imcforecast.m.
|
||||
|
||||
% Copyright (C) 2006-2018 Dynare Team
|
||||
% Copyright (C) 2006-2019 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -27,7 +30,11 @@ function plot_icforecast(Variables,periods,options_)
|
|||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
load conditional_forecasts;
|
||||
if ~isfield(oo_, 'conditional_forecast')
|
||||
error('Can''t find conditional forecasts');
|
||||
else
|
||||
forecasts = oo_.conditional_forecast;
|
||||
end
|
||||
|
||||
forecast_periods = length(forecasts.cond.Mean.(Variables{1}));
|
||||
if nargin==1 || isempty(periods) % Set default number of periods.
|
||||
|
|
|
@ -68,13 +68,23 @@ if SampleSize == 1
|
|||
plot((1:length(idehess.ide_strength_J(:,is)))-0.15,log([idehess.ide_strength_J(:,is)']),'o','MarkerSize',7,'MarkerFaceColor',[0 0 0],'MarkerEdgeColor','none')
|
||||
plot((1:length(idehess.ide_strength_J_prior(:,is)))+0.15,log([idehess.ide_strength_J_prior(:,is)']),'o','MarkerSize',7,'MarkerFaceColor',[0 0 0],'MarkerEdgeColor','none')
|
||||
if any(isinf(log(idehess.ide_strength_J(idehess.identified_parameter_indices))))
|
||||
inf_indices=find(isinf(log(idehess.ide_strength_J(idehess.identified_parameter_indices))));
|
||||
inf_pos=ismember(is,inf_indices);
|
||||
%-Inf, i.e. 0 strength
|
||||
inf_indices=find(isinf(log(idehess.ide_strength_J(idehess.identified_parameter_indices))) & log(idehess.ide_strength_J(idehess.identified_parameter_indices))<0);
|
||||
inf_pos=ismember(is,idehess.identified_parameter_indices(inf_indices));
|
||||
plot(find(inf_pos)-0.15,zeros(sum(inf_pos),1),'o','MarkerSize',7,'MarkerFaceColor',[1 0 0],'MarkerEdgeColor',[0 0 0])
|
||||
%+Inf, i.e. Inf strength
|
||||
inf_indices=find(isinf(log(idehess.ide_strength_J(idehess.identified_parameter_indices))) & log(idehess.ide_strength_J(idehess.identified_parameter_indices))>0);
|
||||
inf_pos=ismember(is,idehess.identified_parameter_indices(inf_indices));
|
||||
plot(find(inf_pos)-0.15,zeros(sum(inf_pos),1),'o','MarkerSize',7,'MarkerFaceColor',[1 1 1],'MarkerEdgeColor',[0 0 0])
|
||||
end
|
||||
if any(isinf(log(idehess.ide_strength_J_prior(idehess.identified_parameter_indices))))
|
||||
inf_indices=find(isinf(log(idehess.ide_strength_J_prior(idehess.identified_parameter_indices))));
|
||||
inf_pos=ismember(is,inf_indices);
|
||||
%-Inf, i.e. 0 strength
|
||||
inf_indices=find(isinf(log(idehess.ide_strength_J_prior(idehess.identified_parameter_indices))) & log(idehess.ide_strength_J_prior(idehess.identified_parameter_indices))<0);
|
||||
inf_pos=ismember(is,idehess.identified_parameter_indices(inf_indices));
|
||||
plot(find(inf_pos)+0.15,zeros(sum(inf_pos),1),'o','MarkerSize',7,'MarkerFaceColor',[1 0 0],'MarkerEdgeColor',[0 0 0])
|
||||
%+Inf, i.e. 0 strength
|
||||
inf_indices=find(isinf(log(idehess.ide_strength_J_prior(idehess.identified_parameter_indices))) & log(idehess.ide_strength_J_prior(idehess.identified_parameter_indices))>0);
|
||||
inf_pos=ismember(is,idehess.identified_parameter_indices(inf_indices));
|
||||
plot(find(inf_pos)+0.15,zeros(sum(inf_pos),1),'o','MarkerSize',7,'MarkerFaceColor',[1 1 1],'MarkerEdgeColor',[0 0 0])
|
||||
end
|
||||
set(gca,'xlim',[0 nparam+1])
|
||||
|
|
|
@ -36,8 +36,11 @@ figurename = 'Priors';
|
|||
npar = length(bayestopt_.p1);
|
||||
[nbplt,nr,nc,lr,lc,nstar] = pltorg(npar);
|
||||
|
||||
if ~exist([M_.fname '/graphs'],'dir')
|
||||
mkdir(M_.fname,'graphs');
|
||||
end
|
||||
if TeX && any(strcmp('eps',cellstr(options_.graph_format)))
|
||||
fidTeX = fopen([M_.fname '_Priors.tex'],'w');
|
||||
fidTeX = fopen([M_.fname, '/graphs/' M_.fname '_Priors.tex'],'w');
|
||||
fprintf(fidTeX,'%% TeX eps-loader file generated by plot_priors.m (Dynare).\n');
|
||||
fprintf(fidTeX,['%% ' datestr(now,0) '\n']);
|
||||
fprintf(fidTeX,' \n');
|
||||
|
@ -70,14 +73,14 @@ for plt = 1:nbplt
|
|||
title(nam,'Interpreter','none')
|
||||
drawnow
|
||||
end
|
||||
dyn_saveas(hplt,[M_.fname '_Priors' int2str(plt)],options_.nodisplay,options_.graph_format);
|
||||
dyn_saveas(hplt,[M_.fname, '/graphs/' M_.fname '_Priors' int2str(plt)],options_.nodisplay,options_.graph_format);
|
||||
if TeX && any(strcmp('eps',cellstr(options_.graph_format)))
|
||||
fprintf(fidTeX,'\\begin{figure}[H]\n');
|
||||
for jj = 1:nstar0
|
||||
fprintf(fidTeX,'\\psfrag{%s}[1][][0.5][0]{%s}\n',deblank(NAMES(jj,:)),deblank(TeXNAMES(jj,:)));
|
||||
end
|
||||
fprintf(fidTeX,'\\centering\n');
|
||||
fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_Priors%s}\n',options_.figures.textwidth*min(index/nc,1),M_.fname,int2str(plt));
|
||||
fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_Priors%s}\n',options_.figures.textwidth*min(index/nc,1),[M_.fname, '/graphs/' M_.fname],int2str(plt));
|
||||
fprintf(fidTeX,'\\caption{Priors.}');
|
||||
fprintf(fidTeX,'\\label{Fig:Priors:%s}\n',int2str(plt));
|
||||
fprintf(fidTeX,'\\end{figure}\n');
|
||||
|
|
|
@ -64,7 +64,7 @@ end
|
|||
|
||||
f = 0.5*(fvec'*fvec) ;
|
||||
|
||||
if max(abs(fvec)) < tolf
|
||||
if max(abs(fvec)) < tolf*tolf
|
||||
return ;
|
||||
end
|
||||
|
||||
|
|
|
@ -201,9 +201,13 @@ end
|
|||
|
||||
if options_.irf
|
||||
var_listTeX = M_.endo_names_tex(i_var);
|
||||
|
||||
if ~options_.nograph
|
||||
if ~exist([M_.fname '/graphs'],'dir')
|
||||
mkdir(M_.fname,'graphs');
|
||||
end
|
||||
end
|
||||
if TeX && any(strcmp('eps',cellstr(options_.graph_format)))
|
||||
fidTeX = fopen([M_.fname '_IRF.tex'],'w');
|
||||
fidTeX = fopen([M_.fname, '/graphs/' M_.fname '_IRF.tex'],'w');
|
||||
fprintf(fidTeX,'%% TeX eps-loader file generated by stoch_simul.m (Dynare).\n');
|
||||
fprintf(fidTeX,['%% ' datestr(now,0) '\n']);
|
||||
fprintf(fidTeX,' \n');
|
||||
|
@ -290,14 +294,14 @@ if options_.irf
|
|||
remove_fractional_xticks;
|
||||
title(deblank(mylist(j,:)),'Interpreter','none');
|
||||
end
|
||||
dyn_saveas(hh,[M_.fname '_IRF_' tit{i}],options_.nodisplay,options_.graph_format);
|
||||
dyn_saveas(hh,[M_.fname, '/graphs/' M_.fname '_IRF_' tit{i}],options_.nodisplay,options_.graph_format);
|
||||
if TeX && any(strcmp('eps',cellstr(options_.graph_format)))
|
||||
fprintf(fidTeX,'\\begin{figure}[H]\n');
|
||||
for j = 1:number_of_plots_to_draw
|
||||
fprintf(fidTeX,'\\psfrag{%s}[1][][0.5][0]{$%s$}\n',deblank(mylist(j,:)),deblank(mylistTeX(j,:)));
|
||||
end
|
||||
fprintf(fidTeX,'\\centering \n');
|
||||
fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_IRF_%s}\n',options_.figures.textwidth*min(j/nc,1),M_.fname,tit{i});
|
||||
fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_IRF_%s}\n',options_.figures.textwidth*min(j/nc,1),[M_.fname, '/graphs/' M_.fname],tit{i});
|
||||
fprintf(fidTeX,'\\caption{Impulse response functions (orthogonalized shock to $%s$).}\n',titTeX{i});
|
||||
fprintf(fidTeX,'\\label{Fig:IRF:%s}\n', tit{i});
|
||||
fprintf(fidTeX,'\\end{figure}\n');
|
||||
|
@ -322,14 +326,14 @@ if options_.irf
|
|||
remove_fractional_xticks
|
||||
title(deblank(mylist((fig-1)*nstar+plt,:)),'Interpreter','none');
|
||||
end
|
||||
dyn_saveas(hh,[ M_.fname '_IRF_' tit{i} int2str(fig)],options_.nodisplay,options_.graph_format);
|
||||
dyn_saveas(hh,[M_.fname, '/graphs/' M_.fname '_IRF_' tit{i} int2str(fig)],options_.nodisplay,options_.graph_format);
|
||||
if TeX && any(strcmp('eps',cellstr(options_.graph_format)))
|
||||
fprintf(fidTeX,'\\begin{figure}[H]\n');
|
||||
for j = 1:nstar
|
||||
fprintf(fidTeX,'\\psfrag{%s}[1][][0.5][0]{$%s$}\n',deblank(mylist((fig-1)*nstar+j,:)),deblank(mylistTeX((fig-1)*nstar+j,:)));
|
||||
end
|
||||
fprintf(fidTeX,'\\centering \n');
|
||||
fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_IRF_%s%s}\n',options_.figures.textwidth*min(plt/nc,1),M_.fname,tit{i},int2str(fig));
|
||||
fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_IRF_%s%s}\n',options_.figures.textwidth*min(plt/nc,1),[M_.fname, '/graphs/' M_.fname],tit{i},int2str(fig));
|
||||
if options_.relative_irf
|
||||
fprintf(fidTeX,'\\caption{Relative impulse response functions (orthogonalized shock to $%s$).}', titTeX{i});
|
||||
else
|
||||
|
@ -353,14 +357,14 @@ if options_.irf
|
|||
remove_fractional_xticks
|
||||
title(deblank(mylist((nbplt-1)*nstar+plt,:)),'Interpreter','none');
|
||||
end
|
||||
dyn_saveas(hh,[ M_.fname '_IRF_' tit{i} int2str(nbplt) ],options_.nodisplay,options_.graph_format);
|
||||
dyn_saveas(hh,[M_.fname, '/graphs/' M_.fname '_IRF_' tit{i} int2str(nbplt) ],options_.nodisplay,options_.graph_format);
|
||||
if TeX && any(strcmp('eps',cellstr(options_.graph_format)))
|
||||
fprintf(fidTeX,'\\begin{figure}[H]\n');
|
||||
for j = 1:m
|
||||
fprintf(fidTeX,'\\psfrag{%s}[1][][0.5][0]{$%s$}\n',deblank(mylist((nbplt-1)*nstar+j,:)),deblank(mylistTeX((nbplt-1)*nstar+j,:)));
|
||||
end
|
||||
fprintf(fidTeX,'\\centering \n');
|
||||
fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_IRF_%s%s}\n',options_.figures.textwidth*min(m/lc,1),M_.fname,tit{i},int2str(nbplt));
|
||||
fprintf(fidTeX,'\\includegraphics[width=%2.2f\\textwidth]{%s_IRF_%s%s}\n',options_.figures.textwidth*min(m/lc,1),[M_.fname, '/graphs/' M_.fname],tit{i},int2str(nbplt));
|
||||
if options_.relative_irf
|
||||
fprintf(fidTeX,'\\caption{Relative impulse response functions (orthogonalized shock to $%s$).}', titTeX{i});
|
||||
else
|
||||
|
|
|
@ -25,7 +25,7 @@ function [x,check,info] = trust_region(fcn,x0,j1,j2,jacobian_flag,gstep,tolf,tol
|
|||
% none
|
||||
|
||||
% Copyright (C) 2008-2012 VZLU Prague, a.s.
|
||||
% Copyright (C) 2014-2017 Dynare Team
|
||||
% Copyright (C) 2014-2019 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -65,24 +65,27 @@ info = 0;
|
|||
fvec = fcn (x, varargin{:});
|
||||
fvec = fvec(j1);
|
||||
fn = norm (fvec);
|
||||
recompute_jacobian = true;
|
||||
|
||||
% Outer loop.
|
||||
while (niter < maxiter && ~info)
|
||||
|
||||
% Calculate function value and Jacobian (possibly via FD).
|
||||
if jacobian_flag
|
||||
[fvec, fjac] = fcn (x, varargin{:});
|
||||
fvec = fvec(j1);
|
||||
fjac = fjac(j1,j2);
|
||||
else
|
||||
dh = max(abs(x(j2)),gstep(1)*ones(n,1))*eps^(1/3);
|
||||
% Calculate Jacobian (possibly via FD).
|
||||
if recompute_jacobian
|
||||
if jacobian_flag
|
||||
[~, fjac] = fcn (x, varargin{:});
|
||||
fjac = fjac(j1,j2);
|
||||
else
|
||||
dh = max(abs(x(j2)),gstep(1)*ones(n,1))*eps^(1/3);
|
||||
|
||||
for j = 1:n
|
||||
xdh = x ;
|
||||
xdh(j2(j)) = xdh(j2(j))+dh(j) ;
|
||||
t = fcn(xdh,varargin{:});
|
||||
fjac(:,j) = (t(j1) - fvec)./dh(j) ;
|
||||
for j = 1:n
|
||||
xdh = x ;
|
||||
xdh(j2(j)) = xdh(j2(j))+dh(j) ;
|
||||
t = fcn(xdh,varargin{:});
|
||||
fjac(:,j) = (t(j1) - fvec)./dh(j) ;
|
||||
end
|
||||
end
|
||||
recompute_jacobian = false;
|
||||
end
|
||||
|
||||
% Get column norms, use them as scaling factors.
|
||||
|
@ -164,20 +167,13 @@ while (niter < maxiter && ~info)
|
|||
xn = norm (dg .* x(j2));
|
||||
fvec = fvec1;
|
||||
fn = fn1;
|
||||
recompute_jacobian = true;
|
||||
end
|
||||
|
||||
niter = niter + 1;
|
||||
|
||||
|
||||
% Tests for termination conditions. A mysterious place, anything
|
||||
% can happen if you change something here...
|
||||
|
||||
% The rule of thumb (which I'm not sure M*b is quite following)
|
||||
% is that for a tolerance that depends on scaling, only 0 makes
|
||||
% sense as a default value. But 0 usually means uselessly long
|
||||
% iterations, so we need scaling-independent tolerances wherever
|
||||
% possible.
|
||||
|
||||
% Tests for termination condition
|
||||
if (fn <= tolf)
|
||||
info = 1;
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@ function write_latex_definitions
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2013-2018 Dynare Team
|
||||
% Copyright (C) 2013-2019 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -39,7 +39,10 @@ else
|
|||
M_var_root = {'M_.endo', 'M_.exo', 'M_.exo_det', 'M_.param'};
|
||||
end
|
||||
|
||||
fid = fopen([M_.fname '_latex_definitions.tex'], 'w');
|
||||
if ~exist([M_.fname '/latex'],'dir')
|
||||
mkdir(M_.fname,'latex');
|
||||
end
|
||||
fid = fopen([M_.fname, '/latex/' M_.fname '_latex_definitions.tex'], 'w');
|
||||
for i=1:length(tables)
|
||||
fprintf(fid, '\\begin{center}\n');
|
||||
fprintf(fid, '\\begin{longtable}{ccc}\n');
|
||||
|
|
|
@ -12,7 +12,7 @@ function write_latex_parameter_table
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2015-2018 Dynare Team
|
||||
% Copyright (C) 2015-2019 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -37,7 +37,11 @@ if ~isequal(M_.param_names, M_.param_names_long)
|
|||
Long_names_present = true;
|
||||
end
|
||||
|
||||
fid = fopen([M_.fname '_latex_parameters.tex'], 'w');
|
||||
if ~exist([M_.fname '/latex'],'dir')
|
||||
mkdir(M_.fname,'latex');
|
||||
end
|
||||
|
||||
fid = fopen([M_.fname, '/latex/' M_.fname '_latex_parameters.tex'], 'w');
|
||||
fprintf(fid, '\\begin{center}\n');
|
||||
if Long_names_present==1
|
||||
fprintf(fid, '\\begin{longtable}{ccc}\n');
|
||||
|
|
|
@ -11,7 +11,7 @@ function write_latex_prior_table
|
|||
% SPECIAL REQUIREMENTS
|
||||
% none
|
||||
|
||||
% Copyright (C) 2015-2017 Dynare Team
|
||||
% Copyright (C) 2015-2019 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -54,7 +54,10 @@ ub=bounds.ub;
|
|||
|
||||
PriorNames = { 'Beta' , 'Gamma' , 'Gaussian' , 'Inv. Gamma' , 'Uniform' , 'Inv. Gamma -- 2', '', 'Weibull' };
|
||||
|
||||
fidTeX = fopen([Model.fname '_priors_table.tex'],'w+');
|
||||
if ~exist([M_.fname '/latex'],'dir')
|
||||
mkdir(M_.fname,'latex');
|
||||
end
|
||||
fidTeX = fopen([M_.fname, '/latex/' Model.fname '_priors_table.tex'],'w+');
|
||||
fprintf(fidTeX,'%% TeX-table generated by Dynare write_latex_prior_table.m.\n');
|
||||
fprintf(fidTeX,'%% Prior Information\n');
|
||||
fprintf(fidTeX,['%% ' datestr(now,0)]);
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
ACLOCAL_AMFLAGS = -I ../../../m4
|
||||
|
||||
if DO_SOMETHING
|
||||
SUBDIRS = mjdgges kronecker bytecode block_kalman_filter sobol local_state_space_iterations perfect_foresight_problem num_procs
|
||||
|
||||
# libdynare++ must come before gensylv, k_order_perturbation, dynare_simul_
|
||||
if HAVE_MATIO
|
||||
if ENABLE_MEX_DYNAREPLUSPLUS
|
||||
SUBDIRS += libdynare++ gensylv k_order_perturbation dynare_simul_
|
||||
endif
|
||||
|
||||
if HAVE_GSL
|
||||
if ENABLE_MEX_MS_SBVAR
|
||||
SUBDIRS += ms_sbvar
|
||||
endif
|
||||
|
||||
if HAVE_SLICOT
|
||||
if ENABLE_MEX_KALMAN_STEADY_STATE
|
||||
SUBDIRS += kalman_steady_state
|
||||
endif
|
||||
|
||||
|
@ -31,6 +30,5 @@ endif
|
|||
|
||||
install-exec-local:
|
||||
$(MKDIR_P) $(DESTDIR)$(pkglibdir)/mex/matlab
|
||||
endif
|
||||
|
||||
EXTRA_DIST = mex.def mexFunction-MacOSX.map
|
||||
|
|
|
@ -26,22 +26,17 @@ dnl The following must occur before we modify CFLAGS/CXXFLAGS
|
|||
AC_CANONICAL_HOST
|
||||
|
||||
AX_MATLAB
|
||||
AX_MATLAB_VERSION
|
||||
AX_DOT_MEXEXT
|
||||
AX_MATLAB_ARCH
|
||||
AX_MEXOPTS
|
||||
|
||||
if test "$ax_enable_matlab" = yes; then
|
||||
AX_MATLAB_VERSION
|
||||
AX_DOT_MEXEXT
|
||||
AX_MATLAB_ARCH
|
||||
|
||||
if test "$ax_matlab_version_ok" = yes; then
|
||||
AX_MEXOPTS
|
||||
AX_COMPARE_VERSION([$MATLAB_VERSION], [lt], [7.9], [AC_MSG_ERROR([Your MATLAB is too old, please upgrade to version 7.9 (R2009b) at least.])])
|
||||
fi
|
||||
|
||||
CFLAGS="$MATLAB_CFLAGS"
|
||||
CXXFLAGS="$MATLAB_CXXFLAGS"
|
||||
FFLAGS="$MATLAB_FFLAGS"
|
||||
if test "$ax_enable_matlab" != yes -o "$ax_matlab_version_ok" != yes -o "$ax_mexopts_ok" != yes; then
|
||||
AC_MSG_ERROR([MATLAB cannot be found])
|
||||
fi
|
||||
|
||||
AX_COMPARE_VERSION([$MATLAB_VERSION], [lt], [7.9], [AC_MSG_ERROR([Your MATLAB is too old, please upgrade to version 7.9 (R2009b) at least (or disable MATLAB support with --disable-matlab).])])
|
||||
|
||||
case ${host_os} in
|
||||
*cygwin*)
|
||||
AC_MSG_WARN([You are compiling for the Cygwin target. This means that the MEX files will])
|
||||
|
@ -50,9 +45,9 @@ case ${host_os} in
|
|||
;;
|
||||
esac
|
||||
|
||||
CFLAGS="$CFLAGS -Wall -Wno-parentheses"
|
||||
FFLAGS="$FFLAGS -Wall"
|
||||
CXXFLAGS="$CXXFLAGS -Wall -Wno-parentheses -Wold-style-cast"
|
||||
CFLAGS="$MATLAB_CFLAGS -Wall -Wno-parentheses"
|
||||
FFLAGS="$MATLAB_FFLAGS -Wall"
|
||||
CXXFLAGS="$MATLAB_CXXFLAGS -Wall -Wno-parentheses -Wold-style-cast"
|
||||
|
||||
AC_PROG_F77([gfortran g77 f77])
|
||||
AC_PROG_CC
|
||||
|
@ -82,17 +77,34 @@ AX_CXX11_THREAD
|
|||
# Check for dlopen(), needed by k_order_perturbation DLL
|
||||
AC_CHECK_LIB([dl], [dlopen], [LIBADD_DLOPEN="-ldl"], [])
|
||||
AC_SUBST([LIBADD_DLOPEN])
|
||||
# Check for GSL, needed by MS-SBVAR
|
||||
AX_GSL
|
||||
AM_CONDITIONAL([HAVE_GSL], [test "$has_gsl" = yes])
|
||||
|
||||
# Define optional components and their corresponding flags and Automake conditionals
|
||||
AC_ARG_ENABLE([mex-ms-sbvar], AS_HELP_STRING([--disable-mex-ms-sbvar], [disable compilation of the MS-SBVAR MEX]), [], [enable_mex_ms_sbvar=yes])
|
||||
AM_CONDITIONAL([ENABLE_MEX_MS_SBVAR], [test "$enable_mex_ms_sbvar" = yes])
|
||||
|
||||
AC_ARG_ENABLE([mex-dynare++], AS_HELP_STRING([--disable-mex-dynare++], [disable compilation of MEX based on Dynare++]), [], [enable_mex_dynareplusplus=yes])
|
||||
AM_CONDITIONAL([ENABLE_MEX_DYNAREPLUSPLUS], [test "$enable_mex_dynareplusplus" = yes])
|
||||
|
||||
AC_ARG_ENABLE([mex-kalman-steady-state], AS_HELP_STRING([--disable-mex-kalman-steady-state], [disable compilation of the kalman_steady_state MEX]), [], [enable_mex_kalman_steady_state=yes])
|
||||
AM_CONDITIONAL([ENABLE_MEX_KALMAN_STEADY_STATE], [test "$enable_mex_kalman_steady_state" = yes])
|
||||
|
||||
# Check for GSL, needed by MS-SBVAR MEX
|
||||
if test "$enable_mex_ms_sbvar" = yes; then
|
||||
AX_GSL
|
||||
test "$has_gsl" != yes && AC_MSG_ERROR([GSL cannot be found. If you want to skip the compilation of the MS-SBVAR MEX, pass the --disable-mex-ms-sbvar flag.])
|
||||
fi
|
||||
|
||||
# Check for libmatio, needed by MEX files using Dynare++ code
|
||||
AX_MATIO
|
||||
AM_CONDITIONAL([HAVE_MATIO], [test "$has_matio" = yes])
|
||||
if test "$enable_mex_dynareplusplus" = yes; then
|
||||
AX_MATIO
|
||||
test "$has_matio" != yes && AC_MSG_ERROR([libmatio cannot be found. If you want to skip the compilation of MEX files based Dynare++, pass the --disable-mex-dynare++ flag.])
|
||||
fi
|
||||
|
||||
# Check for libslicot, needed by kalman_steady_state
|
||||
AX_SLICOT([matlab])
|
||||
AM_CONDITIONAL([HAVE_SLICOT], [test "$has_slicot" = yes])
|
||||
if test "$enable_mex_kalman_steady_state" = yes; then
|
||||
AX_SLICOT([matlab])
|
||||
test "$has_slicot" != yes && AC_MSG_ERROR([slicot cannot be found. If you want to skip the compilation of the kalman_steady_state MEX, pass the --disable-mex-kalman-steady-state flag.])
|
||||
fi
|
||||
|
||||
# On Windows, we want static linking of the external libraries
|
||||
case ${host_os} in
|
||||
|
@ -103,32 +115,7 @@ case ${host_os} in
|
|||
;;
|
||||
esac
|
||||
|
||||
AM_CONDITIONAL([DO_SOMETHING], [test "$ax_enable_matlab" = yes -a "$ax_matlab_version_ok" = yes -a "$ax_mexopts_ok" = yes])
|
||||
|
||||
if test "$ax_enable_matlab" = yes -a "$ax_matlab_version_ok" = yes -a "$ax_mexopts_ok" = yes; then
|
||||
BUILD_MEX_MATLAB="yes"
|
||||
else
|
||||
BUILD_MEX_MATLAB="no (missing MATLAB, or unknown version, or unknown architecture)"
|
||||
fi
|
||||
|
||||
if test "$ax_enable_matlab" = yes -a "$has_matio" = yes; then
|
||||
BUILD_GENSYLV_KORDER_DYNSIMUL_MEX_MATLAB="yes"
|
||||
else
|
||||
BUILD_GENSYLV_KORDER_DYNSIMUL_MEX_MATLAB="no (missing MatIO library)"
|
||||
fi
|
||||
|
||||
if test "$ax_enable_matlab" = yes -a "$ax_matlab_version_ok" = yes -a "$ax_mexopts_ok" = yes -a "$has_slicot" = yes; then
|
||||
BUILD_KALMAN_STEADY_STATE_MATLAB="yes"
|
||||
else
|
||||
BUILD_KALMAN_STEADY_STATE_MATLAB="no (missing SLICOT)"
|
||||
fi
|
||||
|
||||
if test "$ax_enable_matlab" = yes -a "$ax_matlab_version_ok" = yes -a "$ax_mexopts_ok" = yes -a "$has_gsl" = yes; then
|
||||
BUILD_MS_SBVAR_MEX_MATLAB="yes"
|
||||
else
|
||||
BUILD_MS_SBVAR_MEX_MATLAB="no (missing GSL)"
|
||||
fi
|
||||
|
||||
# Support for M2HTML
|
||||
AC_ARG_WITH([m2html], AS_HELP_STRING([--with-m2html=DIR], [specify installation directory of M2HTML]), [
|
||||
M2HTML=$withval
|
||||
BUILD_M2HTML=yes
|
||||
|
@ -139,12 +126,31 @@ BUILD_M2HTML=no
|
|||
AC_SUBST([M2HTML])
|
||||
AM_CONDITIONAL([HAVE_M2HTML], [test "x$M2HTML" != "x"])
|
||||
|
||||
# Construct final output message
|
||||
if test "$enable_mex_dynareplusplus" = yes; then
|
||||
BUILD_GENSYLV_KORDER_DYNSIMUL_MEX_MATLAB="yes"
|
||||
else
|
||||
BUILD_GENSYLV_KORDER_DYNSIMUL_MEX_MATLAB="no"
|
||||
fi
|
||||
|
||||
if test "$enable_mex_kalman_steady_state" = yes; then
|
||||
BUILD_KALMAN_STEADY_STATE_MATLAB="yes"
|
||||
else
|
||||
BUILD_KALMAN_STEADY_STATE_MATLAB="no"
|
||||
fi
|
||||
|
||||
if test "$enable_mex_ms_sbvar" = yes; then
|
||||
BUILD_MS_SBVAR_MEX_MATLAB="yes"
|
||||
else
|
||||
BUILD_MS_SBVAR_MEX_MATLAB="no"
|
||||
fi
|
||||
|
||||
AC_MSG_NOTICE([
|
||||
|
||||
Dynare is now configured for building the following components...
|
||||
|
||||
Binaries (with "make"):
|
||||
MEX files for MATLAB (except those listed below): $BUILD_MEX_MATLAB
|
||||
MEX files for MATLAB (except those listed below): yes
|
||||
Gensylv, k-order and dynare_simul MEX files for MATLAB: $BUILD_GENSYLV_KORDER_DYNSIMUL_MEX_MATLAB
|
||||
MS-SBVAR MEX files for MATLAB: $BUILD_MS_SBVAR_MEX_MATLAB
|
||||
Kalman Steady State MEX file for MATLAB: $BUILD_KALMAN_STEADY_STATE_MATLAB
|
||||
|
|
|
@ -1,24 +1,19 @@
|
|||
ACLOCAL_AMFLAGS = -I ../../../m4
|
||||
|
||||
if DO_SOMETHING
|
||||
SUBDIRS = mjdgges kronecker bytecode block_kalman_filter sobol local_state_space_iterations perfect_foresight_problem num_procs
|
||||
|
||||
# libdynare++ must come before gensylv, k_order_perturbation, dynare_simul_
|
||||
if HAVE_MATIO
|
||||
if ENABLE_MEX_DYNAREPLUSPLUS
|
||||
SUBDIRS += libdynare++ gensylv k_order_perturbation dynare_simul_
|
||||
endif
|
||||
|
||||
if HAVE_GSL
|
||||
if HAVE_MATIO
|
||||
if ENABLE_MEX_MS_SBVAR
|
||||
SUBDIRS += ms_sbvar
|
||||
endif
|
||||
endif
|
||||
|
||||
if HAVE_SLICOT
|
||||
if ENABLE_MEX_KALMAN_STEADY_STATE
|
||||
SUBDIRS += kalman_steady_state
|
||||
endif
|
||||
|
||||
install-exec-local:
|
||||
$(MKDIR_P) $(DESTDIR)$(pkglibdir)/mex/octave
|
||||
|
||||
endif
|
||||
|
|
|
@ -22,22 +22,18 @@ AC_INIT([dynare], [4.6-unstable])
|
|||
AC_CONFIG_SRCDIR([configure.ac])
|
||||
AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign])
|
||||
|
||||
AC_CHECK_PROG([MKOCTFILE], [mkoctfile], [mkoctfile])
|
||||
AC_CHECK_PROG([MKOCTFILE], [mkoctfile], [mkoctfile], [no])
|
||||
test "$MKOCTFILE" = no && AC_MSG_ERROR([Octave cannot be found])
|
||||
|
||||
if test -n "$MKOCTFILE"; then
|
||||
CC=$($MKOCTFILE -p CC)
|
||||
CXX=$($MKOCTFILE -p CXX)
|
||||
CFLAGS=$($MKOCTFILE -p CFLAGS)
|
||||
FFLAGS=$($MKOCTFILE -p FFLAGS)
|
||||
CXXFLAGS=$($MKOCTFILE -p CXXFLAGS)
|
||||
LDFLAGS="$($MKOCTFILE -p LFLAGS) $($MKOCTFILE -p LDFLAGS)"
|
||||
OCTAVE_VERSION=$($MKOCTFILE -v 2>&1 | sed 's/mkoctfile, version //')
|
||||
AX_COMPARE_VERSION([$OCTAVE_VERSION], [lt], [4.2], [AC_MSG_ERROR([Your Octave is too old, please upgrade to version 4.2 at least.])])
|
||||
fi
|
||||
CC=$($MKOCTFILE -p CC)
|
||||
CXX=$($MKOCTFILE -p CXX)
|
||||
CFLAGS="$($MKOCTFILE -p CFLAGS) -Wall -Wno-parentheses"
|
||||
FFLAGS="$($MKOCTFILE -p FFLAGS) -Wall"
|
||||
CXXFLAGS="$($MKOCTFILE -p CXXFLAGS) -Wall -Wno-parentheses -Wold-style-cast"
|
||||
LDFLAGS="$($MKOCTFILE -p LFLAGS) $($MKOCTFILE -p LDFLAGS)"
|
||||
|
||||
CFLAGS="$CFLAGS -Wall -Wno-parentheses"
|
||||
FFLAGS="$FFLAGS -Wall"
|
||||
CXXFLAGS="$CXXFLAGS -Wall -Wno-parentheses -Wold-style-cast"
|
||||
OCTAVE_VERSION=$($MKOCTFILE -v 2>&1 | sed 's/mkoctfile, version //')
|
||||
AX_COMPARE_VERSION([$OCTAVE_VERSION], [lt], [4.2], [AC_MSG_ERROR([Your Octave is too old, please upgrade to version 4.2 at least (or disable Octave support with --disable-octave).])])
|
||||
|
||||
AC_PROG_F77([gfortran g77 f77])
|
||||
AC_PROG_CC
|
||||
|
@ -54,46 +50,56 @@ AX_CXX11_THREAD
|
|||
# Check for dlopen(), needed by k_order_perturbation DLL
|
||||
AC_CHECK_LIB([dl], [dlopen], [LIBADD_DLOPEN="-ldl"], [])
|
||||
AC_SUBST([LIBADD_DLOPEN])
|
||||
|
||||
# Define optional components and their corresponding flags and Automake conditionals
|
||||
AC_ARG_ENABLE([mex-ms-sbvar], AS_HELP_STRING([--disable-mex-ms-sbvar], [disable compilation of the MS-SBVAR MEX]), [], [enable_mex_ms_sbvar=yes])
|
||||
AM_CONDITIONAL([ENABLE_MEX_MS_SBVAR], [test "$enable_mex_ms_sbvar" = yes])
|
||||
|
||||
AC_ARG_ENABLE([mex-dynare++], AS_HELP_STRING([--disable-mex-dynare++], [disable compilation of MEX based on Dynare++]), [], [enable_mex_dynareplusplus=yes])
|
||||
AM_CONDITIONAL([ENABLE_MEX_DYNAREPLUSPLUS], [test "$enable_mex_dynareplusplus" = yes])
|
||||
|
||||
AC_ARG_ENABLE([mex-kalman-steady-state], AS_HELP_STRING([--disable-mex-kalman-steady-state], [disable compilation of the kalman_steady_state MEX]), [], [enable_mex_kalman_steady_state=yes])
|
||||
AM_CONDITIONAL([ENABLE_MEX_KALMAN_STEADY_STATE], [test "$enable_mex_kalman_steady_state" = yes])
|
||||
|
||||
# Check for GSL, needed by MS-SBVAR
|
||||
AX_GSL
|
||||
AM_CONDITIONAL([HAVE_GSL], [test "$has_gsl" = yes])
|
||||
if test "$enable_mex_ms_sbvar" = yes; then
|
||||
AX_GSL
|
||||
test "$has_gsl" != yes && AC_MSG_ERROR([GSL cannot be found. If you want to skip the compilation of the MS-SBVAR MEX, pass the --disable-mex-ms-sbvar flag.])
|
||||
fi
|
||||
|
||||
# Check for libmatio, needed by MEX files using Dynare++ code, and by ms-sbvar (the latter only under Octave, as an alternative to MATLAB's libmat)
|
||||
AX_MATIO
|
||||
AM_CONDITIONAL([HAVE_MATIO], [test "$has_matio" = yes])
|
||||
if test "$enable_mex_dynareplusplus" = yes -o "$enable_mex_ms_sbvar" = yes; then
|
||||
AX_MATIO
|
||||
test "$has_matio" != yes && AC_MSG_ERROR([libmatio cannot be found. If you want to skip the compilation of MS-SBVAR MEX and MEX files based Dynare++, pass the --disable-mex-dynare++ and --disable-mex-ms-sbvar flags.])
|
||||
fi
|
||||
|
||||
# Check for libslicot, needed by kalman_steady_state
|
||||
AX_SLICOT([octave])
|
||||
AM_CONDITIONAL([HAVE_SLICOT], [test "$has_slicot" = yes])
|
||||
if test "$enable_mex_kalman_steady_state" = yes; then
|
||||
AX_SLICOT([octave])
|
||||
test "$has_slicot" != yes && AC_MSG_ERROR([slicot cannot be found. If you want to skip the compilation of the kalman_steady_state MEX, pass the --disable-mex-kalman-steady-state flag.])
|
||||
fi
|
||||
|
||||
# Check for UMFPACK, needed by bytecode
|
||||
AC_CHECK_LIB([umfpack], [umfpack_dl_defaults], [LIBADD_UMFPACK="-lumfpack"], [AC_MSG_ERROR([Can't find UMFPACK])])
|
||||
AC_SUBST([LIBADD_UMFPACK])
|
||||
|
||||
AM_CONDITIONAL([DO_SOMETHING], [test -n "$MKOCTFILE"])
|
||||
|
||||
if test -n "$MKOCTFILE"; then
|
||||
BUILD_MEX_OCTAVE="yes"
|
||||
# Construct final output message
|
||||
if test "$enable_mex_dynareplusplus" = yes; then
|
||||
BUILD_GENSYLV_KORDER_DYNSIMUL_MEX_OCTAVE="yes"
|
||||
else
|
||||
BUILD_MEX_OCTAVE="no (missing mkoctfile)"
|
||||
BUILD_GENSYLV_KORDER_DYNSIMUL_MEX_OCTAVE="no"
|
||||
fi
|
||||
|
||||
if test -n "$MKOCTFILE" -a "$has_matio" = yes; then
|
||||
BUILD_GENSYLV_KORDER_DYNSIMUL_MEX_OCTAVE="yes"
|
||||
else
|
||||
BUILD_GENSYLV_KORDER_DYNSIMUL_MEX_OCTAVE="no (missing MatIO library)"
|
||||
fi
|
||||
|
||||
if test -n "$MKOCTFILE" -a "$has_slicot" = yes; then
|
||||
if test "$enable_mex_kalman_steady_state" = yes; then
|
||||
BUILD_KALMAN_STEADY_STATE_OCTAVE="yes"
|
||||
else
|
||||
BUILD_KALMAN_STEADY_STATE_OCTAVE="no (missing SLICOT)"
|
||||
BUILD_KALMAN_STEADY_STATE_OCTAVE="no"
|
||||
fi
|
||||
|
||||
if test -n "$MKOCTFILE" -a "$has_gsl" = yes -a "$has_matio" = yes; then
|
||||
if test "$enable_mex_ms_sbvar" = yes; then
|
||||
BUILD_MS_SBVAR_MEX_OCTAVE="yes"
|
||||
else
|
||||
BUILD_MS_SBVAR_MEX_OCTAVE="no (missing GSL or MatIO library)"
|
||||
BUILD_MS_SBVAR_MEX_OCTAVE="no"
|
||||
fi
|
||||
|
||||
AC_MSG_NOTICE([
|
||||
|
@ -101,7 +107,7 @@ AC_MSG_NOTICE([
|
|||
Dynare is now configured for building the following components...
|
||||
|
||||
Binaries (with "make"):
|
||||
MEX files for Octave (except those listed below): $BUILD_MEX_OCTAVE
|
||||
MEX files for Octave (except those listed below): yes
|
||||
Gensylv, k-order and dynare_simul MEX for Octave: $BUILD_GENSYLV_KORDER_DYNSIMUL_MEX_OCTAVE
|
||||
MS-SBVAR MEX files for Octave: $BUILD_MS_SBVAR_MEX_OCTAVE
|
||||
Kalman Steady State MEX file for Octave: $BUILD_KALMAN_STEADY_STATE_OCTAVE
|
||||
|
|
|
@ -2618,7 +2618,7 @@ dynSparseMatrix::Sparse_substract_SA_SB(mxArray *A_m, mxArray *B_m)
|
|||
C_j[A_col+1] = nze_C++;
|
||||
C_col = A_col;
|
||||
}
|
||||
else if (A_row < B_row || (nze_B >= total_nze_B && nze_A < total_nze_A))
|
||||
else if ((A_row < B_row && nze_A < total_nze_A) || nze_B == total_nze_B)
|
||||
{
|
||||
C_d[nze_C] = A_d[nze_A++];
|
||||
C_i[nze_C] = A_row;
|
||||
|
@ -2637,7 +2637,7 @@ dynSparseMatrix::Sparse_substract_SA_SB(mxArray *A_m, mxArray *B_m)
|
|||
C_col = B_col;
|
||||
}
|
||||
}
|
||||
else if (A_col < B_col || (nze_B >= total_nze_B && nze_A < total_nze_A))
|
||||
else if ((A_col < B_col && nze_A < total_nze_A) || nze_B == total_nze_B)
|
||||
{
|
||||
C_d[nze_C] = A_d[nze_A++];
|
||||
C_i[nze_C] = A_row;
|
||||
|
|
|
@ -75,8 +75,8 @@ DynamicModelDllCaller::unload_dll()
|
|||
#endif
|
||||
}
|
||||
|
||||
DynamicModelDllCaller::DynamicModelDllCaller(size_t ntt, mwIndex nx, mwIndex ny, size_t ndynvars, const double *x_arg, size_t nb_row_x_arg, const double *params_arg, const double *steady_state_arg, bool compute_jacobian_arg) :
|
||||
DynamicModelCaller{compute_jacobian_arg},
|
||||
DynamicModelDllCaller::DynamicModelDllCaller(size_t ntt, mwIndex nx, mwIndex ny, size_t ndynvars, const double *x_arg, size_t nb_row_x_arg, const double *params_arg, const double *steady_state_arg, bool linear_arg, bool compute_jacobian_arg) :
|
||||
DynamicModelCaller{linear_arg, compute_jacobian_arg},
|
||||
nb_row_x{nb_row_x_arg}, x{x_arg}, params{params_arg}, steady_state{steady_state_arg}
|
||||
{
|
||||
tt = std::make_unique<double[]>(ntt);
|
||||
|
@ -94,11 +94,14 @@ DynamicModelDllCaller::eval(int it, double *resid)
|
|||
{
|
||||
g1_tt_fct(y_p.get(), x, nb_row_x, params, steady_state, it, tt.get());
|
||||
g1_fct(y_p.get(), x, nb_row_x, params, steady_state, it, tt.get(), jacobian_p.get());
|
||||
|
||||
if (linear)
|
||||
compute_jacobian = false; // If model is linear, no need to recompute Jacobian later
|
||||
}
|
||||
}
|
||||
|
||||
DynamicModelMatlabCaller::DynamicModelMatlabCaller(std::string basename_arg, size_t ntt, size_t ndynvars, const mxArray *x_mx_arg, const mxArray *params_mx_arg, const mxArray *steady_state_mx_arg, bool compute_jacobian_arg) :
|
||||
DynamicModelCaller{compute_jacobian_arg},
|
||||
DynamicModelMatlabCaller::DynamicModelMatlabCaller(std::string basename_arg, size_t ntt, size_t ndynvars, const mxArray *x_mx_arg, const mxArray *params_mx_arg, const mxArray *steady_state_mx_arg, bool linear_arg, bool compute_jacobian_arg) :
|
||||
DynamicModelCaller{linear_arg, compute_jacobian_arg},
|
||||
basename{std::move(basename_arg)},
|
||||
T_mx{mxCreateDoubleMatrix(ntt, 1, mxREAL)},
|
||||
y_mx{mxCreateDoubleMatrix(ndynvars, 1, mxREAL)},
|
||||
|
@ -178,6 +181,9 @@ DynamicModelMatlabCaller::eval(int it, double *resid)
|
|||
jacobian_mx = cmplxToReal(plhs[0]);
|
||||
else
|
||||
jacobian_mx = plhs[0];
|
||||
|
||||
if (linear)
|
||||
compute_jacobian = false; // If model is linear, no need to recompute Jacobian later
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,12 +33,13 @@
|
|||
class DynamicModelCaller
|
||||
{
|
||||
public:
|
||||
const bool compute_jacobian;
|
||||
const bool linear;
|
||||
bool compute_jacobian; // Not constant, because will be changed from true to false for linear models after first evaluation
|
||||
|
||||
// Used to store error messages (as exceptions cannot cross the OpenMP boundary)
|
||||
static std::string error_msg;
|
||||
|
||||
DynamicModelCaller(bool compute_jacobian_arg) : compute_jacobian{compute_jacobian_arg} {};
|
||||
DynamicModelCaller(bool linear_arg, bool compute_jacobian_arg) : linear{linear_arg}, compute_jacobian{compute_jacobian_arg} {};
|
||||
virtual ~DynamicModelCaller() = default;
|
||||
virtual double &y(size_t i) const = 0;
|
||||
virtual double jacobian(size_t i) const = 0;
|
||||
|
@ -62,7 +63,7 @@ private:
|
|||
std::unique_ptr<double[]> tt, y_p, jacobian_p;
|
||||
|
||||
public:
|
||||
DynamicModelDllCaller(size_t ntt, mwIndex nx, mwIndex ny, size_t ndynvars, const double *x_arg, size_t nb_row_x_arg, const double *params_arg, const double *steady_state_arg, bool compute_jacobian_arg);
|
||||
DynamicModelDllCaller(size_t ntt, mwIndex nx, mwIndex ny, size_t ndynvars, const double *x_arg, size_t nb_row_x_arg, const double *params_arg, const double *steady_state_arg, bool linear_arg, bool compute_jacobian_arg);
|
||||
virtual ~DynamicModelDllCaller() = default;
|
||||
double &y(size_t i) const override { return y_p[i]; };
|
||||
double jacobian(size_t i) const override { return jacobian_p[i]; };
|
||||
|
@ -82,7 +83,7 @@ private:
|
|||
Destroys the original matrix. */
|
||||
static mxArray *cmplxToReal(mxArray *m);
|
||||
public:
|
||||
DynamicModelMatlabCaller(std::string basename_arg, size_t ntt, size_t ndynvars, const mxArray *x_mx_arg, const mxArray *params_mx_arg, const mxArray *steady_state_mx_arg, bool compute_jacobian_arg);
|
||||
DynamicModelMatlabCaller(std::string basename_arg, size_t ntt, size_t ndynvars, const mxArray *x_mx_arg, const mxArray *params_mx_arg, const mxArray *steady_state_mx_arg, bool linear_arg, bool compute_jacobian_arg);
|
||||
~DynamicModelMatlabCaller() override;
|
||||
double &y(size_t i) const override { return mxGetPr(y_mx)[i]; };
|
||||
double jacobian(size_t i) const override { return jacobian_mx ? mxGetPr(jacobian_mx)[i] : std::numeric_limits<double>::quiet_NaN(); };
|
||||
|
|
|
@ -86,6 +86,11 @@ mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
|
|||
mexErrMsgTxt("options_.use_dll should be a logical scalar");
|
||||
bool use_dll = static_cast<bool>(mxGetScalar(use_dll_mx));
|
||||
|
||||
const mxArray *linear_mx = mxGetField(options_mx, 0, "linear");
|
||||
if (!(linear_mx && mxIsLogicalScalar(linear_mx)))
|
||||
mexErrMsgTxt("options_.linear should be a logical scalar");
|
||||
bool linear = static_cast<bool>(mxGetScalar(linear_mx));
|
||||
|
||||
const mxArray *threads_mx = mxGetField(options_mx, 0, "threads");
|
||||
if (!threads_mx)
|
||||
mexErrMsgTxt("Can't find field options_.threads");
|
||||
|
@ -211,9 +216,9 @@ mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
|
|||
// Allocate (thread-private) model evaluator (which allocates space for temporaries)
|
||||
std::unique_ptr<DynamicModelCaller> m;
|
||||
if (use_dll)
|
||||
m = std::make_unique<DynamicModelDllCaller>(ntt, nx, ny, ndynvars, exo_path, nb_row_x, params, steady_state, compute_jacobian);
|
||||
m = std::make_unique<DynamicModelDllCaller>(ntt, nx, ny, ndynvars, exo_path, nb_row_x, params, steady_state, linear, compute_jacobian);
|
||||
else
|
||||
m = std::make_unique<DynamicModelMatlabCaller>(basename, ntt, ndynvars, exo_path_mx, params_mx, steady_state_mx, compute_jacobian);
|
||||
m = std::make_unique<DynamicModelMatlabCaller>(basename, ntt, ndynvars, exo_path_mx, params_mx, steady_state_mx, linear, compute_jacobian);
|
||||
|
||||
// Main computing loop
|
||||
#pragma omp for
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit e3a3979eba816d3a24d28b1556cb34c7c815ca9d
|
||||
Subproject commit 23ff36a0dd4f5ee56f553d72849a79d320b2a456
|
|
@ -977,6 +977,7 @@ EXTRA_DIST = \
|
|||
block_bytecode/run_ls2003.m \
|
||||
bvar_a_la_sims/bvar_sample.m \
|
||||
dates/fsdat_simul.m \
|
||||
dates/data_uav.xls \
|
||||
dates/data_uav.xlsx \
|
||||
external_function/extFunDeriv.m \
|
||||
external_function/extFunNoDerivs.m \
|
||||
|
@ -986,6 +987,7 @@ EXTRA_DIST = \
|
|||
expectations/expectation_ss_old_steadystate.m \
|
||||
filter_step_ahead/trend_cycle_decomposition_data.m \
|
||||
steady_state/walsh1_old_ss_steadystate.m \
|
||||
data/test.xls \
|
||||
data/test.xlsx \
|
||||
gsa/morris/nk_est_data.m \
|
||||
analytic_derivatives/fsdat_simul.m \
|
||||
|
@ -1014,6 +1016,7 @@ EXTRA_DIST = \
|
|||
ms-sbvar/archive-files/specification_2v2c.dat \
|
||||
recursive/data_ca1.m \
|
||||
recursive/data_ca1_csv.csv \
|
||||
recursive/data_ca1_xls.xls \
|
||||
recursive/data_ca1_xls.xlsx \
|
||||
kalman_filter_smoother/fsdat_simul.m \
|
||||
kalman/lik_init/fs2000_common.inc \
|
||||
|
@ -1023,8 +1026,6 @@ EXTRA_DIST = \
|
|||
kalman/likelihood_from_dynare/fs2000_estimation_check.inc \
|
||||
kalman/likelihood_from_dynare/fs2000ns_model.inc \
|
||||
kalman/likelihood_from_dynare/fs2000ns_estimation_check.inc \
|
||||
identification/kim/kim2_steadystate.m \
|
||||
identification/as2007/as2007_steadystate.m \
|
||||
estimation/fsdat_simul.m \
|
||||
ep/mean_preserving_spread.m \
|
||||
decision_rules/example1_results_dyn_432.mat \
|
||||
|
@ -1075,11 +1076,11 @@ EXTRA_DIST = \
|
|||
ecb/aggregate/3/parameter-values.inc \
|
||||
ecb/aggregate/3/model.inc
|
||||
|
||||
if HAVE_MATLAB
|
||||
if ENABLE_MATLAB
|
||||
check-local: check-matlab
|
||||
endif
|
||||
|
||||
if HAVE_OCTAVE
|
||||
if ENABLE_OCTAVE
|
||||
check-local: check-octave
|
||||
endif
|
||||
|
||||
|
|
|
@ -21,10 +21,21 @@ end;
|
|||
verbatim;
|
||||
|
||||
bgp.write(M_);
|
||||
options = optimoptions('fsolve','Display','iter','Algorithm','levenberg-marquardt','MaxFunctionEvaluations',1000000,'MaxIterations',100000,'SpecifyObjectiveGradient',true,'FunctionTolerance',1e-8,'StepTolerance',1e-8);
|
||||
if isoctave || matlab_ver_less_than('8.1')
|
||||
options = optimset('Display', 'iter', 'MaxFunEvals', 1000000,'MaxIter',100000,'Jacobian','on','TolFun',1e-8,'TolX',1e-8);
|
||||
else
|
||||
options = optimoptions('fsolve','Display','iter','Algorithm','levenberg-marquardt','MaxFunctionEvaluations',1000000,'MaxIterations',100000,'SpecifyObjectiveGradient',true,'FunctionTolerance',1e-8,'StepTolerance',1e-8);
|
||||
end
|
||||
if isoctave
|
||||
% Octave can't take a function handle of a function in a package
|
||||
% See https://savannah.gnu.org/bugs/index.php?46659
|
||||
fun = str2func('nk.bgpfun');
|
||||
else
|
||||
fun = @nk.bgpfun;
|
||||
end
|
||||
y = 1+(rand(3,1)-.5)*.5;
|
||||
g = 1+(rand(3,1)-.5)*.1;
|
||||
[y, fval, exitflag] = fsolve(@nk.bgpfun, [y;g], options);
|
||||
[y, fval, exitflag] = fsolve(fun, [y;g], options);
|
||||
assert(max(abs(y-1))<1e-9);
|
||||
|
||||
end;
|
||||
end;
|
||||
|
|
|
@ -16,10 +16,21 @@ end;
|
|||
verbatim;
|
||||
|
||||
bgp.write(M_);
|
||||
options = optimoptions('fsolve','Display','iter','Algorithm','levenberg-marquardt','MaxFunctionEvaluations',1000000,'MaxIterations',100000,'SpecifyObjectiveGradient',true,'FunctionTolerance',1e-6,'StepTolerance',1e-6);
|
||||
if isoctave || matlab_ver_less_than('8.1')
|
||||
options = optimset('Display', 'iter', 'MaxFunEvals', 1000000,'MaxIter',100000,'Jacobian','on','TolFun',1e-6,'TolX',1e-6);
|
||||
else
|
||||
options = optimoptions('fsolve','Display','iter','Algorithm','levenberg-marquardt','MaxFunctionEvaluations',1000000,'MaxIterations',100000,'SpecifyObjectiveGradient',true,'FunctionTolerance',1e-6,'StepTolerance',1e-6);
|
||||
end
|
||||
if isoctave
|
||||
% Octave can't take a function handle of a function in a package
|
||||
% See https://savannah.gnu.org/bugs/index.php?46659
|
||||
fun = str2func('ramsey.bgpfun');
|
||||
else
|
||||
fun = @ramsey.bgpfun;
|
||||
end
|
||||
y = 1+(rand(M_.endo_nbr,1)-.5)*.5;
|
||||
g = ones(M_.endo_nbr,1);% 1+(rand(M_.endo_nbr,1)-.5)*.1;
|
||||
[y, fval, exitflag] = fsolve(@ramsey.bgpfun, [y;g], options);
|
||||
[y, fval, exitflag] = fsolve(fun, [y;g], options);
|
||||
assert(max(abs(y(M_.endo_nbr+(1:M_.orig_endo_nbr))-1.02))<1e-6)
|
||||
|
||||
end;
|
||||
|
|
|
@ -45,13 +45,16 @@ verbatim;
|
|||
GY = NaN(MC,1);
|
||||
GK = NaN(MC,1);
|
||||
EG = NaN(MC,1);
|
||||
if isoctave
|
||||
if isoctave || matlab_ver_less_than('8.1')
|
||||
options = optimset('Display', 'off', 'MaxFunEvals', 1000000,'MaxIter',100000,'Jacobian','on','TolFun',1e-8,'TolX',1e-8);
|
||||
else
|
||||
options = optimoptions('fsolve','Display','off','Algorithm','levenberg-marquardt','MaxFunctionEvaluations',1000000,'MaxIterations',100000,'SpecifyObjectiveGradient',true,'FunctionTolerance',1e-8,'StepTolerance',1e-8);
|
||||
end
|
||||
if isoctave
|
||||
% Octave can't take a function handle of a function in a package
|
||||
% See https://savannah.gnu.org/bugs/index.php?46659
|
||||
fun = str2func('solow.bgpfun');
|
||||
else
|
||||
options = optimoptions('fsolve','Display','off','Algorithm','levenberg-marquardt','MaxFunctionEvaluations',1000000,'MaxIterations',100000,'SpecifyObjectiveGradient',true,'FunctionTolerance',1e-8,'StepTolerance',1e-8);
|
||||
fun = @solow.bgpfun;
|
||||
end
|
||||
for i=1:MC
|
||||
|
|
|
@ -120,25 +120,16 @@ end;
|
|||
|
||||
conditional_forecast(parameter_set=prior_mode, controlled_varexo=(e_a,e_m));
|
||||
|
||||
if ~(exist('OCTAVE_VERSION') && octave_ver_less_than('3.4.0'))
|
||||
plot_conditional_forecast(periods=10) gy_obs gp_obs;
|
||||
end
|
||||
|
||||
conditional_forecast(parameter_set=posterior_mode, controlled_varexo=(e_a,e_m));
|
||||
|
||||
if ~(exist('OCTAVE_VERSION') && octave_ver_less_than('3.4.0'))
|
||||
plot_conditional_forecast(periods=10) gy_obs gp_obs;
|
||||
end
|
||||
|
||||
conditional_forecast(parameter_set=posterior_mean, controlled_varexo=(e_a,e_m));
|
||||
|
||||
if ~(exist('OCTAVE_VERSION') && octave_ver_less_than('3.4.0'))
|
||||
plot_conditional_forecast(periods=10) gy_obs gp_obs;
|
||||
end
|
||||
|
||||
conditional_forecast(parameter_set=posterior_median, controlled_varexo=(e_a,e_m));
|
||||
|
||||
if ~(exist('OCTAVE_VERSION') && octave_ver_less_than('3.4.0'))
|
||||
plot_conditional_forecast(periods=10) gy_obs gp_obs;
|
||||
end
|
||||
|
||||
|
|
|
@ -85,8 +85,8 @@ plot_conditional_forecast(periods=100) gy_obs gp_obs k;
|
|||
forecast(periods=100);
|
||||
|
||||
%compare unconditional forecasts
|
||||
cond_forecast=load('conditional_forecasts.mat');
|
||||
if max(abs(cond_forecast.forecasts.uncond.Mean.k(2:end)-oo_.forecast.Mean.k))>1e-8
|
||||
cond_forecast=oo_.conditional_forecast;
|
||||
if max(abs(cond_forecast.uncond.Mean.k(2:end)-oo_.forecast.Mean.k))>1e-8
|
||||
error('Unconditional Forecasts do not match')
|
||||
end
|
||||
|
||||
|
@ -94,11 +94,11 @@ end
|
|||
%conditions need to be set with histval;
|
||||
initial_condition_states = oo_.dr.ys;
|
||||
shock_matrix = zeros(options_cond_fcst_.periods ,M_.exo_nbr); %create shock matrix with found controlled shocks
|
||||
shock_matrix(1:5,strmatch('e_a',M_.exo_names,'exact')) = cond_forecast.forecasts.controlled_exo_variables.Mean.e_a; %set controlled shocks to their values
|
||||
shock_matrix(1:5,strmatch('e_m',M_.exo_names,'exact')) = cond_forecast.forecasts.controlled_exo_variables.Mean.e_m; %set controlled shocks to their values
|
||||
shock_matrix(1:5,strmatch('e_a',M_.exo_names,'exact')) = cond_forecast.controlled_exo_variables.Mean.e_a; %set controlled shocks to their values
|
||||
shock_matrix(1:5,strmatch('e_m',M_.exo_names,'exact')) = cond_forecast.controlled_exo_variables.Mean.e_m; %set controlled shocks to their values
|
||||
|
||||
y_simult = simult_(M_,options_,initial_condition_states,oo_.dr,shock_matrix,1);
|
||||
|
||||
if max(abs(y_simult(strmatch('k',M_.endo_names,'exact'),:)'-cond_forecast.forecasts.cond.Mean.k))>1e-8
|
||||
if max(abs(y_simult(strmatch('k',M_.endo_names,'exact'),:)'-cond_forecast.cond.Mean.k))>1e-8
|
||||
error('Unconditional Forecasts do not match')
|
||||
end
|
||||
|
|
|
@ -86,8 +86,8 @@ plot_conditional_forecast(periods=100) gy_obs gp_obs k;
|
|||
forecast(periods=100);
|
||||
|
||||
%compare unconditional forecasts
|
||||
cond_forecast=load('conditional_forecasts.mat');
|
||||
if max(abs(cond_forecast.forecasts.uncond.Mean.k(2:end)-oo_.forecast.Mean.k))>1e-8
|
||||
cond_forecast=oo_.conditional_forecast;
|
||||
if max(abs(cond_forecast.uncond.Mean.k(2:end)-oo_.forecast.Mean.k))>1e-8
|
||||
error('Unconditional Forecasts do not match')
|
||||
end
|
||||
|
||||
|
@ -95,11 +95,11 @@ end
|
|||
initial_condition_states = oo_.dr.ys;
|
||||
initial_condition_states(strmatch('k',M_.endo_names,'exact')) = 6;
|
||||
shock_matrix = zeros(options_cond_fcst_.periods ,M_.exo_nbr); %create shock matrix with found controlled shocks
|
||||
shock_matrix(1:5,strmatch('e_a',M_.exo_names,'exact')) = cond_forecast.forecasts.controlled_exo_variables.Mean.e_a; %set controlled shocks to their values
|
||||
shock_matrix(1:5,strmatch('e_m',M_.exo_names,'exact')) = cond_forecast.forecasts.controlled_exo_variables.Mean.e_m; %set controlled shocks to their values
|
||||
shock_matrix(1:5,strmatch('e_a',M_.exo_names,'exact')) = cond_forecast.controlled_exo_variables.Mean.e_a; %set controlled shocks to their values
|
||||
shock_matrix(1:5,strmatch('e_m',M_.exo_names,'exact')) = cond_forecast.controlled_exo_variables.Mean.e_m; %set controlled shocks to their values
|
||||
|
||||
y_simult = simult_(M_,options_,initial_condition_states,oo_.dr,shock_matrix,1);
|
||||
|
||||
if max(abs(y_simult(strmatch('k',M_.endo_names,'exact'),:)'-cond_forecast.forecasts.cond.Mean.k))>1e-8
|
||||
if max(abs(y_simult(strmatch('k',M_.endo_names,'exact'),:)'-cond_forecast.cond.Mean.k))>1e-8
|
||||
error('Unconditional Forecasts do not match')
|
||||
end
|
||||
|
|
|
@ -76,7 +76,7 @@ for i=1:nvar
|
|||
SubsetOfVariables(i) = i_tmp;
|
||||
end
|
||||
|
||||
if isoctave
|
||||
if isoctave || matlab_ver_less_than('8.1')
|
||||
[observable_pos,index_observables,index_subset]=intersect_stable(SubsetOfVariables,options_.varobs_id);
|
||||
else
|
||||
[observable_pos,index_observables,index_subset]=intersect(SubsetOfVariables,options_.varobs_id,'stable');
|
||||
|
@ -114,7 +114,7 @@ if max(abs(sum(oo_.variance_decomposition,2)-100))>2
|
|||
error(['Variance decomposition at order ',num2str(options_.order),' does not work'])
|
||||
end
|
||||
|
||||
if isoctave
|
||||
if isoctave || matlab_ver_less_than('8.1')
|
||||
[observable_pos,index_observables,index_subset]=intersect_stable(SubsetOfVariables,options_.varobs_id);
|
||||
else
|
||||
[observable_pos,index_observables,index_subset]=intersect(SubsetOfVariables,options_.varobs_id,'stable');
|
||||
|
|
|
@ -20,4 +20,8 @@ end;
|
|||
|
||||
varobs dx dy;
|
||||
check;
|
||||
if isoctave || ~matlab_ver_less_than('7.14') % xlsread is able to read XLSX without Excel installed since R2012a
|
||||
estimation(datafile='test.xlsx',nobs=1000,mh_replic=2000,mh_jscale=1.3);
|
||||
else
|
||||
estimation(datafile='test.xls',nobs=1000,mh_replic=2000,mh_jscale=1.3);
|
||||
end
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -41,9 +41,17 @@ varobs log_nn;
|
|||
|
||||
%reading Excel sheet from column A on creates quarterly dseries starting in
|
||||
%1950
|
||||
estimation(first_obs=2,datafile=data_uav, xls_sheet=Tabelle1, xls_range=a1:b54, mh_replic=2, mh_nblocks=1, mh_jscale=1.1, mh_drop=0.8, plot_priors=0, smoother) log_nn nn hh ;
|
||||
if isoctave || ~matlab_ver_less_than('7.14') % xlsread is able to read XLSX without Excel installed since R2012a
|
||||
estimation(first_obs=2,datafile='data_uav.xlsx', xls_sheet=Tabelle1, xls_range=a1:b54, mh_replic=2, mh_nblocks=1, mh_jscale=1.1, mh_drop=0.8, plot_priors=0, smoother) log_nn nn hh ;
|
||||
else
|
||||
estimation(first_obs=2,datafile='data_uav.xls', xls_sheet=Tabelle1, xls_range=a1:b54, mh_replic=2, mh_nblocks=1, mh_jscale=1.1, mh_drop=0.8, plot_priors=0, smoother) log_nn nn hh ;
|
||||
end
|
||||
shock_decomposition( parameter_set=posterior_median ) nn hh;
|
||||
|
||||
%reading Excel sheet from column B on creates annual dseries starting with 1
|
||||
estimation(first_obs=2,datafile=data_uav, xls_sheet=Tabelle1, xls_range=b1:b54, mh_replic=2, mh_nblocks=1, mh_jscale=1.1, mh_drop=0.8, plot_priors=0, smoother) log_nn nn hh ;
|
||||
if isoctave || ~matlab_ver_less_than('7.14') % xlsread is able to read XLSX without Excel installed since R2012a
|
||||
estimation(first_obs=2,datafile='data_uav.xlsx', xls_sheet=Tabelle1, xls_range=b1:b54, mh_replic=2, mh_nblocks=1, mh_jscale=1.1, mh_drop=0.8, plot_priors=0, smoother) log_nn nn hh ;
|
||||
else
|
||||
estimation(first_obs=2,datafile='data_uav.xls', xls_sheet=Tabelle1, xls_range=b1:b54, mh_replic=2, mh_nblocks=1, mh_jscale=1.1, mh_drop=0.8, plot_priors=0, smoother) log_nn nn hh ;
|
||||
end
|
||||
shock_decomposition( parameter_set=posterior_median ) nn hh;
|
||||
|
|
|
@ -27,8 +27,7 @@ end;
|
|||
check;
|
||||
|
||||
// Deterministic simulation of the model for 200 periods
|
||||
options_.solve_tolf=1e-12;
|
||||
simul(periods=100);
|
||||
simul(periods=100, tolf=1e-12);
|
||||
|
||||
if ~oo_.deterministic_simulation.status
|
||||
error('Perfect foresight simulation failed')
|
||||
|
|
|
@ -6,7 +6,7 @@ rho_1=0.2;
|
|||
rho_2=0.1;
|
||||
|
||||
// Equilibrium conditions
|
||||
model;
|
||||
model(linear);
|
||||
y_backward=rho_1*y_backward(-1)+rho_2*y_backward(-2);
|
||||
dummy_var=0.9*dummy_var(+1);
|
||||
end;
|
||||
|
@ -29,8 +29,7 @@ end;
|
|||
check;
|
||||
|
||||
// Deterministic simulation of the model for 200 periods
|
||||
options_.solve_tolf=1e-12;
|
||||
simul(periods=100);
|
||||
simul(periods=100, tolf=1e-12);
|
||||
|
||||
if ~oo_.deterministic_simulation.status
|
||||
error('Perfect foresight simulation failed')
|
||||
|
|
|
@ -29,6 +29,11 @@ shocks;
|
|||
var EfficiencyInnovation = 1;
|
||||
end;
|
||||
|
||||
steady_state_model;
|
||||
efficiency=0;
|
||||
Efficiency=effstar;
|
||||
end;
|
||||
|
||||
steady;
|
||||
|
||||
options_.ep.stochastic.order = 0;
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
function [ys, info] = ar_steadystate(ys, exogenous)
|
||||
% Steady state routine for ar.mod (First order autoregressive process)
|
||||
|
||||
global M_
|
||||
|
||||
info = 0;
|
||||
|
||||
ys(1)=M_.params(2);
|
||||
ys(2)=0;
|
|
@ -214,5 +214,9 @@ stoch_simul;
|
|||
@#error "Range error"
|
||||
@#endif
|
||||
|
||||
@#if (bool)"FaLse" || !(bool)"TRUE" || (bool)"0" || !(bool)"-3"
|
||||
@#error "Error in cast of string to bool"
|
||||
@#endif
|
||||
|
||||
@#echomacrovars(save)
|
||||
@#echomacrovars
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
function [ys_, check_] = expectation_ss_old_steadystate(ys_orig_, exo_)
|
||||
function [ys_, params, check_] = expectation_ss_old_steadystate(ys_orig_, exo_,M_,options_)
|
||||
ys_=zeros(6,1);
|
||||
global M_
|
||||
params=NaN(size(M_.params));
|
||||
params=M_.params;
|
||||
ys_(4)=0;
|
||||
ys_(6)=0;
|
||||
ys_(5)=0.3333333333333333;
|
||||
ys_(3)=((1/M_.params(1)-(1-M_.params(4)))/(M_.params(3)*ys_(5)^(1-M_.params(3))))^(1/(M_.params(3)-1));
|
||||
ys_(1)=ys_(5)^(1-M_.params(3))*ys_(3)^M_.params(3);
|
||||
ys_(2)=ys_(1)-M_.params(4)*ys_(3);
|
||||
M_.params(5)=(1-M_.params(3))*ys_(1)/(ys_(2)*ys_(5)^(1+M_.params(6)));
|
||||
params(5)=(1-M_.params(3))*ys_(1)/(ys_(2)*ys_(5)^(1+M_.params(6)));
|
||||
check_=0;
|
||||
end
|
||||
|
|
|
@ -30,6 +30,17 @@ INFL = pi_steady+400*pie;
|
|||
INT = pi_steady+rr_steady+4*gam_steady+400*R;
|
||||
end;
|
||||
|
||||
steady_state_model;
|
||||
pie=0;
|
||||
y=0;
|
||||
R=0;
|
||||
g=0;
|
||||
z=0;
|
||||
YGR=gam_steady;
|
||||
INFL = pi_steady;
|
||||
INT = pi_steady+rr_steady+4*gam_steady;
|
||||
end;
|
||||
|
||||
estimated_params;
|
||||
tau, gamma_pdf, 2, 0.5;
|
||||
kap, beta_pdf, 0.2, 0.1;
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
function [ys,check1]=as2007_steadystate(ys,exo)
|
||||
|
||||
global M_
|
||||
|
||||
for j=1:length(M_.param_names)
|
||||
eval([M_.param_names{j},' = M_.params(j);'])
|
||||
assignin('base', M_.param_names{j} , M_.params(j));
|
||||
end
|
||||
for j=1:length(M_.endo_names)
|
||||
eval([M_.endo_names{j},' = NaN;'])
|
||||
end
|
||||
|
||||
check1=0;
|
||||
|
||||
pie=0;
|
||||
y=0;
|
||||
R=0;
|
||||
g=0;
|
||||
z=0;
|
||||
YGR=gam_steady;
|
||||
INFL = pi_steady;
|
||||
INT = pi_steady+rr_steady+4*gam_steady;
|
||||
|
||||
%% end own model equations
|
||||
|
||||
for iter = 1:length(M_.params) %update parameters set in the file
|
||||
eval([ 'M_.params(' num2str(iter) ') = ' M_.param_names{iter} ';' ])
|
||||
end
|
||||
|
||||
NumberOfEndogenousVariables = M_.orig_endo_nbr; %auxiliary variables are set automatically
|
||||
for ii = 1:NumberOfEndogenousVariables
|
||||
varname = M_.endo_names{ii};
|
||||
eval(['ys(' int2str(ii) ') = ' varname ';']);
|
||||
end
|
|
@ -33,6 +33,15 @@ lam = (1-(betae*delta*alph/(1-betae+delta*betae)))^theta/c^(1+theta)/(1+theta);
|
|||
//cobs = c+ec;
|
||||
end;
|
||||
|
||||
steady_state_model;
|
||||
s=betae*delta*alph/(1-betae+delta*betae);
|
||||
a=as; %as^((1-alph)/(1+theta))*(delta^((phi+theta+1)/(theta+1))/s)^alph;
|
||||
k=(delta/s/a)^(1/(alph-1));
|
||||
i=delta*k;
|
||||
c=(((a*k^alph)^(1+theta)-s*(i/s)^(1+theta))/(1-s))^(1/(1+theta))*(1-s);
|
||||
lam = (1-s)^theta/c^(1+theta)/(1+theta);
|
||||
end;
|
||||
|
||||
steady;
|
||||
check;
|
||||
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
function [ys,check1]=kim2_steadystate(ys,exo)
|
||||
|
||||
global M_
|
||||
|
||||
for j=1:length(M_.param_names)
|
||||
eval([M_.param_names{j}, ' = M_.params(j);'])
|
||||
assignin('base', M_.param_names{j}, M_.params(j));
|
||||
end
|
||||
for j=1:length(M_.endo_names)
|
||||
eval([M_.endo_names{j}, ' = NaN;'])
|
||||
end
|
||||
|
||||
check1=0;
|
||||
|
||||
s=betae*delta*alph/(1-betae+delta*betae);
|
||||
a=as; %as^((1-alph)/(1+theta))*(delta^((phi+theta+1)/(theta+1))/s)^alph;
|
||||
k=(delta/s/a)^(1/(alph-1));
|
||||
i=delta*k;
|
||||
c=(((a*k^alph)^(1+theta)-s*(i/s)^(1+theta))/(1-s))^(1/(1+theta))*(1-s);
|
||||
lam = (1-s)^theta/c^(1+theta)/(1+theta);
|
||||
|
||||
%% end own model equations
|
||||
|
||||
for iter = 1:length(M_.params) %update parameters set in the file
|
||||
eval([ 'M_.params(' num2str(iter) ') = ' M_.param_names{iter} ';' ])
|
||||
end
|
||||
|
||||
NumberOfEndogenousVariables = M_.orig_endo_nbr; %auxiliary variables are set automatically
|
||||
for ii = 1:NumberOfEndogenousVariables
|
||||
varname = M_.endo_names{ii};
|
||||
eval(['ys(' int2str(ii) ') = ' varname ';']);
|
||||
end
|
|
@ -77,6 +77,5 @@ end;
|
|||
conditional_forecast(parameter_set=calibration, controlled_varexo=(u,e));
|
||||
|
||||
oo_exp=oo_;
|
||||
load('conditional_forecasts.mat')
|
||||
conditional_forecasts_exp=forecasts;
|
||||
conditional_forecasts_exp=oo_.conditional_forecast;
|
||||
save results_exp.mat oo_exp conditional_forecasts_exp
|
|
@ -85,8 +85,7 @@ end;
|
|||
conditional_forecast(parameter_set=calibration, controlled_varexo=(u,e));
|
||||
|
||||
oo_exp=oo_;
|
||||
load('conditional_forecasts.mat')
|
||||
conditional_forecasts_exp=forecasts;
|
||||
conditional_forecasts_exp=oo_.conditional_forecast;
|
||||
|
||||
oo_exp=oo_;
|
||||
save results_exp_histval.mat oo_exp conditional_forecasts_exp
|
||||
|
|
|
@ -118,7 +118,7 @@ if max(max(abs(struct2array(oo_.forecast.Mean)-struct2array(oo_exp.forecast.Mean
|
|||
error('Option loglinear wrong, forecast not equal')
|
||||
end
|
||||
|
||||
load('conditional_forecasts.mat')
|
||||
forecasts=oo_.conditional_forecast;
|
||||
|
||||
if max(max(abs(struct2array(forecasts.cond.Mean)-struct2array(conditional_forecasts_exp.cond.Mean))))>1e-10 || ...
|
||||
max(max(abs(struct2array(forecasts.cond.ci)-struct2array(conditional_forecasts_exp.cond.ci))))>1e-10 || ...
|
||||
|
|
|
@ -114,7 +114,7 @@ end;
|
|||
conditional_forecast(parameter_set=calibration, controlled_varexo=(u,e));
|
||||
|
||||
|
||||
load('conditional_forecasts.mat')
|
||||
forecasts=oo_.conditional_forecast;
|
||||
|
||||
if max(max(abs(struct2array(forecasts.cond.Mean)-struct2array(conditional_forecasts_exp.cond.Mean))))>1e-10 || ...
|
||||
max(max(abs(struct2array(forecasts.cond.ci)-struct2array(conditional_forecasts_exp.cond.ci))))>1e-10 || ...
|
||||
|
|
|
@ -12,8 +12,8 @@ conditional_forecast(periods=100,parameter_set=posterior_mode,replic=1000, contr
|
|||
plot_conditional_forecast(periods=100) Y_obs P_obs;
|
||||
|
||||
%compare unconditional forecasts
|
||||
cond_forecast=load('conditional_forecasts.mat');
|
||||
if max(abs(cond_forecast.forecasts.uncond.Mean.P_obs(2:end)-oo_.forecast.Mean.P_obs))>1e-8
|
||||
cond_forecast=oo_.conditional_forecast;
|
||||
if max(abs(cond_forecast.uncond.Mean.P_obs(2:end)-oo_.forecast.Mean.P_obs))>1e-8
|
||||
error('Unconditional Forecasts do not match')
|
||||
end
|
||||
|
||||
|
@ -24,16 +24,16 @@ initial_condition_states(strmatch('P_obs',M_.endo_names,'exact')) = oo_.Smoothed
|
|||
initial_condition_states(strmatch('junk1',M_.endo_names,'exact')) = oo_.SmoothedVariables.junk1(end);
|
||||
initial_condition_states(strmatch('junk2',M_.endo_names,'exact')) = oo_.SmoothedVariables.junk2(end)-oo_.Smoother.Trend.junk2(end);
|
||||
shock_matrix = zeros(options_cond_fcst_.periods ,M_.exo_nbr); %create shock matrix with found controlled shocks
|
||||
shock_matrix(1:5,strmatch('e_y',M_.exo_names,'exact')) = cond_forecast.forecasts.controlled_exo_variables.Mean.e_y; %set controlled shocks to their values
|
||||
shock_matrix(1:5,strmatch('e_p',M_.exo_names,'exact')) = cond_forecast.forecasts.controlled_exo_variables.Mean.e_p; %set controlled shocks to their values
|
||||
shock_matrix(1:5,strmatch('e_y',M_.exo_names,'exact')) = cond_forecast.controlled_exo_variables.Mean.e_y; %set controlled shocks to their values
|
||||
shock_matrix(1:5,strmatch('e_p',M_.exo_names,'exact')) = cond_forecast.controlled_exo_variables.Mean.e_p; %set controlled shocks to their values
|
||||
|
||||
y_simult = simult_(M_,options_,initial_condition_states,oo_.dr,shock_matrix,1);
|
||||
|
||||
if max(abs(y_simult(strmatch('Y_obs',M_.endo_names,'exact'),:)'+(options_.first_obs-1+options_.nobs:options_.first_obs-1+options_.nobs+options_.forecast)'*g_y-cond_forecast.forecasts.cond.Mean.Y_obs))>1e-8
|
||||
if max(abs(y_simult(strmatch('Y_obs',M_.endo_names,'exact'),:)'+(options_.first_obs-1+options_.nobs:options_.first_obs-1+options_.nobs+options_.forecast)'*g_y-cond_forecast.cond.Mean.Y_obs))>1e-8
|
||||
error('Conditional Forecasts do not match')
|
||||
end
|
||||
|
||||
if max(abs(y_simult(strmatch('P_obs',M_.endo_names,'exact'),:)'+(options_.first_obs-1+options_.nobs:options_.first_obs-1+options_.nobs+options_.forecast)'*g_p-cond_forecast.forecasts.cond.Mean.P_obs))>1e-8
|
||||
if max(abs(y_simult(strmatch('P_obs',M_.endo_names,'exact'),:)'+(options_.first_obs-1+options_.nobs:options_.first_obs-1+options_.nobs+options_.forecast)'*g_p-cond_forecast.cond.Mean.P_obs))>1e-8
|
||||
error('Conditional Forecasts do not match')
|
||||
end
|
||||
|
||||
|
|
Binary file not shown.
|
@ -61,4 +61,8 @@ stderr e_ys,inv_gamma_pdf,1.2533,0.6551;
|
|||
stderr e_pies,inv_gamma_pdf,1.88,0.9827;
|
||||
end;
|
||||
|
||||
estimation(datafile=data_ca1_xls,first_obs=8,nobs=[76 79],mh_nblocks=1,prefilter=1,mh_jscale=0.5,mh_replic=2000,forecast=8) y_obs R_obs pie_obs dq de;
|
||||
if isoctave || ~matlab_ver_less_than('7.14') % xlsread is able to read XLSX without Excel installed since R2012a
|
||||
estimation(datafile='data_ca1_xls.xlsx',first_obs=8,nobs=[76 79],mh_nblocks=1,prefilter=1,mh_jscale=0.5,mh_replic=2000,forecast=8) y_obs R_obs pie_obs dq de;
|
||||
else
|
||||
estimation(datafile='data_ca1_xls.xls',first_obs=8,nobs=[76 79],mh_nblocks=1,prefilter=1,mh_jscale=0.5,mh_replic=2000,forecast=8) y_obs R_obs pie_obs dq de;
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
function runDynareReport(dc_a, dc_q, db_a, db_q)
|
||||
% Copyright (C) 2013-2018 Dynare Team
|
||||
% Copyright (C) 2013-2019 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
|
@ -32,7 +32,7 @@ longNames = {'Coca Cola', 'Kinder Bueno', 'Pizza', ...
|
|||
'Vegetarianism Is Good', 'OS X', 'Dothraki'};
|
||||
|
||||
%% Begin Report
|
||||
rep = report();
|
||||
rep = report('title', 'Report Title', 'maketoc', true);
|
||||
|
||||
|
||||
%% Page 1: GDP
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue