Rework ndarray implementation

No longer precompute subarrays as it implies some overhead. Now compute
it on the fly.

This leads to some good performance improvement and cleaner (?)
implementation.
Implementation of frexp

Although frexp is a ufunc, it cannot benefit easily from expression
templates, so define it as a regular function.