quantumlib / Stim

A fast stabilizer circuit library.
Apache License 2.0
329 stars 95 forks source link

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

Closed hongyehu closed 5 months ago

hongyehu commented 5 months ago

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!

fangzh-umich commented 5 months ago
>>> 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)
hongyehu commented 5 months ago

@fangzh-umich Thank you!

Strilanc commented 5 months ago

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

Looks like it's resolved.