1function test15 2%TEST15 test AxB and AdotB internal functions 3 4% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved. 5% SPDX-License-Identifier: Apache-2.0 6 7fprintf ('\n --------------------- GB_mex_AxB, GB_mex_AdotB tests\n') ; 8 9rng ('default') ; 10m = 8 ; 11k = 6 ; 12n = 10 ; 13A = sprand (m,k,0.5) ; 14B = sprand (k,n,0.5) ; 15C1 = A*B ; 16C = GB_mex_AxB (A, B) ; 17assert (GB_spok (C) == 1) ; 18assert (norm (C-C1,1) / norm (C,1)< 1e-12) ; 19 20A = A' ; 21C1 = A'*B ; 22C = GB_mex_AdotB (A, B) ; 23assert (GB_spok (C) == 1) ; 24assert (isequal (C, C1)) ; 25 26A = sprandn (10000,2,0.5) ; 27B = sprandn (10000,2,0.0001) ; 28A (5,1) = pi ; 29B (5,2) = 42 ; 30C1 = A'*B ; 31C = GB_mex_AdotB (A, B) ; 32assert (GB_spok (C) == 1) ; 33assert (isequal (C, C1)) ; 34C1 = B'*A ; 35C = GB_mex_AdotB (B, A) ; 36assert (GB_spok (C) == 1) ; 37assert (isequal (C, C1)) ; 38 39S = sparse (10000,2) ; 40C1 = A.*B ; 41C = GB_mex_Matrix_eWiseMult (S, [], [], 'times', A, B) ; 42assert (GB_spok (C.matrix) == 1) ; 43assert (isequal (C.matrix, C1)) ; 44C1 = B.*A ; 45C = GB_mex_Matrix_eWiseMult (S, [], [], 'times', B, A) ; 46assert (GB_spok (C.matrix) == 1) ; 47assert (isequal (C.matrix, C1)) ; 48 49fprintf ('\ntest15: all tests passed\n') ; 50 51