source: trunk/ToBeReviewed/CALCULS/determ2.pro @ 25

Last change on this file since 25 was 25, checked in by pinsard, 18 years ago

upgrade of CALCULS according to cerbere.lodyc.jussieu.fr: /usr/home/smasson/SAXO_RD/ : files

  • Property svn:executable set to *
File size: 957 bytes
Line 
1;+
2; NAME:determ2
3;
4; PURPOSE: computes the determinant of n 2 by 2 arrays
5;
6; CATEGORY: no DO loops and better accuracy
7;
8; CALLING SEQUENCE: 2 cases:
9;     res = determ2(z2ds)
10;     res = determ2(z1d00,z1d01,z1d10,z1d11)
11;
12; INPUTS:
13;     z2ds: an 2*2*n array
14;     or
15;     z1d00,z1d01,z1d10,z1d11: the four n elements arrays
16;     defined as:
17;              z2ds[0, 0, *] = z1d00
18;              z2ds[0, 1, *] = z1d01
19;              z2ds[1, 0, *] = z1d10
20;              z2ds[1, 1, *] = z1d11
21;
22; OUTPUTS: n elements array, the determinent of each 2*2 arrrays
23;
24; EXAMPLE:
25;
26; a=findgen(2,2,5)
27; print, determ2(a)
28; FOR i=0,4 DO print, determ(a[*,*,i]) ; IDL solution
29;
30; MODIFICATION HISTORY:
31;           S. Masson (smasson@lodyc.jussieu.fr)
32;           July 11th, 2002
33;-
34FUNCTION determ2, a, b, c, d
35  CASE n_params() OF
36    1:res = a[0, 0, *]*a[1, 1, *]-a[0, 1, *]*a[1, 0, *]
37    4:res = a[*]*d[*]-c[*]*b[*]
38    ELSE:stop
39  ENDCASE
40
41  RETURN, res
42END
Note: See TracBrowser for help on using the repository browser.