| 16 | //------------------------------------------------------------------------------ |
| 17 | |
| 18 | static inline GrB_Info GB_sel // w<M> = accum (w, select(w,k)) |
| 19 | ( |
| 20 | GrB_Vector w, // input/output vector for results |
| 21 | const GrB_Vector M_in, // optional mask for w, unused if NULL |
| 22 | const GrB_BinaryOp accum, // optional accum for Z=accum(w,T) |
| 23 | const GrB_IndexUnaryOp op, // operator to select the entries |
| 24 | const GrB_Vector u, // first input: vector u |
| 25 | const GrB_Scalar Thunk, // optional input for select operator |
| 26 | const GrB_Descriptor desc, // descriptor for w and M |
| 27 | GB_Context Context |
| 28 | ) |
| 29 | { |
| 30 | |
| 31 | //-------------------------------------------------------------------------- |
| 32 | // check inputs |
| 33 | //-------------------------------------------------------------------------- |
| 34 | |
| 35 | GB_BURBLE_START ("GrB_select") ; |
| 36 | GB_RETURN_IF_NULL_OR_FAULTY (w) ; |
| 37 | GB_RETURN_IF_FAULTY (M_in) ; |
| 38 | GB_RETURN_IF_NULL_OR_FAULTY (u) ; |
| 39 | |
| 40 | // get the descriptor |
| 41 | GB_GET_DESCRIPTOR (info, desc, C_replace, Mask_comp, Mask_struct, |
| 42 | xx0, xx1, xx2, xx7) ; |
| 43 | |
| 44 | // get the mask |
| 45 | GrB_Matrix M = GB_get_mask ((GrB_Matrix) M_in, &Mask_comp, &Mask_struct) ; |
| 46 | |
| 47 | //-------------------------------------------------------------------------- |
| 48 | // select the entries and optionally transpose; assemble pending tuples |
| 49 | //-------------------------------------------------------------------------- |
| 50 | |
| 51 | info = GB_select ( |
| 52 | (GrB_Matrix) w, C_replace, // w and its descriptor |
| 53 | M, Mask_comp, Mask_struct, // mask and its descriptor |
| 54 | accum, // optional accum for Z=accum(w,T) |
| 55 | (GB_Operator) op, // operator to select the entries |
| 56 | (GrB_Matrix) u, // first input: u |
| 57 | Thunk, // optional input for select operator |
| 58 | false, // vector u is never transposed |
| 59 | Context) ; |
| 60 | |
| 61 | GB_BURBLE_END ; |
| 62 | return (info) ; |
| 63 | } |
| 64 | |
| 65 | //------------------------------------------------------------------------------ |
| 66 | // GrB_Vector_select_TYPE: select entries from a vector (built-in types) |
no test coverage detected