Skip to content

Handling arrays with array.shape[i] == 0 #46

Closed
@JesseLivezey

Description

@JesseLivezey

When (accidentally) calling fft on an array with one dimension having shape=0, mkl_fft gives a somewhat cryptic error wheras numpy.fft.fft (with no mkl) returns a sensibly shaped array.

with numpy from conda (uses mkl_fft)

import numpy as np
from numpy.fft import fft

fft(np.zeros((10, 0, 5)))
# ValueError: Internal error occurred: b'Intel MKL DFTI ERROR: Inconsistent configuration parameters'

with numpy from pip

import numpy as np
from numpy.fft import fft

fft(np.zeros((10, 0, 5)))
# array([], shape=(10, 0, 5), dtype=complex128)

Conda list

# packages in environment at /home/jesse/anaconda3/envs/fft_test:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main  
blas                      1.0                         mkl  
ca-certificates           2019.11.27                    0  
certifi                   2019.11.28               py38_0  
intel-openmp              2019.4                      243  
libedit                   3.1.20181209         hc058e9b_0  
libffi                    3.2.1                hd88cf55_4  
libgcc-ng                 9.1.0                hdf63c60_0  
libgfortran-ng            7.3.0                hdf63c60_0  
libstdcxx-ng              9.1.0                hdf63c60_0  
mkl                       2019.4                      243  
mkl-service               2.3.0            py38he904b0f_0  
mkl_fft                   1.0.15           py38ha843d7b_0  
mkl_random                1.1.0            py38h962f231_0  
ncurses                   6.1                  he6710b0_1  
numpy                     1.17.4           py38hc1035e2_0  
numpy-base                1.17.4           py38hde5b4d6_0  
openssl                   1.1.1d               h7b6447c_3  
pip                       19.3.1                   py38_0  
python                    3.8.0                h0371630_2  
readline                  7.0                  h7b6447c_5  
setuptools                44.0.0                   py38_0  
six                       1.13.0                   py38_0  
sqlite                    3.30.1               h7b6447c_0  
tk                        8.6.8                hbc83047_0  
wheel                     0.33.6                   py38_0  
xz                        5.2.4                h14c3975_4  
zlib                      1.2.11               h7b6447c_3  

Similar things happen for rfft, fft2, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions