ind4a=: 4 $. $.
----- Original Message ----- From: "Sherlock, Ric" <[EMAIL PROTECTED]> Date: Thursday, June 12, 2008 6:07 Subject: RE: [Jprogramming] find row and column indices To: Programming forum <[email protected]> > ind4=: [: 4&$.$. > > ts 'ind2 tmp' > 0.256588267503 134218688 > ts 'ind4 tmp' > 0.114605347886 2048 > > Wow! > > > -----Original Message----- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On Behalf Of Don Guinn > > Sent: Thursday, 12 June 2008 23:42 > > To: Programming forum > > Subject: Re: [Jprogramming] find row and column indices > > > > How about? > > 4$.$.tst > > 0 3 > > 2 0 > > 3 3 > > 5 0 > > > > On Wed, Jun 11, 2008 at 6:34 PM, Sherlock, Ric > > <[EMAIL PROTECTED]> > > wrote: > > > > > Thanks Roger & Henry, > > > They are much simpler than the other way I just realised I > > had already > > > created in the other thread. > > > > > > ind0=: (1 , {:@$) *"1 [: (<. ,. 1&|) {:@$ %~ [: I. > , NB. RS > > > ind1=: [:;(i.@:# ,.&.> <@I.) NB. RS > > > ind2=: $ #: I.@, NB. RH & HR > > > ind3=: , # (#: i.@(*/))@$ NB. HR > > > > > > Interestingly ind0 is actually very competitive with ind2, > > but would need > > > more work to sort out tolerance (and is specific to matrices). > > > tmp=: 0.0000001>1e6 [EMAIL PROTECTED] > > > +/+/tmp > > > 9 > > > ts=: 6!:2 , 7!:[EMAIL PROTECTED] > > > > > > ts 'ind0 tmp' > > > 0.264977043172 134218688 > > > ts 'ind1 tmp' > > > 3.26141171573 221066560 > > > ts 'ind2 tmp' > > > 0.2667722434 134218688 > > > ts 'ind3 tmp' > > > |out of memory: ind3 > > > | ind3 tmp > > > > > > ---Roger Hui wrote: > > > > ($tst) #: I. , tst > > > > > > > > Works for any rank array, not just matrices. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
