Help / Release / J 5.01 / < i. 1: Improved

From J Wiki
Jump to navigation Jump to search


>> << Pri JfC LJ Phr Dic Voc !: Rel NuVoc wd Help Release



< i. 1: Improved

initial writing: 2002-02-13
last updated: 2004-10-26


The following dyads are now supported by special code for

Boolean, integer, floating point, or literal vectors or scalars:

   comp i. 0:      i.&0@:comp
   comp i. 1: i.&1@:comp
   comp i: 0: i:&0@:comp
   comp i: 1: i:&1@:comp
   [: +/ comp   +/@:comp

where comp is one of = ~: < <: >: > E. (< <: >: > not available for literal). Time and space savings depend on the arguments used. For example:

   ts=: 6!:2 , 7!:2@]    NB. time and space
   x=: ?1e6$1e9
   y=: 1.5e9

   ts '+/x<y'        
0.0339839 1.04973e6
   ts 'x +/@:< y'        NB. scan entire x
0.0205264 1280
   
   ts '(x<y) i. 1'
0.0295772 1.04941e6
   ts 'x (< i. 1:) y'    NB. immediate hit
4.1346e_5 1216
   
   ts '(x>:y) i. 1'
0.0393262 1.04954e6
   ts 'x (>: i. 1:) y'   NB. scan entire x
0.0218871 1216

   x1=: y 5e5}x
   ts '(x1>:y)i.1'
0.036011 1.04941e6
   ts 'x1 (>: i. 1:) y'  NB. scan half of x1
0.0109947 1216




>> << Pri JfC LJ Phr Dic Voc !: Rel NuVoc wd Help Release