Convex functions of quadratic forms