From 5308da2cad69728abd81e246d7bb6a6a37f2911d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org> Date: Mon, 3 Feb 2014 15:51:41 +0100 Subject: [PATCH] Upgrade the minimum requirement to MATLAB 7.5 (R2007b). --- doc/dynare.texi | 2 +- m4/ax_mexopts.m4 | 16 +++---- matlab/dynare.m | 6 +-- matlab/dynare_config.m | 44 +++++-------------- matlab/global_initialization.m | 6 +-- matlab/matlab_ver_less_than.m | 18 +------- matlab/missing/bsxfun/bsxfun.m | 53 ----------------------- matlab/parallel/GiveCPUnumber.m | 2 +- matlab/parallel/dynareParallelDir.m | 2 +- matlab/parallel/dynareParallelGetFiles.m | 2 +- matlab/parallel/dynareParallelMkDir.m | 2 +- matlab/parallel/dynareParallelSendFiles.m | 2 +- matlab/parallel/masterParallel.m | 4 +- matlab/set_dynare_seed.m | 5 +-- mex/sources/dynmex.h | 8 +--- windows/README.txt | 2 +- windows/dynare.nsi | 10 ----- 17 files changed, 34 insertions(+), 150 deletions(-) delete mode 100644 matlab/missing/bsxfun/bsxfun.m diff --git a/doc/dynare.texi b/doc/dynare.texi index bb2171d1e2..b8bf6f752a 100644 --- a/doc/dynare.texi +++ b/doc/dynare.texi @@ -432,7 +432,7 @@ In order to run Dynare, you need one of the following: @itemize @item -MATLAB version 7.3 (R2006b) or above; +MATLAB version 7.5 (R2007b) or above; @item GNU Octave version 3.6 or above. diff --git a/m4/ax_mexopts.m4 b/m4/ax_mexopts.m4 index 1417c79389..c245e2511a 100644 --- a/m4/ax_mexopts.m4 +++ b/m4/ax_mexopts.m4 @@ -1,4 +1,4 @@ -dnl Copyright (C) 2009-2012 Dynare Team +dnl Copyright (C) 2009-2014 Dynare Team dnl dnl This file is part of Dynare. dnl @@ -22,7 +22,7 @@ AC_REQUIRE([AX_MATLAB_ARCH]) AC_REQUIRE([AX_MATLAB_VERSION]) AC_REQUIRE([AC_PROG_SED]) -AX_COMPARE_VERSION([$MATLAB_VERSION], [lt], [7.3], [AC_MSG_ERROR([Your MATLAB is too old, please upgrade to 7.3 (R2006b) at least.])]) +AX_COMPARE_VERSION([$MATLAB_VERSION], [lt], [7.5], [AC_MSG_ERROR([Your MATLAB is too old, please upgrade to 7.5 (R2007b) at least.])]) AC_MSG_CHECKING([for options to compile MEX for MATLAB]) @@ -36,9 +36,7 @@ case ${MATLAB_ARCH} in MATLAB_FFLAGS="-fPIC -g -O2 -fexceptions" MATLAB_LDFLAGS_NOMAP="-shared -Wl,--no-undefined -Wl,-rpath-link,$MATLAB/bin/${MATLAB_ARCH} -L$MATLAB/bin/${MATLAB_ARCH}" MATLAB_LDFLAGS="$MATLAB_LDFLAGS_NOMAP -Wl,--version-script,$MATLAB/extern/lib/${MATLAB_ARCH}/mexFunction.map" - MATLAB_LIBS="-lmx -lmex -lmat -lm -lstdc++ -lmwlapack" - # Starting from MATLAB 7.5, BLAS and LAPACK are in distinct libraries - AX_COMPARE_VERSION([$MATLAB_VERSION], [ge], [7.5], [MATLAB_LIBS="${MATLAB_LIBS} -lmwblas"]) + MATLAB_LIBS="-lmx -lmex -lmat -lm -lstdc++ -lmwlapack -lmwblas" if test "${MATLAB_ARCH}" = "glnx86"; then MATLAB_DEFS="$MATLAB_DEFS -D_FILE_OFFSET_BITS=64" MATLAB_CFLAGS="$MATLAB_CFLAGS -m32" @@ -57,9 +55,7 @@ case ${MATLAB_ARCH} in # Note that static-libstdc++ is only supported since GCC 4.5 (but generates no error on older versions) MATLAB_LDFLAGS_NOMAP="-static-libgcc -static-libstdc++ -shared -L$MATLAB/bin/${MATLAB_ARCH}" MATLAB_LDFLAGS="$MATLAB_LDFLAGS_NOMAP $(pwd)/$srcdir/mex.def" - MATLAB_LIBS="-lmex -lmx -lmat -lmwlapack" - # Starting from MATLAB 7.5, BLAS and LAPACK are in distinct libraries - AX_COMPARE_VERSION([$MATLAB_VERSION], [ge], [7.5], [MATLAB_LIBS="${MATLAB_LIBS} -lmwblas"]) + MATLAB_LIBS="-lmex -lmx -lmat -lmwlapack -lmwblas" ax_mexopts_ok="yes" ;; maci | maci64) @@ -75,9 +71,7 @@ case ${MATLAB_ARCH} in MATLAB_FFLAGS="-fexceptions -fbackslash -arch $ARCHS" MATLAB_LDFLAGS_NOMAP="-L$MATLAB/bin/${MATLAB_ARCH} -Wl,-twolevel_namespace -undefined error -arch $ARCHS -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET -bundle" MATLAB_LDFLAGS="$MATLAB_LDFLAGS_NOMAP -Wl,-exported_symbols_list,$(pwd)/$srcdir/mexFunction-MacOSX.map" - MATLAB_LIBS="-lmx -lmex -lmat -lstdc++ -lmwlapack" - # Starting from MATLAB 7.5, BLAS and LAPACK are in distinct libraries - AX_COMPARE_VERSION([$MATLAB_VERSION], [ge], [7.5], [MATLAB_LIBS="${MATLAB_LIBS} -lmwblas"]) + MATLAB_LIBS="-lmx -lmex -lmat -lstdc++ -lmwlapack -lmwblas" ax_mexopts_ok="yes" ;; *) diff --git a/matlab/dynare.m b/matlab/dynare.m index 034ec06745..6efd76ee70 100644 --- a/matlab/dynare.m +++ b/matlab/dynare.m @@ -16,7 +16,7 @@ function dynare(fname, varargin) % SPECIAL REQUIREMENTS % none -% Copyright (C) 2001-2013 Dynare Team +% Copyright (C) 2001-2014 Dynare Team % % This file is part of Dynare. % @@ -54,8 +54,8 @@ if isoctave warning('This version of Dynare has only been tested on Octave 3.6.0 and above. Since your Octave version is older than that, Dynare may fail to run, or give unexpected results. Consider upgrading your Octave installation.'); end else - if matlab_ver_less_than('7.3') - warning('This version of Dynare has only been tested on MATLAB 7.3 (R2006b) and above. Since your MATLAB version is older than that, Dynare may fail to run, or give unexpected results. Consider upgrading your MATLAB installation, or switch to Octave.'); + if matlab_ver_less_than('7.5') + warning('This version of Dynare has only been tested on MATLAB 7.5 (R2007b) and above. Since your MATLAB version is older than that, Dynare may fail to run, or give unexpected results. Consider upgrading your MATLAB installation, or switch to Octave.'); end end diff --git a/matlab/dynare_config.m b/matlab/dynare_config.m index 4405c12e8e..1e9ed32330 100644 --- a/matlab/dynare_config.m +++ b/matlab/dynare_config.m @@ -15,7 +15,7 @@ function dynareroot = dynare_config(path_to_dynare,verbose) % SPECIAL REQUIREMENTS % none -% Copyright (C) 2001-2013 Dynare Team +% Copyright (C) 2001-2014 Dynare Team % % This file is part of Dynare. % @@ -84,13 +84,8 @@ if isoctave addpath([dynareroot '/missing/ordeig']) end -% bsxfun is missing in old versions of MATLAB (and exists in Octave) -if ~isoctave && matlab_ver_less_than('7.4') - addpath([dynareroot '/missing/bsxfun']) -end - -% ilu is missing in old versions of MATLAB and in Octave -if isoctave || matlab_ver_less_than('7.4') +% ilu is missing in Octave +if isoctave addpath([dynareroot '/missing/ilu']) end @@ -113,27 +108,15 @@ if isoctave else % Add win32 specific paths for Dynare Windows package if strcmp(computer, 'PCWIN') - if matlab_ver_less_than('7.5') - mexpath = [dynareroot '../mex/matlab/win32-7.3-7.4']; - if exist(mexpath, 'dir') - addpath(mexpath) - end - else - mexpath = [dynareroot '../mex/matlab/win32-7.5-8.2']; - if exist(mexpath, 'dir') - addpath(mexpath) - end + mexpath = [dynareroot '../mex/matlab/win32-7.5-8.2']; + if exist(mexpath, 'dir') + addpath(mexpath) end end % Add win64 specific paths for Dynare Windows package if strcmp(computer, 'PCWIN64') - if matlab_ver_less_than('7.5') - mexpath = [dynareroot '../mex/matlab/win64-7.3-7.4']; - if exist(mexpath, 'dir') - addpath(mexpath) - end - elseif matlab_ver_less_than('7.8') + if matlab_ver_less_than('7.8') mexpath = [dynareroot '../mex/matlab/win64-7.5-7.7']; if exist(mexpath, 'dir') addpath(mexpath) @@ -147,16 +130,9 @@ else end if strcmp(computer, 'MACI') - if matlab_ver_less_than('7.5') - mexpath = [dynareroot '../mex/matlab/osx32-7.4']; - if exist(mexpath, 'dir') - addpath(mexpath) - end - else - mexpath = [dynareroot '../mex/matlab/osx32-7.5-7.11']; - if exist(mexpath, 'dir') - addpath(mexpath) - end + mexpath = [dynareroot '../mex/matlab/osx32-7.5-7.11']; + if exist(mexpath, 'dir') + addpath(mexpath) end end diff --git a/matlab/global_initialization.m b/matlab/global_initialization.m index cf78883eb2..c331eece00 100644 --- a/matlab/global_initialization.m +++ b/matlab/global_initialization.m @@ -11,7 +11,7 @@ function global_initialization() % SPECIAL REQUIREMENTS % none -% Copyright (C) 2003-2013 Dynare Team +% Copyright (C) 2003-2014 Dynare Team % % This file is part of Dynare. % @@ -130,9 +130,7 @@ if isoctave options_.nodisplay = 1; end else - if isunix && (~usejava('jvm') || ... - ((matlab_ver_less_than('7.5') && sum(get(0,'ScreenSize'))==4) || ... - (~matlab_ver_less_than('7.5') && ~feature('ShowFigureWindows')))) + if isunix && (~usejava('jvm') || ~feature('ShowFigureWindows')) options_.console_mode = 1; options_.nodisplay = 1; end diff --git a/matlab/matlab_ver_less_than.m b/matlab/matlab_ver_less_than.m index faec3a5c6f..eb708d7fca 100644 --- a/matlab/matlab_ver_less_than.m +++ b/matlab/matlab_ver_less_than.m @@ -4,9 +4,6 @@ function r = matlab_ver_less_than(verstr) % Returns 1 if current Matlab version is strictly older than % the one given in argument. % -% It basically does the same job than verLessThan(), which is -% only available since Matlab 7.4. -% % Note that this function will fail under Octave. % % INPUTS @@ -18,7 +15,7 @@ function r = matlab_ver_less_than(verstr) % SPECIAL REQUIREMENTS % none -% Copyright (C) 2008-2009 Dynare Team +% Copyright (C) 2008-2014 Dynare Team % % This file is part of Dynare. % @@ -35,15 +32,4 @@ function r = matlab_ver_less_than(verstr) % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <http://www.gnu.org/licenses/>. -ver_struct = ver('matlab'); -cur_verstr = ver_struct.Version; - -r = get_ver_numeric(cur_verstr) < get_ver_numeric(verstr); - - -function x = get_ver_numeric(verstr) -nums = sscanf(verstr, '%d.%d.%d')'; -if length(nums) < 3 - nums(3) = 0; -end -x = nums * [1; 0.01; 0.0001 ]; +r = verLessThan('matlab', verstr) diff --git a/matlab/missing/bsxfun/bsxfun.m b/matlab/missing/bsxfun/bsxfun.m deleted file mode 100644 index ed2f5f2cd1..0000000000 --- a/matlab/missing/bsxfun/bsxfun.m +++ /dev/null @@ -1,53 +0,0 @@ -function C = bsxfun(fun,A,B) -% (Imperfect) Clone of matlab's bsxfun built-in function. - -% Copyright (C) 2010-2011 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/>. - -dA = size(A); -dB = size(B); - -dim_correction = length(dA)-length(dB); -if dim_correction>0 - dB = [dB,ones(1,dim_correction)]; -elseif dim_correction<0 - dA = [dA,ones(1,-dim_correction)]; -end - -if all(dA==dB) - C = fun(A,B); -else - tB = dB<dA; - tA = dA<dB; - if any(tB) - iB = find(tB); - if all(dB(iB)==1) - B = repmat(B,tB.*dA+~tB); - else - error('Non-singleton dimensions of the two input arrays must match each other.') - end - end - if any(tA) - iA = find(tA); - if all(dA(iA)==1) - A = repmat(A,tA.*dB+~tA); - else - error('Non-singleton dimensions of the two input arrays must match each other.') - end - end - C = fun(A,B); -end \ No newline at end of file diff --git a/matlab/parallel/GiveCPUnumber.m b/matlab/parallel/GiveCPUnumber.m index 3176bb1a54..2666d97634 100644 --- a/matlab/parallel/GiveCPUnumber.m +++ b/matlab/parallel/GiveCPUnumber.m @@ -36,7 +36,7 @@ nCPU=''; if nargin < 2, % Determine a specific operating system or software version when necessary % for different command (sintax, name, ...). -Environment=~ispc; %isunix || (~matlab_ver_less_than('7.4') && ismac); +Environment=~ispc; end switch Environment diff --git a/matlab/parallel/dynareParallelDir.m b/matlab/parallel/dynareParallelDir.m index d257e8090e..daecfe6cd4 100644 --- a/matlab/parallel/dynareParallelDir.m +++ b/matlab/parallel/dynareParallelDir.m @@ -29,7 +29,7 @@ function dirlist = dynareParallelDir(filename,PRCDir,Parallel) dirlist=[]; for indPC=1:length(Parallel), - if ~ispc || strcmpi('unix',Parallel(indPC).OperatingSystem), %isunix || (~matlab_ver_less_than('7.4') && ismac), + if ~ispc || strcmpi('unix',Parallel(indPC).OperatingSystem), if Parallel(indPC).Local==0, if ~isempty(Parallel(indPC).Port), ssh_token = ['-p ',Parallel(indPC).Port]; diff --git a/matlab/parallel/dynareParallelGetFiles.m b/matlab/parallel/dynareParallelGetFiles.m index dbd13d6831..bdb6d0143b 100644 --- a/matlab/parallel/dynareParallelGetFiles.m +++ b/matlab/parallel/dynareParallelGetFiles.m @@ -35,7 +35,7 @@ NamFileInput0=NamFileInput; for indPC=1:length(Parallel), if Parallel(indPC).Local==0, - if ~ispc || strcmpi('unix',Parallel(indPC).OperatingSystem), %isunix || (~matlab_ver_less_than('7.4') && ismac), + if ~ispc || strcmpi('unix',Parallel(indPC).OperatingSystem), if ~isempty(Parallel(indPC).Port), ssh_token = ['-p ',Parallel(indPC).Port]; else diff --git a/matlab/parallel/dynareParallelMkDir.m b/matlab/parallel/dynareParallelMkDir.m index 7ebde3819c..9e8d7b7de7 100644 --- a/matlab/parallel/dynareParallelMkDir.m +++ b/matlab/parallel/dynareParallelMkDir.m @@ -36,7 +36,7 @@ end for indPC=1:length(Parallel) if Parallel(indPC).Local==0, - if ~ispc || strcmpi('unix',Parallel(indPC).OperatingSystem), %isunix || (~matlab_ver_less_than('7.4') && ismac), + if ~ispc || strcmpi('unix',Parallel(indPC).OperatingSystem), if ~isempty(Parallel(indPC).Port), ssh_token = ['-p ',Parallel(indPC).Port]; else diff --git a/matlab/parallel/dynareParallelSendFiles.m b/matlab/parallel/dynareParallelSendFiles.m index d76f8a7bd5..6f7e645f55 100644 --- a/matlab/parallel/dynareParallelSendFiles.m +++ b/matlab/parallel/dynareParallelSendFiles.m @@ -41,7 +41,7 @@ end for indPC=1:length(Parallel), if Parallel(indPC).Local==0, - if ~ispc || strcmpi('unix',Parallel(indPC).OperatingSystem), %isunix || (~matlab_ver_less_than('7.4') && ismac), + if ~ispc || strcmpi('unix',Parallel(indPC).OperatingSystem), if ~isempty(Parallel(indPC).Port), ssh_token = ['-p ',Parallel(indPC).Port]; else diff --git a/matlab/parallel/masterParallel.m b/matlab/parallel/masterParallel.m index a0657176ff..6b218310ec 100644 --- a/matlab/parallel/masterParallel.m +++ b/matlab/parallel/masterParallel.m @@ -147,7 +147,7 @@ end DyMo=pwd; % fInputVar.DyMo=DyMo; -if ispc, % ~(isunix || (~matlab_ver_less_than('7.4') && ismac)) , +if ispc, [tempo, MasterName]=system('hostname'); MasterName=deblank(MasterName); end @@ -499,7 +499,7 @@ if Strategy==0 || newInstance, % See above. PRCDirSnapshotInit = PRCDirSnapshot; % Run the slaves. - if ~ispc, %isunix || (~matlab_ver_less_than('7.4') && ismac), + if ~ispc, system('sh ConcurrentCommand1.bat &'); pause(1) else diff --git a/matlab/set_dynare_seed.m b/matlab/set_dynare_seed.m index fbde1abc30..3a71d7236c 100644 --- a/matlab/set_dynare_seed.m +++ b/matlab/set_dynare_seed.m @@ -2,7 +2,7 @@ function set_dynare_seed(a,b) % Set seeds depending on matlab (octave) version. This routine is called in dynare_config and can be called by the % user in the mod file. % -% Copyright (C) 2010-2013 Dynare Team +% Copyright (C) 2010-2014 Dynare Team % % This file is part of Dynare. % @@ -93,10 +93,9 @@ if matlab_random_streams% Use new matlab interface. else% Use old matlab interface. if nargin==1 if ischar(a) && strcmpi(a,'default') - if isoctave || matlab_ver_less_than('7.4') + if isoctave options_.DynareRandomStreams.algo = 'state'; else - % Twister was introduced in MATLAB 7.4 options_.DynareRandomStreams.algo = 'twister'; end options_.DynareRandomStreams.seed = 0; diff --git a/mex/sources/dynmex.h b/mex/sources/dynmex.h index 713f3dd7ff..17015fb20c 100644 --- a/mex/sources/dynmex.h +++ b/mex/sources/dynmex.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2011 Dynare Team + * Copyright (C) 2009-2014 Dynare Team * * This file is part of Dynare. * @@ -26,12 +26,6 @@ #include <mex.h> -/* mwSize, mwIndex and mwSignedIndex appeared in MATLAB 7.3 */ -#if defined(MATLAB_MEX_FILE) && MATLAB_VERSION < 0x0703 -typedef int mwIndex; -typedef int mwSize; -#endif - /* * Fix for trac ticket Ticket #137 */ diff --git a/windows/README.txt b/windows/README.txt index bea713b7ca..02ee18ecf5 100644 --- a/windows/README.txt +++ b/windows/README.txt @@ -25,7 +25,7 @@ NOTE: Dynare comes with an automated uninstaller, which you can run from the Using Dynare with MATLAB (R) ---------------------------- -Dynare requires MATLAB (R) version 7.3 (R2006b) or above. With older versions +Dynare requires MATLAB (R) version 7.5 (R2007b) or above. With older versions of MATLAB (R), it may fail or give unexpected results. To use Dynare, you just have to add the 'matlab' subdirectory of your Dynare diff --git a/windows/dynare.nsi b/windows/dynare.nsi index e2fbc886d3..cabf33e114 100644 --- a/windows/dynare.nsi +++ b/windows/dynare.nsi @@ -83,21 +83,11 @@ SectionEnd SectionGroup "MEX files for MATLAB" -Section "MEX files for MATLAB 32-bit, version 7.3 to 7.4 (R2006b to R2007a)" - SetOutPath $INSTDIR\mex\matlab\win32-7.3-7.4 - File ..\mex\matlab\win32-7.3-7.4\*.mexw32 -SectionEnd - Section "MEX files for MATLAB 32-bit, version 7.5 to 8.2 (R2007b to R2013b)" SetOutPath $INSTDIR\mex\matlab\win32-7.5-8.2 File ..\mex\matlab\win32-7.5-8.2\*.mexw32 SectionEnd -Section "MEX files for MATLAB 64-bit, version 7.3 to 7.4 (R2006b to R2007a)" - SetOutPath $INSTDIR\mex\matlab\win64-7.3-7.4 - File ..\mex\matlab\win64-7.3-7.4\*.mexw64 -SectionEnd - Section "MEX files for MATLAB 64-bit, version 7.5 to 7.7 (R2007b to R2008b)" SetOutPath $INSTDIR\mex\matlab\win64-7.5-7.7 File ..\mex\matlab\win64-7.5-7.7\*.mexw64 -- GitLab