1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
function gbtest49
%GBTEST49 test GrB.prune
% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2022, All Rights Reserved.
% SPDX-License-Identifier: Apache-2.0
rng ('default') ;
for trial = 1:40
A = rand (4) ;
A (A > .5) = 0 ;
A (1,1) = 1 ;
G = GrB (A) ;
C0 = sparse (A) ;
C1 = GrB.prune (A) ;
C2 = GrB.prune (G) ;
assert (isequal (C0, C1)) ;
assert (isequal (C0, C2)) ;
C0 = sparse (A) ;
C0 (1,1) = 0 ; %#ok<*SPRIX>
C1 = GrB.prune (A, 1) ;
C2 = GrB.prune (G, 1) ;
assert (isequal (C0, double (C1))) ;
assert (isequal (C0, double (C2))) ;
end
fprintf ('gbtest49: all tests passed\n') ;
|