1function test47
2%TEST47 prformance test of GrB_vxm
3
4% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
5% SPDX-License-Identifier: Apache-2.0
6
7rng ('default') ;
8% d = struct ('inp1', 'tran', 'inp0', 'tran') ;
9Prob = ssget (939) ;
10% Prob = ssget (2662) ;
11A = Prob.A ;
12
13n = size (A,1) ;
14A (1,2) = 1 ;
15
16w = sparse (n,1) ;
17semiring.multiply = 'times' ;
18semiring.add = 'plus' ;
19semiring.class = 'double' ;
20
21%{
22fprintf ('\nMATLAB C=A'' time:\n') ;
23tic
24C=A' ;
25toc
26%}
27t3 = 0 ;
28
29Xnz = [ ]  ;
30T = [ ]
31
32d2.axb = 'dot' ;
33
34for xnz = [100:100:1000 2000:1000:72000]
35
36    x = sprand (n, 1, xnz/n) ;
37
38    tic
39    c1 = GB_mex_vxm (w, [],[], semiring, x, A, [ ]) ;
40    t = toc ;
41
42    tic
43    c2 = GB_mex_vxm (w, [],[], semiring, x, A, d2) ;
44    t2 = toc ;
45    t2 = grbresults ;
46
47    tic
48    c0 = x'*A ;
49    tm = toc ;
50
51    assert (isequal (c0', c1.matrix)) ;
52
53    Xnz = [Xnz nnz(x)] ;
54    T = [T t] ;
55
56    fprintf ('%5d : %10g(%s) %10g MATLAB %10g speedup %10g %10g\n', ...
57        nnz(x), t, method (1), t2, tm, tm/t, tm/t2) ;
58
59end
60
61fprintf ('\ntest47: all tests passed\n') ;
62
63
64