pure function lMatIndSym(a, b, c, i, j, k) result(index)
! Indexing function implementing 48-fold symmetry:
! Symmetric with respect to permutation of pairs (a,i), (b,j) and (c,k) as well as
! with respect to exchange of a<->i, b<->j and c<->k
! Input: a,b,c - orbital indices of electrons
! i,j,k - orbital indices of holes
! Output: index - contiguous index I(a,b,c,i,j,k) with the aforementioned symmetry
integer(int64), value, intent(in) :: a, b, c ! occupied orb indices
integer(int64), value, intent(in) :: i, j, k ! unoccupied orb
integer(int64) :: index
integer(int64) :: ai, bj, ck
ai = fuseIndex(a, i)
bj = fuseIndex(b, j)
ck = fuseIndex(c, k)
! sort the indices
if (ai > bj) call swap(ai, bj)
if (bj > ck) call swap(bj, ck)
if (ai > bj) call swap(ai, bj)
index = ai + bj * (bj - 1) / 2 + ck * (ck - 1) * (ck + 1) / 6
end function lMatIndSym