; $Id: complexround.pro,v 1.1 1993/04/02 19:43:31 idl Exp $ ; Copyright (c) 1992-1993, Research Systems Inc. All rights ; reserved. Unauthorized reproduction prohibited. FUNCTION COMPLEXROUND, INPUT ;+ ;NAME: ; COMPLEXROUND ; ;PURPOSE: ; Rounding a complex array. ; ;CATEGORY: ; Numerical Analysis ; ;CALLING SEQUENCE: ; OUTPUT=COMPLEXROUND(INPUT) ; ;INPUTS: ; The complex matrix to be rounded. ; ;OPTIONAL INPUT PARAMETERS: ; None ; ;OUTPUTS: ; Returns the rounded complex matrix. ; ;SIDE EFFECTS: ; None ; ;RESTRICTIONS: ; Input matrix must be complex. ; ;PROCEDURE: ; This function rounds the real and imaginary ; components of the input array. ; ;MODIFICATION HISTORY: ; GGS, SEPTEMBER, 1992 ;- dimension=size(input) ; determine size of input matrix output=complexarr(dimension(1),dimension(2)) real=float(input) ; separate into real and imaginary imag=imaginary(input) z1=real+.5 ; round real components neg1=where(real lt 0,count1) if count1 ne 0 then z1(neg1)=z1(neg1)-1 z1=fix(z1) z2=imag+.5 ; round imaginary components neg2=where(imag lt 0,count2) if count2 ne 0 then z2(neg2)=z2(neg2)-1 z2=fix(z2) output=complex(z1,z2) ; form rounded complex matrix return,output end