ComplexTerm¶
- class zixy.qubit.pauli.ComplexTerm(qubits: int | Qubits = 0, source: Cmpnt[ImplT, SpecT] | SpecT | tuple[SpecT | Cmpnt[ImplT, SpecT], CoeffT | None] = '')[source]¶
Bases:
Term[complex]A term consisting of a Pauli string and a complex coefficient.
A single qubit-based term consisting of a Pauli string and a
complexcoefficient that may be an owning instance referencing a single element in aTermDatainstance, or a view on an element in another collection.- __imul__(rhs: int | float | complex | Sign | ComplexSign | Expr | String | Term[CoeffT]) Self¶
In-place multiplication of
selfbyrhs.
- __init__(qubits: int | Qubits = 0, source: Cmpnt[ImplT, SpecT] | SpecT | tuple[SpecT | Cmpnt[ImplT, SpecT], CoeffT | None] = '')¶
Initialize the term.
- Parameters:
qubits – The qubit register or qubit count.
source – The term specifier to use for default qubits and initial value.
- __mul__(rhs: OtherCoeffT | String | Term[OtherCoeffT]) Term[Any][source]¶
- Overloads:
self, other (Sign) → ComplexTerm
self, other (ComplexSign) → ComplexTerm
self, other (float) → ComplexTerm
self, other (complex) → ComplexTerm
self, other (Expr) → SymbolicTerm
self, other (String) → ComplexTerm
self, other (SignTerm) → ComplexTerm
self, other (ComplexSignTerm) → ComplexTerm
self, other (RealTerm) → ComplexTerm
self, other (ComplexTerm) → ComplexTerm
self, other (SymbolicTerm) → SymbolicTerm
Multiplication of
selfbyrhs.
- __rmul__(lhs: OtherCoeffT | String | Term[OtherCoeffT]) Term[Any][source]¶
- Overloads:
self, other (Sign) → ComplexTerm
self, other (ComplexSign) → ComplexTerm
self, other (float) → ComplexTerm
self, other (complex) → ComplexTerm
self, other (Expr) → SymbolicTerm
self, other (String) → ComplexTerm
self, other (SignTerm) → ComplexTerm
self, other (ComplexSignTerm) → ComplexTerm
self, other (RealTerm) → ComplexTerm
self, other (ComplexTerm) → ComplexTerm
self, other (SymbolicTerm) → SymbolicTerm
Multiplication of
lhsbyself.
- aliases(other: Term[Any, Any, Any]) bool¶
Determine whether
selfis a view of the same component asother.
- clear() None¶
Set the value of the component to zero and the coefficient to unity.
Note
This method operates in-place.
- property coeff: CoeffT¶
Get a copy of the coefficient of
self.
- conj_clifford_list(gates: GateList) None¶
Conjugate
selfby a list of Clifford gates.- Parameters:
gates – The Clifford gates to conjugate by.
Note
This method operates in-place.
- classmethod from_cmpnt_coeff(cmpnt: Cmpnt[ImplT, SpecT], coeff: CoeffT) Self¶
Factory to make an instance of
clsfrom a component and a coefficient.- Parameters:
cmpnt – Component to copy from.
coeff – Coefficient scaling the
cmpntin the new instance.
- Returns:
An instance of
clswith the given component and coefficient.
- classmethod from_str(source: str, *args: Any, **kwargs: Any) Self¶
Create an instance of
clsfrom a string.- Parameters:
source – String to parse.
*args – Positional arguments to forward to the component constructor.
**kwargs – Keyword arguments to forward to the component constructor.
- Returns:
An instance of
clsparsed fromsource.
- into(t: type[OutT]) OutT¶
Clone
selfinto a new related container of typet.- Parameters:
t – Type of the new container to create.
- Returns:
A new instance of
tcontaining the same data asself.
- classmethod parse(source: str) Self¶
Parse a string into an instance of
cls.- Deprecated:
use
from_str()instead.
- Parameters:
source – String to parse.
- Returns:
An instance of
clsparsed fromsource.
- set(source: Self | Cmpnt[ImplT, SpecT] | SpecT | tuple[SpecT | Cmpnt[ImplT, SpecT], CoeffT | None]) None¶
Set the value of the term.
- Parameters:
source – Specification for the new value.
Note
This method operates in-place.