ClassicalOrthogonalPolynomials.jl icon indicating copy to clipboard operation
ClassicalOrthogonalPolynomials.jl copied to clipboard

Inverse of Plan Legendre Transform alters input?

Open Veenty opened this issue 9 months ago • 5 comments

Not sure if this is an expected behavior or not, what is the resulting vector?

P = Legendre()
x = chebyshevpoints(Float64, 10, Val(1))
p = plan_transform(P, x, 1)
v = rand(10)
v_copy = copy(v)
p\v 
v ≈ v_copy  #false

Veenty avatar Mar 28 '25 16:03 Veenty

Oh you mean it's mutating the input? That's definitely a bug...

dlfivefifty avatar Mar 28 '25 18:03 dlfivefifty

So I've found the issue, that is also related with the speed problems that I was seeing. The legendre transform uses FastTransforms.plan_th_cheb2leg!, and for unexpected issue, FastTransforms.plan_th_cheb2leg is actually 5 times faster.

Veenty avatar Apr 02 '25 20:04 Veenty

Ugg... we should be able to replace it with plan_cheb2leg (we needed plan_th_cheb2leg because the plans used to have bad complexity but I believe @MikaelSlevinsky and others have corrected this)

dlfivefifty avatar Apr 03 '25 09:04 dlfivefifty

Can I contribute by fixing it?

Veenty avatar Apr 12 '25 20:04 Veenty

That would be amazing! @mikaelslevinsky what is needed to use the fast plans?

dlfivefifty avatar Apr 12 '25 20:04 dlfivefifty