1function test182 2%TEST182 test for internal wait that changes w from sparse/hyper to bitmap/full 3% 4% This test triggers the C<M>=A assignment where C starts out as sparse with 5% has many pending tuples, and is converted to bitmap just before the 6% assignment. In this case, C is the vector w. If w_sparsity is 15 and 'wait' 7% is false, then it starts the w<v>=sum(A) reduction with many pending tuples, 8% and converts w from sparse/hyper with many pending tuples into a bitmap 9% vector. The outputs w, v, and A should be the same, regardless of the input 10% parameter s. 11% 12% The internal condition is triggered if wait is false, and w_sparsity 13% is 5, 6, 7, 13, 14, or 15: 14% 15% 5: 4+1 bitmap (4) or hypersparse (1) 16% 6: 4+2 bitmap (4) or sparse (2) 17% 7: 4+2+1 bitmap (4), sparse (2), or hypersparse (1) 18% 13: 8+4+1 full (8), bitmap (4) or hypersparse (1) 19% 14: 8+4+2 full (8), bitmap (4) or sparse (2) 20% 15: 8+4+2+1 full (8), bitmap (4), sparse (2), or hypersparse (1) 21% 22% That is, the sparsity control for w allows it to change from sparse/hyper 23% (with pending updates) to/from bitmap. If 'wait' is true, then GB_mex_gabor 24% does an explicit GrB_Vector_wait (&w) before the w<v>=sum(A) reduction, so 25% w is converted to bitmap before the assignment, not during, and the internal 26% condition is not triggered. 27% 28% s is an optional vector of length 4, containing 4 parameters: 29% s = [wait, w_sparsity, v_sparsity, A_sparsity] ; 30% with wait 0 or 1, and the sparsity controls in range 1 to 15. 31% 32% The sparsity control for A and v has no effect on this condition. 33% 34% This test case comes from Gabor Szarnyas and Marton Elekes. 35 36% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved. 37% SPDX-License-Identifier: Apache-2.0 38 39I = [ 1, 2, 4, 5, 7, 11, 12, 13, 15, 18, 19, 20, 27, 32, 33, ... 40 35, 37, 41, 46, 50, 52, 53, 55, 57, 58, 61, 62, 63, 65, 66, 69, 70, 72, ... 41 73, 74, 75, 78, 79, 81, 84, 86, 87, 90, 91, 94, 96, 97, 98, 99, 100, ... 42 101, 102, 103, 104, 105, 107, 108, 109, 110, 115, 116, 117, 118, 120, ... 43 123, 129, 131, 132, 133, 134, 136, 140, 145, 146, 149, 152, 153, 154, ... 44 156, 158, 159, 160, 161, 163, 164, 165, 166, 168, 169, 172, 176, 177, ... 45 181, 184, 186, 187, 189, 191, 193, 194, 195, 197, 200, 201, 202, 203, ... 46 204, 205, 208, 209, 210, 211, 216, 217, 218, 219, 224, 225, 229, 230, ... 47 232, 235, 236, 238, 239, 242, 243 ] ; 48 49n = 1000 ; 50Aok = sparse (I+1, I+1, I, n, n) ; 51wok = diag (Aok) ; 52 53for wait = 0:1 54 for w_sparsity = 1:15 55 fprintf ('.') ; 56 for v_sparsity = [2 4 15] % 1:15 57 for A_sparsity = [2 4 15] % 1:15 58 s = [wait, w_sparsity, v_sparsity, A_sparsity] ; 59 [w, v, A] = GB_mex_gabor (s) ; 60 assert (isequal (Aok, A.matrix)) ; 61 assert (isequal (wok, w.matrix)) ; 62 assert (isequal (wok, v.matrix)) ; 63 end 64 end 65 end 66end 67 68fprintf ('\ntest182: all tests passed\n') ; 69 70