f/.!.t _should_ change the tolerance for f . Perhaps you
want to say instead f!.t0/.!.t1 ?  (And if the interpreter
does not accept that then it should.)



----- Original Message -----
From: Henry Rich <[email protected]>
Date: Monday, September 6, 2010 11:04
Subject: Re: [Jprogramming] Mask from list of indices with multiplicity
To: Programming forum <[email protected]>

> I don't see that tolerant comparisons are always used.  But 
> I agree that 
> f/.!.t seems to change the comparison tolerance for f, which in 
> my 
> opinion is an error.
> 
>     z =. 3 + 1e_15 * i. 8
>     </.~ z
> +---------------+
> |3 3 3 3 3 3 3 3|
> +---------------+
>     </.!.0~ z
> +-+-+-+-+-+-+-+-+
> |3|3|3|3|3|3|3|3|
> +-+-+-+-+-+-+-+-+
>     <@:>./.!.0 z
> +-+-+-+-+-+-+-+-+
> |3|4|4|4|4|4|4|4|
> +-+-+-+-+-+-+-+-+
>     <@:(>.!.5e_14)/.!.0 z
> +-+-+-+-+-+-+-+-+
> |3|3|3|3|3|3|3|3|
> +-+-+-+-+-+-+-+-+
> 
> Henry Rich
> 
> On 9/6/2010 1:40 PM, Don Guinn wrote:
> > Played with f/. and tolerance some more. Surprising! /. always 
> does tolerant
> > comparisons when grouping. Including when 9!:18 is zero. And 
> when tolerance
> > is applied to /. it will apply the tolerance to a named verb.
> >
> >     z
> > 1 3 2 2 3 1 1 2 2 3
> >     z-<.z
> > 2.90878e_14 2.88658e_14 2.88658e_14 2.88658e_14 2.88658e_14 
> 2.90878e_14> 2.90878e_14 2.88658e_14 2.88658e_14 2.88658e_14
> >     f=.[:<[=[:<.]
> >     f
> > +--+-+---------------+
> > |[:|<|+-+-+---------+|
> > |  | ||[|=|+--+--+-+||
> > |  | || | ||[:|<.|]|||
> > |  | || | |+--+--+-+||
> > |  | |+-+-+---------+|
> > +--+-+---------------+
> >     f/.~z
> > +-----+-----+-------+
> > |1 1 1|1 1 1|1 1 1 1|
> > +-----+-----+-------+
> >     f/.!.0~z
> > +-----+-----+-------+
> > |0 0 0|0 0 0|0 0 0 0|
> > +-----+-----+-------+
> >     f z
> > +-------------------+
> > |1 1 1 1 1 1 1 1 1 1|
> > +-------------------+
> >     f!.0 z
> > |domain error
> > |       f!.0~z
> >     9!:19]0
> >
> >     f/.~z
> > +-----+-----+-------+
> > |0 0 0|0 0 0|0 0 0 0|
> > +-----+-----+-------+
> >     9!:19]ct
> >     ct
> > 5.68434e_14
> >     f/.~z
> > +-----+-----+-------+
> > |1 1 1|1 1 1|1 1 1 1|
> > +-----+-----+-------+
> >
> > I am not really sure what /. uses for the comparison tolerance 
> for grouping.
> >
> >     z2=.1 3 2 2 3 1 1 2 2 3+3*ct*?10#0
> >     z2
> > 1 3 2 2 3 1 1 2 2 3
> >     z2=<.z2
> > 1 1 0 0 1 1 1 1 0 1
> >     f z2
> > +-------------------+
> > |1 1 0 0 1 1 1 1 0 1|
> > +-------------------+
> >      f/.~z2
> > +-----+-----+-------+
> > |1 1 1|1 1 1|0 0 1 0|
> > +-----+-----+-------+
> >
> > Above the numbers close are grouped together as if equal, yet 
> when they are
> > compared in f they are found to be not tolerably equal.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to