1%TT test eWiseMult and A+B
2
3% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
4% SPDX-License-Identifier: Apache-2.0
5
6tic ;
7C = A + B ;
8t = toc ;
9fprintf ('MATLAB C=A+B time: %g\n\n', t) ;
10
11for k = 1:40
12    nthreads_set (k) ;
13    tic ;
14    C2 = GB_mex_AplusB (A,B,'plus') ;
15    ts (k) = toc ;
16    fprintf ('threads %d time %10.4f speedup %10.2f\n', k, ts(k), ts(1)/ts(k)) ;
17end
18
19tic ;
20C = A .* B ;
21t = toc ;
22fprintf ('MATLAB C=A.*B time: %g\n\n', t) ;
23
24[m n] = size (A) ;
25Z = sparse (m,n) ;
26
27for k = 1:40
28    nthreads_set (k) ;
29    tic ;
30    C2 = GB_mex_Matrix_eWiseMult (Z, [ ], [ ], 'times', A,B) ;
31    ts (k) = toc ;
32    fprintf ('threads %d time %10.4f speedup %10.2f\n', k, ts(k), ts(1)/ts(k)) ;
33end
34
35err = norm (C - C2.matrix, 1)
36