slatrz.c
Go to the documentation of this file.
00001 /* slatrz.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 slatrz_(integer *m, integer *n, integer *l, real *a, 
00017         integer *lda, real *tau, real *work)
00018 {
00019     /* System generated locals */
00020     integer a_dim1, a_offset, i__1, i__2;
00021 
00022     /* Local variables */
00023     integer i__;
00024     extern /* Subroutine */ int slarz_(char *, integer *, integer *, integer *
00025 , real *, integer *, real *, real *, integer *, real *), 
00026             slarfp_(integer *, real *, real *, integer *, real *);
00027 
00028 
00029 /*  -- LAPACK routine (version 3.2) -- */
00030 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00031 /*     November 2006 */
00032 
00033 /*     .. Scalar Arguments .. */
00034 /*     .. */
00035 /*     .. Array Arguments .. */
00036 /*     .. */
00037 
00038 /*  Purpose */
00039 /*  ======= */
00040 
00041 /*  SLATRZ factors the M-by-(M+L) real upper trapezoidal matrix */
00042 /*  [ A1 A2 ] = [ A(1:M,1:M) A(1:M,N-L+1:N) ] as ( R  0 ) * Z, by means */
00043 /*  of orthogonal transformations.  Z is an (M+L)-by-(M+L) orthogonal */
00044 /*  matrix and, R and A1 are M-by-M upper triangular matrices. */
00045 
00046 /*  Arguments */
00047 /*  ========= */
00048 
00049 /*  M       (input) INTEGER */
00050 /*          The number of rows of the matrix A.  M >= 0. */
00051 
00052 /*  N       (input) INTEGER */
00053 /*          The number of columns of the matrix A.  N >= 0. */
00054 
00055 /*  L       (input) INTEGER */
00056 /*          The number of columns of the matrix A containing the */
00057 /*          meaningful part of the Householder vectors. N-M >= L >= 0. */
00058 
00059 /*  A       (input/output) REAL array, dimension (LDA,N) */
00060 /*          On entry, the leading M-by-N upper trapezoidal part of the */
00061 /*          array A must contain the matrix to be factorized. */
00062 /*          On exit, the leading M-by-M upper triangular part of A */
00063 /*          contains the upper triangular matrix R, and elements N-L+1 to */
00064 /*          N of the first M rows of A, with the array TAU, represent the */
00065 /*          orthogonal matrix Z as a product of M elementary reflectors. */
00066 
00067 /*  LDA     (input) INTEGER */
00068 /*          The leading dimension of the array A.  LDA >= max(1,M). */
00069 
00070 /*  TAU     (output) REAL array, dimension (M) */
00071 /*          The scalar factors of the elementary reflectors. */
00072 
00073 /*  WORK    (workspace) REAL array, dimension (M) */
00074 
00075 /*  Further Details */
00076 /*  =============== */
00077 
00078 /*  Based on contributions by */
00079 /*    A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville, USA */
00080 
00081 /*  The factorization is obtained by Householder's method.  The kth */
00082 /*  transformation matrix, Z( k ), which is used to introduce zeros into */
00083 /*  the ( m - k + 1 )th row of A, is given in the form */
00084 
00085 /*     Z( k ) = ( I     0   ), */
00086 /*              ( 0  T( k ) ) */
00087 
00088 /*  where */
00089 
00090 /*     T( k ) = I - tau*u( k )*u( k )',   u( k ) = (   1    ), */
00091 /*                                                 (   0    ) */
00092 /*                                                 ( z( k ) ) */
00093 
00094 /*  tau is a scalar and z( k ) is an l element vector. tau and z( k ) */
00095 /*  are chosen to annihilate the elements of the kth row of A2. */
00096 
00097 /*  The scalar tau is returned in the kth element of TAU and the vector */
00098 /*  u( k ) in the kth row of A2, such that the elements of z( k ) are */
00099 /*  in  a( k, l + 1 ), ..., a( k, n ). The elements of R are returned in */
00100 /*  the upper triangular part of A1. */
00101 
00102 /*  Z is given by */
00103 
00104 /*     Z =  Z( 1 ) * Z( 2 ) * ... * Z( m ). */
00105 
00106 /*  ===================================================================== */
00107 
00108 /*     .. Parameters .. */
00109 /*     .. */
00110 /*     .. Local Scalars .. */
00111 /*     .. */
00112 /*     .. External Subroutines .. */
00113 /*     .. */
00114 /*     .. Executable Statements .. */
00115 
00116 /*     Test the input arguments */
00117 
00118 /*     Quick return if possible */
00119 
00120     /* Parameter adjustments */
00121     a_dim1 = *lda;
00122     a_offset = 1 + a_dim1;
00123     a -= a_offset;
00124     --tau;
00125     --work;
00126 
00127     /* Function Body */
00128     if (*m == 0) {
00129         return 0;
00130     } else if (*m == *n) {
00131         i__1 = *n;
00132         for (i__ = 1; i__ <= i__1; ++i__) {
00133             tau[i__] = 0.f;
00134 /* L10: */
00135         }
00136         return 0;
00137     }
00138 
00139     for (i__ = *m; i__ >= 1; --i__) {
00140 
00141 /*        Generate elementary reflector H(i) to annihilate */
00142 /*        [ A(i,i) A(i,n-l+1:n) ] */
00143 
00144         i__1 = *l + 1;
00145         slarfp_(&i__1, &a[i__ + i__ * a_dim1], &a[i__ + (*n - *l + 1) * 
00146                 a_dim1], lda, &tau[i__]);
00147 
00148 /*        Apply H(i) to A(1:i-1,i:n) from the right */
00149 
00150         i__1 = i__ - 1;
00151         i__2 = *n - i__ + 1;
00152         slarz_("Right", &i__1, &i__2, l, &a[i__ + (*n - *l + 1) * a_dim1], 
00153                 lda, &tau[i__], &a[i__ * a_dim1 + 1], lda, &work[1]);
00154 
00155 /* L20: */
00156     }
00157 
00158     return 0;
00159 
00160 /*     End of SLATRZ */
00161 
00162 } /* slatrz_ */


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