-
Notifications
You must be signed in to change notification settings - Fork 0
/
setupPath.m
84 lines (77 loc) · 2.78 KB
/
setupPath.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
function setupPath
%
% Author: Renliang Gu (gurenliang@gmail.com)
%
% 0.5: put path adding to the end
% 0.4: add variable cleaning statements
% 0.3: add the current path
% 0.2: implement by dbstack, so that it can be called from any location
[a,~]=dbstack('-completenames');
a=a(1);
[pathstr,~,~]=fileparts(a.file);
cd('rwt')
tgt=['mdwt.' mexext];
if(~exist(tgt,'file')...
|| isOlder(tgt,{'mdwt.c','mdwt_r.c'}))
mex -largeArrayDims mdwt.c mdwt_r.c
end
tgt=['midwt.' mexext];
if(~exist(tgt,'file')...
|| isOlder(tgt,{'midwt.c','midwt_r.c'}))
mex -largeArrayDims midwt.c midwt_r.c
end
cd(pathstr)
cd(['utils' filesep 'L-BFGS-B-C' filesep 'Matlab'])
if(~exist(['lbfgsb_wrapper.' mexext],'file'))
if(isunix)
system('make');
elseif(ispc)
mex -largeArrayDims -O -g -UDEBUG -I../src ...
lbfgsb_wrapper.c ../src/lbfgsb.c ../src/linesearch.c ../src/subalgorithms.c ...
../src/print.c ../src/linpack.c ../src/miniCBLAS.c ../src/timer.c
end
end
cd(pathstr)
addpath([pathstr filesep 'rwt']);
addpath([pathstr filesep 'npg']);
addpath([pathstr filesep 'utils']);
addpath([pathstr filesep 'utils' filesep 'L-BFGS-B-C' filesep 'Matlab']);
addpath([pathstr filesep 'irt' filesep 'nufft']);
addpath([pathstr filesep 'irt' filesep 'systems']);
addpath([pathstr filesep 'irt']);
addpath([pathstr filesep 'irt' filesep 'emission']);
addpath([pathstr filesep 'irt' filesep 'general']);
addpath([pathstr filesep 'irt' filesep 'transmission']);
addpath([pathstr filesep 'irt' filesep 'fbp']);
addpath([pathstr filesep 'irt' filesep 'data']);
addpath([pathstr filesep 'irt' filesep 'utilities']);
addpath([pathstr filesep 'others']);
addpath([pathstr filesep 'others' filesep 'FPC_AS']);
addpath([pathstr filesep 'others' filesep 'FPC_AS' filesep 'src']);
addpath([pathstr filesep 'others' filesep 'FPC_AS' filesep 'prob_gen']);
addpath([pathstr filesep 'others' filesep 'FPC_AS' filesep 'prob_gen' filesep 'classes']);
addpath([pathstr filesep 'others' filesep 'glmnet_matlab']);
addpath([pathstr filesep 'others' filesep 'fpc' filesep 'solvers']);
addpath([pathstr filesep 'others' filesep 'fpc' filesep 'solvers' filesep 'utilities']);
if(exist('others/TFOCS','dir'))
addpath([pathstr filesep 'others' filesep 'TFOCS']);
end
%slCharacterEncoding('UTF-8');
%disp('INFO: if your editor does not show (α,β) properly as $(\alpha,\beta)$ rendered with tex, please run the following command:');
%disp(' slCharacterEncoding(''UTF-8'');');
end
function o = isOlder(f1, f2)
if(~iscell(f2))
dependence{1}=f2;
else
dependence=f2;
end
file=dir(dependence{1});
time=datenum(file.date);
for i=2:length(dependence)
file=dir(dependence{i});
time=max(time,datenum(file.date));
end
file=dir(f1);
o=datenum(file.date)<time;
end