Determining algebraic subgroups from invariant dimensions