Function sequant::mbpt::WK_biorthogonalization_filter

Function Documentation

ExprPtr sequant::mbpt::WK_biorthogonalization_filter(ExprPtr expr, const container::svector<container::svector<Index>> &ext_idxs)

filters out the nonunique terms in Wang-Knizia biorthogonalization

WK biorthogonalization rewrites biorthogonal expressions as a projector onto non-null-space (NNS) applied to the biorothogonal expressions where out of each group of terms related by permutation of external indices those with the largest coefficients are selected. This function performs the selection by forming groups of terms that are equivalent modulo external index permutation (all terms in a group have identical graph hashes).

This function processes a sum expression, grouping product terms by hash of their canonicalized tensor network forms. For each group, it retains only the terms with the largest absolute scalar coefficient.

Parameters:
  • expr – The input expression, expected to be a Sum of Product terms.

  • ext_idxs – A vector of external index groups. The function will not apply the filtering logic if ext_idxs.size() is 2 or less.

Returns:

A new ExprPtr representing the filtered and compacted expression.