Added test for dgm code.
Added incomplete function for dgm that handles arbitrary number of groups.