◆ prod_impl() [2/2]

template<Rank r>
SDef syten::TensorProd::prod_impl ( SourceLocation  location,
Tensor< r > const &  a,
Tensor< r > const &  b,
std::array< int, r > const &  c_a,
std::array< int, r > const &  c_b,
Conj const  conj = Conj::n(),
HandleFermions const  handle_ferms = HandleFermions::n(),
ConstSpan< Index ferm_a = ConstSpan<Index>(),
ConstSpan< Index ferm_b = ConstSpan<Index>(),
ConstSpan< Bool parity_a = ConstSpan<Bool>(),
ConstSpan< Bool parity_b = ConstSpan<Bool>() 

Implementation of tensor-tensor-to-scalar product.

locationlocation of the calling function
afirst tensor to be contracted
bsecond tensor to be contracted
c_acontraction spec for a, legs with positive indices here are contracted
c_bcontraction spec for b, legs with positive indices here are contracted
conjif this is Conj::y(), b is complex-conjugated
handle_fermsif this is true, fermionic commutation is handled in a bare-bones manner
ferm_aeffective fermionic order of a tensor
ferm_beffective fermionic order of b tensor
parity_alist of booleans specifying if additional parities are to be placed on a-tensor legs, initialised only if handle_ferms is yes
parity_blist of booleans specifying if additional parities are to be placed on b-tensor legs, initialised only if handle_ferms is yes
handle_ferms only takes care of minus signs from permutations of a and b to go from ferm_a and ferm_b to a fermionic order in which the contraction itself can happen without additional minus signs. It assumes that in the result tensor, legs of B come first in descending order (-2 first, then -4, then -5) and legs of A come second in descending order (-1 first, then -3). It also assumes that ferm_b matches the effective order of b taking into account conj. That is, when calling the method with conj = Conj::y(), you also need to reverse ferm_b.

For every bucket in a, find the matching bucket in b. Since the buckets are sorted in ascending order, we can use lower_bound nicely.

References syten::DenseProduct::check_dense_dims(), std::clock(), syten::SourceLocation::column(), syten::conj(), std::chrono::duration::count(), syten::dense(), syten::Tensor< rank >::dirs, syten::SourceLocation::file_name(), std::array< T >::fill(), syten::Inc, syten::is_perm_fermionic(), syten::isFermionic(), syten::SourceLocation::line(), std::lower_bound(), std::make_pair(), syten::minus_on_swap(), std::chrono::high_resolution_clock::now(), syten::EnvVars::prod_check_early, std::vector< T >::push_back(), syten::LimVec< Type, max, MaxType, type >::push_back(), std::vector< T >::reserve(), syten::Tensor< rank >::size(), std::vector< T >::size(), SYTEN_ASSERT_MSG, syten::EnvVars::tensor_time, syten::tensorSortBuckets(), std::to_string(), syten::MemoryUsage::totalSize(), and syten::DenseProduct::validateProductSpecifier().

+ Here is the call graph for this function: