Skip to content

Commit c2dbfdb

Browse files
correct methods for UInt64 type
1 parent 529c975 commit c2dbfdb

File tree

6 files changed

+107
-25
lines changed

6 files changed

+107
-25
lines changed

src/Object_Methods/Algebra_Methods.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,20 @@ function GrB_Monoid_new(monoid::GrB_Monoid, binary_op::GrB_BinaryOp, identity::T
173173
)
174174
end
175175

176+
function GrB_Monoid_new(monoid::GrB_Monoid, binary_op::GrB_BinaryOp, identity::UInt64)
177+
monoid_ptr = pointer_from_objref(monoid)
178+
fn_name = "GrB_Monoid_new_UINT64"
179+
180+
return GrB_Info(
181+
ccall(
182+
dlsym(graphblas_lib, fn_name),
183+
Cint,
184+
(Ptr{Cvoid}, Ptr{Cvoid}, Cuintmax_t),
185+
monoid_ptr, binary_op.p, identity
186+
)
187+
)
188+
end
189+
176190
function GrB_Monoid_new(monoid::GrB_Monoid, binary_op::GrB_BinaryOp, identity::Float32)
177191
monoid_ptr = pointer_from_objref(monoid)
178192
fn_name = "GrB_Monoid_new_FP32"

src/Object_Methods/Matrix_Methods.jl

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function GrB_Matrix_new(A::GrB_Matrix{T}, type::GrB_Type{T}, nrows::U, ncols::U)
2424
ccall(
2525
dlsym(graphblas_lib, "GrB_Matrix_new"),
2626
Cint,
27-
(Ptr{Cvoid}, Ptr{Cvoid}, Cintmax_t, Cintmax_t),
27+
(Ptr{Cvoid}, Ptr{Cvoid}, Cuintmax_t, Cuintmax_t),
2828
A_ptr, type.p, nrows, ncols
2929
)
3030
)
@@ -82,7 +82,7 @@ function GrB_Matrix_build(C::GrB_Matrix{T}, I::Vector{U}, J::Vector{U}, X::Vecto
8282
ccall(
8383
dlsym(graphblas_lib, fn_name),
8484
Cint,
85-
(Ptr{Cvoid}, Ptr{U}, Ptr{U}, Ptr{T}, Cintmax_t, Ptr{Cvoid}),
85+
(Ptr{Cvoid}, Ptr{U}, Ptr{U}, Ptr{T}, Cuintmax_t, Ptr{Cvoid}),
8686
C.p, I_ptr, J_ptr, X_ptr, nvals, dup.p
8787
)
8888
)
@@ -349,7 +349,19 @@ function GrB_Matrix_setElement(C::GrB_Matrix{T}, X::T, I::U, J::U) where {U <: G
349349
ccall(
350350
dlsym(graphblas_lib, fn_name),
351351
Cint,
352-
(Ptr{Cvoid}, Cintmax_t, Cintmax_t, Cintmax_t),
352+
(Ptr{Cvoid}, Cintmax_t, Cuintmax_t, Cuintmax_t),
353+
C.p, X, I, J
354+
)
355+
)
356+
end
357+
358+
function GrB_Matrix_setElement(C::GrB_Matrix{UInt64}, X::UInt64, I::U, J::U) where U <: GrB_Index
359+
fn_name = "GrB_Matrix_setElement_UINT64"
360+
return GrB_Info(
361+
ccall(
362+
dlsym(graphblas_lib, fn_name),
363+
Cint,
364+
(Ptr{Cvoid}, Cuintmax_t, Cuintmax_t, Cuintmax_t),
353365
C.p, X, I, J
354366
)
355367
)
@@ -361,7 +373,7 @@ function GrB_Matrix_setElement(C::GrB_Matrix{Float32}, X::Float32, I::U, J::U) w
361373
ccall(
362374
dlsym(graphblas_lib, fn_name),
363375
Cint,
364-
(Ptr{Cvoid}, Cfloat, Cintmax_t, Cintmax_t),
376+
(Ptr{Cvoid}, Cfloat, Cuintmax_t, Cuintmax_t),
365377
C.p, X, I, J
366378
)
367379
)
@@ -373,7 +385,7 @@ function GrB_Matrix_setElement(C::GrB_Matrix{Float64}, X::Float64, I::U, J::U) w
373385
ccall(
374386
dlsym(graphblas_lib, fn_name),
375387
Cint,
376-
(Ptr{Cvoid}, Cdouble, Cintmax_t, Cintmax_t),
388+
(Ptr{Cvoid}, Cdouble, Cuintmax_t, Cuintmax_t),
377389
C.p, X, I, J
378390
)
379391
)
@@ -415,7 +427,7 @@ function GrB_Matrix_extractElement(A::GrB_Matrix{T}, row_index::U, col_index::U)
415427
ccall(
416428
dlsym(graphblas_lib, fn_name),
417429
Cint,
418-
(Ptr{Cvoid}, Ptr{Cvoid}, Cintmax_t, Cintmax_t),
430+
(Ptr{Cvoid}, Ptr{Cvoid}, Cuintmax_t, Cuintmax_t),
419431
element, A.p, row_index, col_index
420432
)
421433
)

