FUNCTION: LieTools/SgMonoSortByWgt
USAGE: SgMonoSortByWgt(monolist);
SYNOPSIS: This is a routine to takes a list of monomials in S[g] and produces
  a list of the corresponding weights and a table relating weights to sets of 
  monomials. It should be noted however that this routine simply groups monomials
  by weights, it does not attempt to order the weights (except on a first come,
  first serve basis). 
  
CAVEATS: requires a previously initialized global Lie algebra environment.
  (See LieTools[gSetup].)
EXAMPLE: 
monolist := [g[1],g[2],g[3],g[4]*g[5],g[4]];
           monolist := [g[1], g[2], g[3], g[4] g[5], g[4]]

> wgtlist := map(x->SgLTWgt(x),monolist);

       wgtlist := [[-1, -1], [0, -1], [-1, 0], [0, 0], [0, 0]]

> smonolist := SgMonoSortByWgt(monolist);

  smonolist := [{[-1, 0], [-1, -1], [0, 0], [0, -1]}, table([

        (-1, 0) = [g[3]], (0, 0) = [g[4], g[4] g[5]],

        (0, -1) = [g[2]],

        (-1, -1) = [g[1]]

        ])]

SEE ALSO: LieTools[SgMonoWgt] 
