Template Function sequant::detail::compute_index_replacement_rules

Function Documentation

template<Statistics S>
container::map<Index, Index> sequant::detail::compute_index_replacement_rules(std::shared_ptr<Product> &product, const container::set<Index> &external_indices, const std::set<Index, Index::LabelCompare> &all_indices)

computes index replacement rules

If using orthonormal representation, overlaps are Kronecker deltas, hence summations can be reduced by index replacements. Reducing sums over dummy (internal) indices uses 2 rules:

  • if a Kronecker delta binds 2 internal indices I and J, replace them with a new internal index representing intersection of spaces of I and J, !!remove delta!!

  • if a Kronecker delta binds an internal index J and an external index I:

    • if space of J includes space of I, replace J with I, !!remove delta!!

    • if space of J is a subset of space of I, replace J with a new internal index representing intersection of spaces of I and J, !!keep the delta!!

Throws:

zero_result – if product is zero for any reason, e.g. because it includes an overlap of 2 indices from nonoverlapping spaces