~logan/ubuntu/trusty/suitesparse/4.2.1-3ubuntu1

« back to all changes in this revision

Viewing changes to CXSparse_newfiles/MATLAB/Test/test25.m

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme
  • Date: 2007-05-29 09:36:29 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070529093629-zowquo0b7slkk6nc
Tags: 3.0.0-2
* suitesparse builds properly twice in a row
* Bug fix: "suitesparse - FTBFS: Broken build depens: libgfortran1-dev",
  thanks to Bastian Blank (Closes: #426349).
* Bug fix: "suitesparse_3.0.0-1: FTBFS: build-depends on
  libgfortran1-dev", thanks to Steve Langasek (Closes: #426354).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function test25
 
2
%TEST25 test cs_nd
 
3
%
 
4
% Example:
 
5
%   test25
 
6
% See also: testall
 
7
 
 
8
%   Copyright 2006-2007, Timothy A. Davis.
 
9
%   http://www.cise.ufl.edu/research/sparse
 
10
 
 
11
 
 
12
clear functions
 
13
 
 
14
index = UFget ;
 
15
[ignore f] = sort (max (index.nrows, index.ncols)) ;
 
16
f = f (1:400) ;
 
17
 
 
18
clf
 
19
% f = f(1)
 
20
 
 
21
for k = 1:length (f)
 
22
    
 
23
    i = f (k) ;
 
24
    Prob = UFget (i) ;
 
25
    disp (Prob) ;
 
26
    A = real (Prob.A) ;
 
27
    [m n] = size (A) ;
 
28
    if (m ~= n)
 
29
        continue
 
30
    end
 
31
 
 
32
    A = A|A' ;
 
33
 
 
34
    S = A ;
 
35
    if (mod (k,2) == 0)
 
36
        S = S + 1i * sprand (A) ;
 
37
    end
 
38
 
 
39
    tic ;
 
40
    p1 = symrcm (A) ;
 
41
    t1 = toc ;
 
42
 
 
43
    tic ;
 
44
    p2 = cs_nd (sparse (1)) ;
 
45
    toc ;
 
46
    if (p2 ~= 1)
 
47
        error ('!') ;
 
48
    end
 
49
 
 
50
    tic ;
 
51
    p2 = cs_nd (S) ;
 
52
    t2 = toc ;
 
53
 
 
54
    if (any (sort (p2) ~= 1:n))
 
55
        error ('!') ;
 
56
    end
 
57
 
 
58
    rel = t2 / max (t1,1e-6) ;
 
59
 
 
60
    fprintf ('time: symrcm %8.3f   nd %8.3f  rel %8.2f\n', t1, t2, rel) ;
 
61
 
 
62
    subplot (1,3,1) ; spy (A) ;
 
63
    subplot (1,3,2) ; spy (A (p1,p1)) ;
 
64
    subplot (1,3,3) ; spy (A (p2,p2)) ;
 
65
 
 
66
    % evaluate the profile ...
 
67
 
 
68
 
 
69
    drawnow 
 
70
    % pause
 
71
end