Complex

Complex is a predefined structured type in Chapel. It is specified in the Types chapter of the Chapel Language Specification.

record complex

It is defined as if it were a record with two fields. Note that both of these fields are of type real. Specifically the imaginary component is not of type imag. This is important when using the getter/setter for the field im.

var re: real
var im: real
proc complex.re ref

When used as a value, this returns the real component of the complex number as a real.

When used as an lvalue, this is a setter that assigns the real component.

proc complex.im ref

When used as a value, this returns the imaginary component of the complex number as a real.

When used as an lvalue, this is a setter that assigns the imaginary component.