Skip to content

Commit

Permalink
Remove getindex methods for Sparse, CHOLMOD.Dense
Browse files Browse the repository at this point in the history
  • Loading branch information
mbauman committed Mar 23, 2015
1 parent 7ebd38d commit f837e7b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
12 changes: 4 additions & 8 deletions base/sparse/cholmod.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module CHOLMOD

import Base: (*), convert, copy, eltype, getindex, show, size
import Base: (*), convert, copy, eltype, getindex, show, size,
linearindexing, LinearFast, LinearSlow

import Base.LinAlg: (\), A_mul_Bc, A_mul_Bt, Ac_ldiv_B, Ac_mul_B, At_ldiv_B, At_mul_B,
cholfact, cholfact!, det, diag, ishermitian, isposdef,
Expand Down Expand Up @@ -916,19 +917,14 @@ function size(F::Factor, i::Integer)
return 1
end

linearindexing(::Dense) = LinearFast()
function getindex(A::Dense, i::Integer)
s = unsafe_load(A.p)
0 < i <= s.nrow*s.ncol || throw(BoundsError())
unsafe_load(s.x, i)
end
function getindex(A::Dense, i::Integer, j::Integer)
s = unsafe_load(A.p)
0 < i <= s.nrow || throw(BoundsError())
0 < j <= s.ncol || throw(BoundsError())
unsafe_load(s.x, i + (j - 1)*s.d)
end

getindex(A::Sparse, i::Integer) = getindex(A, ind2sub(size(A),i)...)
linearindexing(::Sparse) = LinearSlow()
function getindex{T}(A::Sparse{T}, i0::Integer, i1::Integer)
s = unsafe_load(A.p)
!(1 <= i0 <= s.nrow && 1 <= i1 <= s.ncol) && throw(BoundsError())
Expand Down
1 change: 0 additions & 1 deletion base/sparse/sparsematrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,6 @@ function rangesearch(haystack::Range, needle)
(rem==0 && 1<=i+1<=length(haystack)) ? i+1 : 0
end

getindex(A::SparseMatrixCSC, i::Integer) = getindex(A, ind2sub(size(A),i))
getindex(A::SparseMatrixCSC, I::(Integer,Integer)) = getindex(A, I[1], I[2])

function getindex{T}(A::SparseMatrixCSC{T}, i0::Integer, i1::Integer)
Expand Down

0 comments on commit f837e7b

Please sign in to comment.