Skip to content

Commit

Permalink
fix sparse matrix colon indexing
Browse files Browse the repository at this point in the history
Added missing method `getindex(A::SparseMatrixCSC, ::Colon, i)`.
The `AbstractArray` fallback was much slower.
  • Loading branch information
tanmaykm committed Jan 26, 2016
1 parent a4d847e commit 01bbcc4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions base/sparse/sparsematrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1466,6 +1466,7 @@ end
# Colon translation
getindex(A::SparseMatrixCSC, ::Colon, ::Colon) = copy(A)
getindex(A::SparseMatrixCSC, i, ::Colon) = getindex(A, i, 1:size(A, 2))
getindex(A::SparseMatrixCSC, ::Colon, i) = getindex(A, 1:size(A, 1), i)

function getindex_cols{Tv,Ti}(A::SparseMatrixCSC{Tv,Ti}, J::AbstractVector)
# for indexing whole columns
Expand Down

0 comments on commit 01bbcc4

Please sign in to comment.