Minimizing a quadratic function w.r.t. a rotation matrix

I have an objective function of the following quadratic form:

$\displaystyle f(\textbf{R}) = \sum_i \textbf{y}_i^\textsf{T} \textbf{R}^\textsf{T} \textbf{P}_i \textbf{R} \textbf{y}_i - \textbf{x}_i^\textsf{T} \textbf{P}_i \textbf{R} \textbf{y}_i - \textbf{y}_i^\textsf{T} \textbf{R}^\textsf{T} \textbf{P}_i \textbf{x}_i + \textbf{x}_i^\textsf{T} \textbf{P}_i \textbf{x}_i$

where $\displaystyle \textbf{P}_i$ is an NxN matrix (properties described below), $\displaystyle \textbf{x}_i$ and $\displaystyle \textbf{y}_i$ are Nx1 vectors, and $\displaystyle \textbf{R}$ is an NxN rotation matrix (including reflections), s.t. $\displaystyle \textbf{R}^\textsf{T} \textbf{R} = \textbf{I} $ (identity). I would like to minimize $\displaystyle f(\textbf{R})$, given that constraint.

I would like to know how this might most efficiently be achieved in the following cases:

1. $\displaystyle \textbf{P}_i = s\textbf{I}$, $\displaystyle s$ being a scalar.

2. $\displaystyle \textbf{P}_i = \textrm{diag}\{\textbf{q}_i\}$, $\displaystyle \textbf{q}_i$ being an Nx1 vector.

3. $\displaystyle \textbf{P}_i$ is a positive semi-definite (symmetric) matrix.

It is worth noting that if there is a specific or simpler solution for N = 3, then I'd be interested in that, though the general solution is of primary interest.

Can you help?