| 19 | } |
| 20 | |
| 21 | GrB_Info GB_bitmap_subref // C = A(I,J): either symbolic or numeric |
| 22 | ( |
| 23 | // output |
| 24 | GrB_Matrix C, // output matrix, static header |
| 25 | // input, not modified |
| 26 | const bool C_iso, // if true, C is iso |
| 27 | const GB_void *cscalar, // scalar value of C, if iso |
| 28 | const bool C_is_csc, // requested format of C |
| 29 | const GrB_Matrix A, |
| 30 | const GrB_Index *I, // index list for C = A(I,J), or GrB_ALL, etc. |
| 31 | const int64_t ni, // length of I, or special |
| 32 | const GrB_Index *J, // index list for C = A(I,J), or GrB_ALL, etc. |
| 33 | const int64_t nj, // length of J, or special |
| 34 | const bool symbolic, // if true, construct C as symbolic |
| 35 | GB_Context Context |
| 36 | ) |
| 37 | { |
| 38 | |
| 39 | //-------------------------------------------------------------------------- |
| 40 | // check inputs |
| 41 | //-------------------------------------------------------------------------- |
| 42 | |
| 43 | GrB_Info info ; |
| 44 | ASSERT (C != NULL && (C->static_header || GBNSTATIC)) ; |
| 45 | ASSERT_MATRIX_OK (A, "A for C=A(I,J) bitmap subref", GB0) ; |
| 46 | ASSERT (GB_IS_BITMAP (A) || GB_IS_FULL (A)) ; |
| 47 | ASSERT (!GB_IS_SPARSE (A)) ; |
| 48 | ASSERT (!GB_IS_HYPERSPARSE (A)) ; |
| 49 | ASSERT (!GB_ZOMBIES (A)) ; |
| 50 | ASSERT (!GB_JUMBLED (A)) ; |
| 51 | ASSERT (!GB_PENDING (A)) ; |
| 52 | |
| 53 | //-------------------------------------------------------------------------- |
| 54 | // get A |
| 55 | //-------------------------------------------------------------------------- |
| 56 | |
| 57 | const int8_t *restrict Ab = A->b ; |
| 58 | const int64_t avlen = A->vlen ; |
| 59 | const int64_t avdim = A->vdim ; |
| 60 | const size_t asize = A->type->size ; |
| 61 | |
| 62 | //-------------------------------------------------------------------------- |
| 63 | // check the properties of I and J |
| 64 | //-------------------------------------------------------------------------- |
| 65 | |
| 66 | // C = A(I,J) so I is in range 0:avlen-1 and J is in range 0:avdim-1 |
| 67 | int64_t nI, nJ, Icolon [3], Jcolon [3] ; |
| 68 | int Ikind, Jkind ; |
| 69 | GB_ijlength (I, ni, avlen, &nI, &Ikind, Icolon) ; |
| 70 | GB_ijlength (J, nj, avdim, &nJ, &Jkind, Jcolon) ; |
| 71 | |
| 72 | bool I_unsorted, I_has_dupl, I_contig, J_unsorted, J_has_dupl, J_contig ; |
| 73 | int64_t imin, imax, jmin, jmax ; |
| 74 | |
| 75 | info = GB_ijproperties (I, ni, nI, avlen, &Ikind, Icolon, |
| 76 | &I_unsorted, &I_has_dupl, &I_contig, &imin, &imax, Context) ; |
| 77 | if (info != GrB_SUCCESS) |
| 78 | { |
no test coverage detected