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 33 34 35 36 37 38 39 40 41 42
|
function test211
%TEST211 test iso assign
% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2022, All Rights Reserved.
% SPDX-License-Identifier: Apache-2.0
rng ('default') ;
n = 10 ;
% GrB.burble (1) ;
Cin.matrix = logical (spones (sprand (n, n, 0.5))) ;
Cin.iso = true ;
op.opname = 'or' ;
op.optype = 'logical' ;
M = sprand (n, n, 0.5) ;
desc = struct ('mask', 'structural') ;
scalar.matrix = true ;
scalar.class = 'logical' ;
for s = [true false]
scalar.matrix = s ;
C1 = GB_mex_assign (Cin, M, [ ], scalar, [ ], [ ], [ ]) ;
C2 = GB_spec_assign (Cin, M, [ ], scalar, [ ], [ ], [ ], true) ;
GB_spec_compare (C1, C2) ;
assert (C1.iso == s) ;
C1 = GB_mex_assign (Cin, M, op, scalar, [ ], [ ], [ ]) ;
C2 = GB_spec_assign (Cin, M, op, scalar, [ ], [ ], [ ], true) ;
GB_spec_compare (C1, C2) ;
assert (C1.iso == s) ;
end
GrB.burble (0) ;
fprintf ('\ntest211: all tests passed\n') ;
|