pure ruby implementation of NArray