0001 function dynareroot = dynare_config(path_to_dynare,verbose)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 if nargin && ~isempty(path_to_dynare)
0036 addpath(path_to_dynare);
0037 end
0038 dynareroot = strrep(which('dynare'),'dynare.m','');
0039
0040 origin = pwd();
0041 cd([dynareroot '/..'])
0042
0043 if ~nargin || nargin==1
0044 verbose = 1;
0045 end
0046
0047
0048 addpath([dynareroot '/distributions/'])
0049 addpath([dynareroot '/kalman/'])
0050 addpath([dynareroot '/kalman/likelihood'])
0051 addpath([dynareroot '/AIM/'])
0052 addpath([dynareroot '/partial_information/'])
0053 addpath([dynareroot '/ms-sbvar/'])
0054 addpath([dynareroot '/ms-sbvar/identification/'])
0055 addpath([dynareroot '../contrib/ms-sbvar/TZcode/MatlabFiles/'])
0056 addpath([dynareroot '/parallel/'])
0057 addpath([dynareroot '/particle/'])
0058 addpath([dynareroot '/gsa/'])
0059 addpath([dynareroot '/ep/'])
0060 addpath([dynareroot '/utilities/doc/'])
0061 addpath([dynareroot '/utilities/tests/'])
0062 addpath([dynareroot '/utilities/dataset/'])
0063 addpath([dynareroot '/utilities/general/'])
0064
0065
0066
0067
0068 if ~exist('OCTAVE_VERSION')
0069
0070 addpath([dynareroot '/missing/rows_columns'])
0071
0072 addpath([dynareroot '/missing/vec'])
0073 if ~user_has_matlab_license('statistics_toolbox')
0074
0075 addpath([dynareroot '/missing/stats/'])
0076 end
0077 end
0078
0079
0080 if exist('OCTAVE_VERSION') || matlab_ver_less_than('7.0.1')
0081 addpath([dynareroot '/missing/ordeig'])
0082 end
0083
0084
0085 if ~exist('OCTAVE_VERSION') && matlab_ver_less_than('7.4')
0086 addpath([dynareroot '/missing/bsxfun'])
0087 end
0088
0089
0090
0091 if (exist('OCTAVE_VERSION') && ~user_has_octave_forge_package('statistics')) ...
0092 || (~exist('OCTAVE_VERSION') && ~user_has_matlab_license('statistics_toolbox'))
0093 addpath([dynareroot '/missing/nanmean'])
0094 end
0095
0096
0097 if exist('OCTAVE_VERSION')
0098 addpath([dynareroot '../mex/octave/']);
0099 else
0100
0101 if strcmp(computer, 'PCWIN')
0102 if matlab_ver_less_than('7.1')
0103 mexpath = [dynareroot '../mex/matlab/win32-7.0-7.0.4'];
0104 if exist(mexpath, 'dir')
0105 addpath(mexpath)
0106 end
0107 elseif matlab_ver_less_than('7.5')
0108 mexpath = [dynareroot '../mex/matlab/win32-7.1-7.4'];
0109 if exist(mexpath, 'dir')
0110 addpath(mexpath)
0111 end
0112 else
0113 mexpath = [dynareroot '../mex/matlab/win32-7.5-7.14'];
0114 if exist(mexpath, 'dir')
0115 addpath(mexpath)
0116 end
0117 end
0118 end
0119
0120
0121 if strcmp(computer, 'PCWIN64')
0122 if matlab_ver_less_than('7.3')
0123 mexpath = [dynareroot '../mex/matlab/win64-7.2'];
0124 if exist(mexpath, 'dir')
0125 addpath(mexpath)
0126 end
0127 elseif matlab_ver_less_than('7.5')
0128 mexpath = [dynareroot '../mex/matlab/win64-7.3-7.4'];
0129 if exist(mexpath, 'dir')
0130 addpath(mexpath)
0131 end
0132 elseif matlab_ver_less_than('7.8')
0133 mexpath = [dynareroot '../mex/matlab/win64-7.5-7.7'];
0134 if exist(mexpath, 'dir')
0135 addpath(mexpath)
0136 end
0137 else
0138 mexpath = [dynareroot '../mex/matlab/win64-7.8-7.14'];
0139 if exist(mexpath, 'dir')
0140 addpath(mexpath)
0141 end
0142 end
0143 end
0144
0145 if strcmp(computer, 'MACI')
0146 if matlab_ver_less_than('7.5')
0147 mexpath = [dynareroot '../mex/matlab/osx32-7.4'];
0148 if exist(mexpath, 'dir')
0149 addpath(mexpath)
0150 end
0151 else
0152 mexpath = [dynareroot '../mex/matlab/osx32-7.5-7.14'];
0153 if exist(mexpath, 'dir')
0154 addpath(mexpath)
0155 end
0156 end
0157 end
0158
0159 if strcmp(computer, 'MACI64')
0160 mexpath = [dynareroot '../mex/matlab/osx64'];
0161 if exist(mexpath, 'dir')
0162 addpath(mexpath)
0163 end
0164 end
0165
0166
0167 addpath([dynareroot '../mex/matlab/']);
0168 end
0169
0170
0171 mex_status = cell(1,3);
0172 mex_status(1,1) = {'mjdgges'};
0173 mex_status(1,2) = {'qz'};
0174 mex_status(1,3) = {'Generalized QZ'};
0175 mex_status(2,1) = {'gensylv'};
0176 mex_status(2,2) = {'gensylv'};
0177 mex_status(2,3) = {'Sylvester equation solution'};
0178 mex_status(3,1) = {'A_times_B_kronecker_C'};
0179 mex_status(3,2) = {'kronecker'};
0180 mex_status(3,3) = {'Kronecker products'};
0181 mex_status(4,1) = {'sparse_hessian_times_B_kronecker_C'};
0182 mex_status(4,2) = {'kronecker'};
0183 mex_status(4,3) = {'Sparse kronecker products'};
0184 mex_status(5,1) = {'local_state_space_iteration_2'};
0185 mex_status(5,2) = {'particle/local_state_space_iteration'};
0186 mex_status(5,3) = {'Local state space iteraton (second order)'};
0187 number_of_mex_files = size(mex_status,1);
0188
0189
0190
0191 matlab_path = path;
0192 for i=1:number_of_mex_files
0193 test = strfind(matlab_path,[dynareroot mex_status{i,2}]);
0194 action = length(test);
0195 if action
0196 rmpath([dynareroot mex_status{i,2}]);
0197 matlab_path = path;
0198 end
0199 end
0200
0201
0202 if verbose
0203 disp(' ')
0204 disp('Configuring Dynare ...')
0205 end
0206
0207 for i=1:number_of_mex_files
0208 test = (exist(mex_status{i,1},'file') == 3);
0209 if ~test
0210 addpath([dynareroot mex_status{i,2}]);
0211 message = '[m] ';
0212 else
0213 message = '[mex] ';
0214 end
0215 if verbose
0216 disp([ message mex_status{i,3} '.' ])
0217 end
0218 end
0219
0220
0221 if exist('bytecode', 'file') == 3
0222 message = '[mex] ';
0223 else
0224 message = '[no] ';
0225 end
0226 if verbose
0227 disp([ message 'Bytecode evaluation.' ])
0228 end
0229
0230
0231 if exist('k_order_perturbation', 'file') == 3
0232 message = '[mex] ';
0233 else
0234 message = '[no] ';
0235 end
0236 if verbose
0237 disp([ message 'k-order perturbation solver.' ])
0238 end
0239
0240
0241 if exist('dynare_simul_', 'file') == 3
0242 message = '[mex] ';
0243 else
0244 message = '[no] ';
0245 end
0246 if verbose
0247 disp([ message 'k-order solution simulation.' ])
0248 end
0249
0250
0251 if exist('qmc_sequence', 'file') == 3
0252 message = '[mex] ';
0253 else
0254 message = '[no] ';
0255 end
0256 if verbose
0257 disp([ message 'Quasi Monte-Carlo sequence (Sobol).' ])
0258 disp(' ')
0259 end
0260
0261 cd(origin);