| 68 | //------------------------------------------------------------------------------ |
| 69 | |
| 70 | static inline GrB_Info GB_1st // w<mask> = accum (w, op(x,u)) |
| 71 | ( |
| 72 | GrB_Vector w, // input/output vector for results |
| 73 | const GrB_Vector M_in, // optional mask for w, unused if NULL |
| 74 | const GrB_BinaryOp accum, // optional accum for z=accum(w,t) |
| 75 | const GrB_BinaryOp op, // operator to apply to the entries |
| 76 | const GrB_Scalar x, // first input: scalar x |
| 77 | const GrB_Vector u, // second input: vector u |
| 78 | const GrB_Descriptor desc, // descriptor for w and M |
| 79 | GB_Context Context |
| 80 | ) |
| 81 | { |
| 82 | |
| 83 | //-------------------------------------------------------------------------- |
| 84 | // check inputs |
| 85 | //-------------------------------------------------------------------------- |
| 86 | |
| 87 | GB_BURBLE_START ("GrB_apply") ; |
| 88 | GB_RETURN_IF_NULL_OR_FAULTY (w) ; |
| 89 | GB_RETURN_IF_FAULTY (M_in) ; |
| 90 | GB_RETURN_IF_NULL_OR_FAULTY (x) ; |
| 91 | GB_RETURN_IF_NULL_OR_FAULTY (u) ; |
| 92 | |
| 93 | ASSERT (GB_VECTOR_OK (w)) ; |
| 94 | ASSERT (M_in == NULL || GB_VECTOR_OK (M_in)) ; |
| 95 | ASSERT (GB_VECTOR_OK (u)) ; |
| 96 | |
| 97 | // get the descriptor |
| 98 | GB_GET_DESCRIPTOR (info, desc, C_replace, Mask_comp, Mask_struct, |
| 99 | xx1, xx2, xx3, xx7) ; |
| 100 | |
| 101 | // get the mask |
| 102 | GrB_Matrix M = GB_get_mask ((GrB_Matrix) M_in, &Mask_comp, &Mask_struct) ; |
| 103 | |
| 104 | //-------------------------------------------------------------------------- |
| 105 | // apply the operator; do not transpose |
| 106 | //-------------------------------------------------------------------------- |
| 107 | |
| 108 | info = GB_apply ( |
| 109 | (GrB_Matrix) w, C_replace, // w and its descriptor |
| 110 | M, Mask_comp, Mask_struct, // mask and its descriptor |
| 111 | accum, // optional accum for Z=accum(w,T) |
| 112 | (GB_Operator) op, x, true, // operator op(x,.) to apply to the entries |
| 113 | (GrB_Matrix) u, false, // u, not transposed |
| 114 | Context) ; |
| 115 | |
| 116 | GB_BURBLE_END ; |
| 117 | return (info) ; |
| 118 | } |
| 119 | |
| 120 | //------------------------------------------------------------------------------ |
| 121 | // GB_2nd: apply a binary operator: op(u,y) or index_unop |
no test coverage detected