1function SuiteSparse_test
2% SuiteSparse_test exhaustive test of all SuiteSparse packages
3%
4% Your current directory must be SuiteSparse for this function to work.
5% SuiteSparse_install must be run prior to running this test.  Warning:
6% this test takes a *** long **** time.
7%
8% Example:
9%   SuiteSparse_test
10%
11% See also SuiteSparse_install, SuiteSparse_demo.
12
13% Copyright 1990-2015, Timothy A. Davis, http://suitesparse.com.
14
15help SuiteSparse_test
16
17npackages = 19 ;
18h = waitbar (0, 'SuiteSparse test:') ;
19SuiteSparse = pwd ;
20package = 0 ;
21
22try
23
24    %---------------------------------------------------------------------------
25    % CSparse
26    %---------------------------------------------------------------------------
27
28    % compile and install CSparse (not installed by SuiteSparse_install)
29    package = package + 1 ;
30    waitbar (package/(npackages+1), h, 'SuiteSparse test: CSparse') ;
31    addpath ([SuiteSparse '/CSparse/MATLAB/CSparse']) ;
32    addpath ([SuiteSparse '/CSparse/MATLAB/Demo']) ;
33    cd ([SuiteSparse '/CSparse/MATLAB/CSparse']) ;
34    cs_make ;
35    % test CSparse
36    cd ([SuiteSparse '/CSparse/MATLAB/Test']) ;
37    testall ;
38    % uninstall CSparse by removing it from path
39    rmpath ([SuiteSparse '/CSparse/MATLAB/CSparse']) ;
40    rmpath ([SuiteSparse '/CSparse/MATLAB/Demo']) ;
41    rmpath ([SuiteSparse '/CSparse/MATLAB/ssget']) ;
42
43    %---------------------------------------------------------------------------
44    % CXSparse
45    %---------------------------------------------------------------------------
46
47    package = package + 1 ;
48    waitbar (package/(npackages+1), h, 'SuiteSparse test: CXSparse') ;
49    cd ([SuiteSparse '/CXSparse/MATLAB/Test']) ;
50    testall ;
51
52    %---------------------------------------------------------------------------
53    % COLAMD
54    %---------------------------------------------------------------------------
55
56    package = package + 1 ;
57    waitbar (package/(npackages+1), h, 'SuiteSparse test: COLAMD') ;
58    cd ([SuiteSparse '/COLAMD/MATLAB']) ;
59    colamd_test ;
60
61    %---------------------------------------------------------------------------
62    % CCOLAMD
63    %---------------------------------------------------------------------------
64
65    package = package + 1 ;
66    waitbar (package/(npackages+1), h, 'SuiteSparse test: CCOLAMD') ;
67    cd ([SuiteSparse '/CCOLAMD/MATLAB']) ;
68    ccolamd_test ;
69
70    %---------------------------------------------------------------------------
71    % UMFPACK
72    %---------------------------------------------------------------------------
73
74    package = package + 1 ;
75    waitbar (package/(npackages+1), h, 'SuiteSparse test: UMFPACK') ;
76    cd ([SuiteSparse '/UMFPACK/MATLAB']) ;
77    umfpack_test (100) ;
78
79    %---------------------------------------------------------------------------
80    % CHOLMOD
81    %---------------------------------------------------------------------------
82
83    package = package + 1 ;
84    waitbar (package/(npackages+1), h, 'SuiteSparse test: CHOLMOD') ;
85    cd ([SuiteSparse '/CHOLMOD/MATLAB/Test']) ;
86    cholmod_test ;
87
88    %---------------------------------------------------------------------------
89    % BTF
90    %---------------------------------------------------------------------------
91
92    package = package + 1 ;
93    waitbar (package/(npackages+1), h, 'SuiteSparse test: BTF') ;
94    cd ([SuiteSparse '/BTF/MATLAB/Test']) ;
95    btf_test ;
96
97    %---------------------------------------------------------------------------
98    % KLU
99    %---------------------------------------------------------------------------
100
101    package = package + 1 ;
102    waitbar (package/(npackages+1), h, 'SuiteSparse test: KLU') ;
103    cd ([SuiteSparse '/KLU/MATLAB/Test']) ;
104    klu_test (100) ;
105
106    %---------------------------------------------------------------------------
107    % LDL
108    %---------------------------------------------------------------------------
109
110    package = package + 1 ;
111    waitbar (package/(npackages+1), h, 'SuiteSparse test: LDL') ;
112    cd ([SuiteSparse '/LDL/MATLAB']) ;
113    ldlmain2 ;
114    ldltest ;
115
116    %---------------------------------------------------------------------------
117    % LINFACTOR:  MATLAB 7.3 (R2006b) or later required
118    %---------------------------------------------------------------------------
119
120    package = package + 1 ;
121    if (verLessThan ('matlab', '7.3'))
122        % skip test of LINFACTOR
123    else
124        waitbar (package/(npackages+1), h, 'SuiteSparse test: LINFACTOR') ;
125        cd ([SuiteSparse '/MATLAB_Tools/LINFACTOR']) ;
126        lintests ;
127    end
128
129    %---------------------------------------------------------------------------
130    % MESHND
131    %---------------------------------------------------------------------------
132
133    package = package + 1 ;
134    waitbar (package/(npackages+1), h, 'SuiteSparse test: MESHND') ;
135    cd ([SuiteSparse '/MATLAB_Tools/MESHND']) ;
136    meshnd_quality ;
137
138    %---------------------------------------------------------------------------
139    % SSMULT
140    %---------------------------------------------------------------------------
141
142    package = package + 1 ;
143    waitbar (package/(npackages+1), h, 'SuiteSparse test: SSMULT') ;
144    cd ([SuiteSparse '/MATLAB_Tools/SSMULT']) ;
145    sstest3 ;
146
147    %---------------------------------------------------------------------------
148    % other MATLAB_Tools
149    %---------------------------------------------------------------------------
150
151    package = package + 1 ;
152    waitbar (package/(npackages+1), h, 'SuiteSparse test: MATLAB Tools') ;
153    cd ([SuiteSparse '/MATLAB_Tools']) ;
154    fprintf ('getversion: %g\n', getversion) ;
155    seashell ;
156    shellgui ;
157    cd ([SuiteSparse '/MATLAB_Tools/waitmex']) ;
158    waitmex ;
159    url = 'http://suitesparse.com' ;
160    fprintf ('<a href="%s">Click here for more details</a>\n', url) ;
161    hprintf ('or see <a href="%s">\n', url) ;
162    cd ([SuiteSparse '/MATLAB_Tools/find_components']) ;
163    find_components_example (1, 0) ;
164    cd ([SuiteSparse '/MATLAB_Tools/spok']) ;
165    spok_test ;
166
167    %---------------------------------------------------------------------------
168    % FACTORIZE
169    %---------------------------------------------------------------------------
170
171    package = package + 1 ;
172    waitbar (package/(npackages+1), h, 'SuiteSparse test: FACTORIZE') ;
173    cd ([SuiteSparse '/MATLAB_Tools/Factorize/Test']) ;
174    test_all ;
175
176    %---------------------------------------------------------------------------
177    % SPARSEINV
178    %---------------------------------------------------------------------------
179
180    package = package + 1 ;
181    waitbar (package/(npackages+1), h, 'SuiteSparse test: SPARSEINV') ;
182    cd ([SuiteSparse '/MATLAB_Tools/sparseinv']) ;
183    sparseinv_test
184
185    %---------------------------------------------------------------------------
186    % SPQR_RANK
187    %---------------------------------------------------------------------------
188
189    package = package + 1 ;
190    waitbar (package/(npackages+1), h, 'SuiteSparse test: spqr_rank') ;
191    cd ([SuiteSparse '/MATLAB_Tools/spqr_rank']) ;
192    demo_spqr_rank ;
193
194    %---------------------------------------------------------------------------
195    % Mongoose
196    %---------------------------------------------------------------------------
197
198    package = package + 1 ;
199    waitbar (package/(npackages+1), h, 'SuiteSparse test: mongoose') ;
200    cd ([SuiteSparse '/Mongoose/MATLAB']) ;
201    mongoose_test ;
202
203    %---------------------------------------------------------------------------
204    % GraphBLAS
205    %---------------------------------------------------------------------------
206
207    package = package + 1 ;
208    waitbar (package/(npackages+1), h, 'SuiteSparse test: GraphBLAS') ;
209    cd ([SuiteSparse '/GraphBLAS/GraphBLAS/test']) ;
210    gbtest ;
211
212    %---------------------------------------------------------------------------
213    % PIRO_BAND
214    %---------------------------------------------------------------------------
215
216%   package = package + 1 ;
217%   waitbar (package/(npackages+1), h, 'SuiteSparse test: PIRO_BAND') ;
218%   cd ([SuiteSparse '/PIRO_BAND/MATLAB/Test']) ;
219%   demo_spqr_rank ;
220
221    %---------------------------------------------------------------------------
222    % AMD, CAMD, SuiteSparseCollection, ssget
223    %---------------------------------------------------------------------------
224
225    % no exhaustive tests; tested via other packages
226
227catch
228
229    %---------------------------------------------------------------------------
230    % test failure
231    %---------------------------------------------------------------------------
232
233    cd (SuiteSparse) ;
234    disp (lasterr) ;                                                        %#ok
235    fprintf ('SuiteSparse test: FAILED\n') ;
236    return
237
238end
239
240%-------------------------------------------------------------------------------
241% test OK
242%-------------------------------------------------------------------------------
243
244close (h) ;
245fprintf ('SuiteSparse test: OK\n') ;
246cd (SuiteSparse) ;
247