00001 /* dopgtr.f -- translated by f2c (version 20061008). 00002 You must link the resulting object file with libf2c: 00003 on Microsoft Windows system, link with libf2c.lib; 00004 on Linux or Unix systems, link with .../path/to/libf2c.a -lm 00005 or, if you install libf2c.a in a standard place, with -lf2c -lm 00006 -- in that order, at the end of the command line, as in 00007 cc *.o -lf2c -lm 00008 Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., 00009 00010 http://www.netlib.org/f2c/libf2c.zip 00011 */ 00012 00013 #include "f2c.h" 00014 #include "blaswrap.h" 00015 00016 /* Subroutine */ int dopgtr_(char *uplo, integer *n, doublereal *ap, 00017 doublereal *tau, doublereal *q, integer *ldq, doublereal *work, 00018 integer *info) 00019 { 00020 /* System generated locals */ 00021 integer q_dim1, q_offset, i__1, i__2, i__3; 00022 00023 /* Local variables */ 00024 integer i__, j, ij; 00025 extern logical lsame_(char *, char *); 00026 integer iinfo; 00027 logical upper; 00028 extern /* Subroutine */ int dorg2l_(integer *, integer *, integer *, 00029 doublereal *, integer *, doublereal *, doublereal *, integer *), 00030 dorg2r_(integer *, integer *, integer *, doublereal *, integer *, 00031 doublereal *, doublereal *, integer *), xerbla_(char *, integer *); 00032 00033 00034 /* -- LAPACK routine (version 3.2) -- */ 00035 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ 00036 /* November 2006 */ 00037 00038 /* .. Scalar Arguments .. */ 00039 /* .. */ 00040 /* .. Array Arguments .. */ 00041 /* .. */ 00042 00043 /* Purpose */ 00044 /* ======= */ 00045 00046 /* DOPGTR generates a real orthogonal matrix Q which is defined as the */ 00047 /* product of n-1 elementary reflectors H(i) of order n, as returned by */ 00048 /* DSPTRD using packed storage: */ 00049 00050 /* if UPLO = 'U', Q = H(n-1) . . . H(2) H(1), */ 00051 00052 /* if UPLO = 'L', Q = H(1) H(2) . . . H(n-1). */ 00053 00054 /* Arguments */ 00055 /* ========= */ 00056 00057 /* UPLO (input) CHARACTER*1 */ 00058 /* = 'U': Upper triangular packed storage used in previous */ 00059 /* call to DSPTRD; */ 00060 /* = 'L': Lower triangular packed storage used in previous */ 00061 /* call to DSPTRD. */ 00062 00063 /* N (input) INTEGER */ 00064 /* The order of the matrix Q. N >= 0. */ 00065 00066 /* AP (input) DOUBLE PRECISION array, dimension (N*(N+1)/2) */ 00067 /* The vectors which define the elementary reflectors, as */ 00068 /* returned by DSPTRD. */ 00069 00070 /* TAU (input) DOUBLE PRECISION array, dimension (N-1) */ 00071 /* TAU(i) must contain the scalar factor of the elementary */ 00072 /* reflector H(i), as returned by DSPTRD. */ 00073 00074 /* Q (output) DOUBLE PRECISION array, dimension (LDQ,N) */ 00075 /* The N-by-N orthogonal matrix Q. */ 00076 00077 /* LDQ (input) INTEGER */ 00078 /* The leading dimension of the array Q. LDQ >= max(1,N). */ 00079 00080 /* WORK (workspace) DOUBLE PRECISION array, dimension (N-1) */ 00081 00082 /* INFO (output) INTEGER */ 00083 /* = 0: successful exit */ 00084 /* < 0: if INFO = -i, the i-th argument had an illegal value */ 00085 00086 /* ===================================================================== */ 00087 00088 /* .. Parameters .. */ 00089 /* .. */ 00090 /* .. Local Scalars .. */ 00091 /* .. */ 00092 /* .. External Functions .. */ 00093 /* .. */ 00094 /* .. External Subroutines .. */ 00095 /* .. */ 00096 /* .. Intrinsic Functions .. */ 00097 /* .. */ 00098 /* .. Executable Statements .. */ 00099 00100 /* Test the input arguments */ 00101 00102 /* Parameter adjustments */ 00103 --ap; 00104 --tau; 00105 q_dim1 = *ldq; 00106 q_offset = 1 + q_dim1; 00107 q -= q_offset; 00108 --work; 00109 00110 /* Function Body */ 00111 *info = 0; 00112 upper = lsame_(uplo, "U"); 00113 if (! upper && ! lsame_(uplo, "L")) { 00114 *info = -1; 00115 } else if (*n < 0) { 00116 *info = -2; 00117 } else if (*ldq < max(1,*n)) { 00118 *info = -6; 00119 } 00120 if (*info != 0) { 00121 i__1 = -(*info); 00122 xerbla_("DOPGTR", &i__1); 00123 return 0; 00124 } 00125 00126 /* Quick return if possible */ 00127 00128 if (*n == 0) { 00129 return 0; 00130 } 00131 00132 if (upper) { 00133 00134 /* Q was determined by a call to DSPTRD with UPLO = 'U' */ 00135 00136 /* Unpack the vectors which define the elementary reflectors and */ 00137 /* set the last row and column of Q equal to those of the unit */ 00138 /* matrix */ 00139 00140 ij = 2; 00141 i__1 = *n - 1; 00142 for (j = 1; j <= i__1; ++j) { 00143 i__2 = j - 1; 00144 for (i__ = 1; i__ <= i__2; ++i__) { 00145 q[i__ + j * q_dim1] = ap[ij]; 00146 ++ij; 00147 /* L10: */ 00148 } 00149 ij += 2; 00150 q[*n + j * q_dim1] = 0.; 00151 /* L20: */ 00152 } 00153 i__1 = *n - 1; 00154 for (i__ = 1; i__ <= i__1; ++i__) { 00155 q[i__ + *n * q_dim1] = 0.; 00156 /* L30: */ 00157 } 00158 q[*n + *n * q_dim1] = 1.; 00159 00160 /* Generate Q(1:n-1,1:n-1) */ 00161 00162 i__1 = *n - 1; 00163 i__2 = *n - 1; 00164 i__3 = *n - 1; 00165 dorg2l_(&i__1, &i__2, &i__3, &q[q_offset], ldq, &tau[1], &work[1], & 00166 iinfo); 00167 00168 } else { 00169 00170 /* Q was determined by a call to DSPTRD with UPLO = 'L'. */ 00171 00172 /* Unpack the vectors which define the elementary reflectors and */ 00173 /* set the first row and column of Q equal to those of the unit */ 00174 /* matrix */ 00175 00176 q[q_dim1 + 1] = 1.; 00177 i__1 = *n; 00178 for (i__ = 2; i__ <= i__1; ++i__) { 00179 q[i__ + q_dim1] = 0.; 00180 /* L40: */ 00181 } 00182 ij = 3; 00183 i__1 = *n; 00184 for (j = 2; j <= i__1; ++j) { 00185 q[j * q_dim1 + 1] = 0.; 00186 i__2 = *n; 00187 for (i__ = j + 1; i__ <= i__2; ++i__) { 00188 q[i__ + j * q_dim1] = ap[ij]; 00189 ++ij; 00190 /* L50: */ 00191 } 00192 ij += 2; 00193 /* L60: */ 00194 } 00195 if (*n > 1) { 00196 00197 /* Generate Q(2:n,2:n) */ 00198 00199 i__1 = *n - 1; 00200 i__2 = *n - 1; 00201 i__3 = *n - 1; 00202 dorg2r_(&i__1, &i__2, &i__3, &q[(q_dim1 << 1) + 2], ldq, &tau[1], 00203 &work[1], &iinfo); 00204 } 00205 } 00206 return 0; 00207 00208 /* End of DOPGTR */ 00209 00210 } /* dopgtr_ */