1function test102 2%TEST102 test GB_AxB_saxpy3_flopcount 3 4% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved. 5% SPDX-License-Identifier: Apache-2.0 6 7fprintf ('\ntest102: testing GB_AxB_saxpy3_flopcount\n') ; 8 9rng ('default') ; 10 11for m = [0 1 10 100] 12 for n = [0 1 10 100] 13 for d = [0.01 0.1 0.5 1.0] 14 15 % create the mask M and its hypersparse version 16 M = sprand (m, n, d) ; 17 Mhyper.matrix = M ; 18 Mhyper.pattern = spones (M) ; 19 Mhyper.is_hyper = true ; 20 21 for k = [0 1 10 100] 22 23 % create B and its hypersparse version 24 B = sprand (k, n, d) ; 25 Bhyper.matrix = B ; 26 Bhyper.pattern = spones (B) ; 27 Bhyper.is_hyper = true ; 28 29 % create A and its hypersparse version 30 A = sprand (m, k, d) ; 31 Ahyper.matrix = A ; 32 Ahyper.pattern = spones (A) ; 33 Ahyper.is_hyper = true ; 34 35 % flop counts for C=A*B 36 mflops = flopcount ([ ], 0, A, B) ; 37 total = mflops (end) ; 38 39 floptest ([ ], 0, A, B, mflops) ; 40 floptest ([ ], 0, Ahyper, Bhyper, total) ; 41 floptest ([ ], 0, Ahyper, B, total) ; 42 floptest ([ ], 0, A, Bhyper, total) ; 43 44 % flop counts for C<M>=A*B 45 mflops = flopcount (M, 0, A, B) ; 46 total = mflops (end) ; 47 48 floptest (M, 0, A, B, mflops) ; 49 floptest (M, 0, A, Bhyper, total) ; 50 floptest (M, 0, Ahyper, B, total) ; 51 floptest (M, 0, Ahyper, Bhyper, total) ; 52 floptest (Mhyper, 0, A, B, total) ; 53 floptest (Mhyper, 0, Ahyper, B, total) ; 54 floptest (Mhyper, 0, A, Bhyper, total) ; 55 floptest (Mhyper, 0, A, B, total) ; 56 57 end 58 end 59 end 60end 61 62fprintf ('\ntest102: all tests passed\n') ; 63 64