Skip to content

Commit 9867f55

Browse files
fix descriptor interface and remove GxB_SelectOp
1 parent cb990d2 commit 9867f55

File tree

7 files changed

+13
-84
lines changed

7 files changed

+13
-84
lines changed

src/Interface/object_methods/descriptor.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ julia> using SuiteSparseGraphBLAS
4141
julia> GrB_init(GrB_NONBLOCKING)
4242
GrB_SUCCESS::GrB_Info = 0
4343
44-
julia> desc = GrB_Descriptor(Dict(GrB_INP0 => GrB_TRAN))
44+
julia> desc = GrB_Descriptor(GrB_INP0 => GrB_TRAN)
4545
GrB_Descriptor
4646
4747
julia> desc[GrB_MASK] = GrB_SCMP;

src/Interface/object_methods/matrix.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ function LowerTriangular(A::GrB_Matrix{T}) where T
230230
error("Matrix is not square")
231231
end
232232
L = GrB_Matrix(T, nrows, ncols)
233-
res = GxB_select(L, GrB_NULL, GrB_NULL, GxB_TRIL, A, 0, GrB_NULL)
233+
res = GxB_select(L, GrB_NULL, GrB_NULL, GxB_TRIL, A, GrB_NULL, GrB_NULL)
234234
if res != GrB_SUCCESS
235235
error(res)
236236
end
@@ -248,7 +248,7 @@ function UpperTriangular(A::GrB_Matrix{T}) where T
248248
error("Matrix is not square")
249249
end
250250
U = GrB_Matrix(T, nrows, ncols)
251-
res = GxB_select(U, GrB_NULL, GrB_NULL, GxB_TRIU, A, 0, GrB_NULL)
251+
res = GxB_select(U, GrB_NULL, GrB_NULL, GxB_TRIU, A, GrB_NULL, GrB_NULL)
252252
if res != GrB_SUCCESS
253253
error(res)
254254
end
@@ -263,7 +263,7 @@ Return diagonal of a GraphBLAS matrix.
263263
function Diagonal(A::GrB_Matrix{T}) where T
264264
nrows, ncols = size(A)
265265
D = GrB_Matrix(T, nrows, ncols)
266-
res = GxB_select(D, GrB_NULL, GrB_NULL, GxB_DIAG, A, 0, GrB_NULL)
266+
res = GxB_select(D, GrB_NULL, GrB_NULL, GxB_DIAG, A, GrB_NULL, GrB_NULL)
267267
if res != GrB_SUCCESS
268268
error(res)
269269
end
@@ -276,7 +276,7 @@ end
276276
Remove all zero entries from GraphBLAS matrix.
277277
"""
278278
function dropzeros!(A::GrB_Matrix)
279-
outp_replace_desc = GrB_Descriptor(Dict(GrB_OUTP => GrB_REPLACE))
279+
outp_replace_desc = GrB_Descriptor(GrB_OUTP => GrB_REPLACE)
280280
res = GrB_assign(A, A, GrB_NULL, A, GrB_ALL, 0, GrB_ALL, 0, outp_replace_desc)
281281
if res != GrB_SUCCESS
282282
error(res)

src/Interface/object_methods/vector.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ end
198198
Remove all zero entries from GraphBLAS vector.
199199
"""
200200
function dropzeros!(v::GrB_Vector)
201-
outp_replace_desc = GrB_Descriptor(Dict(GrB_OUTP => GrB_REPLACE))
201+
outp_replace_desc = GrB_Descriptor(GrB_OUTP => GrB_REPLACE)
202202
res = GrB_assign(v, v, GrB_NULL, v, GrB_ALL, 0, outp_replace_desc)
203203
if res != GrB_SUCCESS
204204
error(res)

src/SuiteSparseGraphBLAS.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export
5858
@GxB_UnaryOp_fprint, @GxB_BinaryOp_fprint, @GxB_Monoid_fprint, @GxB_Semiring_fprint,
5959
@GxB_Matrix_fprint, @GxB_Vector_fprint, @GxB_Descriptor_fprint, @GxB_fprint,
6060
# Select Operations
61-
GxB_SelectOp_new, GxB_Vector_select, GxB_Matrix_select, GxB_select,
61+
GxB_Vector_select, GxB_Matrix_select, GxB_select,
6262
# Print-level enum
6363
GxB_Print_Level
6464
for s in instances(GxB_Print_Level)

