1function cspy_test
2%CSPY_TEST test cspy and cs_dmspy
3% Example
4%   cspy_test
5% See also: testall
6
7% Copyright 2006-2012, Timothy A. Davis, http://www.suitesparse.com
8
9index = ssget ;
10
11[ignore f] = sort (max (index.nrows, index.ncols)) ;
12
13clf
14
15% f = f (523:end) ;
16% f = f ((find (f == 938)):end) ;
17
18for i = f
19
20    Prob = ssget (i,index) ;
21    disp (Prob) ;
22    A = Prob.A ;
23    try
24        subplot (1,4,1) ; cspy (A) ;
25        drawnow
26        subplot (1,4,2) ; cspy (A,64) ;
27        drawnow
28        subplot (1,4,3) ; cs_dmspy (A) ;
29        drawnow
30        subplot (1,4,4) ; cs_dmspy (A,0) ;
31        drawnow
32    catch
33        fprintf ('failed...\n') ;
34    end
35
36    [m n] = size (A) ;
37    if (m == n & nnz (diag (A)) == n)                                       %#ok
38        p = cs_dmperm (A) ;
39        if (any (p ~= 1:n))
40            error ('!') ;
41        end
42        [p q r s cc rr] = cs_dmperm (A) ;                                   %#ok
43        if (any (p ~= q))
44            error ('not sym!') ;
45        end
46    end
47
48    drawnow
49end
50