LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
build_lsoda_mex.m
1function build_lsoda_mex()
2% BUILD_LSODA_MEX Compile the LSODA MEX solver
3%
4% build_lsoda_mex()
5%
6% Compiles liblsoda C sources into a MEX function lsoda_mex.
7% The compiled MEX file is placed in the same directory as this script.
8%
9% Requirements: a C compiler configured via mex -setup
10
11thisDir = fileparts(mfilename('fullpath'));
12srcDir = fullfile(thisDir, 'src');
13
14% List all C source files (excluding ewset.c and printcf.c)
15srcFiles = {
16 fullfile(srcDir, 'lsoda_mex.c')
17 fullfile(srcDir, 'lsoda.c')
18 fullfile(srcDir, 'stoda.c')
19 fullfile(srcDir, 'correction.c')
20 fullfile(srcDir, 'prja.c')
21 fullfile(srcDir, 'solsy.c')
22 fullfile(srcDir, 'intdy.c')
23 fullfile(srcDir, 'cfode.c')
24 fullfile(srcDir, 'methodswitch.c')
25 fullfile(srcDir, 'orderswitch.c')
26 fullfile(srcDir, 'corfailure.c')
27 fullfile(srcDir, 'scaleh.c')
28 fullfile(srcDir, 'common.c')
29 fullfile(srcDir, 'vmnorm.c')
30 fullfile(srcDir, 'fnorm.c')
31 fullfile(srcDir, 'daxpy.c')
32 fullfile(srcDir, 'ddot.c')
33 fullfile(srcDir, 'dgefa.c')
34 fullfile(srcDir, 'dgesl.c')
35 fullfile(srcDir, 'dscal.c')
36 fullfile(srcDir, 'idamax.c')
37 fullfile(srcDir, 'strdup_printf.c')
38};
39
40fprintf('Building lsoda_mex...\n');
41
42mex('-O', ...
43 ['-I' srcDir], ...
44 '-output', fullfile(thisDir, 'lsoda_mex'), ...
45 srcFiles{:});
46
47fprintf('lsoda_mex built successfully.\n');
48end