File: test102.m

package info (click to toggle)
suitesparse-graphblas 7.4.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 67,112 kB
  • sloc: ansic: 1,072,243; cpp: 8,081; sh: 512; makefile: 506; asm: 369; python: 125; awk: 10
file content (63 lines) | stat: -rw-r--r-- 2,009 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
function test102
%TEST102 test GB_AxB_saxpy3_flopcount

% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2022, All Rights Reserved.
% SPDX-License-Identifier: Apache-2.0

fprintf ('\ntest102: testing GB_AxB_saxpy3_flopcount\n') ;

rng ('default') ;

for m = [0 1 10 100]
    for n = [0 1 10 100]
        for d = [0.01 0.1 0.5 1.0]

            % create the mask M and its hypersparse version
            M = sprand (m, n, d) ;
            Mhyper.matrix = M ;
            Mhyper.pattern = spones (M) ;
            Mhyper.is_hyper = true ;

            for k = [0 1 10 100]

                % create B and its hypersparse version
                B = sprand (k, n, d) ;
                Bhyper.matrix = B ;
                Bhyper.pattern = spones (B) ;
                Bhyper.is_hyper = true ;

                % create A and its hypersparse version
                A = sprand (m, k, d) ;
                Ahyper.matrix = A ;
                Ahyper.pattern = spones (A) ;
                Ahyper.is_hyper = true ;

                % flop counts for C=A*B
                mflops = flopcount ([ ], 0, A, B) ;
                total = mflops (end) ;

                floptest ([ ], 0, A, B, mflops) ;
                floptest ([ ], 0, Ahyper, Bhyper, total) ;
                floptest ([ ], 0, Ahyper, B, total) ;
                floptest ([ ], 0, A, Bhyper, total) ;

                % flop counts for C<M>=A*B
                mflops = flopcount (M, 0, A, B) ;
                total = mflops (end) ;

                floptest (M, 0, A, B, mflops) ;
                floptest (M, 0, A, Bhyper, total) ;
                floptest (M, 0, Ahyper, B, total) ;
                floptest (M, 0, Ahyper, Bhyper, total) ;
                floptest (Mhyper, 0, A, B, total) ;
                floptest (Mhyper, 0, Ahyper, B, total) ;
                floptest (Mhyper, 0, A, Bhyper, total) ;
                floptest (Mhyper, 0, A, B, total) ;

            end
        end
    end
end

fprintf ('\ntest102: all tests passed\n') ;