1function test188
2%TEST188 test concat
3
4% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
5% SPDX-License-Identifier: Apache-2.0
6
7fprintf ('test188 ----------- C = concat (Tiles)\n') ;
8
9[~, ~, ~, types, ~, ~] = GB_spec_opsall ;
10types = types.all ;
11
12rng ('default') ;
13
14n1 = 20 ;
15n2 = 4 ;
16
17for d = [1e-4 0.01 0.2 0.8 inf]
18    fprintf ('\nd = %g\n', d) ;
19    for ka = 1:length (types)
20        atype = types {ka} ;
21        A1 = GB_spec_random (n1, n1, d, 128, atype) ;
22        A2 = GB_spec_random (n1, n2, d, 128, atype) ;
23        A3 = GB_spec_random (n2, n1, d, 128, atype) ;
24        if (ka == 11)
25            A4 = GB_spec_random (n2, n2, inf, 128, atype) ;
26        else
27            A4 = GB_spec_random (n2, n2, d, 128, atype) ;
28        end
29
30        for sparsity_control = [1 2 4 8]
31            fprintf ('.') ;
32            A1.sparsity = sparsity_control ;
33            A2.sparsity = sparsity_control ;
34            A3.sparsity = sparsity_control ;
35            if (ka == 11)
36                A4.sparsity = 8 ;
37            else
38                A4.sparsity = sparsity_control ;
39            end
40            for is_csc = [0 1]
41                A1.is_csc = is_csc ;
42                A2.is_csc = is_csc ;
43                A3.is_csc = is_csc ;
44                A4.is_csc = is_csc ;
45
46                Tiles = cell (2,2) ;
47                Tiles {1,1} = A1 ;
48                Tiles {1,2} = A2 ;
49                Tiles {2,1} = A3 ;
50                Tiles {2,2} = A4 ;
51
52                for kc = 1:length (types)
53                    ctype = types {kc} ;
54                    for fmt = 0:1
55                        C1 = GB_mex_concat  (Tiles, ctype, fmt) ;
56                        C2 = GB_spec_concat (Tiles, ctype) ;
57                        GB_spec_compare (C1, C2) ;
58                    end
59                end
60            end
61        end
62    end
63end
64
65fprintf ('\n') ;
66GrB.burble (0) ;
67fprintf ('test188: all tests passed\n') ;
68
69