Open andreasvarga opened 3 months ago
The following works well in Julia 1.9 but fails in Julia 1.10
In Julia 1.9:
julia> Af = Fun(t -> [0 1; -10*cos(t)-1 -24-19*sin(t)],Fourier(0..2pi)); julia> iszero(Af) false
The old definition ofiszero is
iszero
iszero(f::Fun) = all(iszero,f.coefficients)
In Julia 1.10:
julia> Af = Fun(t -> [0 1; -10*cos(t)-1 -24-19*sin(t)],Fourier(0..2pi)); julia> iszero(Af) ERROR: Override for ApproxFunBase.ArraySpace(ApproxFunBase.SumSpace{Tuple{CosSpace{PeriodicSegment{Float64}, Float64}, SinSpace{PeriodicSegment{Float64}, Float64}}, PeriodicSegment{Float64}, Float64}[Fourier(【0.0,6.283185307179586❫) Fourier(【0.0,6.283185307179586❫); Fourier(【0.0,6.283185307179586❫) Fourier(【0.0,6.283185307179586❫)]) Stacktrace: [1] error(s::String) @ Base .\error.jl:35 [2] checkcanonicalspace(sp::ApproxFunBase.ArraySpace{ApproxFunBase.SumSpace{…}, 2, PeriodicSegment{…}, Float64, Matrix{…}}) @ ApproxFunBase C:\Users\Andreas\.julia\packages\ApproxFunBase\sJBXX\src\Space.jl:478 [3] ApproxFunBase.ICanonicalTransformPlan(space::ApproxFunBase.ArraySpace{…}, v::Vector{…}, ip::Val{…}) @ ApproxFunBase C:\Users\Andreas\.julia\packages\ApproxFunBase\sJBXX\src\Space.jl:493 [4] plan_itransform(sp::ApproxFunBase.ArraySpace{…}, v::Vector{…}) @ ApproxFunBase C:\Users\Andreas\.julia\packages\ApproxFunBase\sJBXX\src\Space.jl:497 [5] itransform(S::ApproxFunBase.ArraySpace{…}, cfs::Vector{…}) @ ApproxFunBase C:\Users\Andreas\.julia\packages\ApproxFunBase\sJBXX\src\Space.jl:564 [6] _values @ C:\Users\Andreas\.julia\packages\ApproxFunBase\sJBXX\src\Fun.jl:428 [inlined] [7] values @ C:\Users\Andreas\.julia\packages\ApproxFunBase\sJBXX\src\Fun.jl:426 [inlined] [8] iszero(f::Fun{ApproxFunBase.ArraySpace{…}, Float64, Vector{…}}) @ ApproxFunBase C:\Users\Andreas\.julia\packages\ApproxFunBase\sJBXX\src\Fun.jl:776 [9] top-level scope @ REPL[90]:1 Some type information was truncated. Use `show(err)` to see complete types.
The new definition ofiszero is
iszero(f::Fun) = all(iszero, coefficients(f)) || all(iszero, values(f))
so, the failure is caused by
julia> values(Af) ERROR: Override for ApproxFunBase.ArraySpace(ApproxFunBase.SumSpace{Tuple{CosSpace{PeriodicSegment{Float64}, Float64}, SinSpace{PeriodicSegment{Float64}, Float64}}, PeriodicSegment{Float64}, Float64}[Fourier(【0.0,6.283185307179586❫) Fourier(【0.0,6.283185307179586❫); Fourier(【0.0,6.283185307179586❫) Fourier(【0.0,6.283185307179586❫)]) Stacktrace: [1] error(s::String) @ Base .\error.jl:35 [2] checkcanonicalspace(sp::ApproxFunBase.ArraySpace{ApproxFunBase.SumSpace{…}, 2, PeriodicSegment{…}, Float64, Matrix{…}}) @ ApproxFunBase C:\Users\Andreas\.julia\packages\ApproxFunBase\sJBXX\src\Space.jl:478 [3] ApproxFunBase.ICanonicalTransformPlan(space::ApproxFunBase.ArraySpace{…}, v::Vector{…}, ip::Val{…}) @ ApproxFunBase C:\Users\Andreas\.julia\packages\ApproxFunBase\sJBXX\src\Space.jl:493 [4] plan_itransform(sp::ApproxFunBase.ArraySpace{…}, v::Vector{…}) @ ApproxFunBase C:\Users\Andreas\.julia\packages\ApproxFunBase\sJBXX\src\Space.jl:497 [5] itransform(S::ApproxFunBase.ArraySpace{…}, cfs::Vector{…}) @ ApproxFunBase C:\Users\Andreas\.julia\packages\ApproxFunBase\sJBXX\src\Space.jl:564 [6] _values @ C:\Users\Andreas\.julia\packages\ApproxFunBase\sJBXX\src\Fun.jl:428 [inlined] [7] values(::Fun{ApproxFunBase.ArraySpace{…}, Float64, Vector{…}}) @ ApproxFunBase C:\Users\Andreas\.julia\packages\ApproxFunBase\sJBXX\src\Fun.jl:426 [8] top-level scope @ REPL[91]:1 Some type information was truncated. Use `show(err)` to see complete types.
I wonder why the second test involving all(iszero, values(f)) is necessary!
all(iszero, values(f))
I would appreciate very much if the fix for this very basic function can be done in a short time. Thanks in advance.
IIRC the values was used for piecewise or sum spaces, where the coefficients may not be zero, but the function may still be zero. However, looks like values isn't defined for an ArraySpace.
values
ArraySpace
The following works well in Julia 1.9 but fails in Julia 1.10
In Julia 1.9:
The old definition of
iszero
isiszero(f::Fun) = all(iszero,f.coefficients)
In Julia 1.10:
The new definition of
iszero
isiszero(f::Fun) = all(iszero, coefficients(f)) || all(iszero, values(f))
so, the failure is caused by
I wonder why the second test involving
all(iszero, values(f))
is necessary!I would appreciate very much if the fix for this very basic function can be done in a short time. Thanks in advance.