Perhaps we could emphasize that
df1/"1 Nx2
works for any dyadic df1 that can handle two scalars, whereas
df1/ |:Nx2'
only makes sense if df1 is able to deal with entire arrays at once (and then it
may be faster).
Is this right?
greetings,
Ben
________________________________________
From: [email protected]
[[email protected]] on behalf of alexgian
[[email protected]]
Sent: Wednesday, April 30, 2014 13:48
To: J Programming forum
Subject: Re: [Jprogramming] Applying a dyad to exusting matrix data
Yeah, personally (from my minimal understanding of J), I'd have guessed
that feeding the data at rank 1 would be slower, but what do I know?
On 30 April 2014 12:12, Ben Gorte - CITG <[email protected]> wrote:
> Sorry, but not on my computer:
>
> Nx2 =: i.600000 2x
> df1=:+
> 6!:2 'z=:df1/ |:Nx2'
> 0.46775
> 6!:2 'z=:df1/"1 Nx2'
> 1.18481
>
> I was thinking in the first case it does df1 only once (on a lot of data),
> and in the second case many times, element by element.
>
> Greetings,
> Ben
> ________________________________________
> From: [email protected] [
> [email protected]] on behalf of David Lambert [
> [email protected]]
> Sent: Wednesday, April 30, 2014 12:48
> To: [email protected]
> Subject: Re: [Jprogramming] Applying a dyad to exusting matrix data
>
> Time to learn about rank!
> In my experience
>
> u"1 N_BY_2_MATRIX
>
> runs faster than
>
> u@:|: N_BY_2_MATRIX
> > Date: Wed, 30 Apr 2014 10:49:40 +0100
> > From: alexgian<[email protected]>
> > To: J Programming forum<[email protected]>
> > Subject: [Jprogramming] Applying a dyad to exusting matrix data
> > Message-ID:
> > <CAD=
> [email protected]>
> > Content-Type: text/plain; charset=UTF-8
> >
> > Suppose I have an Nx2 data matrix, say
> > x1 y1
> > x2 y2
> > x3 y3
> > ....
> > and a dyadic verb called, say, df1
> >
> >
> > Is there an elegant way to get the result matrix
> > x1 df1 y1
> > x2 df1 y2
> > x3 df1 y3
> > .....
> >
> > without resorting to "from - {" and "take - {." jiggery-pokery
> > Or perhaps just a means to convert an expresiion from the
> > df1 x1 y1 form, to
> > x1 df1 y1
> >
> > All suggestions gratefully received.
> >
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm