1function test150 2%TEST150 test GrB_mxm with typecasting and zombies (dot3 and saxpy) 3 4% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved. 5% SPDX-License-Identifier: Apache-2.0 6 7fprintf ('test150: ------- GrB_mxm with typecasting and zombies (dot3)\n') ; 8 9[~, ~, ~, types, ~, ~] = GB_spec_opsall ; 10types = types.all ; 11 12semiring.add = 'plus' ; 13semiring.multiply = 'times' ; 14semiring.class = 'double' ; 15identity = 0 ; 16 17dnn_dot = struct ( 'axb', 'dot') ; 18dnn_saxpy = struct ( 'axb', 'saxpy') ; 19 20m = 8 ; 21n = 5 ; 22s = 4 ; 23density = 0.1 ; 24 25for k6 = 1:length (types) 26 atype = types {k6} ; 27 fprintf ('%s ', atype) ; 28 29 A = GB_spec_random (m, s, density, 100, atype) ; 30 B = GB_spec_random (s, n, density, 100, atype) ; 31 B.is_hyper = true ; 32 M_matrix = GB_random_mask (m,n,0.2) ; 33 M.matrix = M_matrix ; 34 M.is_hyper = true ; 35 M.class = 'logical' ; 36 37 clear C 38 C.matrix = sparse (m,n) ; 39 C.class = 'int32' ; 40 C.pattern = false (m,n) ; 41 42 % dot3 43 C0 = GB_spec_mxm (C, M, [ ], semiring, A, B, dnn_dot); 44 C1 = GB_mex_mxm (C, M, [ ], semiring, A, B, dnn_dot); 45 GB_spec_compare (C0, C1, identity) ; 46 47 % saxpy 48 C0 = GB_spec_mxm (C, M, [ ], semiring, A, B, dnn_saxpy); 49 C1 = GB_mex_mxm (C, M, [ ], semiring, A, B, dnn_saxpy); 50 GB_spec_compare (C0, C1, identity) ; 51 52end 53 54fprintf ('\ntest150: all tests passed\n') ; 55 56