-
Notifications
You must be signed in to change notification settings - Fork 11
/
forbes_setup.m
executable file
·26 lines (24 loc) · 1.16 KB
/
forbes_setup.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
% Add ForBES directory to MATLAB's path
forbes_path = fileparts(mfilename('fullpath'));
library_path = fullfile(forbes_path, 'library');
private_path = fullfile(forbes_path, 'private');
utils_path = fullfile(forbes_path, 'utils');
cones_path = fullfile(forbes_path, 'cones');
disp(['Adding ForBES directory to MATLAB path: ', forbes_path]);
addpath(forbes_path);
disp(['Adding ForBES library to MATLAB path: ', library_path]);
addpath(library_path);
disp(['Adding ForBES utils to MATLAB path: ', library_path]);
addpath(utils_path);
addpath(cones_path);
savepath;
% Compile necessary C source files
LBFGS_path = fullfile(forbes_path, 'private', 'lbfgs.c');
Riccati_path = fullfile(forbes_path, 'library', 'RiccatiSolve.c');
error_msg = 'The C compiler could not succesfully compile ';
if mex('-outdir', private_path,'-lmwblas', LBFGS_path), error([error_msg, LBFGS_path]); end
if mex('-outdir', library_path, Riccati_path), error([error_msg, Riccati_path]); end
disp('ForBES was succesfully configured and installed');
disp('Type ''help forbes'' to access the help file');
% Clear variables
clear forbes_path library_path cones_path private_path LBFGS_path Riccati_path error_msg;