Skip to content

Commit d25b1c0

Browse files
committed
some array docs, backup show?
1 parent ef5a72f commit d25b1c0

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

docs/src/arrays.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,19 @@ The usual AbstractArray and SparseArray indexing capabilities are available. Inc
5656
!!! danger "Indexing Structural Zeros"
5757
When indexing a `SparseMatrixCSC` from `SparseArrays` a structural, or implicit, zero will be returned as `zero(T)` where `T` is the element type of the matrix.
5858

59-
When indexing a GBArray structural zeros are instead returned as `nothing`.
59+
When indexing a GBArray structural zeros default to `nothing`.
6060
While this is a significant departure from the `SparseMatrixCSC` it more closely matches the GraphBLAS spec,
6161
and enables the consuming method to determine the value of implicit zeros.
6262

6363
For instance with an element type of `Float64` you may want the zero to be `0.0`, `-∞` or `+∞` depending on your algorithm. In addition, for graph algorithms there may be a distinction between an implicit zero, indicating the lack of an edge between two vertices in an adjacency matrix, and an explicit zero where the edge exists but has a `0` weight.
6464

65-
Better compatibility with `SparseMatrixCSC` and the ability to specify the value of implicit zeros is provided
66-
by `SuiteSparseGraphBLAS.SparseArrayCompat.SparseMatrixGB` array type.
65+
However, many functions outside of GraphBLAS will not work when they index into an `AbstractArray` and get `nothing`.
6766

6867
```@repl mat
6968
A = GBMatrix([1,1,2,2,3,4,4,5,6,7,7,7], [2,4,5,7,6,1,3,6,3,3,4,5], [1:12...])
7069
SparseMatrixCSC(A)
7170
A[4]
72-
A[1,2]
71+
A[1,2]
7372
A[[1,3,5,7], :]
7473
A[1:2:7, :]
7574
A[:,:]

src/abstractgbarray.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,12 @@ function Base.show(io::IO, ::MIME"text/plain", A::AbstractGBArray) #fallback pri
507507
gxbprint(io, A)
508508
end
509509

510+
function Base.show(io::IO, mime, A::AbstractGBArray) #fallback printing
511+
gxbprint(io, A)
512+
end
513+
514+
515+
510516
function Base.getindex(
511517
A::AbstractGBMatrix, i::Union{Vector, UnitRange, StepRange, Number, Colon}, j::Union{Vector, UnitRange, StepRange, Number, Colon};
512518
mask = nothing, accum = nothing, desc = nothing

0 commit comments

Comments
 (0)