btensor.einsum

btensor.einsum(subscripts, *operands, intersect_tol=None, einsumfunc=<function einsum>, **kwargs)[source]

Evaluates the Einstein summation on the operands while performing required basis transformations automatically.

Only basis independent summations are supported. A summation is basis independent, if each label either:

  • Appears once on both the input (before ‘->’) and output side (free label).

  • Appears twice on the input side and not on the output side (contracted label).

See also the documentation of numpy.einsum.

Parameters
  • subscripts (str) – Specifies the subscripts for summation as comma separated list of subscript labels.

  • operands (EinsumOperandT) – Sequence of tensors for the Einstein summation.

  • itersect_tol – If not None, contracted dimensions will first be transformed to the intersect_basis using intersect_tol as the truncation tolerance. This may speed up the summation but introduces an error which increases with the tolerance. Default: None.

  • einsumfunc (Callable) – Passing this argument allows using a different einsum driver as backend. Default: numpy.einsum.

  • intersect_tol (Number | None) –

  • kwargs (Any) –

Returns

Result of the Einstein summation as a tensor or number.

Return type

EinsumOperandT | Number