i have a quantum circuit and i want to find the parameters (angles) of this quantum circuit in a way that the output of the quantum circuit (which is a quantum state) be as close as possible to a desired vector. What method do you propose? i also tried with classical Netwon-Raphson optimization method but the final result was sufficiently good.

import numpy as np

import pennylane as qml

num_qubits = 3

dev = qml.device(“default.qubit”, wires=num_qubits)

a = np.array([np.sqrt(0.1), np.sqrt(0.2), np.sqrt(0.1), np.sqrt(0.3), 0, 0, np.sqrt(0.2), np.sqrt(0.1)])

@qml.qnode(dev)

def circuit(X0, X1, X2, X3, X4, X5, X6):

```
qml.RY(X0, wires=[0])
qml.RY(X1, wires=[1])
qml.RY(X2, wires=[2])
qml.CNOT(wires=[0, 1])
qml.RY(-X1, wires=[1])
qml.CNOT(wires=[0, 2])
qml.RY(X3, wires=[2])
qml.CNOT(wires=[1, 2])
qml.RY(X4, wires=[0])
qml.RY(X5, wires=[1])
qml.RY(X6, wires=[2])
return qml.state()
```

def func(X0, X1, X2, X3, X4, X5, X6):

return np.real(circuit(X0, X1, X2, X3, X4, X5, X6)-a)

the output of func must be close to zero.