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


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:47