Skip to content

Commit

Permalink
Fallback for copying views into sparse matrices (JuliaLang#30895)
Browse files Browse the repository at this point in the history
* Fallback for copying views into sparse matrices

* SparseArray --> SparseVecOrMat

* move copy method to sparsevector

* use the union explicitly
  • Loading branch information
mkborregaard authored and mbauman committed Jan 31, 2019
1 parent 0b0a394 commit d6bcb5a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions stdlib/SparseArrays/src/sparsevector.jl
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,8 @@ function getindex(A::SparseMatrixCSC{Tv,Ti}, I::AbstractVector) where {Tv,Ti}
SparseVector(n, rowvalB, nzvalB)
end

Base.copy(a::SubArray{<:Any,<:Any,<:Union{SparseVector, SparseMatrixCSC}}) = a.parent[a.indices...]

function findall(x::SparseVector)
return findall(identity, x)
end
Expand Down

0 comments on commit d6bcb5a

Please sign in to comment.