LAPACK  3.4.2
LAPACK: Linear Algebra PACKage
 All Files Functions Groups
dladiv.f
Go to the documentation of this file.
1 *> \brief \b DLADIV performs complex division in real arithmetic, avoiding unnecessary overflow.
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 *> \htmlonly
9 *> Download DLADIV + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dladiv.f">
11 *> [TGZ]</a>
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dladiv.f">
13 *> [ZIP]</a>
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dladiv.f">
15 *> [TXT]</a>
16 *> \endhtmlonly
17 *
18 * Definition:
19 * ===========
20 *
21 * SUBROUTINE DLADIV( A, B, C, D, P, Q )
22 *
23 * .. Scalar Arguments ..
24 * DOUBLE PRECISION A, B, C, D, P, Q
25 * ..
26 *
27 *
28 *> \par Purpose:
29 * =============
30 *>
31 *> \verbatim
32 *>
33 *> DLADIV performs complex division in real arithmetic
34 *>
35 *> a + i*b
36 *> p + i*q = ---------
37 *> c + i*d
38 *>
39 *> The algorithm is due to Robert L. Smith and can be found
40 *> in D. Knuth, The art of Computer Programming, Vol.2, p.195
41 *> \endverbatim
42 *
43 * Arguments:
44 * ==========
45 *
46 *> \param[in] A
47 *> \verbatim
48 *> A is DOUBLE PRECISION
49 *> \endverbatim
50 *>
51 *> \param[in] B
52 *> \verbatim
53 *> B is DOUBLE PRECISION
54 *> \endverbatim
55 *>
56 *> \param[in] C
57 *> \verbatim
58 *> C is DOUBLE PRECISION
59 *> \endverbatim
60 *>
61 *> \param[in] D
62 *> \verbatim
63 *> D is DOUBLE PRECISION
64 *> The scalars a, b, c, and d in the above expression.
65 *> \endverbatim
66 *>
67 *> \param[out] P
68 *> \verbatim
69 *> P is DOUBLE PRECISION
70 *> \endverbatim
71 *>
72 *> \param[out] Q
73 *> \verbatim
74 *> Q is DOUBLE PRECISION
75 *> The scalars p and q in the above expression.
76 *> \endverbatim
77 *
78 * Authors:
79 * ========
80 *
81 *> \author Univ. of Tennessee
82 *> \author Univ. of California Berkeley
83 *> \author Univ. of Colorado Denver
84 *> \author NAG Ltd.
85 *
86 *> \date September 2012
87 *
88 *> \ingroup auxOTHERauxiliary
89 *
90 * =====================================================================
91  SUBROUTINE dladiv( A, B, C, D, P, Q )
92 *
93 * -- LAPACK auxiliary routine (version 3.4.2) --
94 * -- LAPACK is a software package provided by Univ. of Tennessee, --
95 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
96 * September 2012
97 *
98 * .. Scalar Arguments ..
99  DOUBLE PRECISION a, b, c, d, p, q
100 * ..
101 *
102 * =====================================================================
103 *
104 * .. Local Scalars ..
105  DOUBLE PRECISION e, f
106 * ..
107 * .. Intrinsic Functions ..
108  INTRINSIC abs
109 * ..
110 * .. Executable Statements ..
111 *
112  IF( abs( d ).LT.abs( c ) ) THEN
113  e = d / c
114  f = c + d*e
115  p = ( a+b*e ) / f
116  q = ( b-a*e ) / f
117  ELSE
118  e = c / d
119  f = d + c*e
120  p = ( b+a*e ) / f
121  q = ( -a+b*e ) / f
122  END IF
123 *
124  return
125 *
126 * End of DLADIV
127 *
128  END