We derive a new representation of Lagrangian subspaces in the form
%
\[
{\mathrm Im}\Pi^T [I,X]^T,
\]
%
where $\Pi$ is a symplectic matrix which is the product of a permutation matrix and a real orthogonal diagonal matrix, and $X$ satisfies
%
\[
\abs{X_{ij}} \leq \begin{cases}1 & \text{if $i=j$,}\\ \sqrt{2} & \text{if $i\neq j$.} \end{cases}
\]
%
This representation allows to limit element growth in the context of doubling algorithms
for the computation of Lagrangian subspaces and the solution of Riccati equations.
It is shown that a simple doubling algorithm using this representation can reach full machine accuracy on a wide range of problems, obtaining invariant subspaces of the same quality as those computed by the state-of-the-art algorithms based on orthogonal transformations.
The same idea carries over to representations of arbitrary subspaces and can be used
for other types of structured pencils.
We introduce a~numerical method for the numerical solution of the Lur'e matrix equations that arise, for instance, in linear-quadratic infinite time horizon optimal control. The method is based on the characterization of the solutions in terms of deflating subspaces of a suitable even matrix pencil. Via a Cayley transformation, the problem is transformed to the discrete-time case. This leaves us with a symplectic problem with several Jordan blocks of eigenvalue 1 and even size, which arise from the remaining eigenvalues at infinity of the original problem. For the solution of this modified problem, we use the {\em structure-preserving doubling algorithm} (SDA), an iterative scheme for the solution of dense continuous- and discrete-time algebraic Riccati equations. Unlike other iterative schemes, this algorithm converges also when the pencil has eigenvalues on the unit circle, as is the case in our problem. Implementation issues such as the choice of the parameter $\gamma$ in the Cayley transform are discussed. The numerical examples presented confirm the effectiveness of this method.