@@ -14,17 +14,17 @@ linearindexing{A<:BitArray}(::Type{A}) = LinearFast()
1414# CartesianIndex
1515abstract CartesianIndex{N}
1616
17- stagedfunction Base. call {N} (:: Type{CartesianIndex} ,index:: NTuple{N,Real } )
17+ stagedfunction Base. call {N} (:: Type{CartesianIndex} ,index:: NTuple{N,Integer } )
1818 indextype = gen_cartesian (N)
1919 return Expr (:call ,indextype,[:(to_index (index[$ i])) for i= 1 : N]. .. )
2020end
21- stagedfunction Base. call {N} (:: Type{CartesianIndex{N}} ,index:: Real ... )
21+ stagedfunction Base. call {N} (:: Type{CartesianIndex{N}} ,index:: Integer ... )
2222 length (index) == N && return :(CartesianIndex (index))
2323 length (index) > N && throw (DimensionMismatch (" Cannot create CartesianIndex{$N } from $(length (index)) indexes" ))
2424 args = [i <= length (index) ? :(index[$ i]) : 1 for i = 1 : N]
2525 :(CartesianIndex (tuple ($ (args... ))))
2626end
27- Base. call {M,N} (:: Type{CartesianIndex{N}} ,index:: NTuple{M,Real } ) = CartesianIndex {N} (index... )
27+ Base. call {M,N} (:: Type{CartesianIndex{N}} ,index:: NTuple{M,Integer } ) = CartesianIndex {N} (index... )
2828
2929let implemented = IntSet ()
3030 global gen_cartesian
@@ -36,7 +36,7 @@ let implemented = IntSet()
3636 fields = [Expr (:(:: ), fnames[i], :Int ) for i = 1 : N]
3737 extype = Expr (:type , false , Expr (:(< :), indextype, Expr (:curly , :CartesianIndex , N)), Expr (:block , fields... ))
3838 eval (extype)
39- argsleft = [Expr (:(:: ), fnames[i], :Real ) for i = 1 : N]
39+ argsleft = [Expr (:(:: ), fnames[i], :Integer ) for i = 1 : N]
4040 argsright = [Expr (:call ,:to_index ,fnames[i]) for i= 1 : N]
4141 exconstructor = Expr (:(= ),Expr (:call ,:(Base. call),:(:: Type{CartesianIndex{$N}} ),argsleft... ),Expr (:call ,indextype,argsright... ))
4242 eval (exconstructor)
0 commit comments