src/Object_Methods/Vector_Methods.jl

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function GrB_Vector_new(v::GrB_Vector{T}, type::GrB_Type{T}, n::U) where {U <: G
2424
ccall(
2525
dlsym(graphblas_lib, "GrB_Vector_new"),
2626
Cint,
27-
(Ptr{Cvoid}, Ptr{Cvoid}, Cintmax_t),
27+
(Ptr{Cvoid}, Ptr{Cvoid}, Cuintmax_t),
2828
v_ptr, type.p, n
2929
)
3030
)
@@ -262,7 +262,7 @@ function GrB_Vector_build(w::GrB_Vector{T}, I::Vector{U}, X::Vector{T}, nvals::U
262262
ccall(
263263
dlsym(graphblas_lib, fn_name),
264264
Cint,
265-
(Ptr{Cvoid}, Ptr{U}, Ptr{T}, Cintmax_t, Ptr{Cvoid}),
265+
(Ptr{Cvoid}, Ptr{U}, Ptr{T}, Cuintmax_t, Ptr{Cvoid}),
266266
w.p, I_ptr, X_ptr, nvals, dup.p
267267
)
268268
)
@@ -307,7 +307,19 @@ function GrB_Vector_setElement(w::GrB_Vector{T}, x::T, i::U) where {U <: GrB_Ind
307307
ccall(
308308
dlsym(graphblas_lib, fn_name),
309309
Cint,
310-
(Ptr{Cvoid}, Cintmax_t, Cintmax_t),
310+
(Ptr{Cvoid}, Cintmax_t, Cuintmax_t),
311+
w.p, x, i
312+
)
313+
)
314+
end
315+
316+
function GrB_Vector_setElement(w::GrB_Vector{UInt64}, x::UInt64, i::U) where U <: GrB_Index
317+
fn_name = "GrB_Vector_setElement_UINT64"
318+
return GrB_Info(
319+
ccall(
320+
dlsym(graphblas_lib, fn_name),
321+
Cint,
322+
(Ptr{Cvoid}, Cuintmax_t, Cuintmax_t),
311323
w.p, x, i
312324
)
313325
)
@@ -319,7 +331,7 @@ function GrB_Vector_setElement(w::GrB_Vector{Float32}, x::Float32, i::U) where U
319331
ccall(
320332
dlsym(graphblas_lib, fn_name),
321333
Cint,
322-
(Ptr{Cvoid}, Cfloat, Cintmax_t),
334+
(Ptr{Cvoid}, Cfloat, Cuintmax_t),
323335
w.p, x, i
324336
)
325337
)
@@ -331,7 +343,7 @@ function GrB_Vector_setElement(w::GrB_Vector{Float64}, x::Float64, i::U) where U
331343
ccall(
332344
dlsym(graphblas_lib, fn_name),
333345
Cint,
334-
(Ptr{Cvoid}, Cdouble, Cintmax_t),
346+
(Ptr{Cvoid}, Cdouble, Cuintmax_t),
335347
w.p, x, i
336348
)
337349
)

src/Operations/Assign.jl

