# Problem with A\_mul\_B! and plan\_idct, possible bug?

**URL:** <https://discourse.julialang.org/t/problem-with-a-mul-b-and-plan-idct-possible-bug/2025>\
**Category:** Internals & Design\
**Tags:** question\
**Created:** [February 10, 2017, 1:07pm UTC](https://discourse.julialang.org/t/problem-with-a-mul-b-and-plan-idct-possible-bug/2025 "2017-02-10T13:07:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nantonel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nantonel/32/2889_2.png) [@nantonel](https://discourse.julialang.org/u/nantonel)\
**Post date:** [February 10, 2017, 1:07pm UTC](https://discourse.julialang.org/t/problem-with-a-mul-b-and-plan-idct-possible-bug/2025/1 "2017-02-10T13:07:19Z")

</div>

Hi all!  
I’m running Julia 0.5 on Linux, and I found this weird thing, which I think could be a bug:

```julia
x = randn(10); # input value             
x2 = copy(x); # copy of input value
y = zeros(10); # output
A = plan_idct(x); # plan an inverse discrete cosine transform
A_mul_B!(y,A,x); # apply transform in place in y (1)
norm(x-x2) # here x should not be modified 
>2.7... # but it's not!!

```

In line (1) if change `plan_idct` with `plan_dct`, `plan_fft` or `plan_ifft` (in the latter 2 cases you need complex vector)  
this issue does not happen.  
The problem is solved when using `y .= A*x`. But my feeling is that something is wrong with `A_mul_B!`  
Please let me know if you experience the same issue or if this was already fixed in julia 0.6!  
Thank you!  
Niccolo’

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [February 15, 2017, 8:54am UTC](https://discourse.julialang.org/t/problem-with-a-mul-b-and-plan-idct-possible-bug/2025/2 "2017-02-15T08:54:55Z")

</div>

[https://github.com/JuliaLang/julia/blob/master/base/fft/dct.jl#L154](https://github.com/JuliaLang/julia/blob/master/base/fft/dct.jl#L154)

But perhaps it should be documented better than just this comment.

---

<div class="post-metadata">

**Author:** ![nantonel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nantonel/32/2889_2.png) [@nantonel](https://discourse.julialang.org/u/nantonel)\
**Post date:** [February 17, 2017, 9:54pm UTC](https://discourse.julialang.org/t/problem-with-a-mul-b-and-plan-idct-possible-bug/2025/3 "2017-02-17T21:54:09Z")

</div>

thanks for the answer! yes I agree that maybe it should appear in the docs!
