(u, theta)
return R
Return matrix that implements the rotation around the vector :math:`u`
    by the angle :math:`\\theta`, cf.
    https://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle.

    :param u: rotation vector
    :param theta: rotation angle
Return matrix that implements the rotation around the vector :math:`u`
    by the angle :math:`\\theta`, cf.
    https://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle.
Return matrix that implements the rotation around the vector : math : u by the angle : math : \\ theta cf . https : // en . wikipedia . org / wiki / Rotation_matrix#Rotation_matrix_from_axis_and_angle .
def rotation_matrix(u, theta):
    """Return matrix that implements the rotation around the vector :math:`u`
    by the angle :math:`\\theta`, cf.
    https://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle.

    :param u: rotation vector
    :param theta: rotation angle
    """
    assert np.isclose(np.inner(u, u), 1.0), "the rotation axis must be unitary"

    # Cross-product matrix.
    cpm = np.array([[0.0, -u[2], u[1]], [u[2], 0.0, -u[0]], [-u[1], u[0], 0.0]])
    c = np.cos(theta)
    s = np.sin(theta)
    R = np.eye(3) * c + s * cpm + (1.0 - c) * np.outer(u, u)
    return R
def rotation_matrix ( u , theta ) : assert np . isclose ( np . inner ( u , u ) , 1.0 ) , "the rotation axis must be unitary" # Cross-product matrix. cpm = np . array ( [ [ 0.0 , - u [ 2 ] , u [ 1 ] ] , [ u [ 2 ] , 0.0 , - u [ 0 ] ] , [ - u [ 1 ] , u [ 0 ] , 0.0 ] ] ) c = np . cos ( theta ) s = np . sin ( theta ) R = np . eye ( 3 ) * c + s * cpm + ( 1.0 - c ) * np . outer ( u , u ) return R