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


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