introduce a dim function for getting sample dimension of a multivariate distribution