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