There is no claim that special for dyad&.(a.&i.) ALREADY exist.
----- Original Message ----- From: Brian Schott <[EMAIL PROTECTED]> Date: Sunday, April 6, 2008 8:58 Subject: Re: [Jprogramming] relational operators and character data To: Programming forum <[email protected]> > I don't see the improvement suggested by the link > below in my tests which follow, unless there is also special > code for the original GTE. > > char1 =: a. {~ num1 =: [EMAIL PROTECTED] > char2 =: a. {~ num2 =: [EMAIL PROTECTED] > GTE =: a. {~ >. & (a. i. ]) > 7!:2 'char2 GTE char1' > 1574016 > 7!:2 'num2 >. num1' > 525120 > > GT =: >.&.(a.&i.) > 7!:2 'char2 GT char1' NB. there is no > improvement here > 1574400 > char2 (GTE-:GT) char1 > 1 > > On Sun, 6 Apr 2008, Roger Hui wrote: > > > For characters x>.y (or any dyad) has only *:256 possibilities. > > Therefore, one solution is to construct a table of size 65536: > > Perhaps special code for well_behaved_dyad&.(a.&i.) > The interpreter is already part way down that road: > http://www.jsoftware.com/help/release/underai.htm > > > > ----- Original Message ----- > From: Roger Hui <[EMAIL PROTECTED]> > Date: Sunday, April 6, 2008 8:13 > Subject: Re: [Jprogramming] relational operators and character data > To: Programming forum <[email protected]> > > > For characters x>.y (or any dyad) has only *:256 > > possibilities. > > Therefore, one solution is to construct a table of size 65536: > > > > MAXC=: , a.{~>./~i.256 > > MAXA=: ,/ ,"0/~ a. > > maxc=: MAXC {~ MAXA i. ,. > > > > GTE =: a. {~ >. & (a. i. ]) > > char1 =: a. {~ [EMAIL PROTECTED] > > char2 =: a. {~ [EMAIL PROTECTED] > > > > char1 (GTE -: maxc) char2 > > 1 > > > > ts=: 6!:2 , 7!:[EMAIL PROTECTED] > > ts 'char1 GTE char2' > > 0.0488294 1.25841e7 > > ts 'char1 maxc char2' > > 0.0753319 6.8169e6 > > > > > > > > ----- Original Message ----- > > From: david alis <[EMAIL PROTECTED]> > > Date: Sunday, April 6, 2008 1:41 > > Subject: [Jprogramming] relational operators and character data > > To: Programming forum <[email protected]> > > > > > Given X and Y with values taken from the set 'A', 'B', 'C', 'D'. > > > I need to compute the larger of the two values (larger > > > with respect > > > to their position in ascii or ebcdic). > > > In other words X >. Y > > > However >. doesnt work with characters. > > > Thus I use an expression similar to: > > > a.{~>. & (a.i.]) > > > > > > In 64 bit J this expression needs around 25M for a character > > > vector of > > > length 1e6: > > > > > > GTE =: a. {~ >. & (a. i. ]) > > > char1 =: a. {~ num1 =: [EMAIL PROTECTED] > > > char2 =: a. {~ num2 =: [EMAIL PROTECTED] > > > > > > 7!:5<'num1' > > > 8388608 > > > 7!:5<'char1' > > > 1048576 > > > > > > 7!:2 'char2 GTE char1' > > > 25167872 > > > 7!:2 'num2 >. num1' > > > 8390272 > > > > > > Is there an alternative, or is there a form of the > expression that > > > would use special code? > > > Perhaps there is an argument to !. such that when applied to > > >. would > > > extend its domain? (Something like >.!.<a.) ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
