Function sequant::detail::fold_deltas

Function Documentation

inline bool sequant::detail::fold_deltas(std::shared_ptr<Product> &product, const container::set<Index> &external_indices)

folds the Kronecker deltas (and Kronecker-equivalent overlaps) of product, which are real and idempotent:

  • a self-delta (between an index and itself) is 1 if its index is bound elsewhere: it is external, or appears in another slot of the product. Otherwise it is the only occurrence of a dummy index, hence the sum over it (the extent of its space), and one self-delta per such index is kept;

  • a delta between two external indices that the deltas kept so far already identify is redundant (δ_ij δ_ji = δ_ij, δ_ij δ_jk δ_ki = δ_ij δ_jk) and becomes 1. A delta with a dummy index is left to the replacement rules, since dropping it would change the slots the dummy is summed over. A Kronecker-equivalent overlap that is kept becomes a Kronecker delta: the bases of its indices are final, since neither a lone dummy nor an external index is replaced by a rule.

Returns:

true if made any changes