MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

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


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
>
>



  • Prev by Date: Re: two y-axis
  • Next by Date: Re: matrices & polynomials in mathematica
  • Previous by thread: Problem: a matrix and a box...
  • Next by thread: Re: Problem: a matrix and a box...