Consider i have a parameterized quantum circuit. The output of this quantum state is a complex vector, since i have RZ gates in my circuit. What is the best choice for least square function?

# Least square and optimization of a complex function

Hi @sassan_moradi, great question!

If I understand your question correctly, what you’re trying to find is the distance between 2 quantum states. Least squares is a good metric when you have real values but in this case it may be better to consider using the trace distance.

We use the trace distance in our demo on The Variational Quantum Thermalizer. You will also find an interesting discussion about this in this thread.

Please let me know if this is helpful!

Many thanks. Indeed, very helpful example.

I’m glad you found it helpful!