Another try to be improved.

   s=: adverb define
:
s=. y,~   m {.x
f=. x, (1-m){.y
mean f,:s
)

mean=: +/ % #

   (i. 5) 3 s 2* i. 4
0 1 2 1.5 3 4 6


On Wed, May 30, 2012 at 12:17 PM, Ben Gorte - LR <b.g.h.go...@tudelft.nl> wrote:
> According to me the two images have different sizes and are partly 
> overlapping.
> In the resulting image, he wants a copy of either image where they don't 
> overlap, and the average where they do.
>
> Like:
>   i1 =: 0 1 2 3 4 _ _
>   i2 =: _ _ _ 0 2 4 6
>
> I can come up with:
>   avg =: +/ % #
>   min =: <./
>  ({"0 1~ (_={."1) )(avg ,. min)i1,:i2
> 0 1 2 1.5 3 4 6
>
> but I'm sure that can be improved.
>
> Ben
> ________________________________________
-- 
(B=)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to