a general parameter $\alpha_{j_{1},...,j_{N}}$ of the unitary $U_{N}$: $$\label{eq:learningruleq}
\mathrm{\delta} \alpha_{j_{1},...,j_{N}}=-\eta\frac{\partial C}{\partial \alpha_{j_{1},...,j_{N}}}.$$

A simpler and less general form of $U_{N}$ has been sufficient for the tasks discussed in this paper: $$\label{eq:u_nrestr}
U_{3} = \sum_{j=1}^4\ket{\tau_j}{\bra{\tau_j}\otimes T_j},$$ where $\{\ket{\tau_j}\}_{j=1}^4= \{ V\ket{00},V\ket{01}, V\ket{10}, V\ket{11}\}$. $V$ is a general 2-qubit unitary of the form of Eq. \[eq:u\_n\]. Each $T_j$ is similarly a general 1-qubit unitary and one can see, using the methods of [@Rowell04] on Eq. \[eq:u\_n\], that this can be expressed as a linear combination of the Pauli matrices, $\sigma_{j}$: $$U_{1-qubit}=e^{i \alpha_{0}} \Bigg( \cos
\Omega ~\mathbb{1} + i
\frac{\sin{\Omega}}{\Omega} \sum_{j=1}^{3} \alpha_{j} \sigma_{j} \Bigg),$$ where $\Omega = \sqrt{\alpha_{1}^2+\alpha_{2}^2+\alpha_{3}^2}$ [@Rowell04]. To extend this to higher dimensional unitaries, see e.g. [@Hedemann13].

The cost function we use for the quantum neural networks is, with experimental feasibility in mind, determined by the expectation values of local Pauli matrices $ (\sigma_{1}, \sigma_{2}, \sigma_{3})$ on individual output qubits, $j$. It has the form $$C=\sum_{i,j} f_{ij} (\langle \sigma_i^{(j)} \rangle_{\mathrm{actual}} -\langle \sigma_i^{(j)} \rangle_{\mathrm{desired}})^2$$ where $f_{ij}$ is a real non-negative number (in the examples to follow $f_{ij}\in \{0,1\}$). We note in the classical mode of operation, where the total density matrix state is diagonal in the computational basis, only $\sigma_3$ will have 