function delind,ina,ind_arr

;+
; NAME
;	delind
; PURPOSE
;  	Return an array comprising an array of elements which are NOT
;	common in the 2 input arrays.
; CALLING SEQUENCE
;	C=delind(A,B)
; INPUTS
; 	A, B are the 2 arrays, e.g., A=[1,2,4,6,8,12], B=[4,6]
; OUTPUT
;	C is the output array, e.g., C=[1,2,8,12]
; HISTORY
;   LWA - (?) user contribution
;   SLF - 25-oct-93 - dont clobber input (a)
;   LWA - 10-Dec-95, Made "for" index a long variable to handle big arrays.
;   LWA - 11-Dec-95, Completely changed to eliminate "for" loop.
;		MUCH, MUCH faster with large arrays.
;   LWA - 15-Jan-96, Treat the case with no common elements, changed header.
;-


aa=ina
bb=ind_arr
cc=[aa,bb]
cc=cc(sort(cc))
ccc=cc
dd=uniq(cc)

if n_elements(dd) eq n_elements(cc) then begin
   print,'  ***** There are no elements in common to the 2 input arrays. ****
   return,cc
endif

cc(dd)=-1
ee=cc ne -1
ii=where(ee eq 1)
ee(ii+1)=1
jj=where(ee eq 0)
ff=ccc(jj)
return,ff

;a=ina	;slf - dont clobber input
;for i=0L,n_elements(ind_arr)-1 do a = a(where(a ne ind_arr(i)))
;return,a

end
