PauliProduct¶
from cascaqit import PauliProduct
PauliProduct ¶
PauliProduct(
terms: Iterable[PauliInput], *, name: str | None = None
) -> Observable
Create an Observable from Pauli factors, preserving declaration order. Each item in terms is a PauliTerm or a (target, basis) pair. Target is a logical name; basis is an uppercase I, X, Y or Z string, or a PauliBasis enum. PauliTerm and PauliBasis belong to cascaqit.observables.
Name is optional and defaults to joined factors such as X(q0)*Y(q1). Terms cannot be empty or repeat a target. Simplify successive operators on the same target mathematically before creating this product. Wrong input shapes raise TypeError; unsupported bases, empty terms or duplicate targets raise ValueError.
from cascaqit import PauliProduct
xy = PauliProduct((("q0", "X"), ("q1", "Y")), name="XY")
assert xy.targets == ("q0", "q1")
assert tuple(b.value for b in xy.bases) == ("X", "Y")
The return value declares a product without a coefficient or evaluated expectation. Use PauliHamiltonian for weighted sums and ObservableSet for batches. See Hamiltonians and observables.