| 11 | #include "GB_get_mask.h" |
| 12 | |
| 13 | GrB_Info GrB_Vector_extract // w<M> = accum (w, u(I)) |
| 14 | ( |
| 15 | GrB_Vector w, // input/output vector for results |
| 16 | const GrB_Vector M_in, // optional mask for w, unused if NULL |
| 17 | const GrB_BinaryOp accum, // optional accum for z=accum(w,t) |
| 18 | const GrB_Vector u, // first input: vector u |
| 19 | const GrB_Index *I, // row indices |
| 20 | GrB_Index ni, // number of row indices |
| 21 | const GrB_Descriptor desc // descriptor for w and M |
| 22 | ) |
| 23 | { |
| 24 | |
| 25 | //-------------------------------------------------------------------------- |
| 26 | // check inputs |
| 27 | //-------------------------------------------------------------------------- |
| 28 | |
| 29 | GB_WHERE (w, "GrB_Vector_extract (w, M, accum, u, I, ni, desc)") ; |
| 30 | GB_BURBLE_START ("GrB_extract") ; |
| 31 | GB_RETURN_IF_NULL_OR_FAULTY (w) ; |
| 32 | GB_RETURN_IF_FAULTY (M_in) ; |
| 33 | GB_RETURN_IF_NULL_OR_FAULTY (u) ; |
| 34 | ASSERT (GB_VECTOR_OK (w)) ; |
| 35 | ASSERT (M_in == NULL || GB_VECTOR_OK (M_in)) ; |
| 36 | ASSERT (GB_VECTOR_OK (u)) ; |
| 37 | |
| 38 | // get the descriptor |
| 39 | GB_GET_DESCRIPTOR (info, desc, C_replace, Mask_comp, Mask_struct, |
| 40 | xx1, xx2, xx3, xx7) ; |
| 41 | |
| 42 | // get the mask |
| 43 | GrB_Matrix M = GB_get_mask ((GrB_Matrix) M_in, &Mask_comp, &Mask_struct) ; |
| 44 | |
| 45 | //-------------------------------------------------------------------------- |
| 46 | // extract entries |
| 47 | //-------------------------------------------------------------------------- |
| 48 | |
| 49 | // If a column list J is constructed containing the single column index 0, |
| 50 | // then T = A(I,0) followed by C<M>=accum(C,T) does the right thing |
| 51 | // where all matrices (C, M, and T) are columns of size ni-by-1. Thus, |
| 52 | // GB_extract does the right thing for this case. Note that the input u is |
| 53 | // not transposed. All GrB_Matrix objects will be in CSC format, and no |
| 54 | // matrices are transposed via the C_is_vector option in GB_extract. |
| 55 | |
| 56 | //-------------------------------------------------------------------------- |
| 57 | // do the work in GB_extract |
| 58 | //-------------------------------------------------------------------------- |
| 59 | |
| 60 | info = GB_extract ( |
| 61 | (GrB_Matrix) w, C_replace, // w as a matrix, and its descriptor |
| 62 | M, Mask_comp, Mask_struct, // mask and its descriptor |
| 63 | accum, // optional accum for z=accum(w,t) |
| 64 | (GrB_Matrix) u, false, // u as matrix; never transposed |
| 65 | I, ni, // row indices I and length ni |
| 66 | GrB_ALL, 1, // all columns |
| 67 | Context) ; |
| 68 | |
| 69 | GB_BURBLE_END ; |
| 70 | return (info) ; |
nothing calls this directly
no test coverage detected