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

Multiplication of FFT plan and AbstractArray stack-overflows #73

Open
jishnub opened this issue Aug 9, 2022 · 1 comment
Open

Multiplication of FFT plan and AbstractArray stack-overflows #73

jishnub opened this issue Aug 9, 2022 · 1 comment

Comments

@jishnub
Copy link
Member

jishnub commented Aug 9, 2022

*(p::Plan{T}, x::AbstractArray) where {T} = p * copy1(T, x)

This may be self-recursive

MWE

julia> f = ApproxFunBase.plan_transform(Chebyshev(), rand(4))
FastTransforms.ChebyshevTransformPlan{Float64, 1, (5,), false, 1, UnitRange{Int64}}(FFTW r2r REDFT10 plan for 4-element array of Float64
(redft10e-r2hc-4
  (rdft-r2hc-direct-r2c-4 "r2cf_4")))

julia> f * rand(4,4)
ERROR: StackOverflowError:
Stacktrace:
 [1] _copyto_impl!
   @ ./array.jl:331 [inlined]
 [2] copyto!
   @ ./array.jl:322 [inlined]
 [3] copyto!
   @ ./array.jl:346 [inlined]
 [4] circcopy!(dest::Matrix{Float64}, src::Matrix{Float64})
   @ Base ./multidimensional.jl:1201
 [5] copy1
   @ ~/.julia/packages/AbstractFFTs/Wg2Yf/src/definitions.jl:50 [inlined]
 [6] *(p::FastTransforms.ChebyshevTransformPlan{Float64, 1, (5,), false, 1, UnitRange{Int64}}, x::Matrix{Float64}) (repeats 79983 times)
   @ AbstractFFTs ~/.julia/packages/AbstractFFTs/Wg2Yf/src/definitions.jl:220

Ideally this should lead to some other error, and not a stack overflow.

@dforero0896
Copy link

I also have a similar problem when trying to generate a plan for rfft like this

plan = plan_rfft(field)

where field is an Array{Float32,3}

ERROR: StackOverflowError:
Stacktrace:
     [1] plan_rfft(x::Array{Float32, 3}, region::UnitRange{Int64})
       @ AbstractFFTs ~/.julia/packages/AbstractFFTs/Wg2Yf/src/definitions.jl:217
     [2] plan_rfft(x::Array{Float32, 3}, region::UnitRange{Int64}; kws::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
       @ AbstractFFTs ~/.julia/packages/AbstractFFTs/Wg2Yf/src/definitions.jl:217
--- the last 2 lines are repeated 39990 more times ---
 [79983] plan_rfft(x::Array{Float32, 3}, region::UnitRange{Int64})
       @ AbstractFFTs ~/.julia/packages/AbstractFFTs/Wg2Yf/src/definitions.jl:217

is this the same?
Thanks

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