LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
sladiv.f
Go to the documentation of this file.
00001 *> \brief \b SLADIV
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *> \htmlonly
00009 *> Download SLADIV + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/sladiv.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/sladiv.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sladiv.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       SUBROUTINE SLADIV( A, B, C, D, P, Q )
00022 * 
00023 *       .. Scalar Arguments ..
00024 *       REAL               A, B, C, D, P, Q
00025 *       ..
00026 *  
00027 *
00028 *> \par Purpose:
00029 *  =============
00030 *>
00031 *> \verbatim
00032 *>
00033 *> SLADIV performs complex division in  real arithmetic
00034 *>
00035 *>                       a + i*b
00036 *>            p + i*q = ---------
00037 *>                       c + i*d
00038 *>
00039 *> The algorithm is due to Robert L. Smith and can be found
00040 *> in D. Knuth, The art of Computer Programming, Vol.2, p.195
00041 *> \endverbatim
00042 *
00043 *  Arguments:
00044 *  ==========
00045 *
00046 *> \param[in] A
00047 *> \verbatim
00048 *>          A is REAL
00049 *> \endverbatim
00050 *>
00051 *> \param[in] B
00052 *> \verbatim
00053 *>          B is REAL
00054 *> \endverbatim
00055 *>
00056 *> \param[in] C
00057 *> \verbatim
00058 *>          C is REAL
00059 *> \endverbatim
00060 *>
00061 *> \param[in] D
00062 *> \verbatim
00063 *>          D is REAL
00064 *>          The scalars a, b, c, and d in the above expression.
00065 *> \endverbatim
00066 *>
00067 *> \param[out] P
00068 *> \verbatim
00069 *>          P is REAL
00070 *> \endverbatim
00071 *>
00072 *> \param[out] Q
00073 *> \verbatim
00074 *>          Q is REAL
00075 *>          The scalars p and q in the above expression.
00076 *> \endverbatim
00077 *
00078 *  Authors:
00079 *  ========
00080 *
00081 *> \author Univ. of Tennessee 
00082 *> \author Univ. of California Berkeley 
00083 *> \author Univ. of Colorado Denver 
00084 *> \author NAG Ltd. 
00085 *
00086 *> \date November 2011
00087 *
00088 *> \ingroup auxOTHERauxiliary
00089 *
00090 *  =====================================================================
00091       SUBROUTINE SLADIV( A, B, C, D, P, Q )
00092 *
00093 *  -- LAPACK auxiliary routine (version 3.4.0) --
00094 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00095 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00096 *     November 2011
00097 *
00098 *     .. Scalar Arguments ..
00099       REAL               A, B, C, D, P, Q
00100 *     ..
00101 *
00102 *  =====================================================================
00103 *
00104 *     .. Local Scalars ..
00105       REAL               E, F
00106 *     ..
00107 *     .. Intrinsic Functions ..
00108       INTRINSIC          ABS
00109 *     ..
00110 *     .. Executable Statements ..
00111 *
00112       IF( ABS( D ).LT.ABS( C ) ) THEN
00113          E = D / C
00114          F = C + D*E
00115          P = ( A+B*E ) / F
00116          Q = ( B-A*E ) / F
00117       ELSE
00118          E = C / D
00119          F = D + C*E
00120          P = ( B+A*E ) / F
00121          Q = ( -A+B*E ) / F
00122       END IF
00123 *
00124       RETURN
00125 *
00126 *     End of SLADIV
00127 *
00128       END
 All Files Functions