1function test07b
2%TEST07B test GrB_assign with a single pending tuple
3
4% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
5% SPDX-License-Identifier: Apache-2.0
6
7% adds a single pending tuple
8
9rng ('default') ;
10C = sparse (rand (5,4)) ;
11C (2,3) = 0 ;
12A = 100 * sparse (magic (2)) ;
13
14I = [2 3] ;
15J = [3 4] ;
16
17C2 = C ;
18C2 (I,J) = A ;
19
20% full (C)
21% full (C2)
22
23I0 = uint64 (I-1) ;
24J0 = uint64 (J-1) ;
25
26C3 = GB_mex_assign (C, [ ], '', A, I0, J0, [ ])
27% C3.matrix
28% full (C3.matrix)
29assert (isequal (C3.matrix, C2))
30
31I0 = I0 (1) ;
32I = I (1) ;
33M = sparse ([0 1]) ;
34% note that the Mask has the same size as C
35C3 = GB_mex_assign (C, C, '', A(1,:), I0, J0, [ ]) ;
36C2 = C ;
37C2 (I,J(2)) = A (1,2) ;
38assert (isequal (C3.matrix, C2))
39
40fprintf ('\ntest07b: all tests passed\n') ;
41
42