| 16 | //------------------------------------------------------------------------------ |
| 17 | |
| 18 | GrB_Info GrB_Vector_apply // w<M> = accum (w, op(u)) |
| 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_UnaryOp op, // operator to apply to the entries |
| 24 | const GrB_Vector u, // first input: vector u |
| 25 | const GrB_Descriptor desc // descriptor for w and M |
| 26 | ) |
| 27 | { |
| 28 | |
| 29 | //-------------------------------------------------------------------------- |
| 30 | // check inputs |
| 31 | //-------------------------------------------------------------------------- |
| 32 | |
| 33 | GB_WHERE (w, "GrB_Vector_apply (w, M, accum, op, u, desc)") ; |
| 34 | GB_BURBLE_START ("GrB_apply") ; |
| 35 | GB_RETURN_IF_NULL_OR_FAULTY (w) ; |
| 36 | GB_RETURN_IF_FAULTY (M_in) ; |
| 37 | GB_RETURN_IF_NULL_OR_FAULTY (u) ; |
| 38 | |
| 39 | ASSERT (GB_VECTOR_OK (w)) ; |
| 40 | ASSERT (M_in == NULL || GB_VECTOR_OK (M_in)) ; |
| 41 | ASSERT (GB_VECTOR_OK (u)) ; |
| 42 | |
| 43 | // get the descriptor |
| 44 | GB_GET_DESCRIPTOR (info, desc, C_replace, Mask_comp, Mask_struct, |
| 45 | xx1, xx2, xx3, xx7) ; |
| 46 | |
| 47 | // get the mask |
| 48 | GrB_Matrix M = GB_get_mask ((GrB_Matrix) M_in, &Mask_comp, &Mask_struct) ; |
| 49 | |
| 50 | //-------------------------------------------------------------------------- |
| 51 | // apply the operator; do not transpose |
| 52 | //-------------------------------------------------------------------------- |
| 53 | |
| 54 | info = GB_apply ( |
| 55 | (GrB_Matrix) w, C_replace, // w and its descriptor |
| 56 | M, Mask_comp, Mask_struct, // mask and its descriptor |
| 57 | accum, // optional accum for Z=accum(w,T) |
| 58 | (GB_Operator) op, NULL, false, // operator op(.) to apply to the entries |
| 59 | (GrB_Matrix) u, false, // u, not transposed |
| 60 | Context) ; |
| 61 | |
| 62 | GB_BURBLE_END ; |
| 63 | return (info) ; |
| 64 | } |
| 65 | |
| 66 | //------------------------------------------------------------------------------ |
| 67 | // GB_1st: apply a binary operator: op(x,u) |
no test coverage detected