Function sequant::antisymm::num_closed_loops

Function Documentation

int sequant::antisymm::num_closed_loops(std::vector<Index> init_upper, std::vector<Index> init_lower, std::vector<Index> new_upper, std::vector<Index> new_lower)

function which counts number of closed loops from the starting order of upper and lower indices and the contracted indices. since the ordering of the new contracted indices is arbitrary, the algorithm searched for the upper index which would connect to the lower index checks if contracted lower index closes the loop, if not, continue searching until the corresponding upper index is not present, or the loop closes. keep track of which indices are used so that loops are not double counted

Parameters:
  • init_upper – initial order of upper indices before contraction,

  • init_lower – initial order of lower indices before contraction,

  • new_upper – set of contracted upper indices,

  • new_lower – set of lower contracted indices. @out the number of loops.