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


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:56:12