Roger Hui wrote:
> 
> My judgment is that the special cases described
> for in the msg for which faster computations exist,
> do not occur sufficiently often to warrant the
> special code which would slow down the general cases.
> I am also skeptical that zero detection in */ would save 
> "an immense amount of time", or that in practice */y
> would be performed on a lengthy y .
> 
As a demonstration of the speed of the current J implementation,
one can consider the following:

   time=:6!:2

   a=:(,~1000)[EMAIL PROTECTED]     NB. random 1000x1000 matrix
   100 time 'a%2.5'    NB. divide a by 2.5
0.0226511
   100 time 'a*%2.5'   NB. multiply a by 1/2.5
0.0189885

One interpretation of this result is that since * is faster
than % in the FPU of the processor, the second expression
executes faster than the first.  

This also makes a difference for instance in the case of the 
vector normalization:

   mp=:+/ . *
   nrm=:%:@(mp~)
   norm1=:%nrm
   norm2=:[EMAIL PROTECTED]
  
   100 time 'norm1"1 a'
0.0384147
   100 time 'norm2"1 a'
0.0315959

-- 
View this message in context: 
http://www.nabble.com/j602-install-tf4844984s24193.html#a13976916
Sent from the J General mailing list archive at Nabble.com.

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to