# Don't understand this circuit

Y. Du, M.-H. Hsieh, T. Liu, S. You, and D. Tao, “On the learnability of quantum neural networks,” arXiv preprint arXiv:2007.12369, 2020.

Why are the two RYs different, the former is a matrix, and the other is a continuous multiplication value. Why does the encoding need 3 times? What determines the number of encodings?

Hi @RX1,

Why are the two RYs different, the former is a matrix, and the other is a continuous multiplication value

Actually they are two slightly different operations, The first operation presented is the RY gate (the matrix as you mentioned). The second operation is a ‘controlled-RY’ gate. This operation can be thought of as only applying a RY gate to a target qubit when a control qubit is in the 1 state, and doing nothing (i.e applying the identity operator) if the control qubit is in the 0 state. The expression provide for this operator can also be expressed as a matrix if you take:

|0><0| = \begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix}

|1><1| = \begin{pmatrix} 0 & 0 \\ 0 & 1 \end{pmatrix}

where \otimes is the tensor product operator.

Why does the encoding need 3 times?

In the section of the paper just above this section, the authors mention that they performed Principle Component Analysis (PCA) to reduce the size of each image from 64 --> 3. This is why we require 3 encoding steps and 3 qubits to encode onto.

What determines the number of encodings?

In general there are many different ways to encode classical data into a quantum circuit. In this case the authors chose to use PCA to reduce their feature space and then encode the reduced features into the quantum system. One could (in theory) keep the entire feature space of 64 pixels and encode that into the circuit, but if you required 1 qubit per feature, then running a 64 qubit simulation would definitely not run on any simulator we have available now.