Generalized alternating projections is an algorithm that alternates relaxed projections onto a finite number of sets to find a point in their intersection. We consider the special case of two linear subspaces, for which the algorithm reduces to a matrix iteration. For convergent matrix iterations, the asymptotic rate is linear and decided by the magnitude of the subdominant eigenvalue. In this paper, we show how to select the three algorithm parameters to optimize this magnitude, and hence the asymptotic convergence rate. The obtained rate depends on the Friedrichs angle between the subspaces and is considerably better than known rates for other methods such as alternating projections and Douglas-Rachford splitting. We also present an adaptive scheme that, online, estimates the Friedrichs angle and updates the algorithm parameters based on this estimate. A numerical example is provided that supports our theoretical claims and shows very good performance for the adaptive method.Definition 1 The principal angles θ k ∈ [0, π/2], k = 1, . . . , p between two subspaces U, V ∈ R n , where p = min(dim U, dim V), are recursively defined by cos θ k := max u k ∈U , v k ∈V u k , v k s.t. u k = v k = 1, u k , v i = u i , v k = 0, ∀ i = 1, ..., k − 1.