Lines changed: 54 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function GrB_Vector_assign( # w<mask>(I) = accum (w(I),u)
7676
ccall(
7777
dlsym(graphblas_lib, "GrB_Vector_assign"),
7878
Cint,
79-
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cintmax_t}, Cintmax_t, Ptr{Cvoid}),
79+
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cintmax_t}, Cuintmax_t, Ptr{Cvoid}),
8080
w.p, mask.p, accum.p, u.p, pointer(I), ni, desc.p
8181
)
8282
)
@@ -135,7 +135,7 @@ function GrB_Matrix_assign( # C<Mask>(I,J) = accum (C(I,J),A)
135135
ccall(
136136
dlsym(graphblas_lib, "GrB_Matrix_assign"),
137137
Cint,
138-
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cintmax_t}, Cintmax_t, Ptr{Cintmax_t}, Cintmax_t, Ptr{Cvoid}),
138+
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Y}, Cuintmax_t, Ptr{Y}, Cuintmax_t, Ptr{Cvoid}),
139139
C.p, Mask.p, accum.p, A.p, pointer(I), ni, pointer(J), nj, desc.p
140140
)
141141
)
@@ -199,7 +199,7 @@ function GrB_Col_assign( # C<mask>(I,j) = accum (C(I,j),u)
199199
ccall(
200200
dlsym(graphblas_lib, "GrB_Col_assign"),
201201
Cint,
202-
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cintmax_t}, Cintmax_t, Cintmax_t, Ptr{Cvoid}),
202+
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cuintmax_t}, Cuintmax_t, Cuintmax_t, Ptr{Cvoid}),
203203
C.p, mask.p, accum.p, u.p, pointer(I), ni, j, desc.p
204204
)
205205
)
@@ -263,7 +263,7 @@ function GrB_Row_assign( # C<mask'>(i,J) = accum (C(i,J),u')
263263
ccall(
264264
dlsym(graphblas_lib, "GrB_Row_assign"),
265265
Cint,
266-
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Cintmax_t, Ptr{Cintmax_t}, Cintmax_t, Ptr{Cvoid}),
266+
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Cuintmax_t, Ptr{Cuintmax_t}, Cuintmax_t, Ptr{Cvoid}),
267267
C.p, mask.p, accum.p, u.p, i, pointer(J), nj, desc.p
268268
)
269269
)
@@ -311,7 +311,29 @@ function GrB_Vector_assign( # w<mask>(I) = accum (w(I),x)
311311
ccall(
312312
dlsym(graphblas_lib, fn_name),
313313
Cint,
314-
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Cintmax_t, Ptr{Cintmax_t}, Cintmax_t, Ptr{Cvoid}),
314+
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Cintmax_t, Ptr{Cuintmax_t}, Cuintmax_t, Ptr{Cvoid}),
315+
w.p, mask.p, accum.p, x, pointer(I), ni, desc.p
316+
)
317+
)
318+
end
319+
320+
function GrB_Vector_assign( # w<mask>(I) = accum (w(I),x)
321+
w::GrB_Vector{UInt64}, # input/output vector for results
322+
mask::T, # optional mask for w, unused if NULL
323+
accum::U, # optional accum for Z=accum(w(I),x)
324+
x::Y, # scalar to assign to w(I)
325+
I::S, # row indices
326+
ni::X, # number of row indices
327+
desc::V # descriptor for w and mask
328+
) where {T <: valid_vector_mask_types, U <: valid_accum_types, V <: valid_desc_types, X <: GrB_Index, Y <: valid_types, S <: valid_indices_types}
329+
330+
fn_name = "GrB_Vector_assign_UINT64"
331+
332+
return GrB_Info(
333+
ccall(
334+
dlsym(graphblas_lib, fn_name),
335+
Cint,
336+
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Cuintmax_t, Ptr{Cuintmax_t}, Cuintmax_t, Ptr{Cvoid}),
315337
w.p, mask.p, accum.p, x, pointer(I), ni, desc.p
316338
)
317339
)
@@ -331,7 +353,7 @@ function GrB_Vector_assign( # w<mask>(I) = accum (w(I),x)
331353
ccall(
332354
dlsym(graphblas_lib, "GrB_Vector_assign_FP64"),
333355
Cint,
334-
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Cdouble, Ptr{Cintmax_t}, Cintmax_t, Ptr{Cvoid}),
356+
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Cdouble, Ptr{Cuintmax_t}, Cuintmax_t, Ptr{Cvoid}),
335357
w.p, mask.p, accum.p, x, pointer(I), ni, desc.p
336358
)
337359
)
@@ -351,7 +373,7 @@ function GrB_Vector_assign( # w<mask>(I) = accum (w(I),x)
351373
ccall(
352374
dlsym(graphblas_lib, "GrB_Vector_assign_FP32"),
353375
Cint,
354-
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Cfloat, Ptr{Cintmax_t}, Cintmax_t, Ptr{Cvoid}),
376+
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Cfloat, Ptr{Cuintmax_t}, Cuintmax_t, Ptr{Cvoid}),
355377
w.p, mask.p, accum.p, x, pointer(I), ni, desc.p
356378
)
357379
)
@@ -401,7 +423,29 @@ function GrB_Matrix_assign( # C<Mask>(I,J) = accum (C(I,J),x)
401423
ccall(
402424
dlsym(graphblas_lib, fn_name),
403425
Cint,
404-
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Cintmax_t, Ptr{Cintmax_t}, Cintmax_t, Ptr{Cintmax_t}, Cintmax_t, Ptr{Cvoid}),
426+
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Cintmax_t, Ptr{S}, Cuintmax_t, Ptr{S}, Cuintmax_t, Ptr{Cvoid}),
427+
C.p, Mask.p, accum.p, x, pointer(I), ni, pointer(J), nj, desc.p
428+
)
429+
)
430+
end
431+
432+
function GrB_Matrix_assign( # C<Mask>(I,J) = accum (C(I,J),x)
433+
C::GrB_Matrix{UInt64}, # input/output matrix for results
434+
Mask::T, # optional mask for C, unused if NULL
435+
accum::U, # optional accum for Z=accum(C(I,J),x)
436+
x::Y, # scalar to assign to C(I,J)
437+
I::S, # row indices
438+
ni::X, # number of row indices
439+
J::S, # column indices
440+
nj::X, # number of column indices
441+
desc::V # descriptor for C and Mask
442+
) where {T <: valid_matrix_mask_types, U <: valid_accum_types, V <: valid_desc_types, X <: GrB_Index, Y <: valid_types, S <: valid_indices_types}
443+
444+
return GrB_Info(
445+
ccall(
446+
dlsym(graphblas_lib, "GrB_Matrix_assign_UINT64"),
447+
Cint,
448+
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Cuintmax_t, Ptr{S}, Cuintmax_t, Ptr{S}, Cuintmax_t, Ptr{Cvoid}),
405449
C.p, Mask.p, accum.p, x, pointer(I), ni, pointer(J), nj, desc.p
406450
)
407451
)
@@ -423,7 +467,7 @@ function GrB_Matrix_assign( # C<Mask>(I,J) = accum (C(I,J),x)
423467
ccall(
424468
dlsym(graphblas_lib, "GrB_Matrix_assign_FP64"),
425469
Cint,
426-
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Cdouble, Ptr{Cintmax_t}, Cintmax_t, Ptr{Cintmax_t}, Cintmax_t, Ptr{Cvoid}),
470+
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Cdouble, Ptr{S}, Cuintmax_t, Ptr{S}, Cuintmax_t, Ptr{Cvoid}),
427471
C.p, Mask.p, accum.p, x, pointer(I), ni, pointer(J), nj, desc.p
428472
)
429473
)
@@ -445,7 +489,7 @@ function GrB_Matrix_assign( # C<Mask>(I,J) = accum (C(I,J),x)
445489
ccall(
446490
dlsym(graphblas_lib, "GrB_Matrix_assign_FP32"),
447491
Cint,
448-
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Cfloat, Ptr{Cintmax_t}, Cintmax_t, Ptr{Cintmax_t}, Cintmax_t, Ptr{Cvoid}),
492+
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Cfloat, Ptr{S}, Cuintmax_t, Ptr{S}, Cuintmax_t, Ptr{Cvoid}),
449493
C.p, Mask.p, accum.p, x, pointer(I), ni, pointer(J), nj, desc.p
450494
)
451495
)

