forked from SacklerCentre/MVGC1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
startup.m
129 lines (98 loc) · 4.68 KB
/
startup.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
%% MVGC Toolbox "startup" script
%
% Initialise MVGC Toolbox. This file is run automatically if Matlab is started
% in the toolbox root (installation) directory.
%
% You may have to (or want to) customise this script for your computing
% environment.
%
% (C) Lionel Barnett and Anil K. Seth, 2012. See file license.txt in
% installation directory for licensing terms.
%
%% Set toolbox version
global mvgc_version;
mvgc_version.major = 1;
mvgc_version.minor = 3;
fprintf('[MVGC startup] Initialising MVGC toolbox version %d.%d\n', mvgc_version.major, mvgc_version.minor);
%% Set path
% Add MVGC root directory and appropriate subdirectories to path
global mvgc_root;
mvgc_root = fileparts(mfilename('fullpath')); % directory containing this file
% essentials
addpath(mvgc_root);
addpath(fullfile(mvgc_root,'core'));
addpath(fullfile(mvgc_root,'gc'));
addpath(fullfile(mvgc_root,'gc','GCCA_compat'));
addpath(fullfile(mvgc_root,'gc','subsample'));
addpath(fullfile(mvgc_root,'stats'));
addpath(fullfile(mvgc_root,'utils'));
if ~fexists(@rng) || ~fexists(@randi) % legacy hack
addpath(fullfile(mvgc_root,'utils','legacy'));
if ~fexists(@rng), addpath(fullfile(mvgc_root,'utils','legacy','rng')); end
if ~fexists(@randi), addpath(fullfile(mvgc_root,'utils','legacy','randi')); end
end
addpath(fullfile(mvgc_root,'demo'));
addpath(fullfile(mvgc_root,'mex'));
addpath(fullfile(mvgc_root,'experimental'));
addpath(fullfile(mvgc_root,'docs')); % don't add the 'html' subdirectory
% comment out for release
% addpath(fullfile(mvgc_root,'testing'));
% addpath(fullfile(mvgc_root,'maintainer'));
fprintf('[MVGC startup] Added MVGC root directory %s and subdirectories to path\n',mvgc_root);
%% Check |mex| files
% Check for |mex| files and set flags appropriately
global have_genvar_mex;
have_genvar_mex = exist('genvar_mex','file') == 3;
if ~have_genvar_mex
fprintf(2,'[MVGC startup] WARNING: no ''genvar'' mex file found; please run the ''mvgc_makemex'' script.\n');
fprintf(2,'[MVGC startup] Meanwhile, a slower scripted VAR simulation routine will be used.\n');
else
fprintf('[MVGC startup] All MVGC ''mex'' files for your platform exist\n');
end
%% Check for dependencies on other Matlab(R) toolboxes
% Check if we have Statistics toolbox - see if ch2cdf is present
if fexists(@chi2cdf)
fprintf('[MVGC startup] Statistics Toolbox(TM) seems to be present.\n');
else
addpath(fullfile(mvgc_root,'utils','stats'));
fprintf(2,'[MVGC startup] WARNING: Statistics Toolbox(TM) does not seem to be present.\n');
fprintf(2,'[MVGC startup] Will use slower scripted routines (see utils/stats directory).\n');
end
% Check if we have Signal Processing toolbox - see if pwelch is present
if fexists(@pwelch)
fprintf('[MVGC startup] Signal Processing Toolbox(TM) seems to be present.\n');
else
fprintf(2,'[MVGC startup] WARNING: Signal Processing Toolbox(TM) does not seem to be present.\n');
fprintf(2,'[MVGC startup] Some spectral estimation routines may not work.\n');
end
% Check if we have 'dlyap' from the Control System toolbox
if fexists(@dlyap)
fprintf('[MVGC startup] Control System Toolbox(TM) seems to be present.\n');
else
addpath(fullfile(mvgc_root,'utils','control'));
fprintf(2,'[MVGC startup] WARNING: Control System Toolbox(TM) does not seem to be present.\n');
fprintf(2,'[MVGC startup] Will use slower scripted routines (see utils/control directory).\n');
end
%% Initialise default random number stream
% Have we got global rng control? Otherwise we're in annoying legacy territory
% Initialise rng to avoid predictability of sessions
rng_seed(-1); % seed from /dev/urandom (Unix/Mac) else from clock
fprintf('[MVGC startup] Random number generator initialised\n');
%% Enable all warnings
warning on all
fprintf('[MVGC startup] All warnings enabled\n');
% Important notes to users
fprintf('[MVGC startup]\n');
fprintf('[MVGC startup] NOTE 1: PLEASE DO NOT ADD THE FULL MVGC HIERARCHY TO YOUR MATLAB SEARCH PATH!\n');
fprintf('[MVGC startup] Doing so is likely to cause problems. This script has already set up\n');
fprintf('[MVGC startup] MVGC paths correctly for your Matlab environment.\n');
fprintf('[MVGC startup]\n');
fprintf('[MVGC startup] NOTE 2: It is highly recommended that any single-precision floating-point data\n');
fprintf('[MVGC startup] be converted to double precision; some routines may be inaccurate or\n');
fprintf('[MVGC startup] numerically unstable for single-precision input.\n');
fprintf('[MVGC startup]\n');
% Done
fprintf('[MVGC startup] Initialisation complete (you may re-run ''startup'' at any time)\n');
fprintf('[MVGC startup] Type ''helpon'' to get started\n');
%%
% <startup.html back to top>