lloca.utils.lorentz

Basic operations in Minkowski space.

Functions

lorentz_cross(v1, v2, v3)

Compute the cross product in Minkowski space using the Laplace expansion.

lorentz_eye(dims[, device, dtype])

Create a identity matrix of given shape

lorentz_inner(v1, v2)

Lorentz inner product, i.e v1^T @ g @ v2

lorentz_metric(dims[, device, dtype])

Create a metric tensor of given shape

lorentz_squarednorm(v)

Lorentz norm, i.e. v^T @ g @ v.

lloca.utils.lorentz.lorentz_cross(v1, v2, v3)[source]

Compute the cross product in Minkowski space using the Laplace expansion. Note that this cross product takes three inputs vectors.

Parameters:
  • v1 (torch.Tensor) – Tensors of shape (…, 4) representing vectors in Minkowski space.

  • v2 (torch.Tensor) – Tensors of shape (…, 4) representing vectors in Minkowski space.

  • v3 (torch.Tensor) – Tensors of shape (…, 4) representing vectors in Minkowski space.

Returns:

The cross product of the three vectors, shape (…, 4).

Return type:

torch.Tensor

lloca.utils.lorentz.lorentz_eye(dims, device=None, dtype=torch.float32)[source]

Create a identity matrix of given shape

Parameters:
  • dims (tuple) – Dimension of the output tensor, e.g. (2, 3) for a 2x3 matrix

  • device (torch.device) – Device to create the tensor on, by default torch.device(“cpu”)

  • dtype (torch.dtype) – Data type of the tensor, by default torch.float32

Returns:

Identity matrix of shape (…, 4, 4)

Return type:

torch.Tensor

lloca.utils.lorentz.lorentz_inner(v1, v2)[source]

Lorentz inner product, i.e v1^T @ g @ v2

Parameters:
  • v1 (torch.Tensor) – Tensors of shape (…, 4)

  • v2 (torch.Tensor) – Tensors of shape (…, 4)

Returns:

Lorentz inner product of shape (…, )

Return type:

torch.Tensor

lloca.utils.lorentz.lorentz_metric(dims, device=None, dtype=torch.float32)[source]

Create a metric tensor of given shape

Parameters:
  • dims (tuple) – Dimension of the output tensor, e.g. (2, 3) for a 2x3 matrix

  • device (torch.device) – Device to create the tensor on, by default torch.device(“cpu”)

  • dtype (torch.dtype) – Data type of the tensor, by default torch.float32

Returns:

Metric tensor of shape (…, 4, 4)

Return type:

torch.Tensor

lloca.utils.lorentz.lorentz_squarednorm(v)[source]

Lorentz norm, i.e. v^T @ g @ v

Parameters:

v (torch.Tensor) – Tensor of shape (…, 4)

Returns:

Lorentz norm of shape (…, )

Return type:

torch.Tensor