Cerovski pointed out findinRows_SH was wrong, I corrected it to
findinRows_SB
findinRows_SB=: +./@((*. 1 |.!.0 +./\.)/@|:@(=/))
AA findinRows_ML BB
1 0 0 0 0 0 0 0 0 0
AA findinRows_SB BB
1 0 0 0 0 0 0 0 0 0
R.E. Boss
> -----Oorspronkelijk bericht-----
> Van: [email protected] [mailto:programming-
> [email protected]] Namens Brian Schott
> Verzonden: vrijdag 19 augustus 2011 18:44
> Aan: Programming forum
> Onderwerp: Re: [Jprogramming] Search for ordered letters within lines of
> matrix
>
> I get different results for ML and SH when I trim the data sets a little
for my
> slower computer.
>
> AA=: data 10 3e2
> BB=: data 1e2
> findinRows_SH=: +./@((*. +./\.)/@|:@(=/))
> findinRows_ML=: [: *@#@> [: ([ #~ (< {:))&.>/ <@I.@(=/~)
>
> (AA findinRows_ML BB)-:(AA findinRows_SH BB)
> 0
> (AA findinRows_ML BB)
> 1 0 0 0 0 0 0 0 0 0
> (AA findinRows_SH BB)
> 1 0 1 1 0 1 0 1 1 1
>
> On Fri, Aug 19, 2011 at 11:06 AM, Raul Miller <[email protected]>
wrote:
> >
> > I like Shaw's approach.
> >
> > However, the efficiency issue is data dependent:
> >
> > findinRows_SH=: +./@((*. +./\.)/@|:@(=/))
> > findinRows_ML=: [: *@#@> [: ([ #~ (< {:))&.>/ <@I.@(=/~)
> > data=: 'ACGT' {~ 4 ?.@$~ ]
> > AA=: data 20 3e3
> > BB=: data 1e3
> >
> > ts 'AA findinRows_SH BB'
> > 2.54335 1.34548e8
> > ts 'AA findinRows_ML BB'
> > 1.09949 2.34531e8
> >
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm