Implementation of trace and larger / smaller dimension.