#
# If R is reducible or non-xtal, the result is simply a long root in the
# dominant chamber. (Highest roots are not defined in these cases).
# We could break the loop as soon as a longer root is found, but in
# reducible cases this might be short.
#
`coxeter/highest_root`:=proc(R) local S,v,l,ll,r;
  S:=coxeter['base'](R); ll:=0; v:=0;
  for r in S do
    l:=coxeter['iprod'](r,r);
    if l>ll then v:=r; ll:=l fi;
  od;
  coxeter['vec2fc'](v,S);
end:
#
save `coxeter/highest_root`, cat(HomeLib,`/coxeter/highest_root.m`);
read cat(HomeLib,`/help/coxeter/highest_root`);
quit;

