Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

np.fft.fft always returns np.complex128 regardless of input type #17801

Closed
@kyjohnso

Description

@kyjohnso

np.fft.fft returns type np.complex128 regardless of input type. If the input type is np.complex64 returning a complex128 array can have a huge effect on system memory and type casting back with asarray is costly for large arrays.

Reproducing code example:

importnumpyasnpx=np.random.multivariate_normal([0,0],[[1,0],[0,1]],(1024)).dot([1,1j])x=np.asarray(x,dtype=np.complex64)print("dtype of x is: {}".format(x.dtype))X=np.fft.fft(x)print("dtype of X is: {}".format(X.dtype))
dtype of x is: complex64dtype of X is: complex128

Expected Behaviour

I would expect np.fft.fft to return the same type (for complex to complex) as the input, or allow control of the return type.

NumPy/Python version information:

1.19.4 3.8.6 (default, Sep 25 2020, 09:36:53)
[GCC 10.2.0]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp