Extrema of sums of heterogeneous quadratic forms