1function test38
2%TEST38 test GrB_transpose
3
4% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
5% SPDX-License-Identifier: Apache-2.0
6
7fprintf ('\n ----------- testing GB_mex_transpose on SuiteSparse matrices\n') ;
8
9% test GB_mex_transpose on lots of matrices from the
10% SuiteSparse matrix collection
11
12index = ssget ;
13[~, f] = sort (index.nnz) ;
14nmat = length (f) ;
15
16for k = 1:500
17    fprintf ('.') ;
18    id = f (k) ;
19    Prob = ssget (id) ;
20    A = Prob.A ;
21    if (~isreal (A))
22        A = real (A) ;
23    end
24    [m n] = size (A) ;
25    % tic
26    C = A' ;
27    % toc
28    % tic
29    S = GB_mex_transpose (sparse (n,m), [ ], [ ], A) ;
30    % toc
31    assert (isequal (C,S.matrix)) ;
32end
33
34fprintf ('\ntest38: all tests passed\n') ;
35
36