direct_sum
- adcc.direct_sum(subscripts: str, *operands: Tensor) Tensor
Form the direct sum of tensors, e.g.
direct_sum("ia+jb->ijab", a, b)computes res[i, j, a, b] = a[i, a] + b[j, b].- Parameters:
subscripts (str) – Specifies the index labels of each operand, separated by “+”, “-” or “,” (equivalent to “+”). A “-” negates the following operand. Labels are single letters (case-sensitive) and must be unique across all operands. An optional “->” followed by a permutation of all labels specifies the axis order of the result tensor. Otherwise the axes follow the order of the operands. Whitespaces are ignored.
*operands (libadcc.Tensor) – At least two tensors. The number of labels of each term has to match the dimension of the corresponding tensor.
Examples
>>> direct_sum("a-i->ia", fvv_diag, foo_diag) # res[i, a] = fvv[a] - foo[i] >>> direct_sum("-i-j+a->aij", eps_o, eps_o, eps_v)