change the internal representation of grouped pdmat from 3D array to vector of matrices