An alternative implementation of base::duplicated.matrix(), base:anyDuplicated.matrix() and base::unique.matrix() for matrices of atomic mode, avoiding the time consuming collapse of the matrix into a character vector. An extra grpDuplicated() function is added, which groups duplicated elements together.
copied from cf-staging / r-uniqueatommat