  The real symplectic Stiefel manifold is the manifold of symplectic bases of
symplectic subspaces of a fixed dimension. It features in a large variety of
applications in physics and engineering. In this work, we study this manifold
with the goal of providing theory and matrix-based numerical tools fit for
basic data processing. Geodesics are fundamental for data processing. However,
these are so far unknown. Pursuing a Lie group approach, we close this gap and
derive efficiently computable formulas for the geodesics both with respect to a
natural pseudo-Riemannian metric and a novel Riemannian metric. In addition, we
provide efficiently computable and invertible retractions. Moreover, we
introduce the real symplectic Grassmann manifold, i.e., the manifold of
symplectic subspaces. Again, we derive efficient formulas for pseudo-Riemannian
and Riemannian geodesics and invertible retractions. The findings are
illustrated by numerical experiments, where we consider optimization via
gradient descent on both manifolds and compare the proposed methods with the
state of the art. In particular, we treat the 'nearest symplectic matrix'
problem and the problem of optimal data representation via a low-rank
symplectic subspace. The latter task is associated with the problem of finding
a 'proper symplectic decomposition', which is important in structure-preserving
model order reduction of Hamiltonian systems.
