Re: better apl array coding

2021-06-16 Thread enztec
Hi you suggested changes to the loop code reduced run time from 41 seconds to 29 seconds but still doesn't compare to the ¨/⌷/⊂ code at 50 msec size of data is 3 and i ran in a ram drive Has anyone tried this on some faster machines? I'm going to run all on a rasp pi and see what times are

Re: better apl array coding

2021-06-16 Thread Dr . Jürgen Sauermann
Hi, the biggest problem with your old loop code is its quadratic runtime. The statement rs←rs,ar[a[i]; b[i]] takes more and more time as rs grows. GNU APL has occasionally been blamed for being slow, but in most cases the above coding pa

Re: better apl array coding

2021-06-15 Thread enztec
Hi thanks for this code - first time actually using ¨ and ⌷ in my comparison test on an old hp dual core linux machine - with only mplayer running with ⍴a and ⍴b 29882 chars according to ⎕ts my loop code takes ~39 seconds to put results into rs 2021 6 15 19 46 11 277 2021 6 15 19 46 50 354

Re: better apl array coding

2021-06-15 Thread Dr . Jürgen Sauermann
Hi, how about:   (a,¨b)⌷¨⊂ar 11 22 33 44 44 33 22 11 Best Regards, Jürgen On 6/15/21 2:45 AM, enz...@gmx.com wrote: hello i've been using this looping for array work but there has to be a better

Re: better apl array coding

2021-06-15 Thread Hans-Peter Sorge
Hi, if this is, what you want? ar←4 4⍴11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44 ⍝ btw: ar← (10×⍳4)∘.+⍳4 a←1 2 3 4 4 3 2 1 b←1 2 3 4 4 3 2 1       ,[1.1]'lp' 'ar' ar 'a' a 'b' b (d,⌽d←1 1⍉ar) It is not quite clear, what your intend is. First:   

better apl array coding

2021-06-14 Thread enztec
hello i've been using this looping for array work but there has to be a better apl way of coding the indexing of the ar array any suggestions ∇rs←lp;a;b;ar;i 'lp' 'ar' +ar←4 4⍴11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44 'a ' +a←1 2 3 4 4 3 2 1 'b ' +b←1 2 3 4 4 3 2 1 i←1 rs←⍴0 sp: rs←rs,ar