def ufftn(inarray, dim=None):
 if (dim is None):
  dim = inarray.ndim
 outarray = np.fft.fftn(inarray, axes=range((- dim), 0))
 return (outarray / np.sqrt(np.prod(inarray.shape[(- dim):])))

def ufftn ( inarray , dim = None ) : if ( dim is None ) : dim = inarray . ndim outarray = np . fft . fftn ( inarray , axes = range ( ( - dim ) , 0 ) ) return ( outarray / np . sqrt ( np . prod ( inarray . shape [ ( - dim ) : ] ) ) )
n-dimensional unitary fourier transform .