union_of_dimensions function

Perform union of dimensions