2011-07-26 11:07:27 +02:00
|
|
|
function dynareroot = dynare_config(path_to_dynare,verbose)
|
2008-08-01 14:40:33 +02:00
|
|
|
%function dynareroot = dynare_config(path_to_dynare)
|
2008-05-16 10:18:37 +02:00
|
|
|
% This function tests the existence of valid mex files (for qz
|
|
|
|
% decomposition, solution to sylvester equation and kronecker
|
|
|
|
% products...) and, if needed, add paths to the matlab versions
|
|
|
|
% of these routines.
|
2008-08-04 15:33:57 +02:00
|
|
|
% Also adds other directories to the path.
|
2008-05-16 10:18:37 +02:00
|
|
|
%
|
|
|
|
% INPUTS
|
|
|
|
% none
|
2011-08-11 15:10:57 +02:00
|
|
|
%
|
2008-05-16 10:18:37 +02:00
|
|
|
% OUTPUTS
|
|
|
|
% none
|
2011-08-11 15:10:57 +02:00
|
|
|
%
|
2008-05-16 10:18:37 +02:00
|
|
|
% SPECIAL REQUIREMENTS
|
|
|
|
% none
|
2008-08-01 14:40:33 +02:00
|
|
|
|
2015-02-16 09:08:02 +01:00
|
|
|
% Copyright (C) 2001-2015 Dynare Team
|
2008-08-01 14:40:33 +02:00
|
|
|
%
|
|
|
|
% 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/>.
|
|
|
|
|
2011-07-26 11:07:27 +02:00
|
|
|
if nargin && ~isempty(path_to_dynare)
|
2008-05-16 10:18:37 +02:00
|
|
|
addpath(path_to_dynare);
|
|
|
|
end
|
2015-03-30 14:54:14 +02:00
|
|
|
|
2009-07-03 12:36:11 +02:00
|
|
|
dynareroot = strrep(which('dynare'),'dynare.m','');
|
2008-06-24 20:20:48 +02:00
|
|
|
|
2011-12-21 18:31:29 +01:00
|
|
|
origin = pwd();
|
|
|
|
cd([dynareroot '/..'])
|
|
|
|
|
2011-08-11 15:10:57 +02:00
|
|
|
if ~nargin || nargin==1
|
2011-07-26 11:07:27 +02:00
|
|
|
verbose = 1;
|
|
|
|
end
|
|
|
|
|
2008-09-09 23:47:13 +02:00
|
|
|
addpath([dynareroot '/distributions/'])
|
2008-10-20 16:46:00 +02:00
|
|
|
addpath([dynareroot '/kalman/'])
|
2008-10-16 23:15:07 +02:00
|
|
|
addpath([dynareroot '/kalman/likelihood'])
|
2009-04-24 18:08:27 +02:00
|
|
|
addpath([dynareroot '/AIM/'])
|
2010-03-23 11:09:59 +01:00
|
|
|
addpath([dynareroot '/partial_information/'])
|
2014-12-19 12:54:09 +01:00
|
|
|
addpath([dynareroot '/perfect-foresight-models/'])
|
2011-02-04 11:55:31 +01:00
|
|
|
addpath([dynareroot '/ms-sbvar/'])
|
2011-09-13 17:35:43 +02:00
|
|
|
addpath([dynareroot '/ms-sbvar/identification/'])
|
2012-04-19 12:03:27 +02:00
|
|
|
addpath([dynareroot '../contrib/ms-sbvar/TZcode/MatlabFiles/'])
|
2010-10-08 16:10:59 +02:00
|
|
|
addpath([dynareroot '/parallel/'])
|
2014-11-12 17:55:18 +01:00
|
|
|
addpath([dynareroot '/particles/src'])
|
2011-03-17 16:29:18 +01:00
|
|
|
addpath([dynareroot '/gsa/'])
|
2011-12-09 18:03:30 +01:00
|
|
|
addpath([dynareroot '/ep/'])
|
2015-02-27 17:12:04 +01:00
|
|
|
addpath([dynareroot '/cli/'])
|
2014-05-12 17:22:36 +02:00
|
|
|
addpath([dynareroot '/lmmcp/'])
|
2015-02-23 14:26:07 +01:00
|
|
|
addpath([dynareroot '/optimization/'])
|
2014-11-27 23:19:53 +01:00
|
|
|
addpath([dynareroot '/modules/dates/src/'])
|
2014-11-28 18:35:19 +01:00
|
|
|
addpath([dynareroot '/modules/dseries/src/'])
|
2011-07-26 11:37:43 +02:00
|
|
|
addpath([dynareroot '/utilities/doc/'])
|
2014-11-07 22:41:25 +01:00
|
|
|
addpath([dynareroot '/utilities/tests/src/'])
|
2011-09-17 15:38:49 +02:00
|
|
|
addpath([dynareroot '/utilities/dataset/'])
|
|
|
|
addpath([dynareroot '/utilities/general/'])
|
2015-02-24 16:38:36 +01:00
|
|
|
addpath([dynareroot '/modules/reporting/src/'])
|
2008-10-13 20:54:42 +02:00
|
|
|
|
2009-07-03 12:20:42 +02:00
|
|
|
% For functions that exist only under some Octave versions
|
|
|
|
% or some MATLAB versions, and for which we provide some replacement functions
|
|
|
|
|
2013-11-04 10:54:45 +01:00
|
|
|
if ~isoctave
|
2012-08-06 18:25:31 +02:00
|
|
|
% Replacements for rows(), columns() and issquare() (inexistent under MATLAB)
|
2009-07-03 12:20:42 +02:00
|
|
|
addpath([dynareroot '/missing/rows_columns'])
|
2012-08-06 18:25:31 +02:00
|
|
|
addpath([dynareroot '/missing/issquare'])
|
2009-09-24 10:34:57 +02:00
|
|
|
% Replacement for vec() (inexistent under MATLAB)
|
|
|
|
addpath([dynareroot '/missing/vec'])
|
2012-01-09 11:06:26 +01:00
|
|
|
if ~user_has_matlab_license('statistics_toolbox')
|
2009-04-24 18:08:27 +02:00
|
|
|
% Replacements for functions of the stats toolbox
|
2009-07-03 12:20:42 +02:00
|
|
|
addpath([dynareroot '/missing/stats/'])
|
2009-04-24 18:08:27 +02:00
|
|
|
end
|
2008-07-28 11:46:07 +02:00
|
|
|
end
|
|
|
|
|
2012-09-18 11:54:40 +02:00
|
|
|
% ordeig() doesn't exist in Octave
|
2013-11-04 10:54:45 +01:00
|
|
|
if isoctave
|
2009-07-03 12:20:42 +02:00
|
|
|
addpath([dynareroot '/missing/ordeig'])
|
|
|
|
end
|
|
|
|
|
2015-03-18 16:03:41 +01:00
|
|
|
% ilu is missing in Octave < 4.0
|
|
|
|
if isoctave && octave_ver_less_than('4.0')
|
2013-03-25 12:03:09 +01:00
|
|
|
addpath([dynareroot '/missing/ilu'])
|
|
|
|
end
|
|
|
|
|
2014-11-24 16:06:05 +01:00
|
|
|
% corrcoef with two outputs is missing in Octave (ticket #796)
|
|
|
|
if isoctave && ~user_has_octave_forge_package('nan')
|
|
|
|
addpath([dynareroot '/missing/corrcoef'])
|
|
|
|
end
|
|
|
|
|
2014-01-02 16:17:37 +01:00
|
|
|
% strjoin is missing in older versions of MATLAB and in Octave < 3.8
|
|
|
|
if (isoctave && octave_ver_less_than('3.8')) || ...
|
|
|
|
(~isoctave && matlab_ver_less_than('8.1'))
|
2013-04-04 10:57:31 +02:00
|
|
|
addpath([dynareroot '/missing/strjoin'])
|
|
|
|
end
|
|
|
|
|
2011-09-27 16:59:21 +02:00
|
|
|
% nanmean is in Octave Forge Statistics package and in MATLAB Statistics
|
|
|
|
% toolbox
|
2013-11-04 10:54:45 +01:00
|
|
|
if (isoctave && ~user_has_octave_forge_package('statistics')) ...
|
|
|
|
|| (~isoctave && ~user_has_matlab_license('statistics_toolbox'))
|
2012-04-20 21:36:49 +02:00
|
|
|
addpath([dynareroot '/missing/nanmean'])
|
2011-09-27 16:59:21 +02:00
|
|
|
end
|
2010-02-19 00:17:54 +01:00
|
|
|
|
2009-04-24 18:08:27 +02:00
|
|
|
% Add path to MEX files
|
2015-03-30 14:54:14 +02:00
|
|
|
add_path_to_mex_files(dynareroot);
|
2009-03-11 15:57:34 +01:00
|
|
|
|
2008-05-16 10:18:37 +02:00
|
|
|
%% Set mex routine names
|
|
|
|
mex_status = cell(1,3);
|
|
|
|
mex_status(1,1) = {'mjdgges'};
|
|
|
|
mex_status(1,2) = {'qz'};
|
2008-05-16 10:22:46 +02:00
|
|
|
mex_status(1,3) = {'Generalized QZ'};
|
2008-05-16 10:18:37 +02:00
|
|
|
mex_status(2,1) = {'gensylv'};
|
|
|
|
mex_status(2,2) = {'gensylv'};
|
|
|
|
mex_status(2,3) = {'Sylvester equation solution'};
|
|
|
|
mex_status(3,1) = {'A_times_B_kronecker_C'};
|
|
|
|
mex_status(3,2) = {'kronecker'};
|
|
|
|
mex_status(3,3) = {'Kronecker products'};
|
|
|
|
mex_status(4,1) = {'sparse_hessian_times_B_kronecker_C'};
|
|
|
|
mex_status(4,2) = {'kronecker'};
|
|
|
|
mex_status(4,3) = {'Sparse kronecker products'};
|
2012-02-28 08:43:28 +01:00
|
|
|
mex_status(5,1) = {'local_state_space_iteration_2'};
|
2014-11-13 15:53:26 +01:00
|
|
|
mex_status(5,2) = {'reduced_form_models/local_state_space_iteration_2'};
|
2012-06-15 15:09:39 +02:00
|
|
|
mex_status(5,3) = {'Local state space iteration (second order)'};
|
2008-05-16 10:18:37 +02:00
|
|
|
number_of_mex_files = size(mex_status,1);
|
|
|
|
%% Remove some directories from matlab's path. This is necessary if the user has
|
|
|
|
%% added dynare_v4/matlab with the subfolders. Matlab has to ignore these
|
|
|
|
%% subfolders if valid mex files exist.
|
|
|
|
matlab_path = path;
|
|
|
|
for i=1:number_of_mex_files
|
2008-05-16 10:22:46 +02:00
|
|
|
test = strfind(matlab_path,[dynareroot mex_status{i,2}]);
|
2008-05-16 10:18:37 +02:00
|
|
|
action = length(test);
|
2008-05-16 10:22:46 +02:00
|
|
|
if action
|
2008-05-16 10:18:37 +02:00
|
|
|
rmpath([dynareroot mex_status{i,2}]);
|
|
|
|
matlab_path = path;
|
|
|
|
end
|
|
|
|
end
|
|
|
|
%% Test if valid mex files are available, if a mex file is not available
|
|
|
|
%% a matlab version of the routine is included in the path.
|
2011-07-26 11:07:27 +02:00
|
|
|
if verbose
|
2013-07-10 17:12:34 +02:00
|
|
|
skipline()
|
2011-07-26 11:07:27 +02:00
|
|
|
disp('Configuring Dynare ...')
|
|
|
|
end
|
2009-04-29 13:35:05 +02:00
|
|
|
|
2008-05-16 10:18:37 +02:00
|
|
|
for i=1:number_of_mex_files
|
2009-06-21 11:20:03 +02:00
|
|
|
test = (exist(mex_status{i,1},'file') == 3);
|
2008-05-16 10:18:37 +02:00
|
|
|
if ~test
|
|
|
|
addpath([dynareroot mex_status{i,2}]);
|
|
|
|
message = '[m] ';
|
|
|
|
else
|
2010-09-27 15:54:54 +02:00
|
|
|
message = '[mex] ';
|
2008-05-16 10:18:37 +02:00
|
|
|
end
|
2011-07-26 11:07:27 +02:00
|
|
|
if verbose
|
|
|
|
disp([ message mex_status{i,3} '.' ])
|
|
|
|
end
|
2008-05-16 10:18:37 +02:00
|
|
|
end
|
2008-10-13 17:20:43 +02:00
|
|
|
|
2009-09-02 16:40:54 +02:00
|
|
|
% Test if bytecode DLL is present
|
2009-12-17 15:20:14 +01:00
|
|
|
if exist('bytecode', 'file') == 3
|
2010-09-27 15:54:54 +02:00
|
|
|
message = '[mex] ';
|
2008-10-13 17:20:43 +02:00
|
|
|
else
|
2009-12-16 18:17:34 +01:00
|
|
|
message = '[no] ';
|
2008-10-13 17:20:43 +02:00
|
|
|
end
|
2011-07-26 11:07:27 +02:00
|
|
|
if verbose
|
|
|
|
disp([ message 'Bytecode evaluation.' ])
|
|
|
|
end
|
2008-10-13 17:20:43 +02:00
|
|
|
|
2009-09-23 15:14:05 +02:00
|
|
|
% Test if k-order perturbation DLL is present
|
2009-12-17 15:20:14 +01:00
|
|
|
if exist('k_order_perturbation', 'file') == 3
|
2009-12-16 18:17:34 +01:00
|
|
|
message = '[mex] ';
|
2009-09-23 15:14:05 +02:00
|
|
|
else
|
2009-12-16 18:17:34 +01:00
|
|
|
message = '[no] ';
|
2009-09-23 15:14:05 +02:00
|
|
|
end
|
2011-07-26 11:07:27 +02:00
|
|
|
if verbose
|
|
|
|
disp([ message 'k-order perturbation solver.' ])
|
|
|
|
end
|
2009-09-23 15:14:05 +02:00
|
|
|
|
2009-11-06 13:03:19 +01:00
|
|
|
% Test if dynare_simul_ DLL is present
|
2009-12-17 15:20:14 +01:00
|
|
|
if exist('dynare_simul_', 'file') == 3
|
2009-12-16 18:17:34 +01:00
|
|
|
message = '[mex] ';
|
2009-11-06 13:03:19 +01:00
|
|
|
else
|
2009-12-16 18:17:34 +01:00
|
|
|
message = '[no] ';
|
2009-11-06 13:03:19 +01:00
|
|
|
end
|
2011-07-26 11:07:27 +02:00
|
|
|
if verbose
|
|
|
|
disp([ message 'k-order solution simulation.' ])
|
2011-12-21 18:23:15 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
% Test if qmc_sequence DLL is present
|
|
|
|
if exist('qmc_sequence', 'file') == 3
|
|
|
|
message = '[mex] ';
|
|
|
|
else
|
|
|
|
message = '[no] ';
|
|
|
|
end
|
|
|
|
if verbose
|
|
|
|
disp([ message 'Quasi Monte-Carlo sequence (Sobol).' ])
|
2012-06-15 16:36:22 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
% Test if MS-SBVAR DLL is present
|
|
|
|
if exist('ms_sbvar_command_line', 'file') == 3
|
|
|
|
message = '[mex] ';
|
|
|
|
else
|
|
|
|
message = '[no] ';
|
|
|
|
end
|
|
|
|
if verbose
|
|
|
|
disp([ message 'Markov Switching SBVAR.' ])
|
2013-07-10 17:12:34 +02:00
|
|
|
skipline()
|
2011-07-26 11:07:27 +02:00
|
|
|
end
|
2011-12-21 18:31:29 +01:00
|
|
|
|
2015-06-24 19:02:42 +02:00
|
|
|
% Initialization of the dates and dseries classes (recursive).
|
|
|
|
initialize_dseries_toolbox;
|
2014-05-14 12:36:06 +02:00
|
|
|
|
2011-12-19 12:36:35 +01:00
|
|
|
cd(origin);
|