11# AbstractGBArray functions:
2- function SparseArrays. nnz (A:: AbsGBArrayOrTranspose )
2+ function SparseArrays. nnz (A:: GBArrayOrTranspose )
33 nvals = Ref {LibGraphBLAS.GrB_Index} ()
44 @wraperror LibGraphBLAS. GrB_Matrix_nvals (nvals, gbpointer (parent (A)))
55 return Int64 (nvals[])
66end
77
8- Base. eltype (:: Type{AbstractGBArray {T}} ) where {T} = T
8+ Base. eltype (:: Type{GBArrayOrTranspose {T}} ) where {T} = T
99
1010"""
1111 empty!(v::GBVector)
@@ -14,32 +14,32 @@ Base.eltype(::Type{AbstractGBArray{T}}) where{T} = T
1414Clear all the entries from the GBArray.
1515Does not modify the type or dimensions.
1616"""
17- function Base. empty! (A:: AbsGBArrayOrTranspose )
17+ function Base. empty! (A:: GBArrayOrTranspose )
1818 @wraperror LibGraphBLAS. GrB_Matrix_clear (gbpointer (parent (A)))
1919 return A
2020end
2121
22- function Base. Matrix (A:: AbstractGBMatrix )
22+ function Base. Matrix (A:: GBArrayOrTranspose )
2323 sparsity = sparsitystatus (A)
2424 T = copy (A) # We copy here to 1. avoid densifying A, and 2. to avoid destroying A.
2525 return unpack! (T, Dense ())
2626end
2727
28- function Base. Vector (v:: AbstractGBVector )
28+ function Base. Vector (v:: GBVectorOrTranspose )
2929 sparsity = sparsitystatus (v)
3030 T = copy (v) # avoid densifying v and destroying v.
3131 return unpack! (T, Dense ())
3232end
3333
34- function SparseArrays. SparseMatrixCSC (A:: AbstractGBArray )
34+ function SparseArrays. SparseMatrixCSC (A:: GBArrayOrTranspose )
3535 sparsity = sparsitystatus (A)
3636 T = copy (A) # avoid changing sparsity of A and destroying it.
3737 return unpack! (T, SparseMatrixCSC)
3838end
3939
40- function SparseArrays. SparseVector (v:: AbstractGBVector )
40+ function SparseArrays. SparseVector (v:: GBVectorOrTranspose )
4141 sparsity = sparsitystatus (v)
42- T = copy (A ) # avoid changing sparsity of v and destroying it.
42+ T = copy (v ) # avoid changing sparsity of v and destroying it.
4343 return unpack! (T, SparseVector)
4444end
4545
@@ -94,7 +94,7 @@ for T ∈ valid_vec
9494 function build (A:: AbstractGBMatrix{$T} , I:: AbstractVector{<:Integer} , J:: AbstractVector{<:Integer} , X:: AbstractVector{$T} ;
9595 combine = +
9696 )
97- combine = BinaryOp (combine)( $ T)
97+ combine = binaryop (combine, $ T)
9898 I isa Vector || (I = collect (I))
9999 J isa Vector || (J = collect (J))
100100 X isa Vector || (X = collect (X))
@@ -181,7 +181,7 @@ function build(
181181 A:: AbstractGBMatrix{T} , I:: AbstractVector{<:Integer} , J:: AbstractVector{<:Integer} , X:: AbstractVector{T} ;
182182 combine = +
183183 ) where {T}
184- combine = BinaryOp (combine)( T)
184+ combine = binaryop (combine, T)
185185 I isa Vector || (I = collect (I))
186186 J isa Vector || (J = collect (J))
187187 X isa Vector || (X = collect (X))
@@ -314,7 +314,7 @@ Assign a submatrix of `A` to `C`. Equivalent to [`assign!`](@ref) except that
314314# Keywords
315315- `mask::Union{Nothing, GBMatrix} = nothing`: mask where
316316 `size(M) == size(A)`.
317- - `accum::Union{Nothing, Function, AbstractBinaryOp } = nothing`: binary accumulator operation
317+ - `accum::Union{Nothing, Function} = nothing`: binary accumulator operation
318318 where `C[i,j] = accum(C[i,j], T[i,j])` where T is the result of this function before accum is applied.
319319- `desc::Union{Nothing, Descriptor} = nothing`
320320
@@ -325,7 +325,7 @@ Assign a submatrix of `A` to `C`. Equivalent to [`assign!`](@ref) except that
325325- `GrB_DIMENSION_MISMATCH`: If `size(A) != (max(I), max(J))` or `size(A) != size(mask)`.
326326"""
327327function subassign! (
328- C:: AbstractGBArray , A:: AbstractGBArray , I, J;
328+ C:: AbstractGBArray , A:: GBArrayOrTranspose , I, J;
329329 mask = nothing , accum = nothing , desc = nothing
330330)
331331 I, ni = idx (I)
@@ -397,7 +397,7 @@ Assign a submatrix of `A` to `C`. Equivalent to [`subassign!`](@ref) except that
397397# Keywords
398398- `mask::Union{Nothing, GBMatrix} = nothing`: mask where
399399 `size(M) == size(C)`.
400- - `accum::Union{Nothing, Function, AbstractBinaryOp } = nothing`: binary accumulator operation
400+ - `accum::Union{Nothing, Function} = nothing`: binary accumulator operation
401401 where `C[i,j] = accum(C[i,j], T[i,j])` where T is the result of this function before accum is applied.
402402- `desc::Union{Nothing, Descriptor} = nothing`
403403
@@ -408,7 +408,7 @@ Assign a submatrix of `A` to `C`. Equivalent to [`subassign!`](@ref) except that
408408- `GrB_DIMENSION_MISMATCH`: If `size(A) != (max(I), max(J))` or `size(C) != size(mask)`.
409409"""
410410function assign! (
411- C:: AbstractGBMatrix , A:: AbstractGBVector , I, J;
411+ C:: AbstractGBMatrix , A:: GBArrayOrTranspose , I, J;
412412 mask = nothing , accum = nothing , desc = nothing
413413)
414414 I, ni = idx (I)
@@ -417,16 +417,16 @@ function assign!(
417417 I = decrement! (I)
418418 J = decrement! (J)
419419 # we know A isn't adjoint/transpose on input
420- desc = _handledescriptor (desc)
421- @wraperror LibGraphBLAS. GrB_Matrix_assign (gbpointer (C), mask, getaccum (accum, eltype (C)), gbpointer (A ), I, ni, J, nj, desc)
420+ desc = _handledescriptor (desc; in1 = A )
421+ @wraperror LibGraphBLAS. GrB_Matrix_assign (gbpointer (C), mask, getaccum (accum, eltype (C)), gbpointer (parent (A) ), I, ni, J, nj, desc)
422422 increment! (I)
423423 increment! (J)
424424 return A
425425end
426426
427- function assign! (C:: AbstractGBArray , x, I, J;
427+ function assign! (C:: AbstractGBArray{T} , x, I, J;
428428 mask = nothing , accum = nothing , desc = nothing
429- )
429+ ) where T
430430 x = typeof (x) === T ? x : convert (T, x)
431431 I, ni = idx (I)
432432 J, nj = idx (J)
467467Base. eltype (:: Type{AbstractGBVector{T}} ) where {T} = T
468468
469469function Base. deleteat! (v:: AbstractGBVector , i)
470- @wraperror LibGraphBLAS. GrB_Matrix_removeElement (gbpointer (v), decrement! (i), 1 )
470+ @wraperror LibGraphBLAS. GrB_Matrix_removeElement (gbpointer (v), decrement! (i), 0 )
471471 return v
472472end
473473
@@ -520,7 +520,7 @@ for T ∈ valid_vec
520520 I isa Vector || (I = collect (I))
521521 X isa Vector || (X = collect (X))
522522 length (X) == length (I) || DimensionMismatch (" I and X must have the same length" )
523- combine = BinaryOp (combine)( $ T)
523+ combine = binaryop (combine, $ T)
524524 decrement! (I)
525525 @wraperror LibGraphBLAS.$ func (
526526 Ptr {LibGraphBLAS.GrB_Vector} (gbpointer (v)),
@@ -606,7 +606,7 @@ function build(v::AbstractGBVector{T}, I::Vector{<:Integer}, X::Vector{T}; combi
606606 I isa Vector || (I = collect (I))
607607 X isa Vector || (X = collect (X))
608608 length (X) == length (I) || DimensionMismatch (" I and X must have the same length" )
609- combine = BinaryOp (combine)( T)
609+ combine = binaryop (combine, T)
610610 decrement! (I)
611611 @wraperror LibGraphBLAS. GrB_Matrix_build_UDT (
612612 Ptr {LibGraphBLAS.GrB_Vector} (gbpointer (v)),
0 commit comments