std::tuple< STensor, std::array< SBasis, 2 > > syten::STensorImpl::commutator | ( | STensorProxy | A, |
STensorProxy | B, | ||
ConstSpan< SBasis > const & | AIds, | ||
ConstSpan< SBasis > const & | BIds | ||
) |
Calculates the commutation of tensors A and B with respect to the requested legs, i.e.
AB-BA. This works for any tensor ranks, but therefore needs to be handeled with care.
A | is an STensor of arbitrary rank. |
B | is an STensor of arbitrary rank. |
AIds | specifies first the left leg of A than the right one. |
BIds | specifies first the left leg of B than the right one. |
References syten::STensorImpl::STensor::b(), project(), syten::STensorImpl::SBasis::repro(), syten::STensorImpl::SBasis::set_id(), syten::SpanImpl::ConstSpan< T >::size(), SYTEN_ASSERT, and SYTEN_ASSERT_DEBUG.