quantumlib/Stim

【question】how to extract information from stim.PauliString("..")

Closed this issue · 3 comments

Hi there,
Suppose I have stim.PauliString("+Z_Z_ZZ__"). I want to extract its data information in python: either as a string "+Z_Z_ZZ__" or some binary vector. How should I do this?
Many thanks!

>>> import stim
>>> p = stim.PauliString("+Z_Z_ZZ__")
>>> str(p)
'+Z_Z_ZZ__'
>>> p.to_numpy()
(array([False, False, False, False, False, False, False, False]), array([ True, False,  True, False,  True,  True, False, False]))
>>> p.sign
(1+0j)

@fangzh-umich Thank you!

Note questions like this should be asked on the quantum computing stack exchange.

Looks like it's resolved.