1function test137 2%TEST137 GrB_eWiseMult with FIRST and SECOND operators 3 4% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved. 5% SPDX-License-Identifier: Apache-2.0 6 7fprintf ('test137: GrB_eWiseMult with FIRST and SECOND operators\n') ; 8 9rng ('default') ; 10 11n = 100 ; 12for k = [false true] 13 fprintf ('builtin_complex: %d\n', k) ; 14 GB_builtin_complex_set (k) ; 15 16 A = sprand (n, n, 0.1) ; 17 Z = sprand (n, n, 0.1) + 1i * sprand (n, n, 0.1) ; 18 S = spones (Z) ; 19 C = sparse (n, n) ; 20 21 try 22 % this is an error 23 C1 = GB_mex_Matrix_eWiseMult (C, [ ], [ ], 'times', A, Z, [ ]) ; 24 assert (false) ; 25 catch 26 assert (true) ; 27 end 28 29 C0 = A .* S ; 30 C1 = GB_mex_eWiseMult_first (C, [ ], [ ], [ ], A, Z, [ ]) ; 31 assert (isequal (C0, C1.matrix)) ; 32 33 C0 = S .* A ; 34 C1 = GB_mex_eWiseMult_second (C, [ ], [ ], [ ], Z, A, [ ]) ; 35 assert (isequal (C0, C1.matrix)) ; 36end 37 38fprintf ('test137: all tests passed\n') ; 39