1function testc5
2%TESTC5 test complex subref
3
4% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
5% SPDX-License-Identifier: Apache-2.0
6
7seed = 1 ;
8for m = [1 5 10 100]
9    for n = [1 5 10 100]
10        seed = seed + 1 ;
11        A = GB_mex_random (m, n, 10*(m+n), 1, seed) ;
12        for trials = 1:10
13
14            J = randperm (n, 1+floor(n/2)) ;
15            I = randperm (m, 1+floor(m/2)) ;
16            J0 = uint64 (J-1) ;
17            I0 = uint64 (I-1) ;
18
19            C1 = GB_mex_Matrix_subref (A, I0, J0) ;
20            C2 = GB_mex_complex (A (I,J)) ;
21            assert (isequal (C1, C2))
22        end
23    end
24end
25fprintf ('testc5: all complex subref C = A(I,J) tests passed\n') ;
26
27