1function test194
2%TEST194 test GxB_Vector_diag
3
4% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
5% SPDX-License-Identifier: Apache-2.0
6
7fprintf ('test194 ----------- V = diag (A,k)\n') ;
8
9[~, ~, ~, types, ~, ~] = GB_spec_opsall ;
10types = types.all ;
11
12rng ('default') ;
13
14ms = [10 20] ;
15ns = [4 10] ;
16
17for d = [1e-4 0.1 0.8 inf]
18    fprintf ('\nd = %g\n', d) ;
19    for ka = 1:length (types)
20        atype = types {ka} ;
21        for m = ms
22            for n = ns
23                A = GB_spec_random (m, n, d, 128, atype) ;
24                for sparsity_control = [1 2 4 8]
25                    fprintf ('.') ;
26                    A.sparsity = sparsity_control ;
27                    for csc = [1 0]
28                        A.is_csc = csc ;
29                        for kc = 1:length (types)
30                            vtype = types {kc} ;
31                            for k = [-10 -2 0 3 ]
32                                V2 = GB_spec_vdiag (A, k, vtype) ;
33                                V1 = GB_mex_vdiag  (A, k, vtype) ;
34                                GB_spec_compare (V1, V2) ;
35                            end
36                        end
37                    end
38                end
39            end
40        end
41    end
42end
43
44fprintf ('\n') ;
45fprintf ('test194: all tests passed\n') ;
46
47