The COMPLEX function returns complex scalars or arrays given one or two scalars or arrays.
Create a complex array from two integer arrays by entering the following commands:
A = [1,2,3]
B = [4,5,6]
C = COMPLEX(A, B)
( 1.00000, 4.00000)( 2.00000, 5.00000)
( 3.00000, 6.00000)
The real and imaginary parts of the complex array can be extracted as follows:
PRINT, 'Real Part: ', REAL_PART(C)
PRINT, 'Imaginary Part: ', IMAGINARY(C)
Real Part: 1.00000 2.00000 3.00000
Imaginary Part: 4.00000 5.00000 6.00000
Result = COMPLEX( Real[, Imaginary] [, /DOUBLE])
Result = COMPLEX(Expression, Offset, D1[, ..., D8] [, /DOUBLE])
Returns a single-precision complex value or array 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. If either or both of the parameters are arrays, the result is an array, following the same rules as standard IDL operators. If three or more parameters are supplied, COMPLEX extracts fields of data from Expression.
Scalar or array to be used as the real part of the complex result.
Scalar or array to be used as the imaginary part of the complex result.
The expression from which data is to be extracted.
Offset from beginning of the Expression data area. Specifying this argument allows fields of data extracted from Expression to be treated as complex data.
When extracting fields of data, the Di arguments specify the dimensions of the result. If no dimension arguments are given, the result is taken to be scalar.
The Di arguments can be either an array or a series of scalar expressions specifying the dimensions of the result. If a single argument is specified, it can be either a scalar expression or an array of up to eight elements. If multiple arguments are specified, they must all be scalar expressions. Up to eight dimensions can be specified.
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.
Set this keyword to return a double-precision complex result. Setting this keyword is equivalent to using the DCOMPLEX function, and is provided as a programming convenience.
Thread Pool Keywords
This routine is written to make use of IDL’s thread pool, which can increase execution speed on systems with multiple CPUs. The values stored in the !CPU system variable control whether IDL uses the thread pool for a given computation. In addition, you can use the thread pool keywords TPOOL_MAX_ELTS, TPOOL_MIN_ELTS, and TPOOL_NOTHREAD to override the defaults established by !CPU for a single invocation of this routine. See Thread Pool Keywords for details.
BYTE, CONJ, DCOMPLEX, DOUBLE, FIX, FLOAT, IMAGINARY, LONG, LONG64, REAL_PART, STRING, UINT, ULONG, ULONG64