Hi All,
I’ve been looking for an equivalent determinant function that computes the determinant of a Vandermonde Matrix. In short, the Vandermonde determinant scales better than a standard determinant due to the fact that the matrix is restricted.
Such a determinant is defined as,

where x is a vector of length n.
I’ve written up a quick function that works, which is,
def vander_det(x: Tensor) -> Tensor:
  """"
  :param x: A Tensor of size [B,N]
  """
  det = 1.
  for j in reversed(range(x.shape[-1])):
    for i in reversed(range(j)):
      det *= (x[:,j] - x[:,i])
  return det

Although this works I’ve noticed that it actually scales worse than using torch.linalg.det (most likely due to the use a nested-loop. I was wondering if 1) There already exists a vandermonde-determinant like function within PyTorch (which I’ve missed) or 2) Is there a way to parallelize the nested loop?
Any help would be greatly apprecitated!
Thank you!