MathGroup Archive 2001

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

Search the Archive

ListCorrelate[] ??

  • To: mathgroup at smc.vnet.net
  • Subject: [mg30104] ListCorrelate[] ??
  • From: Brent Pedersen <bpederse at nature.berkeley.edu>
  • Date: Sat, 28 Jul 2001 01:51:04 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

with a real square matrix H, I calculate the sum of each cell and its 8
neighbors as:
Htot=ListCorrelate[kern, H ,{2,-2}];     (thanks to the help of some of
you)
where:
kern = Table[1, {3}, {3}];

now, for each 9 cell neighborhood around (and including cell H[[i,j]], I
wish to calculate:
Sum[(H[[m,n]]/Htot[[i,j]])^c,{m,i-1,i+1},{n,j-1,j+1}];
(when c=1, this will be 1.)
of course, this code won't work as is but the idea is there.I can write
loops containing a Sum[] similar to that above,but i am sure that
ListCorrelate[] operates much faster (which is important since H is
256*256).in short, i need to output a 256*256 matrix where each cell
contains the result of the Sum[] function above.

ListCorrelate[kern, H/Htot,{2,-2}]; does not work because it contains
H[[i,j]]/Htot[[i,j]]  not H[[i,j]]/Htot[[m,n]];

will some variation of
ListCorrelate[H, 1/Htot, {n,-n}]; work?
as yet, no luck with that.
any ideas will be greatly appreciated.
thanks,
-brent









  • Prev by Date: Re: commands history in notebook
  • Next by Date: RE: commands history in notebook
  • Previous by thread: Re: Nested Trigonometry Functions
  • Next by thread: Re: ListCorrelate[] ??