summaryrefslogtreecommitdiff
path: root/SRC/sladiv.f
diff options
context:
space:
mode:
authorjason <jason@8a072113-8704-0410-8d35-dd094bca7971>2008-10-28 01:38:50 +0000
committerjason <jason@8a072113-8704-0410-8d35-dd094bca7971>2008-10-28 01:38:50 +0000
commitbaba851215b44ac3b60b9248eb02bcce7eb76247 (patch)
tree8c0f5c006875532a30d4409f5e94b0f310ff00a7 /SRC/sladiv.f
downloadlapack-baba851215b44ac3b60b9248eb02bcce7eb76247.tar.gz
lapack-baba851215b44ac3b60b9248eb02bcce7eb76247.tar.bz2
lapack-baba851215b44ac3b60b9248eb02bcce7eb76247.zip
Move LAPACK trunk into position.
Diffstat (limited to 'SRC/sladiv.f')
-rw-r--r--SRC/sladiv.f62
1 files changed, 62 insertions, 0 deletions
diff --git a/SRC/sladiv.f b/SRC/sladiv.f
new file mode 100644
index 00000000..f487d55c
--- /dev/null
+++ b/SRC/sladiv.f
@@ -0,0 +1,62 @@
+ SUBROUTINE SLADIV( A, B, C, D, P, Q )
+*
+* -- LAPACK auxiliary routine (version 3.1) --
+* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
+* November 2006
+*
+* .. Scalar Arguments ..
+ REAL A, B, C, D, P, Q
+* ..
+*
+* Purpose
+* =======
+*
+* SLADIV performs complex division in real arithmetic
+*
+* a + i*b
+* p + i*q = ---------
+* c + i*d
+*
+* The algorithm is due to Robert L. Smith and can be found
+* in D. Knuth, The art of Computer Programming, Vol.2, p.195
+*
+* Arguments
+* =========
+*
+* A (input) REAL
+* B (input) REAL
+* C (input) REAL
+* D (input) REAL
+* The scalars a, b, c, and d in the above expression.
+*
+* P (output) REAL
+* Q (output) REAL
+* The scalars p and q in the above expression.
+*
+* =====================================================================
+*
+* .. Local Scalars ..
+ REAL E, F
+* ..
+* .. Intrinsic Functions ..
+ INTRINSIC ABS
+* ..
+* .. Executable Statements ..
+*
+ IF( ABS( D ).LT.ABS( C ) ) THEN
+ E = D / C
+ F = C + D*E
+ P = ( A+B*E ) / F
+ Q = ( B-A*E ) / F
+ ELSE
+ E = C / D
+ F = D + C*E
+ P = ( B+A*E ) / F
+ Q = ( -A+B*E ) / F
+ END IF
+*
+ RETURN
+*
+* End of SLADIV
+*
+ END