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

Real->complex and complex->real #42

Open
vincefn opened this issue Jun 2, 2018 · 3 comments
Open

Real->complex and complex->real #42

vincefn opened this issue Jun 2, 2018 · 3 comments

Comments

@vincefn
Copy link
Contributor

vincefn commented Jun 2, 2018

I have a question regarding complex<->real plans.

You can create a real<->complex plans using:

 ny, nx = 256, 280
 nx2 = nx //2 + 1
 d = np.arange(ny * nx).reshape((ny,nx)).astype(np.float32)
 cl_d = cla.to_device(queue=queue,ary=d.astype(np.float32))
 cl_d_ft = cla.zeros(queue=queue, shape=(ny, nx2), dtype=np.complex64)
 planr2c = gpyfft.FFT(ctx, queue, cl_d, cl_d_ft, axes=(-1,-2))
 planc2r = gpyfft.FFT(ctx, queue, cl_d_ft, cl_d, axes=(-1,-2), real=True)

... and cl_d_ft is a complex hermitian array - OK
However, to create a complex(half-hermitian array)->real plan, you need to use real=True keyword, but why is it needed ? Should it not be sufficient to detect that the input is complex and output real to trigger the creation of a complex-hermitian->real plan ? (it took me a while to find that keyword was needed, that's why I'm asking...)

@geggo
Copy link
Owner

geggo commented Jun 3, 2018

Dear Vincent,

thanks for your hint, you are right, for an out-of-place complex->real transform, where both in- and output arrays are provided by the user, the real=True keyword should not be necessary (only for an inplace transform).

Real<->complex transforms are a late addition and still lack tests, I did not yet dare to fiddle around with the interface.

Gregor

@vincefn
Copy link
Contributor Author

vincefn commented Jun 3, 2018

Is there any case where the real keyword is used beside real<->complex transforms ? Can I submit a PR deprecating this keyword ?
Thanks, Vincent

@vincefn
Copy link
Contributor Author

vincefn commented Jun 3, 2018

I just saw the inline-real2real branch. No deprecation then ? But may be useful to recognize the complex hermitian->real transform without the keyword. Could inline real2real also be recognized automatically from having in_array.dtype=np.float* and out_array=None ?

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