[AstroPy] Convolution of NumPy arrays of arbitrary dimension

Foad Sojoodi Farimani f.s.farimani at gmail.com
Sat Aug 11 03:51:30 EDT 2018

Hi Adam and Jakub,

Thanks a lot for the reply. I have indeed seen scipy.ndimage.convolve and
have mentioned it in the OP
but some questions:

   1. although there is nothing about the dimension limit of the ndarrays
   in its official page
   but I haven't seen any examples showing it works with higher dimensions.
   2. what is the difference between astropy.convolve_fft and
   scipy.signal.convolve? It seems to me they are for function analysis
   <https://en.wikipedia.org/wiki/Convolution> not array arithmetics.
   3. As I can see the term convolution, even for array arithmetics is used
   for different purposes. For example there is
   also scipy.ndimage.filters.convolve which apparently calculates different
   things. My final goal is to do finite multivariate formal power series
   multiplication (Cauchy product). I think I have figured the formula out
   but I'm not sure if it is correct completely. questions are:
      1. is my formula correct?
         - if not what is the correct one?
         2. if yes has this been done before?
      - if yes where? does any of the above functions do the job?
         3. regardless of the correctness of the formula and existence of
      other implementations, is my implementation correct so far?
      4. how to finish the final step to populate the ndarray using the
      conv function?

Thanks a gain and looking forwards to hearing back.


On Sat, Aug 11, 2018 at 1:56 AM Adam Ginsburg <adam.g.ginsburg at gmail.com>

> On Fri, Aug 10, 2018 at 5:51 PM, Jacob Vanderplas <
> jakevdp at cs.washington.edu> wrote:
>> Hi Foad,
>> I'm sorry if I'm misunderstanding something, but does
>> scipy.ndimage.convolve not address your use case? It implements
>> N-dimensional convolution:
>> from scipy.ndimage import convolveimport numpy as np
>> x = np.random.rand(10, 10, 10, 10)
>> w = np.ones((3, 3, 3, 3))
>> result = convolve(x, w)
>> For completeness, astropy's convolve_fft supports this same operation
> since it's doing an nd fft under the hood, but the direct convolution
> (astropy.convolution.convolve) does not, since we had to hard-code the
> direct convolution operations in each dimension and so far there has been
> no demand for an n-dimensional convolution with n>3.
> _______________________________________________
> AstroPy mailing list
> AstroPy at python.org
> https://mail.python.org/mailman/listinfo/astropy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20180811/cfe2aab8/attachment.html>

More information about the AstroPy mailing list