Skip to content

Commit 2760be3

Browse files
add GrB_ALL
1 parent 8e130fb commit 2760be3

File tree

3 files changed

+32
-17
lines changed

3 files changed

+32
-17
lines changed

src/Operations/Extract.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ function GrB_Vector_extract( # w<mask> = accum (w, u(I))
7575
mask::T, # optional mask for w, unused if NULL
7676
accum::U, # optional accum for z=accum(w,t)
7777
u::GrB_Vector, # first input: vector u
78-
I::Vector{X}, # row indices
78+
I::Y, # row indices
7979
ni::X, # number of row indices
8080
desc::V # descriptor for w and mask
81-
) where {T <: valid_vector_mask_types, U <: valid_accum_types, V <: valid_desc_types, X <: GrB_Index}
81+
) where {T <: valid_vector_mask_types, U <: valid_accum_types, V <: valid_desc_types, X <: GrB_Index, Y <: Union{Vector{X}, GrB_ALL_Type}}
8282

8383
return GrB_Info(
8484
ccall(
@@ -153,12 +153,12 @@ function GrB_Matrix_extract( # C<Mask> = accum (C, A(I,J))
153153
Mask::T, # optional mask for C, unused if NULL
154154
accum::U, # optional accum for Z=accum(C,T)
155155
A::GrB_Matrix, # first input: matrix A
156-
I::Vector{X}, # row indices
156+
I::Y, # row indices
157157
ni::X, # number of row indices
158-
J::Vector{X}, # column indices
158+
J::Y, # column indices
159159
nj::X, # number of column indices
160160
desc::V # descriptor for C, Mask, and A
161-
) where {T <: valid_matrix_mask_types, U <: valid_accum_types, V <: valid_desc_types, X <: GrB_Index}
161+
) where {T <: valid_matrix_mask_types, U <: valid_accum_types, V <: valid_desc_types, X <: GrB_Index, Y <: Union{Vector{X}, GrB_ALL_Type}}
162162

163163
return GrB_Info(
164164
ccall(
@@ -242,11 +242,11 @@ function GrB_Col_extract( # w<mask> = accum (w, A(I,j))
242242
mask::T, # optional mask for w, unused if NULL
243243
accum::U, # optional accum for z=accum(w,t)
244244
A::GrB_Matrix, # first input: matrix A
245-
I::Vector{X}, # row indices
245+
I::Y, # row indices
246246
ni::X, # number of row indices
247247
j::X, # column index
248248
desc::V # descriptor for w, mask, and A
249-
) where {T <: valid_vector_mask_types, U <: valid_accum_types, V <: valid_desc_types, X <: GrB_Index}
249+
) where {T <: valid_vector_mask_types, U <: valid_accum_types, V <: valid_desc_types, X <: GrB_Index, Y <: Union{Vector{X}, GrB_ALL_Type}}
250250

251251
return GrB_Info(
252252
ccall(

src/Structures.jl

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Base.show
22
import Base.==
3+
import Base.pointer
34
export GrB_Type, GrB_UnaryOp, GrB_BinaryOp, GrB_Monoid, GrB_Semiring,
45
GrB_Vector, GrB_Matrix, GrB_Descriptor
56

@@ -8,52 +9,59 @@ abstract type GrB_Struct end
89
mutable struct GrB_Type{T} <: GrB_Struct
910
p::Ptr{Cvoid}
1011
end
11-
GrB_Type{T}() where T = GrB_Type{T}(Ptr{Cvoid}(0))
12+
GrB_Type{T}() where T = GrB_Type{T}(C_NULL)
1213
Base.show(io::IO, ::GrB_Type{T}) where T = print("GrB_Type{" * string(T) * "}")
1314

1415
mutable struct GrB_UnaryOp <: GrB_Struct
1516
p::Ptr{Cvoid}
1617
end
17-
GrB_UnaryOp() = GrB_UnaryOp(Ptr{Cvoid}(0))
18+
GrB_UnaryOp() = GrB_UnaryOp(C_NULL)
1819
Base.show(io::IO, ::GrB_UnaryOp) = print("GrB_UnaryOp")
1920

2021
mutable struct GrB_BinaryOp <: GrB_Struct
2122
p::Ptr{Cvoid}
2223
end
23-
GrB_BinaryOp() = GrB_BinaryOp(Ptr{Cvoid}(0))
24+
GrB_BinaryOp() = GrB_BinaryOp(C_NULL)
2425
Base.show(io::IO, ::GrB_BinaryOp) = print("GrB_BinaryOp")
2526

2627
mutable struct GrB_Monoid <: GrB_Struct
2728
p::Ptr{Cvoid}
2829
end
29-
GrB_Monoid() = GrB_Monoid(Ptr{Cvoid}(0))
30+
GrB_Monoid() = GrB_Monoid(C_NULL)
3031
Base.show(io::IO, ::GrB_Monoid) = print("GrB_Monoid")
3132

3233
mutable struct GrB_Semiring <: GrB_Struct
3334
p::Ptr{Cvoid}
3435
end
35-
GrB_Semiring() = GrB_Semiring(Ptr{Cvoid}(0))
36+
GrB_Semiring() = GrB_Semiring(C_NULL)
3637
Base.show(io::IO, ::GrB_Semiring) = print("GrB_Semiring")
3738

3839
mutable struct GrB_Vector{T} <: GrB_Struct
3940
p::Ptr{Cvoid}
4041
end
41-
GrB_Vector{T}() where T = GrB_Vector{T}(Ptr{Cvoid}(0))
42+
GrB_Vector{T}() where T = GrB_Vector{T}(C_NULL)
4243
Base.show(io::IO, ::GrB_Vector{T}) where T = print("GrB_Vector{" * string(T) * "}")
4344

4445
mutable struct GrB_Matrix{T} <: GrB_Struct
4546
p::Ptr{Cvoid}
4647
end
47-
GrB_Matrix{T}() where T = GrB_Matrix{T}(Ptr{Cvoid}(0))
48+
GrB_Matrix{T}() where T = GrB_Matrix{T}(C_NULL)
4849
Base.show(io::IO, ::GrB_Matrix{T}) where T = print("GrB_Matrix{" * string(T) * "}")
4950

5051
mutable struct GrB_Descriptor <: GrB_Struct
5152
p::Ptr{Cvoid}
5253
end
53-
GrB_Descriptor() = GrB_Descriptor(Ptr{Cvoid}(0))
54+
GrB_Descriptor() = GrB_Descriptor(C_NULL)
5455
Base.show(io::IO, ::GrB_Descriptor) = print("GrB_Descriptor")
5556

5657
struct GrB_NULL_Type
5758
p::Ptr{Cvoid}
5859
end
59-
Base.show(io::IO, ::GrB_NULL_Type) = print("NULL")
60+
Base.show(io::IO, ::GrB_NULL_Type) = print("GrB_NULL")
61+
62+
mutable struct GrB_ALL_Type
63+
p::Ptr{Cvoid}
64+
end
65+
Base.pointer(x::GrB_ALL_Type) = x.p
66+
Base.show(io::IO, ::GrB_ALL_Type) = print("GrB_ALL")
67+

src/SuiteSparseGraphBLAS.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ valid_accum_types = Union{GrB_BinaryOp, GrB_NULL_Type}
6060
valid_desc_types = Union{GrB_Descriptor, GrB_NULL_Type}
6161

6262
const GrB_NULL = GrB_NULL_Type(C_NULL)
63+
const GrB_ALL = GrB_ALL_Type(C_NULL)
64+
6365
const GrB_LNOT = GrB_UnaryOp()
6466
const GrB_LOR = GrB_BinaryOp(); const GrB_LAND = GrB_BinaryOp(); const GrB_LXOR = GrB_BinaryOp()
6567
const GxB_LOR_BOOL_MONOID = GrB_Monoid(); const GxB_LAND_BOOL_MONOID = GrB_Monoid()
@@ -79,6 +81,8 @@ function __init__()
7981
return unsafe_load(cglobal(x, Ptr{Cvoid}))
8082
end
8183

84+
GrB_ALL.p = load_global("GrB_ALL")
85+
8286
#load global types
8387
for t in [Bool, Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64, Float32, Float64]
8488
type_suffix = suffix(t)
@@ -274,7 +278,10 @@ for s in instances(GrB_Desc_Value)
274278
@eval export $(Symbol(s))
275279
end
276280

277-
# NULL
281+
# GrB_NULL
278282
export GrB_NULL
279283

284+
# GrB_ALL
285+
export GrB_ALL
286+
280287
end #end of module

0 commit comments

Comments
 (0)