Skip to content

Commit

Permalink
Reset ellipse.jl to older version
Browse files Browse the repository at this point in the history
  • Loading branch information
mschauer committed Aug 11, 2017
1 parent a3a5318 commit e599c23
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/ellipse.jl
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import Base.getindex, Base.setindex!
const .. = Val{:...}

import Base.getindex, Base.setindex!
const .. = Val{:..}
setindex!{T<:Any, Ti<:Integer}(A::AbstractArray{T,Ti}, x, ::Type{Val{:...}}, ::Base.Colon) = throw( ArgumentError("cannot combine ellipse with colon this way"))
getindex(::Base.SparseArrays.SparseMatrixCSC, ::Type{Val{:...}}, ::Base.Colon) = throw( ArgumentError("cannot combine ellipse with colon this way"))

setindex!{T,N,N2}(A::AbstractArray{T,N}, x, ::Type{Val{:..}}, n::Vararg{Int,N2}) = A[(Colon() for i in 1:N-N2)..., n...] = x
getindex{T,N,N2}(A::AbstractArray{T,N}, ::Type{Val{:..}}, n::Vararg{Int,N2}) = A[(Colon() for i in 1:N-N2)..., n...]
setindex!{T}(A::AbstractArray{T,1}, x, ::Type{Val{:...}}, n) = A[n] = x
setindex!{T}(A::AbstractArray{T,2}, x, ::Type{Val{:...}}, n) = A[ :, n] = x
setindex!{T}(A::AbstractArray{T,3}, x, ::Type{Val{:...}}, n) = A[ :, :, n] =x

setindex!{T,N}(A::AbstractArray{T,N}, x, n::Int, ::Type{Val{:..}}) = A[n, (Colon() for i in 1:N-1)...] = x
#setindex!{T,N,N2}(A::AbstractArray{T,N}, x, n::Vararg{Int,N2}, ::Type{Val{:..}}) = A[n, (Colon() for i in 1:N-N2-1)...] = x
getindex{T}(A::AbstractArray{T,1}, ::Type{Val{:...}}, n) = A[n]
getindex{T}(A::AbstractArray{T,2}, ::Type{Val{:...}}, n) = A[ :, n]
getindex{T}(A::AbstractArray{T,3}, ::Type{Val{:...}}, n) = A[ :, :, n]

getindex{T,N}(A::AbstractArray{T,N}, n::Int, ::Type{Val{:..}}) = A[n,(Colon() for i in 1:N-1)...]
#getindex{T,N,N2}(A::AbstractArray{T,N}, n::Vararg{Int,N2}, ::Type{Val{:..}}) = A[n,(Colon() for i in 1:N-N2-1)...]

export .., getindex, setindex!
export .., getindex, setindex!

0 comments on commit e599c23

Please sign in to comment.