cuda-quantum icon indicating copy to clipboard operation
cuda-quantum copied to clipboard

Generalize exp_pauli()

Open poojarao8 opened this issue 1 year ago • 2 comments

Required prerequisites

  • [X] Search the issue tracker to check if your feature has already been mentioned or rejected in other issues.

Describe the feature

It will be great to have the exp_paul function take the spin_op as the input or the string form of it. I believe the issue with H.to_string() is that it dumps coefficients and exp_pauli takes pauli words only, but I haven't fully investigated it yet.

import cudaq
from cudaq import spin

kernel = cudaq.make_kernel()
qreg = kernel.qalloc(1)

H = spin.z(0)
    
kernel.exp_pauli(0.3, qreg, H)
#kernel.exp_pauli(0.3, qreg, H.to_string()) ###This would work great too.

cudaq.sample(kernel)

poojarao8 avatar Oct 12 '23 00:10 poojarao8