[25] | 1 | ;+ |
---|
| 2 | ; |
---|
[223] | 3 | ; @file_comments |
---|
| 4 | ; computes the determinant of n 2 by 2 arrays Z2DS is an 2*2*n array |
---|
[25] | 5 | ; |
---|
[223] | 6 | ; @categories |
---|
[142] | 7 | ; Without loop |
---|
[223] | 8 | ; |
---|
[142] | 9 | ; @param A {in}{required} |
---|
| 10 | ; n element array |
---|
| 11 | ; Defined as z2ds[0, 0, *] = z1d00 |
---|
[25] | 12 | ; |
---|
[142] | 13 | ; @param B {in}{required} |
---|
| 14 | ; n element array |
---|
| 15 | ; Defined as z2ds[0, 1, *] = z1d01 |
---|
[25] | 16 | ; |
---|
[142] | 17 | ; @param C {in}{required} |
---|
| 18 | ; n element array |
---|
| 19 | ; Defined as z2ds[1, 0, *] = z1d10 |
---|
[25] | 20 | ; |
---|
[142] | 21 | ; @param D {in}{required} |
---|
| 22 | ; n element array |
---|
| 23 | ; Defined as z2ds[1, 1, *] = z1d11 |
---|
[25] | 24 | ; |
---|
[223] | 25 | ; @returns |
---|
[142] | 26 | ; n elements array, the determinent of each 2*2 arrrays |
---|
[25] | 27 | ; |
---|
[142] | 28 | ; @examples |
---|
[223] | 29 | ; IDL> a=findgen(2,2,5) |
---|
| 30 | ; IDL> print, determ2(a) |
---|
[268] | 31 | ; IDL> FOR i=0,4 DO print, determ(a[*,*,i]) |
---|
[25] | 32 | ; |
---|
[142] | 33 | ; @history |
---|
[223] | 34 | ; S. Masson (smasson\@lodyc.jussieu.fr) |
---|
| 35 | ; July 11th, 2002 |
---|
[142] | 36 | ; |
---|
| 37 | ; @version |
---|
| 38 | ; $Id$ |
---|
| 39 | ; |
---|
[25] | 40 | ;- |
---|
[262] | 41 | ; |
---|
[25] | 42 | FUNCTION determ2, a, b, c, d |
---|
[114] | 43 | ; |
---|
| 44 | compile_opt idl2, strictarrsubs |
---|
| 45 | ; |
---|
[25] | 46 | CASE n_params() OF |
---|
| 47 | 1:res = a[0, 0, *]*a[1, 1, *]-a[0, 1, *]*a[1, 0, *] |
---|
| 48 | 4:res = a[*]*d[*]-c[*]*b[*] |
---|
| 49 | ELSE:stop |
---|
| 50 | ENDCASE |
---|
| 51 | |
---|
| 52 | RETURN, res |
---|
| 53 | END |
---|