Open y-richie-y opened 1 year ago
I can work on this issue, please assign it to me. Do we have Pauli to be similar to opflow ? What are the expected operations? Can you share a little more detail on the features required? Implementation expectations :
I = Pauli("I")
X = Pauli("X")
Y = Pauli("Y")
Z = Pauli("Z")
pauli_expr = 1.1 * ((1.2 * X) ^ (Y + (1.3 * Z)))
print(pauli_expr)
Outputs
1.56 * XY + 1.43 * XZ
Hi, sorry for the late reply, and thanks for the input! :)
There (now :D) exists already an enum for Pauli-matrices. See here: https://github.com/sg495/pauliopt/blob/42057f8c971e536d51e70adf8bc9a25c5c7722dd/pauliopt/pauli/utils.py#L4
I would still allow an interface like qiskit opflow
featuring: addition, multiplication, and the power operator as Kronecker product, which results in this summation you just described. (The idea behind this would be that it's more intuitive to create a specific Hamiltonian using Paulis )
From reading the link regarding the deprecation of opflow (I thought they just moved it to qi, sorry :D ), from what I see, qiskit displays Paul Gadgets in a very similar fashion towards our current datastructure, so converting them is not a big issue then. Just taking the example from their Migration guide:
OpFlow:
operator = 0.39 * (I ^ Z ^ I) + 0.5 * (I ^ X ^ X)
Quantum Info equivalent:
SparsePauliOp(["IZI", "IXX"], coeffs = [0.39, 0.5])
So @anushkrishnav, what do you think of a data structure that displays the addition, multiplication, and Kronecker product of the Pauli enum as basis and is able to convert them into our PauliPolynomial data structure (which get's then printed?)
@y-richie-y if @anushkrishnav is happy can you assign him the task? :D
I was able to write up a small example that can do addition, and multiplication, but I will take a look at how qiskit does it, I was able to obtain the output I described about but since Opflow has already set an interface it must be quite easy to take notes from that to implement other operations as well. I think such a data structure would be quite useful, Where would be a good starting point to start building this DS ?
Mhmm what do you think of something like this:
class Pauli(Enum):
....
def __add__(self, other):
if isinstance(other, PauliPolynomial):
... # TODO add the pauli matrix to the paulipolynomial
else:
... # TODO add two pauli polynomials together
You can also overwrite the addition multiplication operators on PauliPolynomials. Was just a first idea if you can think of a better data structure, go for it! :)
Is there a Slack/discord/irc I can join? Overriding makes sense, unless we have a requirement for another ds this should make things uniform. I will start with the implementation for this , please assign it to me :)
Hey @anushkrishnav! Thanks for your participation! Feel free to join the Unitary Fund discord, and make a post in the unitaryhack forum channel. I'm not sure if @daehiff is on there, but if so, feel free to DM me (Nate Stemen#5334), and I'll connect the two of you there.
Would be amazing! :)
Ahh and @anushkrishnav you can safely override those methods in the Pauli Enum :)
Sorry for the delay, I had to deal with a few stuff I will start working on them today.
Ahh and @anushkrishnav you can safely override those methods in the Pauli Enum :)
haha thank you, I will get started
Is it possible to share a list of requirement? What operators are required?
A bit confused on the goals
Uhm: required Operators: X, Y, Z and I (the pauli matrices
Requirements:
Basically If you can get from a term like:
I ^ (0.39 * (Z ^ I)) + 0.5 * (I ^ X ^ X)
Towards its corresponding sum of tensor product of pauli representation:
0.39*(I ^ Z ^ I) + 0.5 * (I ^ X ^ X)
(This is possible, since kA ^ B = A ^kB = k (A^B))
Note that XOR != XOR but rather the Kronecker product.
anyone still working on this issue.. I would like to work on this, please lemme know :)
anyone still working on this issue.. I would like to work on this, please lemme know :)
I am dealing with some stuff atm, unable to work on it. if you like to please move ahead, I would be happy to do it if it's still open in the near future. Sorry about it, something came up unexpectedly.
Taken from #4:
Create a class for
Pauli
s. It should have essentially the same interface asqiskit.opflow
.This is an intermediate step to #6, which should take a Pauli string as input and output a trotterised circuit.