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


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