The information from http://jsoftware.com/help/dictionary/special.htm should
probably be incorporated into http://www.jsoftware.com/jwiki/NuVoc?

Here's a list of the entries which are relevant in the context of ("1):

$, dyad also ($,)"r ; also {, {., }., e., ; avoids ravel; see the J 4.06
release notes

=/"r monad also < <: > >: +. +: * *. *: ~: ; word-parallel operations on
Boolean arguments; also special code for insert over an axis of length 2;
see the J 5.03 release notes

/: dyad special code when the left and right arguments are the same
boolean, literal, integer, or floating point vector; also for /:"1 when the
left and right arguments are the same boolean, literal, integer, or
floating point arrays; also for \: ; see the J 5.01 release notes

/:~ monad special code for boolean, literal, integer, or floating point
vectors; also for /:~"1 and /:"1~ ; also for \: ; see the J 5.01 release
notes

<"1@[ { ] dyad avoids <"1 if left argument is integer array

p{~q i.] monad also (q i.]) { p"_  and  q&i.{p"_ ; special code when p and
q are literal lists; see the J 6.02 release notes

f"r both numerous verbs have integrated rank support
monad and dyad  <. <: < >. >: + +. +: * *. *: - -: % ^ ~: | |. |: , ,: ! /:
\: [ ] {. }. o.
monad only  -. %: ^. #. ,. / \ \. {: }: @. ? A. H. j. p. p: q: r. t. x:
 /:@/:  +/%#
dyad only  = > $ # { e. i. i:  $,  m b.  -.@-:
For (+/%#)"r see the J 6.02 release notes.

p {~ q i. ] monad also (q i. ]) { p"_ and q&i. { p"_ ; special code when p
and q are literal lists; see the J 6.02 release notes

There's also a couple in there that are only for ("0).

I think it can be worthwhile spending *short* periods of time scanning the
special code list. A perfect time for this is when you have code which is
too slow, and you've isolated the particular routine that is the bottleneck
but you are drawing a blank on thinking what you could do to make it be
faster. Another good time for this is when you are feeling bored but want
to change your habits.

Another approach is just to be aware that the interpreter includes various
optimizations for cases where the brute force implementation would be too
slow.

I think the fundamental principle here is that while math and the human
mind almost routinely deal with infinities, that the language should have a
decent implementation for frequently useful cases.

(All of which relates to why it would be really exciting to implement
compilers or other sorts of translators for carefully chosen subsets of the
language.)

Thanks,

-- 
Raul



On Wed, Apr 30, 2014 at 7:48 AM, alexgian <[email protected]> wrote:

> 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

Reply via email to