A Dimension Reduction Scheme for the Computation of Optimal Unions of Subspaces