View Full Version : assign complex values?

02-22-2012, 04:58 PM
Is COMPLEX and DCOMPLEX the only way to assign numeric real and imaginary values to a complex array? Because I don't want to use COMPLEX if my data is double-precision, and I don't want to use DCOMPLEX due to the cost of type converting it to double if it is not. What is the most memory-efficient way to do the following?

; r is real array, may be double
; i is imaginary array, may be double
cplx = COMPLEX(r, i) ; OR
cplx = DCOMPLEX(r, i) ; ?

Really, what I want to do is get r and i into the variable cplx without losing unnecessarily inflating precision. I suppose I could resort to IF statements, but is their a better way?