Skip to content

Commit

Permalink
COLAMD: add octave support
Browse files Browse the repository at this point in the history
tests don't work
  • Loading branch information
homka122 committed May 17, 2024
1 parent 5d4127f commit 857650b
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 9 deletions.
18 changes: 14 additions & 4 deletions COLAMD/MATLAB/colamd_make.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,25 @@
% Acknowledgements: This work was supported by the National Science Foundation,
% under grants DMS-9504974 and DMS-9803599.

have_octave = (exist ('OCTAVE_VERSION', 'builtin') == 5) ;

details = 0 ; % 1 if details of each command are to be printed
d = '' ;
if (~isempty (strfind (computer, '64')))
if (~have_octave && ~isempty (strfind (computer, '64')))
d = '-largeArrayDims' ;
end

% MATLAB 8.3.0 now has a -silent option to keep 'mex' from burbling too much
if (~verLessThan ('matlab', '8.3.0'))
d = ['-silent ' d] ;
if (have_octave)
d = ['--silent ' d];
else
% MATLAB 8.3.0 now has a -silent option to keep 'mex' from burbling too much
if (~verLessThan ('matlab', '8.3.0'))
d = ['-silent ' d] ;
end
end

if (have_octave)
d = ['-DOCTAVE ' d]
end

src = '../Source/colamd_l.c ../../SuiteSparse_config/SuiteSparse_config.c' ;
Expand Down
14 changes: 13 additions & 1 deletion COLAMD/MATLAB/colamd_test.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
% Acknowledgements: This work was supported by the National Science Foundation,
% under grants DMS-9504974 and DMS-9803599.

have_octave = (exist ('OCTAVE_VERSION', 'builtin') == 5) ;

help colamd_test


Expand All @@ -32,6 +34,10 @@
end
cmd = sprintf (...
'mex -O %s -I../../SuiteSparse_config -I../Include ', d) ;
if(have_octave)
warning ("off", "Octave:possible-matlab-short-circuit-operator")
cmd = [cmd '-DOCTAVE ']
end
src = '../Source/colamd_l.c ../../SuiteSparse_config/SuiteSparse_config.c' ;
if (~(ispc || ismac))
% for POSIX timing routine
Expand Down Expand Up @@ -422,6 +428,8 @@ function check_perm (p, A)
% mtype 2: rectangular
% mtype 3: symmetric (mmax is ignored)

have_octave = (exist ('OCTAVE_VERSION', 'builtin') == 5) ;

n = irand (nmax) ;
if (mtype ~= 2)
% square
Expand All @@ -430,7 +438,11 @@ function check_perm (p, A)
m = irand (mmax) ;
end

A = sprand (m, n, 10 / max (m,n)) ;
if (have_octave)
A = sprand (m, n, rand() / 10) ;
else
A = sprand (m, n, 10 / max(m, n)) ;
end

if (drows > 0)
% add dense rows
Expand Down
4 changes: 3 additions & 1 deletion COLAMD/MATLAB/colamdmex.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@

#include "colamd.h"
#include "mex.h"
#include "matrix.h"
#include <stdlib.h>
#include <string.h>

#ifndef OCTAVE
#include "matrix.h"
#endif
/* ========================================================================== */
/* === colamd mexFunction =================================================== */
/* ========================================================================== */
Expand Down
6 changes: 5 additions & 1 deletion COLAMD/MATLAB/colamdtestmex.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,14 @@

#include "colamd.h"
#include "mex.h"
#include "matrix.h"
#include <stdlib.h>
#include <string.h>

#ifndef OCTAVE
#include "matrix.h"
#endif


static void dump_matrix
(
int64_t A [ ],
Expand Down
5 changes: 4 additions & 1 deletion COLAMD/MATLAB/symamdmex.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,12 @@

#include "colamd.h"
#include "mex.h"
#include "matrix.h"
#include <stdlib.h>

#ifndef OCTAVE
#include "matrix.h"
#endif

/* ========================================================================== */
/* === symamd mexFunction =================================================== */
/* ========================================================================== */
Expand Down
5 changes: 4 additions & 1 deletion COLAMD/MATLAB/symamdtestmex.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,13 @@

#include "colamd.h"
#include "mex.h"
#include "matrix.h"
#include <stdlib.h>
#include <string.h>

#ifndef OCTAVE
#include "matrix.h"
#endif

static void dump_matrix
(
int64_t A [ ],
Expand Down

0 comments on commit 857650b

Please sign in to comment.