import torch


def arap_R(Si):
    """
    Given the covariance matrix Si, computes the ARAP rotation for point Pi
    
    Parameters
    ----------
    Si : Tensor
        the (3,3,) tensor represeting the covariance matrix of point Pi
        
    Returns
    -------
    Tensor
        a (3,3,) tensor representing the ARAP rotation matrix of point Pi
    """
    
    U, _, V = torch.svd(Si)
    return torch.matmul(V, torch.t(U))