1 //------------------------------------------------------------------------------
2 // GB_bitmap_assign_M_row_template:  traverse M for GB_ROW_ASSIGN
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 // M is a 1-by-(C->vdim) hypersparse or sparse matrix, not a vector, for
11 // GrB_Row_assign (if C is CSC) or GrB_Col_assign (if C is CSR).
12 
13 // C is bitmap/full.  M is sparse/hyper, and can be jumbled.
14 
15 {
16 
17     const int64_t *restrict kfirst_Mslice = M_ek_slicing ;
18     const int64_t *restrict klast_Mslice  = M_ek_slicing + M_ntasks ;
19     const int64_t *restrict pstart_Mslice = M_ek_slicing + M_ntasks * 2 ;
20 
21     ASSERT (mvlen == 1) ;
22     int64_t iC = I [0] ;
23     int tid ;
24     #pragma omp parallel for num_threads(M_nthreads) schedule(dynamic,1) \
25         reduction(+:cnvals)
26     for (tid = 0 ; tid < M_ntasks ; tid++)
27     {
28         int64_t kfirst = kfirst_Mslice [tid] ;
29         int64_t klast  = klast_Mslice  [tid] ;
30         int64_t task_cnvals = 0 ;
31 
32         //----------------------------------------------------------------------
33         // traverse over M (0,kfirst:klast)
34         //----------------------------------------------------------------------
35 
36         for (int64_t k = kfirst ; k <= klast ; k++)
37         {
38 
39             //------------------------------------------------------------------
40             // find the part of M(0,k) for this task
41             //------------------------------------------------------------------
42 
43             int64_t jM = GBH (Mh, k) ;
44             int64_t pM_start, pM_end ;
45             GB_get_pA (&pM_start, &pM_end, tid, k, kfirst,
46                 klast, pstart_Mslice, Mp, mvlen) ;
47 
48             //------------------------------------------------------------------
49             // traverse over M(0,jM), the kth vector of M
50             //------------------------------------------------------------------
51 
52             // for row_assign: M is a single row, iC = I [0]
53             // It has either 0 or 1 entry.
54             int64_t pM = pM_start ;
55 
56             if (pM < pM_end)
57             {
58                 bool mij = GB_mcast (Mx, pM, msize) ;
59                 if (mij)
60                 {
61                     int64_t jC = jM ;
62                     int64_t pC = iC + jC * cvlen ;
63                     GB_MASK_WORK (pC) ;
64                 }
65             }
66         }
67         cnvals += task_cnvals ;
68     }
69 }
70 
71