  We describe the geometry of the incompressible porous medium (IPM) equation:
we prove that it is a gradient dynamical system on the group of area-preserving
diffeomorphisms and has a special double-bracket form. Furthermore, we show its
similarities and differences with the dispersionless Toda system. The Toda flow
describes an integrable interaction of several particles on a line with an
exponential potential between neighbours, while its continuous version is an
integrable PDE, whose physical meaning was obscure. Here we show that this
continuous Toda flow can be naturally regarded as a special IPM equation, while
the key double-bracket property of Toda is shared by all equations of the IPM
type, thus manifesting their gradient and non-autonomous Hamiltonian origin.
Finally, we comment on Toda and IPM modifications of the QR diagonalization
algorithm, as well as describe double-bracket flows in an invariant setting of
general Lie groups with arbitrary inertia operators.
