Robert, I've implemented your tweaked solution and indeed it runs significantly faster! In retrospect it looks so obvious, almost embarrasing! Thanks a million, your effort is appreciated! Ralf, yes I am aware of NArray, and probably that will be the optimal solution. At some stage I will probably use it, however, at least for now, I want to avoid external dependencies and just go with a pure Ruby solution. Thanks, Chris -- Posted via http://www.ruby-forum.com/.