Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • giovanma/dynare
  • giorgiomas/dynare
  • Vermandel/dynare
  • Dynare/dynare
  • normann/dynare
  • MichelJuillard/dynare
  • wmutschl/dynare
  • FerhatMihoubi/dynare
  • sebastien/dynare
  • lnsongxf/dynare
  • rattoma/dynare
  • CIMERS/dynare
  • FredericKarame/dynare
  • SumuduK/dynare
  • MinjeJeon/dynare
  • camilomrch/dynare
  • DoraK/dynare
  • avtishin/dynare
  • selma/dynare
  • claudio_olguin/dynare
  • jeffjiang07/dynare
  • EthanSystem/dynare
  • stepan-a/dynare
  • wjgatt/dynare
  • JohannesPfeifer/dynare
  • gboehl/dynare
  • chskcau/dynare-doc-fixes
27 results
Select Git revision
Show changes
source_dir = getenv('source_root');
addpath([source_dir filesep 'matlab']);
dynare_config;
testFailed = 0;
skipline()
disp('*** TESTING: riccatiupdate.m ***');
t0 = clock;
% Set the number of experiments for time measurement
N = 5000;
% Set the dimension of the problem to be solved.
r = 50;
n = 100;
tol = 1e-15;
% Set the input arguments
% P, Q: use the fact that for any real matrix A, A'*A is positive semidefinite
P = rand(n,r);
P = P'*P;
Q = rand(n,r);
Q = Q'*Q;
K = rand(r,n);
Z = rand(n,r);
T = rand(r,r);
% Computing an upperbound for the norm the updated variance-covariance matrix
ub = norm(T,1)^2*norm(P,1)*(1+norm(K*Z,1))+norm(Q,1);
% Weighting the P and Q matrices to keep the norm of the variance-covariance matrix below 1
P = 0.5*P/ub;
Q = 0.5*Q/ub;
% 1. Update the state vairance-covariance matrix with Matlab
tElapsed1 = 0.;
tic;
for i=1:N
Ptmp_matlab = T*(P-K*Z*P)*transpose(T)+Q;
end
tElapsed1 = toc;
disp(['Elapsed time for the Matlab Riccati update is: ' num2str(tElapsed1) ' (N=' int2str(N) ').'])
% 2. Update the state varance-covariance matrix with the mex routine
tElapsed2 = 0.;
Ptmp_fortran = P;
try
tic;
for i=1:N
Ptmp_fortran = riccati_update(P, T, K, Z, Q);
end
tElapsed2 = toc;
disp(['Elapsed time for the Fortran Riccati update is: ' num2str(tElapsed2) ' (N=' int2str(N) ').'])
R = norm(Ptmp_fortran-Ptmp_matlab,1);
if (R > tol)
testFailed = testFailed+1;
dprintf('The Fortran Riccati update is wrong')
end
catch
testFailed = testFailed+1;
dprintf('Fortran Riccati update failed')
end
% Compare the Fortran and Matlab execution time
if tElapsed1<tElapsed2
skipline()
dprintf('Matlab Riccati update is %5.2f times faster than its Fortran counterpart.', tElapsed2/tElapsed1)
skipline()
else
skipline()
dprintf('Fortran Riccati update is %5.2f times faster than its Matlab counterpart.', tElapsed1/tElapsed2)
skipline()
end
% Compare results after multiple calls
N = 50;
disp(['After 1 update using the Riccati formula, the norm-1 discrepancy is ' num2str(norm(Ptmp_fortran-Ptmp_matlab,1)) '.']);
for i=2:N
Ptmp_matlab = T*(Ptmp_matlab-K*Z*Ptmp_matlab)*transpose(T)+Q;
Ptmp_fortran = riccati_update(Ptmp_fortran, T, K, Z, Q);
disp(['After ' int2str(i) ' updates using the Riccati formula, the norm-1 discrepancy is ' num2str(norm(Ptmp_fortran-Ptmp_matlab,1)) '.'])
end
t1 = clock;
fprintf('\n*** Elapsed time (in seconds): %.1f\n\n', etime(t1, t0));
quit(testFailed > 0)
% Copyright © 2011-2024 Dynare Team
% Copyright © 2011-2025 Dynare Team
%
% This file is part of Dynare.
%
......@@ -111,36 +111,47 @@ for blockFlag = 0:1
end
end
for i = 1:length(stack_solve_algos)
if ismember(stack_solve_algos(i), [2 3])
if storageFlag ~= 2
preconditioners = {'umfiter', 'iterstack', 'ilu'};
else % bytecode
preconditioners = {'ilu'};
end
else
preconditioners = {''};
end
for j = 1:length(preconditioners)
try
old_path = path;
clear oo_ % Ensure that oo_.endo_simul won’t be overwritten when loading wsMat
save wsMat
run_ls2003(blockFlag, storageFlag, default_solve_algo, stack_solve_algos(i))
run_ls2003(blockFlag, storageFlag, default_solve_algo, stack_solve_algos(i), preconditioners{j})
load wsMat
path(old_path);
% Test against the reference simulation path
load('test.mat','y_ref');
diff = oo_.endo_simul - y_ref;
if max(max(abs(diff))) > options_.dynatol.x
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'];
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ',' preconditioners{j} ')'];
if isoctave
exception.message = 'ERROR: simulation path differs from the reference path';
else
exception = MException('Dynare:simerr', 'ERROR: simulation path difers from the reference path');
end
printTestError(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'], exception);
printTestError(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ',' preconditioners{j} ')'], exception);
clear exception
end
catch exception
load wsMat
path(old_path);
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'];
printTestError(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ')'], exception);
failedBlock{size(failedBlock,2)+1} = ['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ',' preconditioners{j} ')'];
printTestError(['block_bytecode' filesep 'run_ls2003.m(' num2str(blockFlag) ',' num2str(storageFlag) ',' num2str(default_solve_algo) ',' num2str(stack_solve_algos(i)) ',' preconditioners{j} ')'], exception);
clear exception
end
end
end
end
end
delete('wsMat.mat')
......
......@@ -21,8 +21,8 @@ Note: Dynare comes with an automated uninstaller, which you can run from the
Using Dynare with MATLAB®
─────────────────────────
Dynare works on top of MATLAB®, any version ranging from 9.5 (R2018b) to 24.2
(R2024b). Only 64-bit versions are supported.
Dynare works on top of MATLAB®, any version ranging from 9.5 (R2018b) to 25.1
(R2025a). Only 64-bit versions are supported.
To use Dynare, you just have to add the ‘matlab’ subdirectory of your Dynare
installation to MATLAB® path. You have two options for doing that:
......@@ -52,10 +52,10 @@ Using Dynare with Octave
Dynare also works on top of GNU Octave, a free clone of MATLAB® (see
<https://www.octave.org>).
This version of Dynare is compiled for Octave 9.2.0 (MinGW, 64-bit),
This version of Dynare is compiled for Octave 10.2.0 (MinGW, 64-bit),
and may not work with other versions of Octave. The recommended version of
Octave can be downloaded at:
https://ftpmirror.gnu.org/gnu/octave/windows/octave-9.2.0-w64-installer.exe
https://ftpmirror.gnu.org/gnu/octave/windows/octave-10.2.0-w64-installer.exe
Every time you run Octave, you should type the following command (assuming that
you have installed Dynare at the standard location, and replacing ‘x.y’ by
......
......@@ -5,7 +5,7 @@
# The binaries are cross compiled for Windows (64-bit), Octave and MATLAB
# (all supported versions).
# Copyright © 2017-2024 Dynare Team
# Copyright © 2017-2025 Dynare Team
#
# This file is part of Dynare.
#
......@@ -53,7 +53,7 @@ ln -s "$ROOT_DIRECTORY"/deps/mkoctfile64 /tmp/windeps/
# Go to source root directory
cd ..
common_meson_opts=(-Dbuildtype=release --cross-file windows/mingw-cross.ini)
common_meson_opts=(--buildtype=release --cross-file windows/mingw-cross.ini)
# Create Windows 64-bit DLL binaries for MATLAB ≥ R2018b
meson setup --cross-file windows/mingw-cross-matlab.ini -Dmatlab_path=/tmp/windeps/matlab64/R2018b \
......@@ -119,8 +119,8 @@ cp -p windows/README.txt "$ZIPDIR"
cp -pr windows/deps/mingw64 "$ZIPDIR"
mkdir -p "$ZIPDIR"/contrib/ms-sbvar/TZcode
cp -pr contrib/ms-sbvar/TZcode/MatlabFiles "$ZIPDIR"/contrib/ms-sbvar/TZcode
mkdir -p "$ZIPDIR"/mex/matlab/win64-9.5-24.2
cp -p build-win-matlab/*.mexw64 "$ZIPDIR"/mex/matlab/win64-9.5-24.2
mkdir -p "$ZIPDIR"/mex/matlab/win64-9.5-25.1
cp -p build-win-matlab/*.mexw64 "$ZIPDIR"/mex/matlab/win64-9.5-25.1
mkdir -p "$ZIPDIR"/mex/octave/win64
cp -p build-win-octave/*.mex "$ZIPDIR"/mex/octave/win64
mkdir "$ZIPDIR"/preprocessor
......
......@@ -104,7 +104,7 @@ octave64: tarballs/octave-${OCTAVE_VERSION}${OCTAVE_W64_BUILD}-w64.7z
mv octave-${OCTAVE_VERSION}-w64 $@
# Clean up MinGW stuff that interferes with our cross-compiler
cd $@/mingw64/lib && rm -f libadvapi32.a libkernel32.a libmingw32.a libmingwex.a libmoldname.a libmsvcrt.a libpthread.dll.a libshell32.a libuser32.a
cd $@/mingw64/include && rm -f $$(grep -l "This file is part of the mingw-w64 runtime package" *.h) omp.h
cd $@/mingw64/include && rm -f $$(grep -l "This file is part of the \\(mingw-w64 runtime\\|mingw-runtime\\) package" *.h) minwinbase.h omp.h swprintf.inl
touch $@
octave: octave64
......@@ -151,7 +151,7 @@ lib64-msys2: tarballs/mingw-w64-x86_64-boost-$(MINGW64_BOOST_VERSION)-any.pkg.ta
for f in $^; do tar xf $$f --directory $@ $(MSYS2_EXCLUDES); done
touch $@
mingw64: tarballs/mingw-w64-x86_64-gcc-$(MINGW64_GCC_VERSION)-any.pkg.tar.zst tarballs/mingw-w64-x86_64-gcc-libs-$(MINGW64_GCC_VERSION)-any.pkg.tar.zst tarballs/mingw-w64-x86_64-gmp-$(MINGW64_GMP_VERSION)-any.pkg.tar.zst tarballs/mingw-w64-x86_64-binutils-$(MINGW64_BINUTILS_VERSION)-any.pkg.tar.zst tarballs/mingw-w64-x86_64-headers-git-$(MINGW64_HEADERS_VERSION)-any.pkg.tar.zst tarballs/mingw-w64-x86_64-crt-git-$(MINGW64_CRT_VERSION)-any.pkg.tar.zst tarballs/mingw-w64-x86_64-winpthreads-git-$(MINGW64_WINPTHREADS_VERSION)-any.pkg.tar.zst tarballs/mingw-w64-x86_64-libwinpthread-git-$(MINGW64_WINPTHREADS_VERSION)-any.pkg.tar.zst tarballs/mingw-w64-x86_64-zlib-$(MINGW64_ZLIB_VERSION)-any.pkg.tar.zst tarballs/mingw-w64-x86_64-zstd-$(MINGW64_ZSTD_VERSION)-any.pkg.tar.zst tarballs/mingw-w64-x86_64-isl-$(MINGW64_ISL_VERSION)-any.pkg.tar.zst tarballs/mingw-w64-x86_64-mpc-$(MINGW64_MPC_VERSION)-any.pkg.tar.zst tarballs/mingw-w64-x86_64-mpfr-$(MINGW64_MPFR_VERSION)-any.pkg.tar.zst tarballs/mingw-w64-x86_64-libiconv-$(MINGW64_LIBICONV_VERSION)-any.pkg.tar.zst tarballs/mingw-w64-x86_64-windows-default-manifest-$(MINGW64_WINDOWS_DEFAULT_MANIFEST_VERSION)-any.pkg.tar.zst
mingw64: tarballs/mingw-w64-x86_64-gcc-$(MINGW64_GCC_VERSION)-any.pkg.tar.zst tarballs/mingw-w64-x86_64-gcc-libs-$(MINGW64_GCC_VERSION)-any.pkg.tar.zst tarballs/mingw-w64-x86_64-gmp-$(MINGW64_GMP_VERSION)-any.pkg.tar.zst tarballs/mingw-w64-x86_64-binutils-$(MINGW64_BINUTILS_VERSION)-any.pkg.tar.zst tarballs/mingw-w64-x86_64-headers-git-$(MINGW64_HEADERS_VERSION)-any.pkg.tar.zst tarballs/mingw-w64-x86_64-crt-git-$(MINGW64_CRT_VERSION)-any.pkg.tar.zst tarballs/mingw-w64-x86_64-winpthreads-git-$(MINGW64_WINPTHREADS_VERSION)-any.pkg.tar.zst tarballs/mingw-w64-x86_64-libwinpthread-git-$(MINGW64_WINPTHREADS_VERSION)-any.pkg.tar.zst tarballs/mingw-w64-x86_64-zlib-$(MINGW64_ZLIB_VERSION)-any.pkg.tar.zst tarballs/mingw-w64-x86_64-zstd-$(MINGW64_ZSTD_VERSION)-any.pkg.tar.zst tarballs/mingw-w64-x86_64-isl-$(MINGW64_ISL_VERSION)-any.pkg.tar.zst tarballs/mingw-w64-x86_64-mpc-$(MINGW64_MPC_VERSION)-any.pkg.tar.zst tarballs/mingw-w64-x86_64-mpfr-$(MINGW64_MPFR_VERSION)-any.pkg.tar.zst tarballs/mingw-w64-x86_64-libiconv-$(MINGW64_LIBICONV_VERSION)-any.pkg.tar.zst tarballs/mingw-w64-x86_64-windows-default-manifest-$(MINGW64_WINDOWS_DEFAULT_MANIFEST_VERSION)-any.pkg.tar.zst tarballs/mingw-w64-x86_64-gettext-runtime-$(MINGW64_GETTEXT_RUNTIME_VERSION)-any.pkg.tar.zst
rm -rf $@
for f in $^; do tar xf $$f $(MSYS2_EXCLUDES); done
touch $@
......
......@@ -105,6 +105,8 @@ fi
: ${OCTAVE_LIBS="$LIBOCTINTERP $LIBOCTAVE $SPECIAL_MATH_LIB"}
: ${LIBOCTMEX="-loctmex"}
# Local variables.
FFTW_LIBS="$FFTW3_LDFLAGS $FFTW3_LIBS $FFTW3F_LDFLAGS $FFTW3F_LIBS"
......
SLICOT_VERSION = 5.9
X13AS_VERSION = 1-1-b61
OCTAVE_VERSION = 9.2.0
OCTAVE_VERSION = 10.2.0
OCTAVE_W64_BUILD =
MATLAB64_VERSION = 20231122
......@@ -19,98 +19,105 @@ MATLAB64_VERSION = 20231122
# pacman -Ss mingw-w64-x86_64-boost
# (also used by the preprocessor CI, so it can be updated there also)
MINGW64_BOOST_VERSION = 1.85.0-2
MINGW64_BOOST_VERSION = 1.88.0-2
# pacman -Ss mingw-w64-x86_64-gsl
MINGW64_GSL_VERSION = 2.8-1
# pacman -Ss mingw-w64-x86_64-matio
MINGW64_MATIO_VERSION = 1.5.27-1
MINGW64_MATIO_VERSION = 1.5.28-1
# Dependency of matio (and of the MinGW compiler)
# Dependency of matio and libssh2 (and of the MinGW compiler)
# pacman -Ss mingw-w64-x86_64-zlib
MINGW64_ZLIB_VERSION = 1.3.1-1
# Dependency of matio
# pacman -Ss mingw-w64-x86_64-hdf5
MINGW64_HDF5_VERSION = 1.14.3-2
MINGW64_HDF5_VERSION = 1.14.6-3
# Dependency of HDF5 (provides szip library)
# pacman -Ss mingw-w64-x86_64-libaec
MINGW64_LIBAEC_VERSION = 1.1.3-2
MINGW64_LIBAEC_VERSION = 1.1.3-4
# Dependency of HDF5
# Dependency of HDF5 and libssh2
# pacman -Ss mingw-w64-x86_64-openssl
MINGW64_OPENSSL_VERSION = 3.3.1-1
MINGW64_OPENSSL_VERSION = 3.5.0-1
# Dependency of HDF5
# pacman -Ss mingw-w64-x86_64-curl
MINGW64_CURL_VERSION = 8.8.0-10
MINGW64_CURL_VERSION = 8.13.0-2
# Dependency of curl (and of the MinGW compiler)
# pacman -Ss mingw-w64-x86_64-zstd
MINGW64_ZSTD_VERSION = 1.5.6-2
MINGW64_ZSTD_VERSION = 1.5.7-1
# Dependency of curl
# pacman -Ss mingw-w64-x86_64-brotli
MINGW64_BROTLI_VERSION = 1.1.0-1
MINGW64_BROTLI_VERSION = 1.1.0-4
# Dependency of curl
# pacman -Ss mingw-w64-x86_64-libpsl
MINGW64_LIBPSL_VERSION = 0.21.5-2
MINGW64_LIBPSL_VERSION = 0.21.5-3
# Dependency of curl and of libpsl
# pacman -Ss mingw-w64-x86_64-libidn2
MINGW64_LIBIDN2_VERSION = 2.3.7-2
MINGW64_LIBIDN2_VERSION = 2.3.8-2
# Dependency of curl
# pacman -Ss mingw-w64-x86_64-libssh2
MINGW64_LIBSSH2_VERSION = 1.11.0-2
MINGW64_LIBSSH2_VERSION = 1.11.1-1
# Dependency of curl
# pacman -Ss mingw-w64-x86_64-nghttp2
MINGW64_NGHTTP2_VERSION = 1.61.0-2
MINGW64_NGHTTP2_VERSION = 1.65.0-1
# Dependency of curl
# pacman -Ss mingw-w64-x86_64-nghttp3
MINGW64_NGHTTP3_VERSION = 1.4.0-1
MINGW64_NGHTTP3_VERSION = 1.9.0-1
# Dependency of libpsl and libunistring (and of the MinGW compiler)
# pacman -Ss mingw-w64-x86_64-libiconv
MINGW64_LIBICONV_VERSION = 1.17-4
MINGW64_LIBICONV_VERSION = 1.18-1
# Dependency of libpsl and libidn2
# pacman -Ss mingw-w64-x86_64-libunistring
MINGW64_LIBUNISTRING_VERSION = 1.2-1
MINGW64_LIBUNISTRING_VERSION = 1.3-1
## MinGW packages for the embedded compiler
# pacman -Ss mingw-w64-x86_64-gcc$
MINGW64_GCC_VERSION = 14.1.0-3
MINGW64_GCC_VERSION = 15.1.0-1
# Dependency of gcc, isl, mpc and mpfr
# pacman -Ss mingw-w64-x86_64-gmp
MINGW64_GMP_VERSION = 6.3.0-2
# pacman -Ss mingw-w64-x86_64-binutils
MINGW64_BINUTILS_VERSION = 2.42-2
MINGW64_BINUTILS_VERSION = 2.44-1
# pacman -Ss mingw-w64-x86_64-headers-git
MINGW64_HEADERS_VERSION = 12.0.0.r81.g90abf784a-1
MINGW64_HEADERS_VERSION = 12.0.0.r679.g71699efcb-1
# pacman -Ss mingw-w64-x86_64-crt-git
MINGW64_CRT_VERSION = 12.0.0.r81.g90abf784a-1
MINGW64_CRT_VERSION = 12.0.0.r679.g71699efcb-1
# NB: Renamed to mingw-w64-x86_64-winpthreads recently!
# pacman -Ss mingw-w64-x86_64-winpthreads-git
MINGW64_WINPTHREADS_VERSION = 12.0.0.r81.g90abf784a-1
MINGW64_WINPTHREADS_VERSION = 12.0.0.r679.g71699efcb-1
# pacman -Ss mingw-w64-x86_64-isl
MINGW64_ISL_VERSION = 0.26-1
MINGW64_ISL_VERSION = 0.27-1
# pacman -Ss mingw-w64-x86_64-mpc
MINGW64_MPC_VERSION = 1.3.1-2
# Dependency of mpc
# pacman -Ss mingw-w64-x86_64-mpfr
MINGW64_MPFR_VERSION = 4.2.1-2
MINGW64_MPFR_VERSION = 4.2.2-1
# pacman -Ss mingw-w64-x86_64-windows-default-manifest
MINGW64_WINDOWS_DEFAULT_MANIFEST_VERSION = 6.4-4
# Dependency of binutils
# pacman -Ss mingw-w64-x86_64-gettext-runtime
MINGW64_GETTEXT_RUNTIME_VERSION = 0.24.1-1
......@@ -90,8 +90,8 @@ Section "Dynare core (preprocessor and M-files)"
SectionEnd
Section "MEX files for MATLAB 64-bit, version 9.5 to 24.2 (R2018b to R2024b)"
SetOutPath $INSTDIR\mex\matlab\win64-9.5-24.2
Section "MEX files for MATLAB 64-bit, version 9.5 to 25.1 (R2018b to R2025a)"
SetOutPath $INSTDIR\mex\matlab\win64-9.5-25.1
File ..\build-win-matlab\*.mexw64
SectionEnd
......@@ -100,7 +100,7 @@ Section "MinGW compiler for MATLAB 64-bit"
File /r deps\mingw64\*
SectionEnd
Section "MEX files for Octave 9.2.0 (64-bit)"
Section "MEX files for Octave 10.2.0 (64-bit)"
SetOutPath $INSTDIR\mex\octave\win64
File ..\build-win-octave\*.mex
SectionEnd
......