1function test92 2%TEST92 test GB_subref (symbolic case) 3 4% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved. 5% SPDX-License-Identifier: Apache-2.0 6 7fprintf ('test92: test GB_subref (symbolic case)\n') ; 8 9rng ('default') ; 10n = 100 ; 11A = sprand (n, n, 0.1) ; 12 13% S = A (I,J) ; 14% No column of A can be dense 15% length(I) > 1 16% I is not ":", not lo:hi 17% sort not needed so I must be sorted 18% 32*length(I) > entries in columns of A 19 20I = [ 1 2 2 4:8 20:30 32 32 32 32] ; 21I0 = uint64 (I) - 1 ; 22 23J = 1:n ; 24J0 = uint64 (J) - 1 ; 25 26nI = length (I) ; 27nJ = n ; 28 29S = GB_mex_subref_symbolic (A, I0, J0) ; 30[si,sj,sx] = find (S.matrix) ; 31 32[i,j,x] = find (A) ; 33nz = length (x) ; 34x = 1:nz ; 35X = sparse (i,j,x,n,n) ; 36 37S2 = X (I,J) ; 38[si2,sj2,sx2] = find (S2) ; 39 40assert (isequal (si, si2)) ; 41assert (isequal (sj, sj2)) ; 42assert (isequal (sx+1, sx2)) ; 43 44fprintf ('test92: all tests passed\n') ; 45 46