On Monday, December 8, 2014 8:34:04 PM UTC+10, Christoph Ortner wrote:
>
> Since julia 0.3.3 I receive the following error message
>
> Warning: New definition 
>     getindex(AbstractArray{T,2},Array{Integer,1}) at 
> /Users/ortner/Dropbox/Work/Projects/QM_Localisation/jqmmm/TBgeom.jl:74
> is ambiguous with: 
>     
> getindex(SubArray{T,N,A<:AbstractArray{T,N},I<:(Union(Int64,Range{Int64})...,)},Union(AbstractArray{T,1},Real)...)
>  at subarray.jl:335.
> To fix, define 
>     
> getindex(SubArray{T,2,A<:AbstractArray{T,N},I<:(Union(Int64,Range{Int64})...,)},Array{Integer,1})
> before the new definition.
>
>
> The offending definitions are
>
> getindex{T}(a::AbstractArray{T,2}, idx::Array{Integer,1}) = a[idx[1], 
> idx[2]]
> getindex{T}(a::AbstractArray{T,3}, idx::Array{Integer,1}) = a[idx[1], 
> idx[2], idx[3]]
>
>
> What changed? What should I have done? I would ike to better understand 
> the "To fix . . ." sentence, before going ahead and fixing this.
>

I appears that in a new version the Julia library added a definition that 
is ambiguous with a definition in your code. Unfortunately this is always 
possible with multiple dispatch systems.  The solution is as described in 
the error message, if you are sure that the two definitions are correct. 
 IIUC this declaration is not added automatically as that could hide some 
types of real errors.  For more information 
see http://docs.julialang.org/en/release-0.3/manual/methods/#method-ambiguities

Chers
Lex


> Thank you,
>    Christoph
>
>

Reply via email to