def compute_L_inverse(self, X, Y):
    N = X.size()[0]
    Xmat = X.expand(N, N)
    Ymat = Y.expand(N, N)
    P_dist_squared = (torch.pow((Xmat - Xmat.transpose(0, 1)), 2) + torch.pow((Ymat - Ymat.transpose(0, 1)), 2))
    P_dist_squared[(P_dist_squared == 0)] = 1
    K = torch.mul(P_dist_squared, torch.log(P_dist_squared))
    O = torch.FloatTensor(N, 1).fill_(1)
    O = O.to(device)
    Z = torch.FloatTensor(3, 3).fill_(0)
    Z = Z.to(device)
    P = torch.cat((O, X, Y), 1)
    L = torch.cat((torch.cat((K, P), 1), torch.cat((P.transpose(0, 1), Z), 1)), 0)
    Li = torch.inverse(L)
    Li = Li.to(device)
    return Li
def compute_L_inverse(self, X, Y):
    N = X.size()[0]
    Xmat = X.expand(N, N)
    Ymat = Y.expand(N, N)
    P_dist_squared = (torch.pow((Xmat - Xmat.transpose(0, 1)), 2) + torch.pow((Ymat - Ymat.transpose(0, 1)), 2))
    P_dist_squared[(P_dist_squared == 0)] = 1
    K = torch.mul(P_dist_squared, torch.log(P_dist_squared))
    O = torch.FloatTensor(N, 1).fill_(1)
    O = O.to(device)
    Z = torch.FloatTensor(3, 3).fill_(0)
    Z = Z.to(device)
    P = torch.cat((O, X, Y), 1)
    L = torch.cat((torch.cat((K, P), 1), torch.cat((P.transpose(0, 1), Z), 1)), 0)
    Li = torch.inverse(L)
    Li = Li.to(device)
    return Li