Skip to content

Ambiguities in Base functions introduced by FillArrays #105

@jishnub

Description

@jishnub

In a fresh Julia session

   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.4.2 (2020-05-23)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |


julia> using Test

julia> Test.detect_ambiguities(Base, Core)
0-element Array{Tuple{Method,Method},1}

julia> using FillArrays

(@v1.4) pkg> st -m FillArrays
Status `~/.julia/environments/v1.4/Manifest.toml`
  [1a297f60] FillArrays v0.8.12
  [37e2e46d] LinearAlgebra 
  [9a3f8284] Random 
  [2f01184e] SparseArrays

julia> Test.detect_ambiguities(Base, Core)
36-element Array{Tuple{Method,Method},1}:
 (*(u::AbstractArray{T,1} where T, v::Union{LinearAlgebra.Adjoint{T,#s662}, LinearAlgebra.Transpose{T,#s662}} where #s662<:(AbstractArray{T,1} where T) where T) in LinearAlgebra at /home/jishnu/Downloads/julia-1.4.2/share/julia/stdlib/v1.4/LinearAlgebra/src/adjtrans.jl:253, *(a::Zeros{#s14,1,Axes} where Axes where #s14, b::AbstractArray{T,2} where T) in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/fillalgebra.jl:89)
 (*(A::AbstractArray{T,2} where T, B::LinearAlgebra.AbstractTriangular) in LinearAlgebra at /home/jishnu/Downloads/julia-1.4.2/share/julia/stdlib/v1.4/LinearAlgebra/src/triangular.jl:2095, *(a::Zeros{#s14,2,Axes} where Axes where #s14, b::AbstractArray{T,2} where T) in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/fillalgebra.jl:90)
 (*(a::AbstractArray{T,1} where T, adjB::LinearAlgebra.Adjoint{#s662,#s661} where #s661<:(AbstractArray{T,2} where T) where #s662) in LinearAlgebra at /home/jishnu/Downloads/julia-1.4.2/share/julia/stdlib/v1.4/LinearAlgebra/src/matmul.jl:60, *(a::Zeros{#s14,1,Axes} where Axes where #s14, b::AbstractArray{T,2} where T) in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/fillalgebra.jl:89)
 (convert(T::Type{#s662} where #s662<:SparseArrays.SparseVector, m::AbstractArray{T,1} where T) in SparseArrays at /home/jishnu/Downloads/julia-1.4.2/share/julia/stdlib/v1.4/SparseArrays/src/sparsevector.jl:434, convert(::Type{SparseArrays.SparseVector{Tv,Ti}}, Z::Zeros{T,1,Axes} where Axes) where {T, Tv, Ti} in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/FillArrays.jl:405)
 (*(adjA::LinearAlgebra.Adjoint{#s662,#s661} where #s661<:AbstractArray{T,2} where #s662, x::AbstractArray{S,1}) where {T, S} in LinearAlgebra at /home/jishnu/Downloads/julia-1.4.2/share/julia/stdlib/v1.4/LinearAlgebra/src/matmul.jl:111, *(a::AbstractArray{T,2} where T, b::Zeros{#s14,1,Axes} where Axes where #s14) in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/fillalgebra.jl:91)
 (*(u::LinearAlgebra.Adjoint{T,#s662} where #s662<:(AbstractArray{T,1} where T) where T, v::AbstractArray{T,1} where T) in LinearAlgebra at /home/jishnu/Downloads/julia-1.4.2/share/julia/stdlib/v1.4/LinearAlgebra/src/adjtrans.jl:245, *(a::AbstractArray{T,2} where T, b::Zeros{#s14,1,Axes} where Axes where #s14) in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/fillalgebra.jl:91)
 (*(A::AbstractArray{T,2} where T, transB::LinearAlgebra.Transpose{#s662,#s661} where #s661<:LinearAlgebra.AbstractTriangular where #s662) in LinearAlgebra at /home/jishnu/Downloads/julia-1.4.2/share/julia/stdlib/v1.4/LinearAlgebra/src/triangular.jl:2110, *(a::Zeros{#s14,2,Axes} where Axes where #s14, b::AbstractArray{T,2} where T) in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/fillalgebra.jl:90)
 (*(u::LinearAlgebra.Transpose{T,#s662} where #s662<:(AbstractArray{T,1} where T) where T, v::AbstractArray{T,1} where T) in LinearAlgebra at /home/jishnu/Downloads/julia-1.4.2/share/julia/stdlib/v1.4/LinearAlgebra/src/adjtrans.jl:248, *(a::AbstractArray{T,2} where T, b::Zeros{#s14,1,Axes} where Axes where #s14) in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/fillalgebra.jl:91)
 (*(transA::LinearAlgebra.Transpose{#s662,#s661} where #s661<:(Union{LinearAlgebra.Hermitian{T,S}, LinearAlgebra.Symmetric{T,S}, LinearAlgebra.Symmetric{Complex{T},S}} where S where T<:Real) where #s662, B::AbstractArray{T,2} where T) in LinearAlgebra at /home/jishnu/Downloads/julia-1.4.2/share/julia/stdlib/v1.4/LinearAlgebra/src/symmetric.jl:585, *(a::AbstractArray{T,2} where T, b::Zeros{#s14,2,Axes} where Axes where #s14) in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/fillalgebra.jl:92)
 (*(transA::LinearAlgebra.Transpose{#s662,#s661} where #s661<:(Union{LinearAlgebra.Hermitian{T,S}, LinearAlgebra.Symmetric{T,S}, LinearAlgebra.Symmetric{Complex{T},S}} where S where T<:Real) where #s662, B::AbstractArray{T,1} where T) in LinearAlgebra at /home/jishnu/Downloads/julia-1.4.2/share/julia/stdlib/v1.4/LinearAlgebra/src/symmetric.jl:584, *(a::AbstractArray{T,2} where T, b::Zeros{#s14,1,Axes} where Axes where #s14) in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/fillalgebra.jl:91)
 (*(A::AbstractArray{T,2} where T, adjR::LinearAlgebra.Adjoint{#s662,#s661} where #s661<:LinearAlgebra.AbstractRotation where #s662) in LinearAlgebra at /home/jishnu/Downloads/julia-1.4.2/share/julia/stdlib/v1.4/LinearAlgebra/src/givens.jl:14, *(a::Zeros{#s14,2,Axes} where Axes where #s14, b::AbstractArray{T,2} where T) in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/fillalgebra.jl:90)
 (convert(::Type{Fill}, arr::AbstractArray{T,N} where N) where T in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/FillArrays.jl:116, convert(::Type{T}, F::T) where T<:Fill in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/FillArrays.jl:118)
 ((::Type{Fill{T,N,Axes} where Axes})(x, sz::Axes) where {T, N, Axes<:Tuple{Vararg{AbstractUnitRange,N}}} in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/FillArrays.jl:66, (::Type{Fill{T,N,Axes} where Axes})(x, sz::SZ) where {T, N, SZ<:Tuple{Vararg{Integer,N}}} in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/FillArrays.jl:69)
 (*(u::LinearAlgebra.Transpose{T,#s662} where #s662<:(AbstractArray{T,1} where T), v::AbstractArray{T,1}) where T<:Real in LinearAlgebra at /home/jishnu/Downloads/julia-1.4.2/share/julia/stdlib/v1.4/LinearAlgebra/src/adjtrans.jl:246, *(a::AbstractArray{T,2} where T, b::Zeros{#s14,1,Axes} where Axes where #s14) in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/fillalgebra.jl:91)
 (*(adjA::LinearAlgebra.Adjoint{#s662,#s661} where #s661<:(Union{LinearAlgebra.Hermitian{T,S}, LinearAlgebra.Hermitian{Complex{T},S}, LinearAlgebra.Symmetric{T,S}} where S where T<:Real) where #s662, B::AbstractArray{T,2} where T) in LinearAlgebra at /home/jishnu/Downloads/julia-1.4.2/share/julia/stdlib/v1.4/LinearAlgebra/src/symmetric.jl:589, *(a::AbstractArray{T,2} where T, b::Zeros{#s14,2,Axes} where Axes where #s14) in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/fillalgebra.jl:92)

 (*(transA::LinearAlgebra.Transpose{#s662,#s661} where #s661<:AbstractArray{T,2} where #s662, x::AbstractArray{S,1}) where {T, S} in LinearAlgebra at /home/jishnu/Downloads/julia-1.4.2/share/julia/stdlib/v1.4/LinearAlgebra/src/matmul.jl:90, *(a::AbstractArray{T,2} where T, b::Zeros{#s14,1,Axes} where Axes where #s14) in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/fillalgebra.jl:91)
 (*(transA::LinearAlgebra.Transpose{#s660,#s659} where #s659<:LinearAlgebra.AbstractTriangular where #s660, B::AbstractArray{T,1} where T) in LinearAlgebra at /home/jishnu/Downloads/julia-1.4.2/share/julia/stdlib/v1.4/LinearAlgebra/src/triangular.jl:1979, *(a::AbstractArray{T,2} where T, b::Zeros{#s14,1,Axes} where Axes where #s14) in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/fillalgebra.jl:91)
 (*(A::LinearAlgebra.AbstractTriangular, B::AbstractArray{T,1} where T) in LinearAlgebra at /home/jishnu/Downloads/julia-1.4.2/share/julia/stdlib/v1.4/LinearAlgebra/src/triangular.jl:1964, *(a::AbstractArray{T,2} where T, b::Zeros{#s14,1,Axes} where Axes where #s14) in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/fillalgebra.jl:91)
 (*(x::LinearAlgebra.Adjoint{T,#s662} where #s662<:(AbstractArray{T,1} where T) where T, A::AbstractArray{T,2} where T) in LinearAlgebra at /home/jishnu/Downloads/julia-1.4.2/share/julia/stdlib/v1.4/LinearAlgebra/src/matmul.jl:133, *(a::AbstractArray{T,2} where T, b::Zeros{#s14,2,Axes} where Axes where #s14) in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/fillalgebra.jl:92)
 (*(A::AbstractArray{T,2} where T, adjB::LinearAlgebra.Adjoint{#s662,#s661} where #s661<:(Union{LinearAlgebra.Hermitian{T,S}, LinearAlgebra.Hermitian{Complex{T},S}, LinearAlgebra.Symmetric{T,S}} where S where T<:Real) where #s662) in LinearAlgebra at /home/jishnu/Downloads/julia-1.4.2/share/julia/stdlib/v1.4/LinearAlgebra/src/symmetric.jl:590, *(a::Zeros{#s14,2,Axes} where Axes where #s14, b::AbstractArray{T,2} where T) in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/fillalgebra.jl:90)
 (*(adjA::LinearAlgebra.Adjoint{#s662,#s661} where #s661<:(Union{LinearAlgebra.Hermitian{T,S}, LinearAlgebra.Hermitian{Complex{T},S}, LinearAlgebra.Symmetric{T,S}} where S where T<:Real) where #s662, B::AbstractArray{T,1} where T) in LinearAlgebra at /home/jishnu/Downloads/julia-1.4.2/share/julia/stdlib/v1.4/LinearAlgebra/src/symmetric.jl:588, *(a::LinearAlgebra.Adjoint{T,#s14} where #s14<:AbstractArray{T,2} where T, b::Zeros{#s13,1,Axes} where Axes where #s13) in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/fillalgebra.jl:130)
 (*(transA::LinearAlgebra.Transpose{#s660,#s659} where #s659<:LinearAlgebra.AbstractTriangular where #s660, B::AbstractArray{T,1} where T) in LinearAlgebra at /home/jishnu/Downloads/julia-1.4.2/share/julia/stdlib/v1.4/LinearAlgebra/src/triangular.jl:1979, *(a::LinearAlgebra.Transpose{T,#s14} where #s14<:AbstractArray{T,2}, b::Zeros{T,1,Axes} where Axes) where T<:Real in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/fillalgebra.jl:139)
 (reshape(parent::FillArrays.AbstractFill, dims::Union{Colon, Integer}...) in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/FillArrays.jl:175, reshape(parent::AbstractArray{T,1} where T, ::Colon) in Base at reshapedarray.jl:115)
 (*(transA::LinearAlgebra.Transpose{#s662,#s661} where #s661<:(Union{LinearAlgebra.Hermitian{T,S}, LinearAlgebra.Symmetric{T,S}, LinearAlgebra.Symmetric{Complex{T},S}} where S where T<:Real) where #s662, B::AbstractArray{T,1} where T) in LinearAlgebra at /home/jishnu/Downloads/julia-1.4.2/share/julia/stdlib/v1.4/LinearAlgebra/src/symmetric.jl:584, *(a::LinearAlgebra.Transpose{T,#s14} where #s14<:AbstractArray{T,2}, b::Zeros{T,1,Axes} where Axes) where T<:Real in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/fillalgebra.jl:139)
 (*(transA::LinearAlgebra.Transpose{#s660,#s659} where #s659<:LinearAlgebra.AbstractTriangular where #s660, B::AbstractArray{T,2} where T) in LinearAlgebra at /home/jishnu/Downloads/julia-1.4.2/share/julia/stdlib/v1.4/LinearAlgebra/src/triangular.jl:1979, *(a::AbstractArray{T,2} where T, b::Zeros{#s14,2,Axes} where Axes where #s14) in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/fillalgebra.jl:92)
 (*(adjA::LinearAlgebra.Adjoint{#s662,#s661} where #s661<:LinearAlgebra.AbstractTriangular where #s662, B::AbstractArray{T,1} where T) in LinearAlgebra at /home/jishnu/Downloads/julia-1.4.2/share/julia/stdlib/v1.4/LinearAlgebra/src/triangular.jl:1971, *(a::LinearAlgebra.Adjoint{T,#s14} where #s14<:AbstractArray{T,2} where T, b::Zeros{#s13,1,Axes} where Axes where #s13) in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/fillalgebra.jl:130)
 (*(adjA::LinearAlgebra.Adjoint{#s662,#s661} where #s661<:LinearAlgebra.AbstractTriangular where #s662, B::AbstractArray{T,1} where T) in LinearAlgebra at /home/jishnu/Downloads/julia-1.4.2/share/julia/stdlib/v1.4/LinearAlgebra/src/triangular.jl:1971, *(a::AbstractArray{T,2} where T, b::Zeros{#s14,1,Axes} where Axes where #s14) in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/fillalgebra.jl:91)
 (*(x::LinearAlgebra.Transpose{T,#s662} where #s662<:(AbstractArray{T,1} where T) where T, A::AbstractArray{T,2} where T) in LinearAlgebra at /home/jishnu/Downloads/julia-1.4.2/share/julia/stdlib/v1.4/LinearAlgebra/src/matmul.jl:134, *(a::AbstractArray{T,2} where T, b::Zeros{#s14,2,Axes} where Axes where #s14) in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/fillalgebra.jl:92)
 (*(A::AbstractArray{T,2} where T, transB::LinearAlgebra.Transpose{#s662,#s661} where #s661<:(Union{LinearAlgebra.Hermitian{T,S}, LinearAlgebra.Symmetric{T,S}, LinearAlgebra.Symmetric{Complex{T},S}} where S where T<:Real) where #s662) in LinearAlgebra at /home/jishnu/Downloads/julia-1.4.2/share/julia/stdlib/v1.4/LinearAlgebra/src/symmetric.jl:586, *(a::Zeros{#s14,2,Axes} where Axes where #s14, b::AbstractArray{T,2} where T) in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/fillalgebra.jl:90)

As a consequence something like this doesn't work:

julia> Zeros(2) * ones(2)'
ERROR: MethodError: *(::Zeros{Float64,1,Tuple{Base.OneTo{Int64}}}, ::Adjoint{Float64,Array{Float64,1}}) is ambiguous. Candidates:
  *(a::Zeros{#s14,1,Axes} where Axes where #s14, b::AbstractArray{T,2} where T) in FillArrays at /home/jishnu/.julia/packages/FillArrays/g4e4i/src/fillalgebra.jl:89
  *(u::AbstractArray{T,1} where T, v::Union{Adjoint{T,#s662}, Transpose{T,#s662}} where #s662<:(AbstractArray{T,1} where T) where T) in LinearAlgebra at /home/jishnu/Downloads/julia-1.4.2/share/julia/stdlib/v1.4/LinearAlgebra/src/adjtrans.jl:253
Possible fix, define
  *(::Zeros{#s14,1,Axes} where Axes where #s14, ::Union{Adjoint{T,#s662}, Transpose{T,#s662}} where #s662<:(AbstractArray{T,1} where T) where T)
Stacktrace:
 [1] top-level scope at REPL[14]:1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions