Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in iszero in Julia v1.10 #647

Open
andreasvarga opened this issue Apr 15, 2024 · 1 comment
Open

Error in iszero in Julia v1.10 #647

andreasvarga opened this issue Apr 15, 2024 · 1 comment

Comments

@andreasvarga
Copy link

andreasvarga commented Apr 15, 2024

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 of iszero is

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 of iszero 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!

I would appreciate very much if the fix for this very basic function can be done in a short time. Thanks in advance.

@jishnub
Copy link
Member

jishnub commented Apr 15, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants