1 //------------------------------------------------------------------------------
2 // GB_bitmap_assign_M_all_template:  traverse M for GB_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 sparse or hypersparse, not bitmap or full.  C<M>(I,J) = ... is being
11 // computed (or !M), and all entries in M are traversed.  For a given entry
12 // M (iM,jM) in the mask, the entry C(iM,jM) is accessed at location pC.
13 
14 // C is bitmap/full.  M is sparse/hyper, and can be jumbled.
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     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             int64_t jM = GBH (Mh, k) ;
42             int64_t pM_start, pM_end ;
43             GB_get_pA (&pM_start, &pM_end, tid, k, kfirst,
44                 klast, pstart_Mslice, Mp, mvlen) ;
45 
46             //------------------------------------------------------------------
47             // traverse over M(:,jM), the kth vector of M
48             //------------------------------------------------------------------
49 
50             // for assign: M is a matrix the same size as C
51             int64_t jC = jM ;
52 
53             for (int64_t pM = pM_start ; pM < pM_end ; pM++)
54             {
55                 bool mij = GB_mcast (Mx, pM, msize) ;
56                 if (mij)
57                 {
58                     int64_t iC = Mi [pM] ;
59                     int64_t pC = iC + jC * cvlen ;
60                     GB_MASK_WORK (pC) ;
61                 }
62             }
63         }
64         cnvals += task_cnvals ;
65     }
66 }
67 
68