Hi Roger I tried this and encountered the same problem - processing across all lists sequentially in the 3 planes. I tried different combos of "1 2 without success - the out result at the end of the first plane becomes the starting out for the second plane and that plane's output is the input for the last plane. I would like all three planes to start with out =. 0 0 0 0 or whatever starting input (even just the first list in the plane) for each plane. I'm sure it is something to do with rank but I'm not there yet.
Bob -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Roger Hui Sent: January 16, 2010 4:29 PM To: Programming forum Subject: Re: [Jprogramming] Matrix calculations What you need is a phrase like TEST"r1"r2 . It's easier if you use positive ranks. First, get it working for one plane, using positive ranks: mat=: 0{data TEST"_1 mat TEST"1 mat Now get it working for the entire of "data", something like: TEST"1"2 data If it makes it easier, think of it as g=: TEST"1 and then g"2 data . ----- Original Message ----- From: Robert O'Boyle <[email protected]> Date: Saturday, January 16, 2010 12:01 Subject: [Jprogramming] Matrix calculations To: [email protected] > Hi all > > > > I am doing some probabistic population projections and have come > up with a > problem. I have an arbitrary 3 x 3 x 2 matrix > > > > data =. (3 3 4$i.12);"1 0 (10 20 30) > > > > and a noun out =. 0 0 0 0 > > > > What I would like to do is separately for each plane of data to > apply a verb > TEST > > > > TEST =: 3 : 0 > > 'a b' =: y > > out > =: a+out*b > > ) > > > > which multiplies out by the second row scalar, adds this to out > and then > reassigns out. > > > > This works great for a simple matrix > > > > TEST"_1 (0{data) > > > > But when I try > > > > TEST"_2 data I get (sorry for the formatting) > > > > 0 > 1 2 3 > > 4 > 25 46 67 > > 128 > 759 1390 2021 > > > > > 1280 7591 13902 20213 > > 25604 > 151825 278046 404267 > > 768128 4.55476e6 8.34139e6 > 1.2128e7 > > > 7.68128e6 4.55476e7 8.34139e7 1.2128e8 > > 1.53626e8 9.10952e8 1.66828e9 2.4256e9 > > 4.60877e9 2.73286e10 5.00483e10 7.27681e10 > > > > It applies the verb sequentially through all the lists of the 3 > planes. What > I would like is the verb to be applied separately to each plane. > In this > case, I would have the same output for each plane. Ultimately, I > will be > sampling the first row of each plane from a population > distribution and then > undertaking, say, 500 -1000 projections (each of these being a > plane in > data). > > > > I have tried a number of rank conjunctions formulations to no > avail. I'm > sure it is simple to do but I am just learning the nuances of > the rank > conjunction. > > > > Any help would be most appreciated. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
