This is an old version, view current version.

4.5 Complex (compound) assignment operators

The assignment operator only serves as a component in the assignment statement and is thus not technically a function in the Stan language. With that caveat, it is documented here for completeness.

Assignment of complex numbers works elementwise. If an expression of type int or real is assigned to a complex number, it will be promoted before assignment as if calling to_complex(), so that the imaginary component is 0.0.

void operator=(complex x, complex y)
y = x; assigns a (copy of) the value of y to x.
Available since 2.28

void operator+=(complex x, complex y)
x += y; is equivalent to x = x + y;.
Available since 2.28

void operator-=(complex x, complex y)
x -= y; is equivalent to x = x - y;.
Available since 2.28

void operator*=(complex x, complex y)
x *= y; is equivalent to x = x * y;.
Available since 2.28

void operator/=(complex x, complex y)
x /= y; is equivalent to x = x / y;.
Available since 2.28