SyTen

◆ trace()

STensor syten::STensorImpl::trace ( STensor const &  in)

Calculates the trace of a tensor.

Remarks
For fermionic tensors, this is still the trace, not the supertrace! That is, the fermionic ordering of the two legs (whether it is \( |a\rangle\langle b| \) or \( \langle b| |a\rangle \)) is effectively ignored.
This function is autodifferentiable.

References syten::STensorImpl::STensor::autodiff_enabled(), syten::STensorImpl::STensor::b(), conj(), syten::STensorImpl::STensor::copy(), syten::STensorImpl::STensor::disable_autodiff(), gen_io(), syten::STensorImpl::STensor::get_autodiff_id(), syten::STensorImpl::STensor::get_autodiff_node(), if_constexpr, std::move(), syten::mve(), syten::STensorImpl::STensor::new_autodiff_id(), syten::STensorImpl::Autodiff::new_id(), parityEqualDirs(), prod(), project(), syten::STensorImpl::STensor::rank(), syten::STensorImpl::STensor::set_autodiff_node(), SYTEN_ASSERT, SYTEN_ASSERT_MSG, SYTEN_TENSOR_RANK, trace(), and syten::STensorImpl::STensor::visnz().

Referenced by ferm_trace(), and trace().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: