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.
Result = DCOMPLEX( Real [, Imaginary] )
Result = DCOMPLEX( Expression, Offset [, D1 [, ..., D8]] )
Returns double-precision complex scalars or arrays given one or two scalars or arrays.
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. See the description in Constants and Variables for details.
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.
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
Create a complex array from two integer arrays by entering the following commands:
; Create the first integer array: A = [1,2,3] ; Create the second integer array: B = [4,5,6] ; Make A the real parts and B the imaginary parts of the new ; complex array: C = DCOMPLEX(A, B) ; See how the two arrays were combined: PRINT, C
( 1.0000000, 4.0000000)( 2.0000000, 5.0000000) ( 3.0000000, 6.0000000)
The real and imaginary parts of the complex array can be extracted as follows:
; Print the real part of the complex array C: PRINT, 'Real Part: ', REAL_PART(C) ; Print the imaginary part of the complex array C: PRINT, 'Imaginary Part: ', IMAGINARY(C)
Real Part: 1.0000000 2.0000000 3.0000000 Imaginary Part: 4.0000000 5.0000000 6.0000000
BYTE, COMPLEX, CONJ, DOUBLE, FIX, FLOAT, IMAGINARY, LONG, LONG64, REAL_PART, STRING, UINT, ULONG, ULONG64