  The problem of an optimal mapping between Hilbert spaces $IN$ and $OUT$,
based on a series of density matrix mapping measurements $\rho^{(l)} \to
\varrho^{(l)}$, $l=1\dots M$, is formulated as an optimization problem
maximizing the total fidelity $\mathcal{F}=\sum_{l=1}^{M} \omega^{(l)}
F\left(\varrho^{(l)},\sum_s B_s \rho^{(l)} B^{\dagger}_s\right)$ subject to
probability preservation constraints on Kraus operators $B_s$. For
$F(\varrho,\sigma)$ in the form that total fidelity can be represented as a
quadratic form with superoperator $\mathcal{F}=\sum_s\left\langle
B_s\middle|S\middle| B_s \right\rangle$ (either exactly or as an approximation)
an iterative algorithm is developed to find the global maximum. The result
comprises in $N_s$ operators $B_s$ that collectively form an $IN$ to $OUT$
quantum channel $A^{OUT}=\sum_s B_s A^{IN} B_s^{\dagger}$. The work introduces
two important generalizations of unitary learning: 1. $IN$/$OUT$ states are
represented as density matrices. 2. The mapping itself is formulated as a
general quantum channel. This marks a crucial advancement from the commonly
studied unitary mapping of pure states $\phi_l=\mathcal{U} \psi_l$ to a general
quantum channel, what allows us to distinguish probabilistic mixture of states
and their superposition. An application of the approach is demonstrated on
unitary learning of density matrix mapping $\varrho^{(l)}=\mathcal{U}
\rho^{(l)} \mathcal{U}^{\dagger}$, in this case a quadratic on $\mathcal{U}$
fidelity can be constructed by considering $\sqrt{\rho^{(l)}} \to
\sqrt{\varrho^{(l)}}$ mapping, and on a general quantum channel of Kraus rank
$N_s$, where quadratic on $B_s$ fidelity is an approximation -- a quantum
channel is then built as a hierarchy of unitary mappings. The approach can be
applied to study decoherence effects, spontaneous coherence, synchronizing,
etc.
