utility function: ncomp.