Implements the work done by F. Landis Merkley to calculate the average quaternion.