src/Operations/Extract.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function GrB_Vector_extract( # w<mask> = accum (w, u(I))
8282
ccall(
8383
dlsym(graphblas_lib, "GrB_Vector_extract"),
8484
Cint,
85-
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cintmax_t}, Cintmax_t, Ptr{Cvoid}),
85+
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Y}, Cuintmax_t, Ptr{Cvoid}),
8686
w.p, mask.p, accum.p, u.p, pointer(I), ni, desc.p
8787
)
8888
)
@@ -162,7 +162,7 @@ function GrB_Matrix_extract( # C<Mask> = accum (C, A(I,J))
162162
ccall(
163163
dlsym(graphblas_lib, "GrB_Matrix_extract"),
164164
Cint,
165-
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cintmax_t}, Cintmax_t, Ptr{Cintmax_t}, Cintmax_t, Ptr{Cvoid}),
165+
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Y}, Cuintmax_t, Ptr{Y}, Cuintmax_t, Ptr{Cvoid}),
166166
C.p, Mask.p, accum.p, A.p, pointer(I), ni, pointer(J), nj, desc.p
167167
)
168168
)
@@ -250,7 +250,7 @@ function GrB_Col_extract( # w<mask> = accum (w, A(I,j))
250250
ccall(
251251
dlsym(graphblas_lib, "GrB_Col_extract"),
252252
Cint,
253-
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cintmax_t}, Cintmax_t, Cintmax_t, Ptr{Cvoid}),
253+
(Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Y}, Cuintmax_t, Cuintmax_t, Ptr{Cvoid}),
254254
w.p, mask.p, accum.p, A.p, pointer(I), ni, j, desc.p
255255
)
256256
)

src/SuiteSparseGraphBLAS.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const types = ["BOOL", "INT8", "UINT8", "INT16", "UINT16", "INT32", "UINT32",
1212

1313
const GrB_Index = Union{Int64, UInt64}
1414
const valid_types = Union{Bool, Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64, Float32, Float64}
15-
const valid_int_types = Union{Bool, Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64}
15+
const valid_int_types = Union{Bool, Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64}
1616

1717
built_in_unary_operators = ["IDENTITY", "AINV", "MINV"]
1818

0 commit comments

Comments
 (0)