Hi there. I have a large matrix which I have been able to decompose into Pauli matrices using the decompose_hamiltonian() function and have been able to convert it to Hamiltonian form based on the provided docs.
How can I create a circuit from this Hamiltonian now? I don’t understand how the coeffs and obs output work.
Hi @rachel7838,
Welcome to the forum!
It depends on what exactly you want to do with the Hamiltonian, but I can offer some insights on typical use cases.
Often, the goal of the quantum algorithm is to compute an expectation value of the Hamiltonian with respect to a state prepared by a quantum circuit. In this case, you can pass the Hamiltonian to qml.ExvpalCost(), together with the circuit and device, to compute the expectation value. This is done for example when running the VQE algorithm.
The other example I can think of is to create a circuit applying the time evolution operator e^{-iHt}. This can be done using the ApproxTimeEvolution() template, which also takes the Hamiltonian as one of its parameters.
Let me know if this is what you had in mind!
Best,
Juan Miguel