Simon Kr÷šer <SimonKroeger / gmx.de> writes:

> Here is the second version (which was my first version):
> --------------------------------------------------------------------
> --------------------------------------------------------------------
>
> It's quite similar except the loop.

Indeed, this is more what I expected - and this is a distinctly
different algorithm than the first solution you posted.  In fact, your
main loop is pretty much identical to mine, except that you were using
NArray whereas I was using a bignum to hold the frequency.  This meant
that it was much more cumbersome for me to extract each component and
update than it was for you.

I think that this algorithm itself is significantly faster than the
update-all-26-at-once version, and the only reason you see an
advantage to the update-all-26-at-once approach is because you can do
almost all of it by calling NArray vector operations.