refactor registration code

This is a rebased branch which implements the refactoring of the existing
registration code to increase speed. Simple benchmarking via the ``time``
command suggest around a x2 speedup from this change.

It also has the nice property of replacing an explicit matrix inverse with a
solution via eigendecomposition.