On Mon, Sep 22, 2008 at 3:14 PM, J. Patrick Harrington
<[EMAIL PROTECTED]> wrote:
> So the problem looks like this: a -- intensity array, size = np (nphotons >
> 1e5)
> a0, a1, a2 -- tags for position & angle, all size np
> f0, f1, f2 -- boundaries of the cells into which I want
> to sort the the photons.
> Thus, b0=. f0 I. a0 will be the index which shows into which f0 interval
> each photon in "a" falls. The number
> of boundaries might be ~40, so there will be 40^3=64000
> cells to which the exiting photons might be assigned.
I would be inclined to use J's key adverb to perform your sums.
If I understand your description correctly, I think I would use:
sums=: (|:b) +//. a
bins=: ~.&.|: b
I would also think about replacing b with its transpose since
using it as a key suggests that would be more natural. Perhaps
using an expression like:
b=. (f0 I. a0),.(f1 I. a1),.(f2 I. a2)
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm