MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / GB_2nd

Function GB_2nd

deps/GraphBLAS/Source/GrB_Vector_apply.c:124–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122//------------------------------------------------------------------------------
123
124static inline GrB_Info GB_2nd // w<mask> = accum (w, op(u,y))
125(
126 GrB_Vector w, // input/output vector for results
127 const GrB_Vector M_in, // optional mask for w, unused if NULL
128 const GrB_BinaryOp accum, // optional accum for z=accum(w,t)
129 const GB_Operator op, // operator to apply to the entries
130 const GrB_Vector u, // first input: vector u
131 const GrB_Scalar y, // second input: scalar y
132 const GrB_Descriptor desc, // descriptor for w and M
133 GB_Context Context
134)
135{
136
137 //--------------------------------------------------------------------------
138 // check inputs
139 //--------------------------------------------------------------------------
140
141 GB_BURBLE_START ("GrB_apply") ;
142 GB_RETURN_IF_NULL_OR_FAULTY (w) ;
143 GB_RETURN_IF_FAULTY (M_in) ;
144 GB_RETURN_IF_NULL_OR_FAULTY (u) ;
145 GB_RETURN_IF_NULL_OR_FAULTY (y) ;
146
147 ASSERT (GB_VECTOR_OK (w)) ;
148 ASSERT (M_in == NULL || GB_VECTOR_OK (M_in)) ;
149 ASSERT (GB_VECTOR_OK (u)) ;
150
151 // get the descriptor
152 GB_GET_DESCRIPTOR (info, desc, C_replace, Mask_comp, Mask_struct,
153 xx1, xx2, xx3, xx7) ;
154
155 // get the mask
156 GrB_Matrix M = GB_get_mask ((GrB_Matrix) M_in, &Mask_comp, &Mask_struct) ;
157
158 //--------------------------------------------------------------------------
159 // apply the operator; do not transpose
160 //--------------------------------------------------------------------------
161
162 info = GB_apply (
163 (GrB_Matrix) w, C_replace, // w and its descriptor
164 M, Mask_comp, Mask_struct, // mask and its descriptor
165 accum, // optional accum for Z=accum(w,T)
166 op, y, false, // operator op(.,y) to apply to the entries
167 (GrB_Matrix) u, false, // u, not transposed
168 Context) ;
169
170 GB_BURBLE_END ;
171 return (info) ;
172}
173
174//------------------------------------------------------------------------------
175// GrB_Vector_apply_BinaryOp1st_Scalar: apply a binary operator: op(x,u)

Calls 2

GB_get_maskFunction · 0.85
GB_applyFunction · 0.85

Tested by

no test coverage detected