JuliaSparse / SuiteSparseGraphBLAS.jl

Sparse, General Linear Algebra for Graphs!
MIT License
102 stars 17 forks source link

Indexing GBMatrix with a list of indices mutates the parameter #79

Closed andreyz4k closed 2 years ago

andreyz4k commented 2 years ago
julia> i = [1, 2]
2-element Vector{Int64}:
 1
 2

julia> 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...])
7x7 GraphBLAS int64_t matrix, bitmap by row
  12 entries, memory: 649 bytes

    (1,2)   1
    (1,4)   2
    (2,5)   3
    (2,7)   4
    (3,6)   5
    (4,1)   6
    (4,3)   7
    (5,6)   8
    (6,3)   9
    (7,3)   10
    (7,4)   11
    (7,5)   12

julia> A[i, :]
2x7 GraphBLAS int64_t matrix, bitmap by row
  4 entries, memory: 334 bytes

    (1,2)   1
    (1,4)   2
    (2,5)   3
    (2,7)   4

julia> i
2-element Vector{Int64}:
 0
 1
rayegun commented 2 years ago

fixed by 2c5a8bbc3d53561c7b9c4a8862e11156aad2a0c2