[Jprogramming] projecting onto a fixed grid

Joe Bogner joebogner at gmail.com
Fri Nov 14 11:04:07 UTC 2014


I would probably do this:

(ys,0) {~ xs i. xGrid

0 100 200 0 300


On Thu, Nov 13, 2014 at 11:08 AM, Johann Hibschman <jhibschman at gmail.com>
wrote:

> I'm trying to figure out how best to project some values (think counts
> for particular bins) onto a fixed grid of bins (think each bin in
> order).
>
> For example, this does what I want:
>
>    xGrid=: 0 5 10 15 20
>    xs=: 5 10 20
>    ys=: 100 200 300
>    ys (xGrid i. xs)}0*xGrid
> 0 100 200 0 300
>
> It seems a little cumbersome, though, so I was wondering if there's a
> better way.
>
> Thanks,
> Johann
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>


More information about the Programming mailing list