1function floptest (M, Mask_complement, A, B, flops1)
2%FLOPTEST compare flopcount with GB_mex_mxm_flops
3% floptest (M, Mask_complement, A, B, flops1)
4%
5% compares the results of
6% flops1 = flopcount (M, Mask_complement, A, B)
7% with
8% flops2 = GB_mex_mxm_flops (M, Mask_complement, A, B)
9%
10% However, flopcount(M,Mask_complement,A,B) can only be computed when M, A, B
11% are all MATLAB sparse matrices, not structs.  If the matrices are
12% hypersparse, flops1 has length B->nvec+1, not size(B,2).  In this case,
13% only the total flop count is checked.  In that case, flops1 is a scalar.
14
15% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
16% SPDX-License-Identifier: Apache-2.0
17
18[flops2 mwork] = GB_mex_mxm_flops (M, Mask_complement, A, B) ;
19total_flops = flops2 (end) ;
20
21if (isscalar (flops1))
22    % flops1 is just the total flop count
23    assert (isequal (flops1, total_flops)) ;
24else
25    % flops1 is the cumulative sum
26    assert (isequal (flops1, flops2)) ;
27end
28
29