-
-
Notifications
You must be signed in to change notification settings - Fork 37
Closed
Description
Just checked LinearAlgebra with JET on 1.8.0. Result:
═════ 70 possible errors found ═════
[...]
There are some real beauties like this one
┌ @ C:\Users\Win10\AppData\Local\Programs\Julia-1.8.0-DEV\share\julia\stdlib\v1.8\LinearAlgebra\src\adjtrans.jl:314 #self#(v, 0)
│┌ @ C:\Users\Win10\AppData\Local\Programs\Julia-1.8.0-DEV\share\julia\stdlib\v1.8\LinearAlgebra\src\adjtrans.jl:314 LinearAlgebra.pinv(Base.getproperty(v, :parent), tol)
││┌ @ C:\Users\Win10\AppData\Local\Programs\Julia-1.8.0-DEV\share\julia\stdlib\v1.8\LinearAlgebra\src\generic.jl:1078 LinearAlgebra._vectorpinv(LinearAlgebra.adjoint, v, tol)
│││┌ @ C:\Users\Win10\AppData\Local\Programs\Julia-1.8.0-DEV\share\julia\stdlib\v1.8\LinearAlgebra\src\generic.jl:1082 den = LinearAlgebra.sum(LinearAlgebra.abs2, v)
││││┌ @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.8\SparseArrays\src\sparsevector.jl:1377 SparseArrays.sum(f, SparseArrays.nonzeros(x))
│││││┌ @ reducedim.jl:890 Base.#sum#748(Base.:, Base.pairs(Core.NamedTuple()), #self#, f, a)
││││││┌ @ reducedim.jl:890 Base._sum(f, a, dims)
│││││││┌ @ reducedim.jl:894 Base.#_sum#750(Base.pairs(Core.NamedTuple()), #self#, f, a, _4)
││││││││┌ @ reducedim.jl:894 Base.mapreduce(f, Base.add_sum, a)
│││││││││┌ @ reducedim.jl:322 Base.#mapreduce#740(Base.:, Base._InitialValue(), #self#, f, op, A)
││││││││││┌ @ reducedim.jl:322 Base._mapreduce_dim(f, op, init, A, dims)
│││││││││││┌ @ reducedim.jl:330 Base._mapreduce(f, op, Base.IndexStyle(A), A)
││││││││││││┌ @ reduce.jl:419 Base.mapreduce_empty_iter(f, op, A, Base.IteratorEltype(A))
│││││││││││││┌ @ reduce.jl:367 Base.reduce_empty_iter(Base.MappingRF(f, op), itr, ItrEltype)
││││││││││││││┌ @ reduce.jl:371 Base.reduce_empty(op, Base.eltype(itr))
│││││││││││││││┌ @ reduce.jl:348 Base.mapreduce_empty(Base.getproperty(op, :f), Base.getproperty(op, :rf), _)
││││││││││││││││┌ @ reduce.jl:361 Base.reduce_empty(op, T)
│││││││││││││││││┌ @ reduce.jl:339 Base.reduce_empty(Base.+, _)
││││││││││││││││││┌ @ reduce.jl:330 Base.zero(_)
│││││││││││││││││││┌ @ missing.jl:106 Base.throw(Base.MethodError(Base.zero, Core.tuple(Base.Any)))
││││││││││││││││││││ MethodError: no method matching zero(::Type{Any})
│││││││││││││││││││└──────────────────
with code like
function sum(f, x::AbstractSparseVector)
n = length(x)
n > 0 || return sum(f, nonzeros(x)) # <-- ???
m = nnz(x)
(m == 0 ? n * f(zero(eltype(x))) :
m == n ? sum(f, nonzeros(x)) :
Base.add_sum((n - m) * f(zero(eltype(x))), sum(f, nonzeros(x))))
end
I'm wondering: why is that?
Edit: attached JET output.
chriscoey
Metadata
Metadata
Assignees
Labels
No labels