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.
Bob
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm