1: SUBROUTINE DLADIV( A, B, C, D, P, Q )
2: *
3: * -- LAPACK auxiliary routine (version 3.2) --
4: * -- LAPACK is a software package provided by Univ. of Tennessee, --
5: * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
6: * November 2006
7: *
8: * .. Scalar Arguments ..
9: DOUBLE PRECISION A, B, C, D, P, Q
10: * ..
11: *
12: * Purpose
13: * =======
14: *
15: * DLADIV performs complex division in real arithmetic
16: *
17: * a + i*b
18: * p + i*q = ---------
19: * c + i*d
20: *
21: * The algorithm is due to Robert L. Smith and can be found
22: * in D. Knuth, The art of Computer Programming, Vol.2, p.195
23: *
24: * Arguments
25: * =========
26: *
27: * A (input) DOUBLE PRECISION
28: * B (input) DOUBLE PRECISION
29: * C (input) DOUBLE PRECISION
30: * D (input) DOUBLE PRECISION
31: * The scalars a, b, c, and d in the above expression.
32: *
33: * P (output) DOUBLE PRECISION
34: * Q (output) DOUBLE PRECISION
35: * The scalars p and q in the above expression.
36: *
37: * =====================================================================
38: *
39: * .. Local Scalars ..
40: DOUBLE PRECISION E, F
41: * ..
42: * .. Intrinsic Functions ..
43: INTRINSIC ABS
44: * ..
45: * .. Executable Statements ..
46: *
47: IF( ABS( D ).LT.ABS( C ) ) THEN
48: E = D / C
49: F = C + D*E
50: P = ( A+B*E ) / F
51: Q = ( B-A*E ) / F
52: ELSE
53: E = C / D
54: F = D + C*E
55: P = ( B+A*E ) / F
56: Q = ( -A+B*E ) / F
57: END IF
58: *
59: RETURN
60: *
61: * End of DLADIV
62: *
63: END
CVSweb interface <joel.bertrand@systella.fr>