What is variational quantum linear solver and variational quantum eigen solver? What all codebook exercises I should solve to develop some grasp on these topics.

I am trying to understand : Variational Quantum Linear Solver | PennyLane Demos but not able to understand anything at all.

Hey @Manu_Chaudhary, thanks for checking in.

So both of these (VQE and VQLS) are full algorithms that do something specific.

VQE is a very useful algorithm that uses variational circuits to find the ground-state energy of a quantum system, and VQLS solves linear systems of equations (represented using unitary matrices).

It’s actually really normal to feel like it’s difficult to understand how an algorithm works when you’re looking at it for the first time. Are you getting stuck somewhere in the Introduction, or with the code implementation?

Thank you @Ivana_at_Xanadu for the response. I get stuck with mathematical equations and the Circuit diagram. If I can understand them, then I think I can understand the code somehow.

Hmm, I think you can try looking at the H.6 Codebook node if you want a little bit of a push when it comes to linear combinations of unitaries: Xanadu Quantum Codebook

But honestly, understanding derivations is not always the easiest thing, so you shouldn’t feel bad about it. There’s code there for a reason — sometimes it’s just a lot easier to understand how something works if you look at the implementation itself. So if you’re a bit stuck on the theory, my advice would be to check out the code, run it step-by-step, try out different inputs… and *then* go back to the mathematics again. Sometimes that’s what you need for the theory to ‘click’.

Thank you @Ivana_at_Xanadu . I will follow the technique you suggested.

Suppose, I go through your code using a debugger line by line, then what should I try to grasp?

I think you can try to compare the two. The example that’s coded in the tutorial is actually very simple (which means the code is short, which is always helpful ). That means you should be able to figure out what it does and see that it works — that it minimizes the cost function. I would stop there and then look at the introduction again.

Sometimes it’s much easier to understand why something works in theory by first seeing how it works in practice. But it’s normal that it takes some time to figure this out. In research it’s rare to understand something just by reading it, you need to work it out for yourself. It would be so much easier if you could just read something and that’s it, but a part of the fun is getting to that moment when it ‘clicks’, when you understand how and why an algorithm or protocol works.

Good luck!