Skip to content

Improve PauliOperator constructor

Vicentini Filippo requested to merge pv/op into master

Created by: PhilipVinc

Allows to construct a PauliOperator by passing a string alone like

PauliOperator("XXYZ")

instead of requiring users to wrap it in a list PauliOperator(["XXYZ"])

Also, now supports passing a single coefficient that is applied to all strings identically

PauliOperator(["XXYZ", "XYZX", "YYYZ"], 0.3) == PauliOperator(["XXYZ", "XYZX", "YYYZ"], [0.3, 0.3, 0.3])

--

By the way, I think we should have simple constructors for Pualistrings like spin.sigmax/y/z but explicitly for Paulis, with the same syntax. But I don't know where to keep them and how to call them.

Merge request reports