1function test149
2%TEST149 test fine hash method for C<!M>=A*B
3
4% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
5% SPDX-License-Identifier: Apache-2.0
6
7fprintf ('test149: --------- fine hash method for C<!M>=A*B\n') ;
8
9rng ('default') ;
10
11nthreads_set (4, 1) ;
12
13desc.axb = 'hash' ;
14desc.mask = 'complement' ;
15
16n = 1000 ;
17m = 1e8 ;
18A = sparse (m, n) ;
19A (1:n, 1:n) = rand (n) ;
20B = sparse (rand (n,1)) ;
21C = sparse (m, 1) ;
22
23M = logical (sparse (m, 1)) ;
24M (1:n, 1) = sparse (rand (n,1) > 0.5) ;
25
26semiring.add = 'plus' ;
27semiring.multiply = 'times' ;
28semiring.class = 'double' ;
29
30tic
31C1 = GB_mex_mxm (C, M, [ ], semiring, A, B, desc) ;
32toc
33tic
34C2 = (A*B) .* double (~M) ;
35toc
36
37cnorm = norm (C2,1) ;
38assert (norm (C1.matrix - C2, 1) / cnorm < 1e-12)
39
40fprintf ('test149: all tests passed\n') ;
41
42