Calculate the optimal rotation from ``P`` unto ``Q``.

    Using the Kabsch algorithm the optimal rotation matrix
    for the rotation of ``other`` unto ``self`` is calculated.
    The algorithm is described very well in
    `wikipedia <http://en.wikipedia.org/wiki/Kabsch_algorithm>`_.

    Args:
        other (Cartesian):

    Returns:
        :class:`~numpy.array`: Rotation matrix

def get_kabsch_rotation(Q, P):
    """Calculate the optimal rotation from ``P`` unto ``Q``.

    Using the Kabsch algorithm the optimal rotation matrix
    for the rotation of ``other`` unto ``self`` is calculated.
    The algorithm is described very well in
    `wikipedia <http://en.wikipedia.org/wiki/Kabsch_algorithm>`_.

    Args:
        other (Cartesian):

    Returns:
        :class:`~numpy.array`: Rotation matrix
    """
    # Naming of variables follows the wikipedia article:
    # http://en.wikipedia.org/wiki/Kabsch_algorithm
    A = np.dot(np.transpose(P), Q)
    # One can't initialize an array over its transposed
    V, S, W = np.linalg.svd(A)  # pylint:disable=unused-variable
    W = W.T
    d = np.linalg.det(np.dot(W, V.T))
    return np.linalg.multi_dot((W, np.diag([1., 1., d]), V.T))