;+ ; ; @file_comments ; computes the determinant of n 2 by 2 arrays Z2DS is an 2*2*n array ; ; @categories ; Without loop ; ; @param A {in}{required} ; n element array ; Defined as z2ds[0, 0, *] = z1d00 ; ; @param B {in}{required} ; n element array ; Defined as z2ds[0, 1, *] = z1d01 ; ; @param C {in}{required} ; n element array ; Defined as z2ds[1, 0, *] = z1d10 ; ; @param D {in}{required} ; n element array ; Defined as z2ds[1, 1, *] = z1d11 ; ; @returns ; n elements array, the determinent of each 2*2 arrrays ; ; @examples ; IDL> a=findgen(2,2,5) ; IDL> print, determ2(a) ; IDL> FOR i=0,4 DO print, determ(a[*,*,i]) ; ; @history ; S. Masson (smasson\@lodyc.jussieu.fr) ; July 11th, 2002 ; ; @version ; $Id$ ; ;- FUNCTION determ2, a, b, c, d ; compile_opt idl2, strictarrsubs ; CASE n_params() OF 1:res = a[0, 0, *]*a[1, 1, *]-a[0, 1, *]*a[1, 0, *] 4:res = a[*]*d[*]-c[*]*b[*] ELSE:stop ENDCASE RETURN, res END