1function test78
2%TEST78 test subref
3
4% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
5% SPDX-License-Identifier: Apache-2.0
6
7n = 500 ;
8I = speye (n) ;
9X = sparse (rand (n)) ;
10A = [X I ; I I] ;
11
12I = 1:n ;
13I0 = uint64 (I-1) ;
14
15C1 = A(I,I) ;
16C2 = GB_mex_Matrix_subref (A, I0, I0) ;
17
18Ahyper.matrix = A ;
19Ahyper.is_hyper = true ;
20
21% this requires a hyper realloc for C2
22C2 = GB_mex_Matrix_subref (Ahyper, I0, I0) ;
23
24assert (isequal (C1, C2)) ;
25
26fprintf ('\ntest78: all tests passed\n') ;
27