##
DCOMPLEX

The
DCOMPLEX
function returns double-precision
complex scalars or arrays given one or two scalars or arrays. If only one parameter is supplied, the imaginary part of the result is zero, otherwise it is set to the value of the *
Imaginary*
parameter. Parameters are first converted to double-precision floating-point. If either or both of the parameters are arrays, the result is an array, following the same rules as standard IDL operators. If three parameters are supplied, DCOMPLEX extracts fields of data from *
Expression*
.

###
Calling Sequence

Result = DCOMPLEX(*
Real [, Imaginary]*
)

or

Result = DCOMPLEX(*
Expression, Offset, Dim*
_{
1}
*
[, ..., Dim*
_{
n}
*
]*
)

###
Arguments

####
Real

Scalar or array to be used as the real part of the complex result.

####
Imaginary

Scalar or array to be used as the imaginary part of the complex result.

####
Expression

The expression from which data is to be extracted.

####
Offset

Offset from beginning of the *
Expression*
data area. Specifying this argument allows fields of data extracted from *
Expression*
to be treated as complex data. See the description in
Constants and Variables
for details.

####
D_{
i}

When extracting fields of data, the *
D*
_{
i}
arguments specify the dimensions of the result. The dimension parameters can be any scalar expression. Up to eight dimensions can be specified. If no dimension arguments are given, the result is taken to be scalar.

When converting from a string argument, it is possible that the string does not contain a valid floating-point value and no conversion is possible. The default action in such cases is to print a warning message and return 0. The ON_IOERROR procedure can be used to establish a statement to be jumped to in case of such errors.

###
Example

Create a complex array from two integer arrays by entering the following commands:

A = [1,2,3]

B = [4,5,6]

C = DCOMPLEX(A, B)

PRINT, C

*
*
IDL*
prints:*

( 1.0000000, 4.0000000)( 2.0000000, 5.0000000)

( 3.0000000, 6.0000000)