1function test34 2%TEST34 test GrB_eWiseAdd 3 4% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved. 5% SPDX-License-Identifier: Apache-2.0 6 7fprintf ('\n----- quick test for GB_mex_Matrix_eWiseAdd\n') ; 8 9A = sparse (rand (4,3)) ; 10B = sparse (rand (4,3)) ; 11Cin = sparse (rand (4,3)) ; 12 13add = 'plus' ; 14Mask = [ ] ; 15accum = 'plus' ; 16 17C0 = Cin + (A+B) ; 18 19C = GB_mex_Matrix_eWiseAdd (Cin, Mask, accum, add, A, B, [ ]) ; 20assert (isequal (C.matrix, C0)) 21 22C3 = GB_spec_Matrix_eWiseAdd (Cin, Mask, accum, add, A, B, [ ]) ; 23assert (isequal (C3.matrix, C0)) 24 25try 26 % compare with CSparse 27 C4 = cs_add (Cin, cs_add (A, B)) ; 28 ok = isequal (C4, C0) ; 29catch 30 % CSparse not available 31 ok = true ; 32end 33assert (ok) ; 34 35fprintf ('\ntest34: all tests passed\n') ; 36 37