add same_space, non-const matrix, tr_of_prod, dim