SyTen

◆ commutator()

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.

Parameters
Ais an STensor of arbitrary rank.
Bis an STensor of arbitrary rank.
AIdsspecifies first the left leg of A than the right one.
BIdsspecifies first the left leg of B than the right one.
Returns
The commutator and the new SBasisIds of the matrix legs.
Remarks
This function is not autodifferentiable.

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.

+ Here is the call graph for this function: