slasr.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 386 行 · 第 1/2 页
HTML
386 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>slasr.f</title>
<meta name="generator" content="emacs 21.3.1; htmlfontify 0.20">
<style type="text/css"><!--
body { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.default { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.default a { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
span.string { color: rgb(188, 143, 143); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.string a { color: rgb(188, 143, 143); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
span.comment { color: rgb(178, 34, 34); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.comment a { color: rgb(178, 34, 34); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
--></style>
</head>
<body>
<pre>
SUBROUTINE <a name="SLASR.1"></a><a href="slasr.f.html#SLASR.1">SLASR</a>( SIDE, PIVOT, DIRECT, M, N, C, S, A, LDA )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> -- LAPACK auxiliary routine (version 3.1) --
</span><span class="comment">*</span><span class="comment"> Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
</span><span class="comment">*</span><span class="comment"> November 2006
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> .. Scalar Arguments ..
</span> CHARACTER DIRECT, PIVOT, SIDE
INTEGER LDA, M, N
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Array Arguments ..
</span> REAL A( LDA, * ), C( * ), S( * )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Purpose
</span><span class="comment">*</span><span class="comment"> =======
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> <a name="SLASR.18"></a><a href="slasr.f.html#SLASR.1">SLASR</a> applies a sequence of plane rotations to a real matrix A,
</span><span class="comment">*</span><span class="comment"> from either the left or the right.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> When SIDE = 'L', the transformation takes the form
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> A := P*A
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> and when SIDE = 'R', the transformation takes the form
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> A := A*P**T
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> where P is an orthogonal matrix consisting of a sequence of z plane
</span><span class="comment">*</span><span class="comment"> rotations, with z = M when SIDE = 'L' and z = N when SIDE = 'R',
</span><span class="comment">*</span><span class="comment"> and P**T is the transpose of P.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> When DIRECT = 'F' (Forward sequence), then
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> P = P(z-1) * ... * P(2) * P(1)
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> and when DIRECT = 'B' (Backward sequence), then
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> P = P(1) * P(2) * ... * P(z-1)
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> where P(k) is a plane rotation matrix defined by the 2-by-2 rotation
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> R(k) = ( c(k) s(k) )
</span><span class="comment">*</span><span class="comment"> = ( -s(k) c(k) ).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> When PIVOT = 'V' (Variable pivot), the rotation is performed
</span><span class="comment">*</span><span class="comment"> for the plane (k,k+1), i.e., P(k) has the form
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> P(k) = ( 1 )
</span><span class="comment">*</span><span class="comment"> ( ... )
</span><span class="comment">*</span><span class="comment"> ( 1 )
</span><span class="comment">*</span><span class="comment"> ( c(k) s(k) )
</span><span class="comment">*</span><span class="comment"> ( -s(k) c(k) )
</span><span class="comment">*</span><span class="comment"> ( 1 )
</span><span class="comment">*</span><span class="comment"> ( ... )
</span><span class="comment">*</span><span class="comment"> ( 1 )
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> where R(k) appears as a rank-2 modification to the identity matrix in
</span><span class="comment">*</span><span class="comment"> rows and columns k and k+1.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> When PIVOT = 'T' (Top pivot), the rotation is performed for the
</span><span class="comment">*</span><span class="comment"> plane (1,k+1), so P(k) has the form
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> P(k) = ( c(k) s(k) )
</span><span class="comment">*</span><span class="comment"> ( 1 )
</span><span class="comment">*</span><span class="comment"> ( ... )
</span><span class="comment">*</span><span class="comment"> ( 1 )
</span><span class="comment">*</span><span class="comment"> ( -s(k) c(k) )
</span><span class="comment">*</span><span class="comment"> ( 1 )
</span><span class="comment">*</span><span class="comment"> ( ... )
</span><span class="comment">*</span><span class="comment"> ( 1 )
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> where R(k) appears in rows and columns 1 and k+1.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Similarly, when PIVOT = 'B' (Bottom pivot), the rotation is
</span><span class="comment">*</span><span class="comment"> performed for the plane (k,z), giving P(k) the form
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> P(k) = ( 1 )
</span><span class="comment">*</span><span class="comment"> ( ... )
</span><span class="comment">*</span><span class="comment"> ( 1 )
</span><span class="comment">*</span><span class="comment"> ( c(k) s(k) )
</span><span class="comment">*</span><span class="comment"> ( 1 )
</span><span class="comment">*</span><span class="comment"> ( ... )
</span><span class="comment">*</span><span class="comment"> ( 1 )
</span><span class="comment">*</span><span class="comment"> ( -s(k) c(k) )
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> where R(k) appears in rows and columns k and z. The rotations are
</span><span class="comment">*</span><span class="comment"> performed without ever forming P(k) explicitly.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Arguments
</span><span class="comment">*</span><span class="comment"> =========
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> SIDE (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment"> Specifies whether the plane rotation matrix P is applied to
</span><span class="comment">*</span><span class="comment"> A on the left or the right.
</span><span class="comment">*</span><span class="comment"> = 'L': Left, compute A := P*A
</span><span class="comment">*</span><span class="comment"> = 'R': Right, compute A:= A*P**T
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> PIVOT (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment"> Specifies the plane for which P(k) is a plane rotation
</span><span class="comment">*</span><span class="comment"> matrix.
</span><span class="comment">*</span><span class="comment"> = 'V': Variable pivot, the plane (k,k+1)
</span><span class="comment">*</span><span class="comment"> = 'T': Top pivot, the plane (1,k+1)
</span><span class="comment">*</span><span class="comment"> = 'B': Bottom pivot, the plane (k,z)
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> DIRECT (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment"> Specifies whether P is a forward or backward sequence of
</span><span class="comment">*</span><span class="comment"> plane rotations.
</span><span class="comment">*</span><span class="comment"> = 'F': Forward, P = P(z-1)*...*P(2)*P(1)
</span><span class="comment">*</span><span class="comment"> = 'B': Backward, P = P(1)*P(2)*...*P(z-1)
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> M (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The number of rows of the matrix A. If m <= 1, an immediate
</span><span class="comment">*</span><span class="comment"> return is effected.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> N (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The number of columns of the matrix A. If n <= 1, an
</span><span class="comment">*</span><span class="comment"> immediate return is effected.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> C (input) REAL array, dimension
</span><span class="comment">*</span><span class="comment"> (M-1) if SIDE = 'L'
</span><span class="comment">*</span><span class="comment"> (N-1) if SIDE = 'R'
</span><span class="comment">*</span><span class="comment"> The cosines c(k) of the plane rotations.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> S (input) REAL array, dimension
</span><span class="comment">*</span><span class="comment"> (M-1) if SIDE = 'L'
</span><span class="comment">*</span><span class="comment"> (N-1) if SIDE = 'R'
</span><span class="comment">*</span><span class="comment"> The sines s(k) of the plane rotations. The 2-by-2 plane
</span><span class="comment">*</span><span class="comment"> rotation part of the matrix P(k), R(k), has the form
</span><span class="comment">*</span><span class="comment"> R(k) = ( c(k) s(k) )
</span><span class="comment">*</span><span class="comment"> ( -s(k) c(k) ).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> A (input/output) REAL array, dimension (LDA,N)
</span><span class="comment">*</span><span class="comment"> The M-by-N matrix A. On exit, A is overwritten by P*A if
</span><span class="comment">*</span><span class="comment"> SIDE = 'R' or by A*P**T if SIDE = 'L'.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> LDA (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The leading dimension of the array A. LDA >= max(1,M).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> =====================================================================
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> .. Parameters ..
</span> REAL ONE, ZERO
PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> INTEGER I, INFO, J
REAL CTEMP, STEMP, TEMP
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Functions ..
</span> LOGICAL <a name="LSAME.151"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
EXTERNAL <a name="LSAME.152"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Subroutines ..
</span> EXTERNAL <a name="XERBLA.155"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Intrinsic Functions ..
</span> INTRINSIC MAX
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Executable Statements ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Test the input parameters
</span><span class="comment">*</span><span class="comment">
</span> INFO = 0
IF( .NOT.( <a name="LSAME.165"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( SIDE, <span class="string">'L'</span> ) .OR. <a name="LSAME.165"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( SIDE, <span class="string">'R'</span> ) ) ) THEN
INFO = 1
ELSE IF( .NOT.( <a name="LSAME.167"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( PIVOT, <span class="string">'V'</span> ) .OR. <a name="LSAME.167"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( PIVOT,
$ <span class="string">'T'</span> ) .OR. <a name="LSAME.168"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( PIVOT, <span class="string">'B'</span> ) ) ) THEN
INFO = 2
ELSE IF( .NOT.( <a name="LSAME.170"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( DIRECT, <span class="string">'F'</span> ) .OR. <a name="LSAME.170"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( DIRECT, <span class="string">'B'</span> ) ) )
$ THEN
INFO = 3
ELSE IF( M.LT.0 ) THEN
INFO = 4
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?