1function test147
2%TEST147 test C<M>A*B with very sparse M
3
4% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
5% SPDX-License-Identifier: Apache-2.0
6
7fprintf ('test147 ----------------------------- C<M>A*B with very sparse M\n') ;
8rng ('default') ;
9
10n = 1000 ;
11A = sprand (n, n, 0.01) ;
12A (:,1:300) = 1 ;
13S = sparse (n, n) ;
14M = spones (speye (n) + sparse (n, n, 1e-5)) ;
15
16semiring.add = 'plus' ;
17semiring.multiply = 'times' ;
18semiring.class = 'double' ;
19
20C1 = GB_mex_mxm (S, M, [ ], semiring, A, A, [ ]) ;
21C2 = (A*A) .* M ;
22
23assert (norm (C1.matrix - C2, 1) < 1e-12)
24
25fprintf ('test147: all tests passed\n') ;
26
27