 |
» |
|
|
 |
Declares entities of type complex. SyntaxCOMPLEX [kind-spec] [[, attrib-list] ::] entity-list |
 |
- kind-spec
is the kind type parameter that specifies the range
and precision of the entities in entity-list.
kind-spec takes the form: where kind-param represents the
kind of both the real and imaginary parts of the complex number.
It can be a named constant or a constant expression that has the
integer value of 4 or 8. The size of the default type is 4. As an extension, kind-spec can
take the form: *len-param where len-param is the integer
8 or 16 (default = 8), which represents the size of the
whole complex entity. - attrib-list
is a list of one or more of the following attributes,
separated by commas: If attrib-list is present, it must
be followed by the double colon. For information about individual
attributes, see the corresponding statement in this chapter. - entity-list
is a list of entities, separated by commas. Each
entity takes the form: name [( array-spec )] [= initialization-expr] where name is the name of a variable
or function, array-spec is a comma-separated
list of dimension bounds, and initialization-expr
is a complex constant expression. If initialization-expr
is present, entity-list must be preceded
by the double colon.
DescriptionThe COMPLEX
statement is used to declare the length and properties of data that
are approximations to the mathematical complex numbers. A complex
number consists of a real part and an imaginary part. A kind parameter
(if specified) indicates the representation method. The COMPLEX
statement is constrained by the rules for type declaration statements,
including the requirement that it precede all executable statements. As a portability extension, HP Fortran 90 allows the following
syntax for specifying the length of an entity: name [*len] [ ( array-spec )] [= initialization-expr] |
If array-spec is specified, *len
may appear on either side of array-spec.
If name appears with *len,
it overrides the length specified by kind-spec. ExamplesThe following are valid declarations: COMPLEX x, y COMPLEX(KIND=8) :: z COMPLEX,PARAMETER :: t1(2)=(/(3.2, 0), (.04, -1.1)/) ! initialize an array, using an array constructor COMPLEX, DIMENSION(2) :: & cvec=(/(2.294, 6.288E-2), (-1.0096E7, 0)/) ! use slashes as initialization delimiters, an HP extension COMPLEX cx/(2.294, 6.288E-2)/ ! note, no double colon ! the following declarations are equivalent; the second uses the ! HP length specification extension COMPLEX(KIND = 8) x COMPLEX(8) x*16 |
Related statementsDOUBLE COMPLEX Related conceptsFor related information, see the following:
|