A duality theory for some non-convex functions of matrices