Generalized constrained co-inertia analysis