JuliaMath / JuliaMath/FFTW.jl

Applying a complex in-place plan via '*' to a real vector should throw

Open
#341 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
300
Forks
61
PR merge metrics
No merged PRs in 30d

Description

My colleague sent me this MWE - it is about defining a complex in-place plan.
This should mutate vectors when applied via '*' as documented.
When applying this to a vector of floats it should throw, but in fact it
returns a complex vector but does not mutate the the vector.

```julia
using FFTW

plan = plan_fft!(zeros(ComplexF64, 4))
vec1 = ComplexF64[1,1,1,1]
vec2 = [1,1,1,1]

# changes vec1 as expected
plan * vec1; println(vec1,"\n")

# sends error as expected
try
FFTW.mul!(vec2, plan, vec2)
catch e;
println(e,"\n")
end

# does not say anything and does not change vec2
plan * vec2; println(vec2,"\n")
```

PR follows.

Contributor guide

No contributing guide indexed for this repository

Research direction

Run the Julia MWE in the issue and compare the `plan * vec2` path with the `FFTW.mul!` call that already raises an error. Trace the implementation of `*` for plans; it is done when applying the complex in-place plan to the real vector throws instead of silently returning a complex vector without mutating the input.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.