def skewmat(x_vec):
'''

torch.matrix_exp(a)

Eigen::Matrix3f mat = Eigen::Matrix3f::Zero();

mat(0, 1) = -v[2]; mat(0, 2) = +v[1];

mat(1, 0) = +v[2]; mat(1, 2) = -v[0];

mat(2, 0) = -v[1]; mat(2, 1) = +v[0];

return mat;

input : (*, 3)

output : (*, 3, 3)

'''

W_row0 = torch.tensor([0,0,0,  0,0,1,  0,-1,0]).view(3,3).to(x_vec.device)

W_row1  = torch.tensor([0,0,-1,  0,0,0,  1,0,0]).view(3,3).to(x_vec.device)

W_row2  = torch.tensor([0,1,0,  -1,0,0,  0,0,0]).view(3,3).to(x_vec.device)



x_skewmat = torch.stack([torch.matmul(x_vec, W_row0.t()) , torch.matmul(x_vec, W_row1.t()), torch.matmul(x_vec, W_row2.t())] , dim = -1)

return x_skewmat