sgglse.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 291 行 · 第 1/2 页
HTML
291 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>sgglse.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="SGGLSE.1"></a><a href="sgglse.f.html#SGGLSE.1">SGGLSE</a>( M, N, P, A, LDA, B, LDB, C, D, X, WORK, LWORK,
$ INFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> -- LAPACK driver 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> INTEGER INFO, LDA, LDB, LWORK, M, N, P
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Array Arguments ..
</span> REAL A( LDA, * ), B( LDB, * ), C( * ), D( * ),
$ WORK( * ), X( * )
<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="SGGLSE.19"></a><a href="sgglse.f.html#SGGLSE.1">SGGLSE</a> solves the linear equality-constrained least squares (LSE)
</span><span class="comment">*</span><span class="comment"> problem:
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> minimize || c - A*x ||_2 subject to B*x = d
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> where A is an M-by-N matrix, B is a P-by-N matrix, c is a given
</span><span class="comment">*</span><span class="comment"> M-vector, and d is a given P-vector. It is assumed that
</span><span class="comment">*</span><span class="comment"> P <= N <= M+P, and
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> rank(B) = P and rank( (A) ) = N.
</span><span class="comment">*</span><span class="comment"> ( (B) )
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> These conditions ensure that the LSE problem has a unique solution,
</span><span class="comment">*</span><span class="comment"> which is obtained using a generalized RQ factorization of the
</span><span class="comment">*</span><span class="comment"> matrices (B, A) given by
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> B = (0 R)*Q, A = Z*T*Q.
</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"> M (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The number of rows of the matrix A. M >= 0.
</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 matrices A and B. N >= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> P (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The number of rows of the matrix B. 0 <= P <= N <= M+P.
</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"> On entry, the M-by-N matrix A.
</span><span class="comment">*</span><span class="comment"> On exit, the elements on and above the diagonal of the array
</span><span class="comment">*</span><span class="comment"> contain the min(M,N)-by-N upper trapezoidal matrix T.
</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"> B (input/output) REAL array, dimension (LDB,N)
</span><span class="comment">*</span><span class="comment"> On entry, the P-by-N matrix B.
</span><span class="comment">*</span><span class="comment"> On exit, the upper triangle of the subarray B(1:P,N-P+1:N)
</span><span class="comment">*</span><span class="comment"> contains the P-by-P upper triangular matrix R.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> LDB (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The leading dimension of the array B. LDB >= max(1,P).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> C (input/output) REAL array, dimension (M)
</span><span class="comment">*</span><span class="comment"> On entry, C contains the right hand side vector for the
</span><span class="comment">*</span><span class="comment"> least squares part of the LSE problem.
</span><span class="comment">*</span><span class="comment"> On exit, the residual sum of squares for the solution
</span><span class="comment">*</span><span class="comment"> is given by the sum of squares of elements N-P+1 to M of
</span><span class="comment">*</span><span class="comment"> vector C.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> D (input/output) REAL array, dimension (P)
</span><span class="comment">*</span><span class="comment"> On entry, D contains the right hand side vector for the
</span><span class="comment">*</span><span class="comment"> constrained equation.
</span><span class="comment">*</span><span class="comment"> On exit, D is destroyed.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> X (output) REAL array, dimension (N)
</span><span class="comment">*</span><span class="comment"> On exit, X is the solution of the LSE problem.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> WORK (workspace/output) REAL array, dimension (MAX(1,LWORK))
</span><span class="comment">*</span><span class="comment"> On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> LWORK (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The dimension of the array WORK. LWORK >= max(1,M+N+P).
</span><span class="comment">*</span><span class="comment"> For optimum performance LWORK >= P+min(M,N)+max(M,N)*NB,
</span><span class="comment">*</span><span class="comment"> where NB is an upper bound for the optimal blocksizes for
</span><span class="comment">*</span><span class="comment"> <a name="SGEQRF.87"></a><a href="sgeqrf.f.html#SGEQRF.1">SGEQRF</a>, <a name="SGERQF.87"></a><a href="sgerqf.f.html#SGERQF.1">SGERQF</a>, <a name="SORMQR.87"></a><a href="sormqr.f.html#SORMQR.1">SORMQR</a> and <a name="SORMRQ.87"></a><a href="sormrq.f.html#SORMRQ.1">SORMRQ</a>.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> If LWORK = -1, then a workspace query is assumed; the routine
</span><span class="comment">*</span><span class="comment"> only calculates the optimal size of the WORK array, returns
</span><span class="comment">*</span><span class="comment"> this value as the first entry of the WORK array, and no error
</span><span class="comment">*</span><span class="comment"> message related to LWORK is issued by <a name="XERBLA.92"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> INFO (output) INTEGER
</span><span class="comment">*</span><span class="comment"> = 0: successful exit.
</span><span class="comment">*</span><span class="comment"> < 0: if INFO = -i, the i-th argument had an illegal value.
</span><span class="comment">*</span><span class="comment"> = 1: the upper triangular factor R associated with B in the
</span><span class="comment">*</span><span class="comment"> generalized RQ factorization of the pair (B, A) is
</span><span class="comment">*</span><span class="comment"> singular, so that rank(B) < P; the least squares
</span><span class="comment">*</span><span class="comment"> solution could not be computed.
</span><span class="comment">*</span><span class="comment"> = 2: the (N-P) by (N-P) part of the upper trapezoidal factor
</span><span class="comment">*</span><span class="comment"> T associated with A in the generalized RQ factorization
</span><span class="comment">*</span><span class="comment"> of the pair (B, A) is singular, so that
</span><span class="comment">*</span><span class="comment"> rank( (A) ) < N; the least squares solution could not
</span><span class="comment">*</span><span class="comment"> ( (B) )
</span><span class="comment">*</span><span class="comment"> be computed.
</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
PARAMETER ( ONE = 1.0E+0 )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> LOGICAL LQUERY
INTEGER LOPT, LWKMIN, LWKOPT, MN, NB, NB1, NB2, NB3,
$ NB4, NR
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Subroutines ..
</span> EXTERNAL SAXPY, SCOPY, SGEMV, <a name="SGGRQF.120"></a><a href="sggrqf.f.html#SGGRQF.1">SGGRQF</a>, <a name="SORMQR.120"></a><a href="sormqr.f.html#SORMQR.1">SORMQR</a>, <a name="SORMRQ.120"></a><a href="sormrq.f.html#SORMRQ.1">SORMRQ</a>,
$ STRMV, <a name="STRTRS.121"></a><a href="strtrs.f.html#STRTRS.1">STRTRS</a>, <a name="XERBLA.121"></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"> .. External Functions ..
</span> INTEGER <a name="ILAENV.124"></a><a href="hfy-index.html#ILAENV">ILAENV</a>
EXTERNAL <a name="ILAENV.125"></a><a href="hfy-index.html#ILAENV">ILAENV</a>
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Intrinsic Functions ..
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?