netket.operator.SumOperator#
- class netket.operator.SumOperator[source]#
Bases:
objectBase class for sum of quantum operators.
This class represents a linear combination of quantum operators with coefficients, implementing the mathematical concept of \(\sum_i c_i \hat{H}_i\) where \(c_i\) are scalar coefficients and \(\hat{H}_i\) are quantum operators.
The class uses a metaclass dispatch mechanism to automatically select the appropriate specialized subclass based on the types of operators being summed:
SumDiscreteJaxOperatorfor sums ofDiscreteJaxOperatorinstancesSumDiscreteOperatorfor sums ofDiscreteOperatorinstancesSumContinuousOperatorfor sums ofContinuousOperatorinstancesSumGenericOperatorfor mixed operator types or fallback cases.
- Inheritance

- __init__(operators, *args, coefficients=1.0, dtype=None, **kwargs)[source]#
Constructs a Sum of Operators.
- Parameters:
*operators (
Iterable[AbstractHilbert]) – An iterable of quantum operators to be summed. All operators must act on the same Hilbert space.coefficients (
Union[float,Iterable[float]]) – Scalar coefficient or iterable of coefficients for each operator. If a single scalar is provided, it will be used for all operators. Default is 1.0.dtype – Data type for the coefficients. If None, it will be inferred from the operators and coefficients.
- Attributes
- coefficients#
The coefficients for each operator term in the sum.
Each coefficient corresponds to \(c_i\) in the sum \(\sum_i c_i \hat{O}_i\), where each coefficient multiplies its corresponding operator from
operators.- Returns:
A JAX array containing the scalar coefficients for each operator.
- dtype#
The data type of the operator coefficients.
- Returns:
The numpy/JAX dtype used for the coefficients array.
- is_hermitian#
- operators#
The tuple of all operators in the terms of this sum.
Each operator corresponds to a term \(\hat{O}_i\) in the sum \(\sum_i c_i \hat{O}_i\), where each operator is multiplied by its corresponding coefficient from
coefficients.- Returns:
A tuple containing all the quantum operators being summed.
Methods