1 //------------------------------------------------------------------------------ 2 // GB_bitmap_assign_C_whole_template: iterate over a bitmap matrix 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 // The #include'ing file defines a GB_CIJ_WORK macro for the body of the loop, 11 // which operates on the entry C(iC,jC) at position Cx [pC] and Cb [pC]. The C 12 // matrix held in bitmap form. If the mask matrix is also a bitmap matrix or 13 // full matrix, the GB_GET_MIJ macro can compute the effective value of the 14 // mask for the C(iC,jC) entry. 15 16 // C must be bitmap or full. If M is accessed, it must also be bitmap or full. 17 18 #ifndef GB_GET_MIJ 19 #define GB_GET_MIJ(mij,pM) ; 20 #endif 21 22 { 23 // iterate over all of C(:,:). 24 int nthreads = GB_nthreads (cnzmax, chunk, nthreads_max) ; 25 int tid ; 26 #pragma omp parallel for num_threads(nthreads) schedule(static) \ 27 reduction(+:cnvals) 28 for (tid = 0 ; tid < nthreads ; tid++) 29 { 30 int64_t pC_start, pC_end, task_cnvals = 0 ; 31 GB_PARTITION (pC_start, pC_end, cnzmax, tid, nthreads) ; 32 for (int64_t pC = pC_start ; pC < pC_end ; pC++) 33 { 34 // int64_t iC = pC % cvlen ; 35 // int64_t jC = pC / cvlen ; 36 GB_GET_MIJ (mij, pC) ; // mij = Mask (pC) 37 GB_CIJ_WORK (pC) ; // operate on C(iC,jC) 38 } 39 cnvals += task_cnvals ; 40 } 41 } 42