Skip to content

getindex(::Sparse, ...) returns incorrect results for unsorted Sparse objects #758

Description

@topolarity
julia> using SparseArrays, SparseArrays.CHOLMOD

julia> A = sparse([2, 1, 2], [1, 2, 2], Float64[1, 2, 3])

2×2 SparseMatrixCSC{Float64, Int64} with 3 stored entries:
     2.0
 1.0  3.0

julia> S = CHOLMOD.Sparse(A); P = S' * S; # P ends up unsorted

julia> Matrix(sparse(P)) # good
2×2 Matrix{Float64}:
 1.0   3.0
 3.0  13.0

julia> P[1,2]
0.0

this affects some conversions as well:

julia> Array(P) # bad
2×2 Matrix{Float64}:
 1.0  0.0
 3.0  0.0

noticed while investigating the bug in #756

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions