Oops, I should have replace i.9 1 with i.10 1 $1e5+I.+./(3#"1":i.10 1) +./@E."1/ ":1e5+i.9e5 1 33219
Sorry about that... -- Raul On Sat, Jul 3, 2021 at 11:51 PM Raul Miller <[email protected]> wrote: > > You did not include a definition for triple here, and I have no way of > reproducing your result. > > This is a bit slower to execute (0.37 seconds on my laptop), but > faster to implement: > > $1e5+I.+./(3#"1":i.9 1) +./@E."1/ ":1e5+i.9e5 1 > 29816 > (12345+i.10){1e5+I.+./(3#"1":i.9 1) +./@E."1/ ":1e5+i.9e5 1 > 444993 444994 444995 444996 444997 444998 444999 445000 445111 445222 > > -- > Raul > > On Sat, Jul 3, 2021 at 7:59 PM Julian Fondren <[email protected]> > wrote: > > > > On Saturday, July 3rd, 2021 at 6:50 PM, Julian Fondren > > <[email protected]> wrote: > > > That takes about 80x as long as the attached method > > > using the FFI and a quick library in D. > > > > That attachment got stripped? Well, it's nothing special. > > > > extern(C) void triples(int* xs, int len) @nogc { > > foreach (i; 0 .. len) > > xs[i] = triple(xs[i]); > > } > > > > triplesd =: './libtriple.so triples n *i i'&cd > > triples =: [: triplesd (; #) > > triples 123334 122344 121212 111222 112122 555432 > > +-+-----------+-+ > > |0|1 0 0 1 0 1|6| > > +-+-----------+-+ > > $(#~ triple"1) sn > > 33219 6 > > $(#~ 1 {:: triples) n > > 33219 > > 30 timex '$(#~ triple"1) sn' > > 0.869076 > > 30 timex '$(#~ 1 {:: triples) n' > > 0.0100672 > > > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
