Re: Help: Generalized convolution using ListConvolve

*To*: mathgroup at smc.vnet.net*Subject*: [mg47307] Re: Help: Generalized convolution using ListConvolve*From*: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>*Date*: Mon, 5 Apr 2004 05:22:45 -0400 (EDT)*Organization*: Universitaet Leipzig*References*: <c4jaqj$dpc$1@smc.vnet.net>*Reply-to*: kuska at informatik.uni-leipzig.de*Sender*: owner-wri-mathgroup at wolfram.com

Hi, I can't follow you. When you get the Dimensions[] of your output, you get {2,2,3} and this is an 2 x 2 array of 3d-vectors. So what is your problem. Regards Jens Kezhao Zhang wrote: > > I tried to use ListConvolve to calculate the convolution of a 2x2x3x3 > tensor and a 2x2x3 tensor. > The kernel (2x2x3x3 tensor) is a 2x2 array of 3x3 matrices. The list > is a 2x2 array of vectors of length 3. > The operation between the element in the kernel and the element in the > list is Dot product between a matrix > and a vector. I used the general form of ListConvolve: > ListConvolve[kernel, lst, {1, 1}, {}, Dot, Plus, 2] and > expected the output to be a 2x2 array of vectors of length 3. But only > one element of the output array is vector > and the rest are matrices. > > Could someone please help me find out what went wrong. > > Thanks for your help. > > The sample code is listed below. > > K. Zhang > > --------------- > > In[1]:=kernel > Out[1]={{{{-0.333333, 0, 0}, {0, -0.333333, 0}, {0, > 0, -0.333333}}, {{-0.0675086, 0, 0}, {0, 0.135017, > 0}, {0, 0, -0.0675086}}}, {{{0.135017, 0, 0}, {0, -0.0675086, > 0}, { > 0, 0, -0.0675086}}, {{0.0137858, 0.0530667, -0.0170824}, > {0.0530667, \ > 0.0137858, 0}, {-0.0170824, 0, -0.0275715}}}} > In[2]:=lst=Table[{1,0,0},{2},{2}] > Out[2]={{{1, 0, 0}, {1, 0, 0}}, {{1, 0, 0}, {1, 0, 0}}} > In[3]:=ListConvolve[kernel, lst, {1, 1}, {}, Dot, Plus, 2] > Out[3]={{{{-0.252039, -0.280267, -0.350416}, {0.0530667, > 0.0812944, 0.}, {-0.0170824, 0., -0.162589}}, {{-0.252039, > -0.347775, \ > -0.417924}, {0.0530667, -0.0537228, > 0.}, {-0.0170824, 0., -0.0950801}}}, {{{-0.252039, -0.145249, > \ > -0.215399}, {0.0530667, 0.148803, 0.}, {-0.0170824, 0., -0.0950801}}, > \ > {-0.252039, 0.0530667, -0.0170824}}}