Skip to content

Commit 3ac3ff3

Browse files
fix select operations
1 parent 5781ac6 commit 3ac3ff3

File tree

3 files changed

+59
-5
lines changed

3 files changed

+59
-5
lines changed

src/Object_Methods/Algebra_Methods.jl

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,17 +239,71 @@ end
239239
function GxB_SelectOp_new(op::GxB_SelectOp, GxB_select_function::Function, xtype::GrB_Type{T}, thunk_type::GrB_Type{U}) where {T, U}
240240

241241
GxB_select_function_C = @cfunction(
242-
$GxB_select_function,
242+
$GxB_select_function,
243243
Bool,
244244
(Cuintmax_t, Cuintmax_t, Cuintmax_t, Cuintmax_t, Ref{T}, Ref{U})
245245
)
246-
246+
247+
return GrB_Info(
248+
ccall(
249+
dlsym(graphblas_lib, "GxB_SelectOp_new"),
250+
Cint,
251+
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}),
252+
pointer_from_objref(op), GxB_select_function_C, xtype.p
253+
)
254+
)
255+
end
256+
257+
function GxB_SelectOp_new(op::GxB_SelectOp, GxB_select_function::Function, xtype::GrB_NULL_Type, thunk_type::GrB_NULL_Type)
258+
259+
GxB_select_function_C = @cfunction(
260+
$GxB_select_function,
261+
Bool,
262+
(Cuintmax_t, Cuintmax_t, Cuintmax_t, Cuintmax_t, Ptr{Cvoid}, Ptr{Cvoid})
263+
)
264+
265+
return GrB_Info(
266+
ccall(
267+
dlsym(graphblas_lib, "GxB_SelectOp_new"),
268+
Cint,
269+
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}),
270+
pointer_from_objref(op), GxB_select_function_C, xtype.p
271+
)
272+
)
273+
end
274+
275+
function GxB_SelectOp_new(op::GxB_SelectOp, GxB_select_function::Function, xtype::GrB_NULL_Type, thunk_type::GrB_Type{U}) where U
276+
277+
GxB_select_function_C = @cfunction(
278+
$GxB_select_function,
279+
Bool,
280+
(Cuintmax_t, Cuintmax_t, Cuintmax_t, Cuintmax_t, Ptr{Cvoid}, Ref{U})
281+
)
282+
283+
return GrB_Info(
284+
ccall(
285+
dlsym(graphblas_lib, "GxB_SelectOp_new"),
286+
Cint,
287+
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}),
288+
pointer_from_objref(op), GxB_select_function_C, xtype.p
289+
)
290+
)
291+
end
292+
293+
function GxB_SelectOp_new(op::GxB_SelectOp, GxB_select_function::Function, xtype::GrB_Type{T}, thunk_type::GrB_NULL_Type) where T
294+
295+
GxB_select_function_C = @cfunction(
296+
$GxB_select_function,
297+
Bool,
298+
(Cuintmax_t, Cuintmax_t, Cuintmax_t, Cuintmax_t, Ref{T}, Ptr{Cvoid})
299+
)
300+
247301
return GrB_Info(
248302
ccall(
249303
dlsym(graphblas_lib, "GxB_SelectOp_new"),
250304
Cint,
251305
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}),
252-
op.p, GxB_select_function_C, xtype.p
306+
pointer_from_objref(op), GxB_select_function_C, xtype.p
253307
)
254308
)
255309
end

src/Operations/Select.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
GxB_select(C::GrB_Matrix, Mask, accum, op, A, k, desc) = GxB_Matrix_select(C, Mask, accum, op, A, k, desc)
2-
GxB_select(C::GrB_Vector, Mask, accum, op, A, k, desc) = GxB_Vectorselect(C, Mask, accum, op, A, k, desc)
2+
GxB_select(C::GrB_Vector, Mask, accum, op, A, k, desc) = GxB_Vector_select(C, Mask, accum, op, A, k, desc)
33

44
function GxB_Vector_select( # w<mask> = accum (w, op(u,k))
55
w::GrB_Vector, # input/output vector for results

src/SuiteSparseGraphBLAS.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export
6868
@GxB_UnaryOp_fprint, @GxB_BinaryOp_fprint, @GxB_Monoid_fprint, @GxB_Semiring_fprint,
6969
@GxB_Matrix_fprint, @GxB_Vector_fprint, @GxB_Descriptor_fprint, @GxB_fprint,
7070
# Select Operations
71-
GxB_Vector_select, GxB_Matrix_select, GxB_select,
71+
GxB_SelectOp_new, GxB_Vector_select, GxB_Matrix_select, GxB_select,
7272
# Print-level enum
7373
GxB_Print_Level
7474
for s in instances(GxB_Print_Level)

0 commit comments

Comments
 (0)