@@ -55,22 +55,22 @@ function emul!(
5555 w:: GBVector ,
5656 u:: GBVector ,
5757 v:: GBVector ,
58- op = nothing ;
58+ op = BinaryOps . TIMES ;
5959 mask = nothing ,
6060 accum = nothing ,
6161 desc = nothing
6262)
63- op, mask, accum, desc = _handlectx (op, mask, accum, desc, BinaryOps . TIMES )
63+ mask, accum, desc = _handlenothings ( mask, accum, desc)
6464 size (w) == size (u) == size (v) || throw (DimensionMismatch ())
6565 op = getoperator (op, optype (u, v))
6666 accum = getoperator (accum, eltype (w))
67- if op isa libgb . GrB_Semiring
67+ if op isa TypedSemiring
6868 libgb. GrB_Vector_eWiseMult_Semiring (w, mask, accum, op, u, v, desc)
6969 return w
70- elseif op isa libgb . GrB_Monoid
70+ elseif op isa TypedMonoid
7171 libgb. GrB_Vector_eWiseMult_Monoid (w, mask, accum, op, u, v, desc)
7272 return w
73- elseif op isa libgb . GrB_BinaryOp
73+ elseif op isa TypedBinaryOperator
7474 libgb. GrB_Vector_eWiseMult_BinaryOp (w, mask, accum, op, u, v, desc)
7575 return w
7676 else
8282function emul (
8383 u:: GBVector ,
8484 v:: GBVector ,
85- op = nothing ;
85+ op = BinaryOps . TIMES ;
8686 mask = nothing ,
8787 accum = nothing ,
8888 desc = nothing
8989)
90- op = _handlectx (op, ctxop, BinaryOps. TIMES)
9190 t = inferoutputtype (u, v, op)
9291 w = GBVector {t} (size (u))
9392 return emul! (w, u, v, op; mask , accum, desc)
@@ -97,23 +96,23 @@ function emul!(
9796 C:: GBMatrix ,
9897 A:: GBMatOrTranspose ,
9998 B:: GBMatOrTranspose ,
100- op = nothing ;
99+ op = BinaryOps . TIMES ;
101100 mask = nothing ,
102101 accum = nothing ,
103102 desc = nothing
104103)
105- op, mask, accum, desc = _handlectx (op, mask, accum, desc, BinaryOps . TIMES )
104+ mask, accum, desc = _handlenothings ( mask, accum, desc)
106105 size (C) == size (A) == size (B) || throw (DimensionMismatch ())
107106 A, desc, B = _handletranspose (A, desc, B)
108107 op = getoperator (op, optype (A, B))
109108 accum = getoperator (accum, eltype (C))
110- if op isa libgb . GrB_Semiring
109+ if op isa TypedSemiring
111110 libgb. GrB_Matrix_eWiseMult_Semiring (C, mask, accum, op, A, B, desc)
112111 return C
113- elseif op isa libgb . GrB_Monoid
112+ elseif op isa TypedMonoid
114113 libgb. GrB_Matrix_eWiseMult_Monoid (C, mask, accum, op, A, B, desc)
115114 return C
116- elseif op isa libgb . GrB_BinaryOp
115+ elseif op isa TypedBinaryOperator
117116 libgb. GrB_Matrix_eWiseMult_BinaryOp (C, mask, accum, op, A, B, desc)
118117 return C
119118 else
@@ -125,12 +124,11 @@ end
125124function emul (
126125 A:: GBMatOrTranspose ,
127126 B:: GBMatOrTranspose ,
128- op = nothing ;
127+ op = BinaryOps . TIMES ;
129128 mask = nothing ,
130129 accum = nothing ,
131130 desc = nothing
132131)
133- op = _handlectx (op, ctxop, BinaryOps. TIMES)
134132 t = inferoutputtype (A, B, op)
135133 C = GBMatrix {t} (size (A))
136134 return emul! (C, A, B, op; mask, accum, desc)
@@ -193,22 +191,22 @@ function eadd!(
193191 w:: GBVector ,
194192 u:: GBVector ,
195193 v:: GBVector ,
196- op = nothing ;
194+ op = BinaryOps . PLUS ;
197195 mask = nothing ,
198196 accum = nothing ,
199197 desc = nothing
200198)
201- op, mask, accum, desc = _handlectx (op, mask, accum, desc, BinaryOps . PLUS )
199+ mask, accum, desc = _handlenothings ( mask, accum, desc)
202200 size (w) == size (u) == size (v) || throw (DimensionMismatch ())
203201 op = getoperator (op, optype (u, v))
204202 accum = getoperator (accum, eltype (w))
205- if op isa libgb . GrB_Semiring
203+ if op isa TypedSemiring
206204 libgb. GrB_Vector_eWiseAdd_Semiring (w, mask, accum, op, u, v, desc)
207205 return w
208- elseif op isa libgb . GrB_Monoid
206+ elseif op isa TypedMonoid
209207 libgb. GrB_Vector_eWiseAdd_Monoid (w, mask, accum, op, u, v, desc)
210208 return w
211- elseif op isa libgb . GrB_BinaryOp
209+ elseif op isa TypedBinaryOperator
212210 libgb. GrB_Vector_eWiseAdd_BinaryOp (w, mask, accum, op, u, v, desc)
213211 return w
214212 else
@@ -220,12 +218,11 @@ end
220218function eadd (
221219 u:: GBVector ,
222220 v:: GBVector ,
223- op = nothing ;
221+ op = BinaryOps . PLUS ;
224222 mask = nothing ,
225223 accum = nothing ,
226224 desc = nothing
227225)
228- op, mask, accum, desc = _handlectx (op, mask, accum, desc, BinaryOps. PLUS)
229226 t = inferoutputtype (u, v, op)
230227 w = GBVector {t} (size (u))
231228 return eadd! (w, u, v, op; mask, accum, desc)
@@ -235,23 +232,23 @@ function eadd!(
235232 C:: GBMatrix ,
236233 A:: GBMatOrTranspose ,
237234 B:: GBMatOrTranspose ,
238- op = nothing ;
235+ op = BinaryOps . PLUS ;
239236 mask = nothing ,
240237 accum = nothing ,
241238 desc = nothing
242239)
243- op, mask, accum, desc = _handlectx (op, mask, accum, desc, BinaryOps . PLUS )
240+ mask, accum, desc = _handlenothings ( mask, accum, desc)
244241 size (C) == size (A) == size (B) || throw (DimensionMismatch ())
245242 A, desc, B = _handletranspose (A, desc, B)
246243 op = getoperator (op, optype (A, B))
247244 accum = getoperator (accum, eltype (C))
248- if op isa libgb . GrB_Semiring
245+ if op isa TypedSemiring
249246 libgb. GrB_Matrix_eWiseAdd_Semiring (C, mask, accum, op, A, B, desc)
250247 return C
251- elseif op isa libgb . GrB_Monoid
248+ elseif op isa TypedMonoid
252249 libgb. GrB_Matrix_eWiseAdd_Monoid (C, mask, accum, op, A, B, desc)
253250 return C
254- elseif op isa libgb . GrB_BinaryOp
251+ elseif op isa TypedBinaryOperator
255252 libgb. GrB_Matrix_eWiseAdd_BinaryOp (C, mask, accum, op, A, B, desc)
256253 return C
257254 else
@@ -263,19 +260,18 @@ end
263260function eadd (
264261 A:: GBMatOrTranspose ,
265262 B:: GBMatOrTranspose ,
266- op = nothing ;
263+ op = BinaryOps . PLUS ;
267264 mask = nothing ,
268265 accum = nothing ,
269266 desc = nothing
270267)
271- op, mask, accum, desc = _handlectx (op, mask, accum, desc, BinaryOps. PLUS)
272268 t = inferoutputtype (A, B, op)
273269 C = GBMatrix {t} (size (A))
274270 return eadd! (C, A, B, op; mask, accum, desc)
275271end
276272
277273function Base.:+ (A:: GBArray , B:: GBArray )
278- eadd (A, B, nothing )
274+ eadd (A, B, BinaryOps . PLUS )
279275end
280276
281277function Base.:- (A:: GBArray , B:: GBArray )
284280# Elementwise Broadcasts
285281# ######################
286282
287- # default argument is missing to avoid `nothing` picking up the default default :).
288- function Base. broadcasted (:: typeof (∪ ), A:: GBArray , B:: GBArray )
289- eadd (A, B, missing )
290- end
291-
292- # default argument is missing to avoid `nothing` picking up the default default :).
293- function Base. broadcasted (:: typeof (∩ ), A:: GBArray , B:: GBArray )
294- emul (A, B, missing )
295- end
296-
297283function Base. broadcasted (:: typeof (* ), A:: GBArray , B:: GBArray )
298284 emul (A, B, BinaryOps. TIMES)
299285end
0 commit comments