src/object_methods/algebraic.jl

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -235,75 +235,3 @@ function GrB_Semiring_new(semiring::GrB_Semiring, monoid::GrB_Monoid, binary_op:
235235
)
236236
)
237237
end
238-
239-
function GxB_SelectOp_new(op::GxB_SelectOp, GxB_select_function::Function, xtype::GrB_Type{T}, thunk_type::GrB_Type{U}) where {T, U}
240-
241-
GxB_select_function_C = @cfunction(
242-
$GxB_select_function,
243-
Bool,
244-
(Cuintmax_t, Cuintmax_t, Cuintmax_t, Cuintmax_t, Ref{T}, Ref{U})
245-
)
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-
301-
return GrB_Info(
302-
ccall(
303-
dlsym(graphblas_lib, "GxB_SelectOp_new"),
304-
Cint,
305-
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}),
306-
pointer_from_objref(op), GxB_select_function_C, xtype.p
307-
)
308-
)
309-
end

src/operations/select.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function GxB_Vector_select( # w<mask> = accum (w, op(u,k))
77
accum::U, # optional accum for z=accum(w,t)
88
op::GxB_SelectOp, # operator to apply to the entries
99
u::GrB_Vector, # first input: vector u
10-
thunk, # optional input for the select operator
10+
thunk::GrB_NULL_Type, # optional input for the select operator
1111
desc::V # descriptor for w and mask
1212
) where {T <: valid_vector_mask_types, U <: valid_accum_types, V <: valid_desc_types}
1313

@@ -16,7 +16,7 @@ function GxB_Vector_select( # w<mask> = accum (w, op(u,k))
1616
dlsym(graphblas_lib, "GxB_Vector_select"),
1717
Cint,
1818
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}),
19-
w.p, mask.p, accum.p, op.p, u.p, Ref(thunk), desc.p
19+
w.p, mask.p, accum.p, op.p, u.p, thunk.p, desc.p
2020
)
2121
)
2222
end
@@ -27,7 +27,7 @@ function GxB_Matrix_select( # C<Mask> = accum (C, op(A,k)) or op(A',
2727
accum::U, # optional accum for Z=accum(C,T)
2828
op::GxB_SelectOp, # operator to apply to the entries
2929
A::GrB_Matrix, # first input: matrix A
30-
thunk, # optional input for the select operator
30+
thunk::GrB_NULL_Type, # optional input for the select operator
3131
desc::V # descriptor for C, mask, and A
3232
) where {T <: valid_matrix_mask_types, U <: valid_accum_types, V <: valid_desc_types}
3333

@@ -36,7 +36,7 @@ function GxB_Matrix_select( # C<Mask> = accum (C, op(A,k)) or op(A',
3636
dlsym(graphblas_lib, "GxB_Matrix_select"),
3737
Cint,
3838
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}),
39-
C.p, Mask.p, accum.p, op.p, A.p, Ref(thunk), desc.p
39+
C.p, Mask.p, accum.p, op.p, A.p, thunk.p, desc.p
4040
)
4141
)
4242
end

src/structures.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Base:
33

44
export ZeroBasedIndex, OneBasedIndex, ZeroBasedIndices, OneBasedIndices,
55
GrB_Type, GrB_UnaryOp, GrB_BinaryOp, GrB_Monoid, GrB_Semiring,
6-
GrB_Vector, GrB_Matrix, GrB_Descriptor, GxB_SelectOp
6+
GrB_Vector, GrB_Matrix, GrB_Descriptor
77

88
const valid_types = Union{Bool, Int8, UInt8, Int16, UInt16, Int32,
99
UInt32, Int64, UInt64, Float32, Float64}
@@ -104,3 +104,4 @@ mutable struct GrB_ALL_Type <: Abstract_GrB_ALL
104104
end
105105
pointer(x::GrB_ALL_Type) = x.p
106106
show(io::IO, ::GrB_ALL_Type) = print("GrB_ALL")
107+
ZeroBasedIndices(::GrB_ALL_Type) = GrB_ALL

0 commit comments

Comments
 (0)