Skip to content

Commit d6944aa

Browse files
committed
CAMD: add octave support
1 parent 857650b commit d6944aa

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

Diff for: CAMD/MATLAB/camd_demo.m

+8-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
n = size (A,1) ;
2727

28+
have_octave = (exist ('OCTAVE_VERSION', 'builtin') == 5) ;
29+
2830
rand ('state', 0) ;
2931
C = irand (6, n) ;
3032

@@ -70,11 +72,15 @@
7072
[cn, height, parent, post, R] = symbfact (A(p,p)) ;
7173

7274
subplot (2,2,3) ;
73-
spy (R') ;
75+
spy (R') ;
7476
title ('Cholesky factor L') ;
7577

7678
subplot (2,2,4) ;
77-
treeplot (parent) ;
79+
if (have_octave)
80+
treeplot (parent')
81+
else
82+
treeplot(parent)
83+
end
7884
title ('etree') ;
7985

8086
% results from symbfact

Diff for: CAMD/MATLAB/camd_make.m

+13-3
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,28 @@
1010
% Amestoy, and Iain S. Duff. All Rights Reserved.
1111
% SPDX-License-Identifier: BSD-3-clause
1212

13+
have_octave = (exist ('OCTAVE_VERSION', 'builtin') == 5) ;
14+
1315
details = 0 ; % 1 if details of each command are to be printed
1416

1517
d = '' ;
1618
if (~isempty (strfind (computer, '64')))
1719
d = '-largeArrayDims' ;
1820
end
1921

20-
% MATLAB 8.3.0 now has a -silent option to keep 'mex' from burbling too much
21-
if (~verLessThan ('matlab', '8.3.0'))
22-
d = ['-silent ' d] ;
22+
if (have_octave)
23+
d = ['--silent ' d] ;
24+
else
25+
% MATLAB 8.3.0 now has a -silent option to keep 'mex' from burbling too much
26+
if (~verLessThan ('matlab', '8.3.0'))
27+
d = ['-silent ' d] ;
28+
end
2329
end
2430

31+
if (have_octave)
32+
d = ['-DOCTAVE ' d] ;
33+
end
34+
2535
i = sprintf ('-I../Include -I../../SuiteSparse_config') ;
2636
cmd = sprintf ('mex -O %s -output camd %s camd_mex.c %s', d, i, ...
2737
'../../SuiteSparse_config/SuiteSparse_config.c') ;

Diff for: CAMD/MATLAB/camd_mex.c

+3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@
2828

2929
#include "camd.h"
3030
#include "mex.h"
31+
32+
#ifndef OCTAVE
3133
#include "matrix.h"
34+
#endif
3235

3336
void mexFunction
3437
(

0 commit comments

Comments
 (0)