Efficiency improvements:
 - More in place operations.
 - Use float32 instead of float64. There are methods (eg. clip) that have fast C implementations for float32, but fall back to Python for float64.
 - Explicitly delete and collect transiently used arrays.