1function test183
2%TEST183 test GrB_eWiseMult with a hypersparse mask
3
4% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
5% SPDX-License-Identifier: Apache-2.0
6
7[binops, ~, ~, types, ~, ~] = GB_spec_opsall ;
8binops = binops.all ;
9types = types.all ;
10
11fprintf ('test183 -----------eWiseMult with hypersparse mask\n') ;
12
13n = 10 ;
14
15rng ('default') ;
16dtt = struct ( 'inp0', 'tran', 'inp1', 'tran' ) ;
17
18op.opname = 'times' ;
19op.optype = 'double' ;
20tol = 1e-12 ;
21
22% for trial = 1:5
23
24    A = GB_spec_random (n, n, inf, 1, 'double') ;
25    A.matrix (1,1) = 0 ;
26    A.pattern = logical (A.matrix) ;
27    A.pattern (1,1) = false ;
28    A.sparsity = 2 ;    % sparse
29    B = GB_spec_random (n, n, inf, 1, 'double') ;
30    B.sparsity = 2 ;    % sparse
31    M = GB_spec_random (n, n, 0.001, 1, 'logical') ;
32    M.sparsity = 1 ;    % hypersparse
33    C = sparse (n, n) ;
34
35    %---------------------------------------
36    % A'.*B', with mask
37    %---------------------------------------
38
39    C0 = GB_spec_Matrix_eWiseMult (C, M, [ ], op, A, B, dtt) ;
40    C1 = GB_mex_Matrix_eWiseMult  (C, M, [ ], op, A, B, dtt) ;
41    GB_spec_compare (C0, C1, 0, tol) ;
42
43% end
44
45fprintf ('\ntest183: all tests passed\n') ;
46
47