Multidetector multicomponent spectral matching and applications for cosmic microwave background data analysis