1function test105
2%TEST105 eWiseAdd with hypersparse matrices
3
4% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
5% SPDX-License-Identifier: Apache-2.0
6
7rng 'default'
8fprintf ('\ntest105: eWiseAdd with hypersparse\n') ;
9
10for m = [0 1 5 100]
11    for n = [0 1 5 100]
12        for d = [0 0.1 0.5 1]
13            for is_csc = 0:1
14                for is_hyper = 0:1
15
16                    if (is_hyper)
17                        hyper_switch = 1 ;
18                    else
19                        hyper_switch = 0 ;
20                    end
21
22                    A = GB_spec_random (m, n, d, 100, 'double', ...
23                        is_csc, is_hyper, hyper_switch) ;
24                    B = GB_spec_random (m, n, d, 100, 'double', ...
25                        is_csc, is_hyper, hyper_switch) ;
26                    C = GB_spec_random (m, n, d, 100, 'double', ...
27                        is_csc, is_hyper, hyper_switch) ;
28                    M = GB_spec_random (m, n, d, 100, 'double', ...
29                        is_csc, is_hyper, hyper_switch) ;
30
31                    % C = A+B, no mask
32                    C0 = GB_spec_Matrix_eWiseAdd (C, [ ], [ ], ...
33                                                 'plus', A, B, [ ], 'test') ;
34                    C1 = GB_mex_Matrix_eWiseAdd  (C, [ ], [ ], ...
35                                                 'plus', A, B, [ ], 'test') ;
36                    GB_spec_compare (C0, C1) ;
37
38                    % C = A+B, with mask
39                    C0 = GB_spec_Matrix_eWiseAdd (C, M, [ ], ...
40                                                 'plus', A, B, [ ], 'test') ;
41                    C1 = GB_mex_Matrix_eWiseAdd  (C, M, [ ], ...
42                                                 'plus', A, B, [ ], 'test') ;
43                    GB_spec_compare (C0, C1) ;
44
45                end
46            end
47        end
48    end
49end
50
51fprintf ('\ntest105: all tests passed\n') ;
52