  The optimization of the Relay Transform Matrix (RTM) in a two-hop relay
network with an average relay power constraint and perfect channel state
information at the relay is addressed in this paper. The study considers the
most general case in terms of number of transmit and receive antennas at the
source, relay, and destination, with arbitrary correlation of the received
noise at all terminals. The optimization problem is reduced to a manageable
convex form, which is solved by linear algebra transformation and the KKT
equations. A parametric solution is given, which yields the power constraint
and the capacity achieved with uncorrelated transmitted data. The solution is
shown to be amenable to a \emph{water-filling-like} algorithmic implementation,
which extends earlier literature results addressing the case without the direct
link. Simulation results are reported concerning a Rayleigh relay network
where, in particular, the role of the direct link SNR is precisely assessed.
