1 //------------------------------------------------------------------------------
2 // GB_bitmap_assign_M_template: traverse over M for bitmap assignment into C
3 //------------------------------------------------------------------------------
4 
5 // SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
6 // SPDX-License-Identifier: Apache-2.0
7 
8 //------------------------------------------------------------------------------
9 
10 // This template traverses over all the entries of the mask matrix M, and
11 // operates on C(i,j) if the mask M(i,j) == 1, via the GB_MASK_WORK macro,
12 // where C(i,j) is at Cx [pC] and Cb [pC].  M is hypersparse or sparse.
13 
14 // GB_SLICE_MATRIX (M,...) has alreadly sliced M for parallel work.  The tasks
15 // are held in pstart_Mslice, kfirst_Mslice, klast_Mslice, M_ntasks, and the
16 // work is done by M_nthreads threads.
17 
18 // The work done by this kernel is independent of Mask_comp; both M and !M
19 // do the same work by scattering their entries into the C bitmap.
20 
21 // C is bitmap/full.  M is sparse/hyper, and can be jumbled.
22 ASSERT (GB_IS_HYPERSPARSE (M) || GB_IS_SPARSE (M)) ;
23 ASSERT (GB_IS_BITMAP (C) || GB_IS_FULL (C)) ;
24 ASSERT (GB_JUMBLED_OK (M)) ;
25 
26 switch (assign_kind)
27 {
28     case GB_ROW_ASSIGN :
29         // row assignment: C<M>(iC,J), where M is a row vector
30         #include "GB_bitmap_assign_M_row_template.c"
31         break ;
32     case GB_COL_ASSIGN :
33         // column assignment: C<M>(I,jC), where M is a column vector
34         #include "GB_bitmap_assign_M_col_template.c"
35         break ;
36     case GB_ASSIGN :
37         // GrB_assign: C<M>(I,J), where M is the same size as C
38         #include "GB_bitmap_assign_M_all_template.c"
39         break ;
40     #ifndef GB_NO_SUBASSIGN_CASE
41     case GB_SUBASSIGN :
42         // GxB_subassign: C(I,J)<M>, where M is the same size as C(I,J) and A
43         #include "GB_bitmap_assign_M_sub_template.c"
44         break ;
45     #endif
46     default: ;
47 }
48 
49