fields.utils.utilities.signature_to_tensor_class#

fields.utils.utilities.signature_to_tensor_class(signature: SignatureInput) Tuple[int, int][source]#

Convert a tensor signature to its \((p, q)\) form.

The \((p, q)\) notation describes the number of contravariant (upper) and covariant (lower) indices in a tensor:

  • p: number of 1’s in the signature (contravariant indices)

  • q: number of -1’s in the signature (covariant indices)

Parameters:

signature (sequence of int) – The tensor signature, typically a tuple of 1 and -1.

Returns:

A tuple (p, q) where:

  • p is the count of contravariant indices

  • q is the count of covariant indices

Return type:

tuple of int

Raises:

ValueError – If the signature contains values other than 1 or -1.