| 13 | #define GB_FREE_ALL ; |
| 14 | |
| 15 | GrB_Info GB_bitmap_selector |
| 16 | ( |
| 17 | GrB_Matrix C, // output matrix, static header |
| 18 | const bool C_iso, // if true, C is iso |
| 19 | GB_Opcode opcode, // selector/idxunop opcode |
| 20 | const GB_Operator op, |
| 21 | const bool flipij, // if true, flip i and j for user operator |
| 22 | GrB_Matrix A, // input matrix |
| 23 | const int64_t ithunk, // (int64_t) Thunk, if Thunk is NULL |
| 24 | const GB_void *restrict athunk, // (A->type) Thunk |
| 25 | const GB_void *restrict ythunk, // (op->utype) Thunk |
| 26 | GB_Context Context |
| 27 | ) |
| 28 | { |
| 29 | |
| 30 | //-------------------------------------------------------------------------- |
| 31 | // check inputs |
| 32 | //-------------------------------------------------------------------------- |
| 33 | |
| 34 | GrB_Info info ; |
| 35 | ASSERT_MATRIX_OK (A, "A for bitmap selector", GB0) ; |
| 36 | ASSERT (GB_IS_BITMAP (A) || GB_as_if_full (A)) ; |
| 37 | ASSERT (opcode != GB_NONZOMBIE_selop_code) ; |
| 38 | ASSERT (C != NULL && (C->static_header || GBNSTATIC)) ; |
| 39 | |
| 40 | //-------------------------------------------------------------------------- |
| 41 | // get A |
| 42 | //-------------------------------------------------------------------------- |
| 43 | |
| 44 | int64_t anz = GB_nnz_held (A) ; |
| 45 | const size_t asize = A->type->size ; |
| 46 | const GB_Type_code acode = A->type->code ; |
| 47 | |
| 48 | //-------------------------------------------------------------------------- |
| 49 | // allocate C |
| 50 | //-------------------------------------------------------------------------- |
| 51 | |
| 52 | // C->b and C->x are malloc'd, not calloc'd |
| 53 | // set C->iso = C_iso OK |
| 54 | GB_OK (GB_new_bix (&C, // always bitmap, existing header |
| 55 | A->type, A->vlen, A->vdim, GB_Ap_calloc, true, |
| 56 | GxB_BITMAP, false, A->hyper_switch, -1, anz, true, C_iso, Context)) ; |
| 57 | int64_t cnvals ; |
| 58 | |
| 59 | //-------------------------------------------------------------------------- |
| 60 | // determine the number of threads to use |
| 61 | //-------------------------------------------------------------------------- |
| 62 | |
| 63 | GB_GET_NTHREADS_MAX (nthreads_max, chunk, Context) ; |
| 64 | int nthreads = GB_nthreads (anz, chunk, nthreads_max) ; |
| 65 | |
| 66 | //-------------------------------------------------------------------------- |
| 67 | // set the iso value of C |
| 68 | //-------------------------------------------------------------------------- |
| 69 | |
| 70 | if (C_iso) |
| 71 | { |
| 72 | GB_iso_select (C->x, opcode, athunk, A->x, acode, asize) ; |
no test coverage detected