cuda-quantum
cuda-quantum copied to clipboard
Generalize exp_pauli()
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)