Skip to main content

+=

Symbol of RealOperatorSum.

(RealOperatorSum lhs += const Operator rhs) -> void

Adds an Operator to the sum. Operators without explicit coefficients default to 1.0. Important: Coefficients are NOT automatically combined - each term is kept separate. Use the merged() function if you want to combine like terms.

Parameters

  • lhs: Left-hand side value.
  • rhs: The Operator to add to the sum.

Example

var sum = RealOperatorSum()
sum += X(0) // sum = 1*X(0)
sum += Y(1) // sum = 1*X(0) + 1*Y(1)
sum += X(0) // sum = 1*X(0) + 1*Y(1) + 1*X(0) (NOT combined!)
var combined = merged(sum) // Use merged() to get 2*X(0) + 1*Y(1)