On Julia v1.11:
julia> using FillArrays, LinearAlgebra
julia> Zeros(2,2) * UpperTriangular(Zeros(2,2))
ERROR: MethodError: *(::Zeros{Float64, 2, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}}, ::UpperTriangular{Float64, Zeros{Float64, 2, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}}}) is ambiguous.
Candidates:
*(a::FillArrays.AbstractZeros{T, 2} where T, b::AbstractMatrix)
@ FillArrays ~/.julia/packages/FillArrays/p9YG6/src/fillalgebra.jl:89
*(A::AbstractMatrix, B::LinearAlgebra.AbstractTriangular)
@ LinearAlgebra ~/packages/julias/julia-latest/share/julia/stdlib/v1.11/LinearAlgebra/src/triangular.jl:1501
Possible fix, define
*(::FillArrays.AbstractZeros{T, 2} where T, ::LinearAlgebra.AbstractTriangular)
Stacktrace:
[1] top-level scope
@ REPL[6]:1
The suggestion is to define a method that dispatches on LinearAlgebra.AbstractTriangular
. If I check what that is, I obtain
help?> LinearAlgebra.AbstractTriangular
│ Warning
│
│ The following bindings may be internal; they may change or be removed in future versions:
│
│ • LinearAlgebra.AbstractTriangular
No documentation found for private symbol.
This doesn’t inspire much confidence in the proposed fix. I’m unsure what’s the best solution is in general, but in this specific example, the resolution might be to define methods for UpperTriangular
and LowerTriangular
separately.