1function test84
2%TEST84 test GrB_assign (row and column with C in CSR format)
3
4% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
5% SPDX-License-Identifier: Apache-2.0
6
7rng ('default') ;
8m = 10 ;
9n = 20 ;
10
11% create a CSR matrix
12C0 = GB_spec_random (m, n, 0.5, 100, 'double', false, false) ;
13
14Mcol = sparse (ones (m,1)) ; % spones (sprandn (m, 1, 0.5)) ;
15Mrow = sparse (ones (n,1)) ; % spones (sprandn (n, 1, 0.5)) ;
16
17Acol = sprandn (4, 1, 0.5)  ;
18Arow = sprandn (4, 1, 0.5)  ;
19
20J = [3 4 5 6] ;
21J0 = uint64 (J) - 1 ;
22I = 2 ;
23I0 = uint64 (I) - 1 ;
24
25% row assign
26C1 = GB_mex_assign      (C0, Mrow, 'plus', Arow, I0, J0, [ ], 2) ;
27C2 = GB_spec_Row_assign (C0, Mrow, 'plus', Arow, I,  J,  [ ]) ;
28GB_spec_compare (C1, C2) ;
29
30% col assign
31C1 = GB_mex_assign      (C0, Mcol, 'plus', Acol, J0, I0, [ ], 1) ;
32C2 = GB_spec_Col_assign (C0, Mcol, 'plus', Acol, J,  I,  [ ]) ;
33GB_spec_compare (C1, C2) ;
34
35fprintf ('\ntest84: all tests passed\n') ;
36
37
38