File: test106.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 (54 lines) | stat: -rw-r--r-- 1,937 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
function test106
%TEST106 GxB_subassign with alias

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

rng 'default'
fprintf ('\ntest106: GxB_subassign with alias\n') ;

for m = [0 1 5 100]
    for n = [0 1 5 100]
        I1 = randperm (m) ;
        J1 = randperm (n) ;
        I0 = uint64 (I1) - 1 ;
        J0 = uint64 (J1) - 1 ;
        for d = [0 0.1 0.5 1]
            for is_csc = 0:1
                for is_hyper = 0:1

                    if (is_hyper)
                        hyper_switch = 1 ;
                    else
                        hyper_switch = 0 ;
                    end

                    A = GB_spec_random (m, n, d, 100, 'double', ...
                        is_csc, is_hyper, hyper_switch) ;
                    B = GB_spec_random (m, n, d, 100, 'double', ...
                        is_csc, is_hyper, hyper_switch) ;
                    C = GB_spec_random (m, n, d, 100, 'double', ...
                        is_csc, is_hyper, hyper_switch) ;
                    M = GB_spec_random (m, n, d, 100, 'double', ...
                        is_csc, is_hyper, hyper_switch) ;

                    C1a = GB_mex_subassign  (C, [ ], [ ],  C,  I0, J0, [ ]) ;
                    C2  = GB_spec_subassign (C, [ ], [ ],  C,  I1, J1, [ ], 0) ;
                    GB_spec_compare (C1a, C2) ;
                    C1b = GB_mex_subassign  (C, [ ], [ ], 'C', I0, J0, [ ]) ;
                    GB_spec_compare (C1b, C2) ;

                    C1a = GB_mex_subassign  (C,  C,  [ ], A, I0, J0, [ ]) ;
                    C2  = GB_spec_subassign (C,  C,  [ ], A, I1, J1, [ ], 0) ;
                    GB_spec_compare (C1a, C2) ;
                    C1b = GB_mex_subassign  (C, 'C', [ ], A, I0, J0, [ ]) ;
                    GB_spec_compare (C1b, C2) ;

                end
            end
        end
    end
end

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