Re: Problem: a matrix and a box...

*To*: mathgroup at smc.vnet.net*Subject*: [mg27274] Re: [mg27268] Problem: a matrix and a box...*From*: "Carl K. Woll" <carlw at u.washington.edu>*Date*: Sun, 18 Feb 2001 02:52:10 -0500 (EST)*References*: <200102170830.DAA17186@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Bedrosian, Here is one very simple possibility. Use the built in function ListConvolve as follows: In[24]:= ListConvolve[{{1,1},{1,1}},{{a1,a2,a3},{b1,b2,b3},{c1,c2,c3}}] Out[24]= {{a1 + a2 + b1 + b2, a2 + a3 + b2 + b3}, {b1 + b2 + c1 + c2, b2 + b3 + c2 + c3}} Carl Woll Physics Dept U of Washington ----- Original Message ----- From: "Bedrosian Baol" <Bedrosian at MailAndNews.com> To: mathgroup at smc.vnet.net Subject: [mg27274] [mg27268] Problem: a matrix and a box... > Hi > this is the problem: I have a n x m matrix (with n and m ~3000 elements or > more) > > a1 a2 a3.. > b1 b2 b3.. > c1 c2 c3.. > . . . > . . . > > the algorythm is: compute the summ of the the a1, a2, b1 and b2 elements (a > ''gliding box'' 2x2), shifing the ''box'' for 1 column and repeat the sum of > the elements (now a2, a3, b2, b3), and so on... > at the and of the first line, the box return on the second line and > repeat... > > the final resuls would be another matrix like this: > > [a1+a2+b1+b2] [a2+a3+b2+b3]... > [b1+b2+c1+c2] [b2+b3+c2+c3]... > ... > > I'm not very experienced with Math4: there is a simple and easy way for > reach > the result? > > thanks > Bed > >

**References**:**Problem: a matrix and a box...***From:*Bedrosian Baol <Bedrosian@MailAndNews.com>