outer inner product between two quaternions
cos angle(g1,g2)/2 = dot(g1,g2)
d = dot_outer(g1,g2,varargin)