LAPACK
3.12.1
LAPACK: Linear Algebra PACKage
Toggle main menu visibility
Main Page
Related Pages
Routines
Modules
Modules List
Module Members
All
c
d
s
z
Functions/Subroutines
Variables
c
d
s
z
Data Types
Data Types List
Data Type Index
Data Fields
All
Functions/Subroutines
Variables
Files
File List
File Members
All
_
a
b
c
d
f
g
h
i
l
m
p
r
s
t
u
x
z
Functions/Subroutines
_
a
c
d
f
g
h
i
l
m
s
t
x
z
Variables
c
l
r
Typedefs
Enumerations
Enumerator
Macros
a
b
c
f
i
p
t
u
x
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
Loading...
Searching...
No Matches
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
*> Download DLADIV + dependencies
9
*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dladiv.f">
10
*> [TGZ]</a>
11
*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dladiv.f">
12
*> [ZIP]</a>
13
*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dladiv.f">
14
*> [TXT]</a>
15
*
16
* Definition:
17
* ===========
18
*
19
* SUBROUTINE DLADIV( A, B, C, D, P, Q )
20
*
21
* .. Scalar Arguments ..
22
* DOUBLE PRECISION A, B, C, D, P, Q
23
* ..
24
*
25
*
26
*> \par Purpose:
27
* =============
28
*>
29
*> \verbatim
30
*>
31
*> DLADIV performs complex division in real arithmetic
32
*>
33
*> a + i*b
34
*> p + i*q = ---------
35
*> c + i*d
36
*>
37
*> The algorithm is due to Michael Baudin and Robert L. Smith
38
*> and can be found in the paper
39
*> "A Robust Complex Division in Scilab"
40
*> \endverbatim
41
*
42
* Arguments:
43
* ==========
44
*
45
*> \param[in] A
46
*> \verbatim
47
*> A is DOUBLE PRECISION
48
*> \endverbatim
49
*>
50
*> \param[in] B
51
*> \verbatim
52
*> B is DOUBLE PRECISION
53
*> \endverbatim
54
*>
55
*> \param[in] C
56
*> \verbatim
57
*> C is DOUBLE PRECISION
58
*> \endverbatim
59
*>
60
*> \param[in] D
61
*> \verbatim
62
*> D is DOUBLE PRECISION
63
*> The scalars a, b, c, and d in the above expression.
64
*> \endverbatim
65
*>
66
*> \param[out] P
67
*> \verbatim
68
*> P is DOUBLE PRECISION
69
*> \endverbatim
70
*>
71
*> \param[out] Q
72
*> \verbatim
73
*> Q is DOUBLE PRECISION
74
*> The scalars p and q in the above expression.
75
*> \endverbatim
76
*
77
* Authors:
78
* ========
79
*
80
*> \author Univ. of Tennessee
81
*> \author Univ. of California Berkeley
82
*> \author Univ. of Colorado Denver
83
*> \author NAG Ltd.
84
*
85
*> \ingroup ladiv
86
*
87
* =====================================================================
88
SUBROUTINE
dladiv
( A, B, C, D, P, Q )
89
*
90
* -- LAPACK auxiliary routine --
91
* -- LAPACK is a software package provided by Univ. of Tennessee, --
92
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
93
*
94
* .. Scalar Arguments ..
95
DOUBLE PRECISION
A, B, C, D, P, Q
96
* ..
97
*
98
* =====================================================================
99
*
100
* .. Parameters ..
101
DOUBLE PRECISION
BS
102
parameter( bs = 2.0d0 )
103
DOUBLE PRECISION
HALF
104
parameter( half = 0.5d0 )
105
DOUBLE PRECISION
TWO
106
parameter( two = 2.0d0 )
107
*
108
* .. Local Scalars ..
109
DOUBLE PRECISION
AA, BB, CC, DD, AB, CD, S, OV, UN, BE, EPS
110
* ..
111
* .. External Functions ..
112
DOUBLE PRECISION
DLAMCH
113
EXTERNAL
dlamch
114
* ..
115
* .. External Subroutines ..
116
EXTERNAL
dladiv1
117
* ..
118
* .. Intrinsic Functions ..
119
INTRINSIC
abs, max
120
* ..
121
* .. Executable Statements ..
122
*
123
aa = a
124
bb = b
125
cc = c
126
dd = d
127
ab = max( abs(a), abs(b) )
128
cd = max( abs(c), abs(d) )
129
s = 1.0d0
130
131
ov = dlamch(
'Overflow threshold'
)
132
un = dlamch(
'Safe minimum'
)
133
eps = dlamch(
'Epsilon'
)
134
be = bs / (eps*eps)
135
136
IF
( ab >= half*ov )
THEN
137
aa = half * aa
138
bb = half * bb
139
s = two * s
140
END IF
141
IF
( cd >= half*ov )
THEN
142
cc = half * cc
143
dd = half * dd
144
s = half * s
145
END IF
146
IF
( ab <= un*bs/eps )
THEN
147
aa = aa * be
148
bb = bb * be
149
s = s / be
150
END IF
151
IF
( cd <= un*bs/eps )
THEN
152
cc = cc * be
153
dd = dd * be
154
s = s * be
155
END IF
156
IF
( abs( d ).LE.abs( c ) )
THEN
157
CALL
dladiv1
(aa, bb, cc, dd, p, q)
158
ELSE
159
CALL
dladiv1
(bb, aa, dd, cc, p, q)
160
q = -q
161
END IF
162
p = p * s
163
q = q * s
164
*
165
RETURN
166
*
167
* End of DLADIV
168
*
88
SUBROUTINE
dladiv
( A, B, C, D, P, Q )
…
169
END
170
171
*> \ingroup ladiv
172
173
174
SUBROUTINE
dladiv1
( A, B, C, D, P, Q )
175
*
176
* -- LAPACK auxiliary routine --
177
* -- LAPACK is a software package provided by Univ. of Tennessee, --
178
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
179
*
180
* .. Scalar Arguments ..
181
DOUBLE PRECISION
A, B, C, D, P, Q
182
* ..
183
*
184
* =====================================================================
185
*
186
* .. Parameters ..
187
DOUBLE PRECISION
ONE
188
parameter( one = 1.0d0 )
189
*
190
* .. Local Scalars ..
191
DOUBLE PRECISION
R, T
192
* ..
193
* .. External Functions ..
194
DOUBLE PRECISION
DLADIV2
195
EXTERNAL
dladiv2
196
* ..
197
* .. Executable Statements ..
198
*
199
r = d / c
200
t = one / (c + d * r)
201
p = dladiv2(a, b, c, d, r, t)
202
a = -a
203
q = dladiv2(b, a, c, d, r, t)
204
*
205
RETURN
206
*
207
* End of DLADIV1
208
*
174
SUBROUTINE
dladiv1
( A, B, C, D, P, Q )
…
209
END
210
211
*> \ingroup ladiv
212
213
DOUBLE PRECISION
FUNCTION
dladiv2
( A, B, C, D, R, T )
214
*
215
* -- LAPACK auxiliary routine --
216
* -- LAPACK is a software package provided by Univ. of Tennessee, --
217
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
218
*
219
* .. Scalar Arguments ..
220
DOUBLE PRECISION
a, b, c, d, r, t
221
* ..
222
*
223
* =====================================================================
224
*
225
* .. Parameters ..
226
DOUBLE PRECISION
zero
227
parameter( zero = 0.0d0 )
228
*
229
* .. Local Scalars ..
230
DOUBLE PRECISION
br
231
* ..
232
* .. Executable Statements ..
233
*
234
IF
( r.NE.zero )
THEN
235
br = b * r
236
IF
( br.NE.zero )
THEN
237
dladiv2
= (a + br) * t
238
ELSE
239
dladiv2
= a * t + (b * t) * r
240
END IF
241
ELSE
242
dladiv2
= (a + d * (b / c)) * t
243
END IF
244
*
245
RETURN
246
*
247
* End of DLADIV2
248
*
213
DOUBLE PRECISION
FUNCTION
dladiv2
( A, B, C, D, R, T )
…
249
END
dladiv1
subroutine dladiv1(a, b, c, d, p, q)
Definition
dladiv.f:175
dladiv2
double precision function dladiv2(a, b, c, d, r, t)
Definition
dladiv.f:214
dladiv
subroutine dladiv(a, b, c, d, p, q)
DLADIV performs complex division in real arithmetic, avoiding unnecessary overflow.
Definition
dladiv.f:89
SRC
dladiv.f
Generated on Mon Jan 20 2025 17:18:10 for LAPACK by
1.11.0