openff.recharge.utilities.tensors.pairwise_differences

openff.recharge.utilities.tensors.pairwise_differences(a: ndarray, b: ndarray) ndarray[source]
openff.recharge.utilities.tensors.pairwise_differences(a: torch.Tensor, b: torch.Tensor) torch.Tensor

Returns a tensor containing the vectors which point from all of the points (with dimension of n_dim) in tensor a to all of the points in tensor b.

Parameters
  • a – The first tensor of points with shape=(n_a, n_dim).

  • b – The second tensor of points with shape=(n_b, n_dim).

Returns

  • The vector field tensor with shape=(n_points_b, n_dim, n_points_a) and where

  • tensor[i, :, j] = (b_i - a_j)