# How does VQE performs the measurement on a given Hamiltonian?

I'm trying to understand, given a specific Hamiltonian, for example $$H = Z\otimes Z+X\otimes Z$$, does the VQE algorithm calculates the expectation value of $$Z\otimes Z$$ first or does it calculates the expectation value of $$X\otimes Z$$ first? couldn't understand it from the source code.

Thank you very much!

• If you use IBM hardware, you can look at the order of the circuit being executed on the hardware and see which one is being executed first. Oct 15 '20 at 17:00
• I see you found your answer, but why would matter though which one it measure first? Oct 15 '20 at 18:15

For a VQE, the circuit applies $$Z \otimes Z$$ and $$X \otimes Z$$ on different iterations, and their expectation values are added classically. So, it doesn't really matter which is run first on a quantum computer - they're entirely different circuits.
Thank you for your answers. After a check it appears that the VQE algorithm processes first the rightmost expression and only then the leftmost. i.e. it first processes $$X\otimes Z$$ and then $$Z\otimes Z$$