I am looking to compute the diagonal entries of a projection matrix
$$ P(X) = X (X' X)^{-1} X' $$
where $X$ is a design matrix that contains high dimensional fixed effects, that is, $X = [A ~~ D]$ with $A$ covariates and $D$ sets of fixed effects, $D = [D_1 ~~ D_2 ~~ \cdots~~]$. Generating and operating with the matrix $D$ can be computationally prohibitive, but I know that
$$ P(X) = P(D) + P((I - P(D)) A) $$
It's computationally feasible to obtain $(I - P(D)) A$, and thus the diagonal entries of $P((I - P(D)) A)$, without generating the matrix $D$. However, I don't know how to compute the diagonal entries of $P(D)$ without generating $D$ (unless there is only one set of fixed effects, in which case the diagonal entries of $P(D)$ would be one over the number of rows in each group).
Is there a way to compute the diagonal entries of $P(D)$ without creating the matrix $D$?