~ubuntu-branches/ubuntu/natty/suitesparse/natty

« back to all changes in this revision

Viewing changes to CSparse/MATLAB/Test/test11.m

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme
  • Date: 2006-12-22 10:16:15 UTC
  • Revision ID: james.westby@ubuntu.com-20061222101615-2ohaj8902oix2rnk
Tags: upstream-2.3.1
ImportĀ upstreamĀ versionĀ 2.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function test11
 
2
%TEST11 test cs_rowcnt
 
3
%
 
4
% Example:
 
5
%   test11
 
6
% See also: testall
 
7
 
 
8
%   Copyright 2006, Timothy A. Davis.
 
9
%   http://www.cise.ufl.edu/research/sparse
 
10
 
 
11
clear
 
12
clear functions
 
13
index = UFget ;
 
14
[ignore f] = sort (max (index.nrows, index.ncols)) ;
 
15
f = f (1:200) ;
 
16
 
 
17
for i = f
 
18
    Prob = UFget (i, index) ;
 
19
    disp (Prob) ;
 
20
    A = Prob.A ;
 
21
    [m n] = size (A) ;
 
22
    if (~isreal (A) || m ~= n)
 
23
        continue
 
24
    end
 
25
 
 
26
    A = spones (A) ;
 
27
    A = A+A' + speye(n) ;
 
28
 
 
29
    [cc h pa po R] = symbfact (A) ;
 
30
    rc1 = full (sum (R)) ;
 
31
    rc2 = cs_rowcnt (A, pa, po) ;
 
32
    if (any (rc1 ~= rc2))
 
33
        error ('!') ;
 
34
    end
 
35
 
 
36
    try
 
37
        p = amd (A) ;
 
38
    catch
 
39
        p = symamd (A) ;
 
40
    end
 
41
    A = A (p,p) ;
 
42
 
 
43
    [cc h pa po R] = symbfact (A) ;
 
44
    rc1 = full (sum (R)) ;
 
45
    rc2 = cs_rowcnt (A, pa, po) ;
 
46
    if (any (rc1 ~= rc2))
 
47
        error ('!') ;
 
48
    end
 
49
 
 
50
end
 
51