If you are measuring performance, use fftw. FFT will be better on big problems.
Henry Rich On Wed, Mar 2, 2022, 7:35 PM Raul Miller <rauldmil...@gmail.com> wrote: > Yes, ... maybe I should replace my caching wrapper with M. > > That said, using the fft cyclotomic000 implementation and the caching > wrapper from the rosettacode page (and the fftw implementation for fft > and ifft): > > taskorder=: {{ > r=.$k=.0 > while.y>#r do.k=.k+1 > if.(1+#r) e.|u k do. > r=. r,k > k=. k-1 > end. > end.r > }} > > timespacex 'cyclotomic taskorder 10 [ cache=: 2 {. cache' > 8.17343 5.70164e8 > > vs. > > timespacex '(cyclotomic=:{{if.2>y do._1 1 else. unpad cyclotomic000 > y end.}}M."0) taskorder 10' > 15.1576 6.86114e8 > > I'm not sure that this is an improvement. > > -- > Raul > > On Wed, Mar 2, 2022 at 7:01 PM 'Michael Day' via Programming > <programm...@jsoftware.com> wrote: > > > > Interesting! I've got some thoughts on this, but it's getting late > > here, so I'll > > defer a fuller reply. > > > > Meanwhile, a quickie: since the memoisation does seem to work, might > > it be better > > to dispense with cache? A pity as you put some effort into its use, > > but the code is > > simpler without it. > > > > Thanks, > > > > Mike > > > > On 02/03/2022 19:57, Raul Miller wrote: > > > I've updated the rosettacode page to include this implementation. And, > > > I plan on updating the j wiki polynomial division essay, also, once I > > > think through a bit how to describe this approach. (Descriptive > > > phrases and sentences would be welcome. Documentation needs good > > > perspectives, above all else.) > > > > > > For the purpose of the rosettacode page, I used a different phrasing > of rou: > > > > > > rou =: {{(,j.) r,(%:0j1),j.+|.}.r=.^o.j.(i.@%&8 % -:) y}} NB. > > > roots of unity > > > > > > This seems (to me) to be more concise, and straightforward, than the > > > purely tacit expression. > > > > > > (That said, I'm not sure if this change in notation would be a good > > > fit for the FFT essay.) > > > > > > Thanks, > > > > > > > > > -- > > This email has been checked for viruses by Avast antivirus software. > > https://www.avast.com/antivirus > > > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm