Closed vishal-ph closed 1 year ago
Hello @vishal-ph! I am new to OpenQAOA and woud like to implement this functionality. Could you please assign it to me and if possible show any relavant literature to show matrix rep?
@manulpatel, thanks for taking the initiative! In OpenQAOA, the Hamiltonian object is a sum over the terms of the Pauli and Identity operators set tensored over n-qubits. The goal is to represent the sum of these terms in a matrix form. To get started, you may want to start looking at the matrix representation of the Pauli operators here https://en.wikipedia.org/wiki/Pauli_matrices and think about their tensor products.
@AlexisRalli, thanks for your contribution to OpenQAOA and helping close this issue!
@AlexisRalli congrats on the nice hack! Don't forget to comment here on this issue so that you can be assigned to the issue!
Thanks for integrating the code!
Prerequisites
Before raising this feature request, I made sure:
Is your feature request related to a problem? Please describe.
The class
Hamiltonian
in OpenQAOA defined insrc/openqaoa-src/openqaoa/qaoa_components/ansatz_constructor/operators.py
is responsible for constructing theCost
andMixer
Hamiltonians in QAOA. It fundamentally describes the Hamiltonian object via list ofPauliOp
s defined on a set of qubits and a corresponding list of their coefficients. Implicitly, the definition of the Hamiltonian is then assumed as follows: $$H = \sumi \alpha{i} Pi + \sum{ij} J{ij} P{ij},$$ where $\ Pi, P{ij}$ are one-qubit and two-qubitPauliOp
s respectively.Implement a method in this class that returns the matrix representation of the
Hamiltonian
object. This will be a $2^n x 2^n$ dimensional sum over all Pauli entries as shown above.Describe the solution you'd like