Skip to main content

+

Symbol of Operator.

(const Operator lhs + const Operator rhs) -> Operator

Adds two operators together. Returns a generic Operator for basic additions, ComplexOperatorSum when explicitly working with complex coefficients.

Parameters

  • lhs: Left-hand side value.
  • rhs: The second operator in the sum.

Returns

An Operator (generic) or ComplexOperatorSum representing the sum.

Example

var sum1 = X(0) + Y(1)                    // Operator + Operator → Operator (generic)
var sum2 = X(0) + 2.0*Y(1) // Operator + RealOperatorSum → RealOperatorSum
var sum3 = (1+1i)*X(0) + Y(1) // ComplexOperatorSum + Operator → ComplexOperatorSum