v4 matlab:
* added a function matlab_ver_less_than() for testing Matlab version * updated dynare_config.m and build_matlab.m accordingly * removed tests to check whether we are older than Matlab 6.5 (R13), since we don't support those old versions anymore * removed a few unnecessary uses of eval() git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1936 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
27886047cf
commit
ddaaf9e1e3
|
@ -25,10 +25,8 @@ GridSize = length(omega);
|
||||||
exo_names_orig_ord = M_.exo_names_orig_ord;
|
exo_names_orig_ord = M_.exo_names_orig_ord;
|
||||||
if exist('OCTAVE_VERSION')
|
if exist('OCTAVE_VERSION')
|
||||||
warning('off', 'Octave:divide-by-zero')
|
warning('off', 'Octave:divide-by-zero')
|
||||||
elseif sscanf(version('-release'),'%d') < 13
|
|
||||||
warning off
|
|
||||||
else
|
else
|
||||||
eval('warning off MATLAB:dividebyzero')
|
warning off MATLAB:dividebyzero
|
||||||
end
|
end
|
||||||
if nargin<2
|
if nargin<2
|
||||||
var_list = [];
|
var_list = [];
|
||||||
|
@ -150,10 +148,8 @@ end
|
||||||
|
|
||||||
if exist('OCTAVE_VERSION')
|
if exist('OCTAVE_VERSION')
|
||||||
warning('on', 'Octave:divide-by-zero')
|
warning('on', 'Octave:divide-by-zero')
|
||||||
elseif sscanf(version('-release'),'%d') < 13
|
|
||||||
warning_config
|
|
||||||
else
|
else
|
||||||
eval('warning on MATLAB:dividebyzero')
|
warning on MATLAB:dividebyzero
|
||||||
end
|
end
|
||||||
|
|
||||||
if pltinfo
|
if pltinfo
|
||||||
|
|
|
@ -24,14 +24,7 @@ dynareroot = strrep(which('dynare.m'),'dynare.m','');
|
||||||
if exist('OCTAVE_VERSION')
|
if exist('OCTAVE_VERSION')
|
||||||
addpath([dynareroot '../mex/octave/'])
|
addpath([dynareroot '../mex/octave/'])
|
||||||
else
|
else
|
||||||
MATLAB = ver('matlab');
|
if matlab_ver_less_than('7.5')
|
||||||
%% FIXME:
|
|
||||||
%% It's not satisfactory to convert string versions into numbers, and to
|
|
||||||
%% compare these numbers:
|
|
||||||
%% - conversion will fail if version = 1.2.3
|
|
||||||
%% - it will give 7.10 < 7.9
|
|
||||||
VERSION = str2num(MATLAB.Version);
|
|
||||||
if (VERSION <= 7.4)
|
|
||||||
addpath([dynareroot '../mex/2007a/'])
|
addpath([dynareroot '../mex/2007a/'])
|
||||||
else
|
else
|
||||||
addpath([dynareroot '../mex/2007b/'])
|
addpath([dynareroot '../mex/2007b/'])
|
||||||
|
|
|
@ -26,7 +26,7 @@ function [x,info] = dynare_solve(func,x,jacobian_flag,varargin)
|
||||||
options_ = set_default_option(options_,'solve_algo',2);
|
options_ = set_default_option(options_,'solve_algo',2);
|
||||||
info = 0;
|
info = 0;
|
||||||
if options_.solve_algo == 0
|
if options_.solve_algo == 0
|
||||||
if ~isempty(which('fsolve')) & sscanf(version('-release'),'%d') >= 13;
|
if ~isempty(which('fsolve'))
|
||||||
options=optimset('fsolve');
|
options=optimset('fsolve');
|
||||||
options.MaxFunEvals = 50000;
|
options.MaxFunEvals = 50000;
|
||||||
options.MaxIter = 2000;
|
options.MaxIter = 2000;
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
function r = matlab_ver_less_than(verstr)
|
||||||
|
% 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
|
||||||
|
% verstr: a string of the format 'x.y' or 'x.y.z'
|
||||||
|
%
|
||||||
|
% OUTPUTS
|
||||||
|
% r: 0 or 1
|
||||||
|
%
|
||||||
|
% SPECIAL REQUIREMENTS
|
||||||
|
% none
|
||||||
|
%
|
||||||
|
% part of DYNARE, copyright Dynare Team (2008)
|
||||||
|
% Gnu Public License.
|
||||||
|
|
||||||
|
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 ];
|
|
@ -18,11 +18,7 @@ function options=set_default_option(options,field,default)
|
||||||
% Gnu Public License.
|
% Gnu Public License.
|
||||||
|
|
||||||
if ~isfield(options,field)
|
if ~isfield(options,field)
|
||||||
if ~exist('OCTAVE_VERSION') && sscanf(version('-release'),'%d') < 13
|
options.(field) = default;
|
||||||
options = setfield(options,field,default);
|
|
||||||
else
|
|
||||||
eval('options.(field) = default;');
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
% 06/07/03 MJ added ; to eval expression
|
% 06/07/03 MJ added ; to eval expression
|
|
@ -22,10 +22,8 @@ function [Gamma_y,ivar]=th_autocovariances(dr,ivar,M_,options_)
|
||||||
exo_names_orig_ord = M_.exo_names_orig_ord;
|
exo_names_orig_ord = M_.exo_names_orig_ord;
|
||||||
if exist('OCTAVE_VERSION')
|
if exist('OCTAVE_VERSION')
|
||||||
warning('off', 'Octave:divide-by-zero')
|
warning('off', 'Octave:divide-by-zero')
|
||||||
elseif sscanf(version('-release'),'%d') < 13
|
|
||||||
warning off
|
|
||||||
else
|
else
|
||||||
eval('warning off MATLAB:dividebyzero')
|
warning off MATLAB:dividebyzero
|
||||||
end
|
end
|
||||||
nar = options_.ar;
|
nar = options_.ar;
|
||||||
Gamma_y = cell(nar+1,1);
|
Gamma_y = cell(nar+1,1);
|
||||||
|
@ -202,9 +200,7 @@ function [Gamma_y,ivar]=th_autocovariances(dr,ivar,M_,options_)
|
||||||
end
|
end
|
||||||
if exist('OCTAVE_VERSION')
|
if exist('OCTAVE_VERSION')
|
||||||
warning('on', 'Octave:divide-by-zero')
|
warning('on', 'Octave:divide-by-zero')
|
||||||
elseif sscanf(version('-release'),'%d') < 13
|
|
||||||
warning_config
|
|
||||||
else
|
else
|
||||||
eval('warning on MATLAB:dividebyzero')
|
warning on MATLAB:dividebyzero
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,14 +2,7 @@
|
||||||
% Copyright Dynare Team (2007-2008)
|
% Copyright Dynare Team (2007-2008)
|
||||||
% GNU Public License
|
% GNU Public License
|
||||||
|
|
||||||
% Get Matlab version number in numeric format
|
addpath '../../matlab'; % For matlab_ver_less_than
|
||||||
% FIXME:
|
|
||||||
% It's not satisfactory to convert string versions into numbers, and to
|
|
||||||
% compare these numbers:
|
|
||||||
% - conversion will fail if version = 1.2.3
|
|
||||||
% - it will give 7.10 < 7.9
|
|
||||||
MATLAB = ver('matlab');
|
|
||||||
VERSION = str2num(MATLAB.Version);
|
|
||||||
|
|
||||||
MATLAB_PATH = matlabroot;
|
MATLAB_PATH = matlabroot;
|
||||||
|
|
||||||
|
@ -19,7 +12,7 @@ if strcmpi('GLNX86', computer) || strcmpi('GLNXA64', computer) ...
|
||||||
|| strcmpi('MACI', computer) || strcmpi('MAC', computer)
|
|| strcmpi('MACI', computer) || strcmpi('MAC', computer)
|
||||||
% GNU/Linux (x86-32 or x86-64) or MacOS (Intel or PPC)
|
% GNU/Linux (x86-32 or x86-64) or MacOS (Intel or PPC)
|
||||||
LAPACK_PATH = '-lmwlapack';
|
LAPACK_PATH = '-lmwlapack';
|
||||||
if VERSION <= 7.4
|
if matlab_ver_less_than('7.5')
|
||||||
BLAS_PATH = LAPACK_PATH; % On <= 7.4, BLAS in included in LAPACK
|
BLAS_PATH = LAPACK_PATH; % On <= 7.4, BLAS in included in LAPACK
|
||||||
else
|
else
|
||||||
BLAS_PATH = '-lmwblas';
|
BLAS_PATH = '-lmwblas';
|
||||||
|
@ -28,7 +21,7 @@ elseif strcmpi('PCWIN', computer)
|
||||||
% Windows (x86-32) with Microsoft or gcc compiler
|
% Windows (x86-32) with Microsoft or gcc compiler
|
||||||
LIBRARY_PATH = [MATLAB_PATH '/extern/lib/win32/microsoft/'];
|
LIBRARY_PATH = [MATLAB_PATH '/extern/lib/win32/microsoft/'];
|
||||||
LAPACK_PATH = ['"' LIBRARY_PATH 'libmwlapack.lib"'];
|
LAPACK_PATH = ['"' LIBRARY_PATH 'libmwlapack.lib"'];
|
||||||
if VERSION <= 7.4
|
if matlab_ver_less_than('7.5')
|
||||||
BLAS_PATH = LAPACK_PATH; % On <= 7.4, BLAS in included in LAPACK
|
BLAS_PATH = LAPACK_PATH; % On <= 7.4, BLAS in included in LAPACK
|
||||||
else
|
else
|
||||||
BLAS_PATH = ['"' LIBRARY_PATH 'libmwblas.lib"'];
|
BLAS_PATH = ['"' LIBRARY_PATH 'libmwblas.lib"'];
|
||||||
|
@ -38,21 +31,21 @@ else
|
||||||
end
|
end
|
||||||
|
|
||||||
% mwSize and mwIndex appeared in Matlab 7.3
|
% mwSize and mwIndex appeared in Matlab 7.3
|
||||||
if VERSION < 7.3
|
if matlab_ver_less_than('7.3')
|
||||||
COMPILE_OPTIONS = [ COMPILE_OPTIONS ' -DMWTYPES_NOT_DEFINED' ];
|
COMPILE_OPTIONS = [ COMPILE_OPTIONS ' -DMWTYPES_NOT_DEFINED' ];
|
||||||
end
|
end
|
||||||
|
|
||||||
% Large array dims for 64 bits platforms appeared in Matlab 7.3
|
% Large array dims for 64 bits platforms appeared in Matlab 7.3
|
||||||
if strcmpi('GLNXA64', computer) && VERSION >= 7.3
|
if strcmpi('GLNXA64', computer) && ~matlab_ver_less_than('7.3')
|
||||||
COMPILE_OPTIONS = [ COMPILE_OPTIONS ' -largeArrayDims' ];
|
COMPILE_OPTIONS = [ COMPILE_OPTIONS ' -largeArrayDims' ];
|
||||||
end
|
end
|
||||||
|
|
||||||
% blas.h and lapack.h appeared in Matlab 7.5
|
% blas.h and lapack.h appeared in Matlab 7.5
|
||||||
if VERSION < 7.5
|
if matlab_ver_less_than('7.5')
|
||||||
COMPILE_OPTIONS = [ COMPILE_OPTIONS ' -DNO_BLAS_H -DNO_LAPACK_H' ];
|
COMPILE_OPTIONS = [ COMPILE_OPTIONS ' -DNO_BLAS_H -DNO_LAPACK_H' ];
|
||||||
end
|
end
|
||||||
|
|
||||||
if VERSION <= 7.4
|
if matlab_ver_less_than('7.5')
|
||||||
OUTPUT_DIR = '../2007a';
|
OUTPUT_DIR = '../2007a';
|
||||||
else
|
else
|
||||||
OUTPUT_DIR = '../2007b';
|
OUTPUT_DIR = '../2007b';
|
||||||
|
|
Loading…
Reference in New Issue