File: test191.m

package info (click to toggle)
suitesparse-graphblas 7.4.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 67,112 kB
  • sloc: ansic: 1,072,243; cpp: 8,081; sh: 512; makefile: 506; asm: 369; python: 125; awk: 10
file content (57 lines) | stat: -rw-r--r-- 1,626 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
function test191
%TEST191 test split

% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2022, All Rights Reserved.
% SPDX-License-Identifier: Apache-2.0

fprintf ('test191 ----------- Tiles = split (A)\n') ;

[~, ~, ~, types, ~, ~] = GB_spec_opsall ;
types = types.all ;

rng ('default') ;

m = 100 ;
n = 110 ;
ms = [10 1 89] ;
ns = [1 4 50 45 10] ;

for d = [1e-4 0.01 0.2 0.8 inf]
    fprintf ('\nd = %g\n', d) ;
    for ka = 1:length (types)
        atype = types {ka} ;
        A = GB_spec_random (m, n, d, 128, atype) ;
        for sparsity_control = [1 2 4 8]
            fprintf ('.') ;
            A.sparsity = sparsity_control ;
            for is_csc = [0 1]
                A.is_csc = is_csc ;
                C2 = GB_spec_split (A, ms, ns) ;
                C1 = GB_mex_split  (A, ms, ns) ;
                for i = 1:length(ms)
                    for j = 1:length(ns)
                        GB_spec_compare (C1 {i,j}, C2 {i,j}) ;
                    end
                end

                if (nnz (A.matrix) > 0)
                    % also try the iso case
                    B = A ;
                    B.matrix = spones (A.matrix) * pi ;
                    B.iso = true ;
                    C2 = GB_spec_split (B, ms, ns) ;
                    C1 = GB_mex_split  (B, ms, ns) ;
                    for i = 1:length(ms)
                        for j = 1:length(ns)
                            GB_spec_compare (C1 {i,j}, C2 {i,j}) ;
                        end
                    end
                end
            end
        end
    end
end

fprintf ('\n') ;
fprintf ('test191: all tests passed\n') ;