Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

dgetrf.c

Go to the documentation of this file.
00001 /* DGETRF.F -- translated by f2c (version 19941215).
00002    You must link the resulting object file with the libraries:
00003         -lf2c -lm   (in that order)
00004 */
00005 
00006 #include "f2c.h"
00007 
00008 /* Table of constant values */
00009 
00010 static integer c__1 = 1;
00011 static integer c_n1 = -1;
00012 static doublereal c_b16 = 1.;
00013 static doublereal c_b19 = -1.;
00014 
00015 /* Subroutine */ int dgetrf_(m, n, a, lda, ipiv, info)
00016 integer *m, *n;
00017 doublereal *a;
00018 integer *lda, *ipiv, *info;
00019 {
00020     /* System generated locals */
00021     integer a_dim1, a_offset, i__1, i__2, i__3, i__4, i__5;
00022 
00023     /* Local variables */
00024     static integer i, j;
00025     extern /* Subroutine */ int dgemm_();
00026     static integer iinfo;
00027     extern /* Subroutine */ int dtrsm_(), dgetf2_();
00028     static integer jb, nb;
00029     extern /* Subroutine */ int xerbla_();
00030     extern integer ilaenv_();
00031     extern /* Subroutine */ int dlaswp_();
00032 
00033 
00034 /*  -- LAPACK routine (version 1.1) -- */
00035 /*     Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., */
00036 /*     Courant Institute, Argonne National Lab, and Rice University */
00037 /*     March 31, 1993 */
00038 
00039 /*     .. Scalar Arguments .. */
00040 /*     .. */
00041 /*     .. Array Arguments .. */
00042 /*     .. */
00043 
00044 /*  Purpose */
00045 /*  ======= */
00046 
00047 /*  DGETRF computes an LU factorization of a general M-by-N matrix A */
00048 /*  using partial pivoting with row interchanges. */
00049 
00050 /*  The factorization has the form */
00051 /*     A = P * L * U */
00052 /*  where P is a permutation matrix, L is lower triangular with unit */
00053 /*  diagonal elements (lower trapezoidal if m > n), and U is upper */
00054 /*  triangular (upper trapezoidal if m < n). */
00055 
00056 /*  This is the right-looking Level 3 BLAS version of the algorithm. */
00057 
00058 /*  Arguments */
00059 /*  ========= */
00060 
00061 /*  M       (input) INTEGER */
00062 /*          The number of rows of the matrix A.  M >= 0. */
00063 
00064 /*  N       (input) INTEGER */
00065 /*          The number of columns of the matrix A.  N >= 0. */
00066 
00067 /*  A       (input/output) DOUBLE PRECISION array, dimension (LDA,N) */
00068 /*          On entry, the M-by-N matrix to be factored. */
00069 /*          On exit, the factors L and U from the factorization */
00070 /*          A = P*L*U; the unit diagonal elements of L are not stored. */
00071 
00072 /*  LDA     (input) INTEGER */
00073 /*          The leading dimension of the array A.  LDA >= max(1,M). */
00074 
00075 /*  IPIV    (output) INTEGER array, dimension (min(M,N)) */
00076 /*          The pivot indices; for 1 <= i <= min(M,N), row i of the */
00077 /*          matrix was interchanged with row IPIV(i). */
00078 
00079 /*  INFO    (output) INTEGER */
00080 /*          = 0:  successful exit */
00081 /*          < 0:  if INFO = -i, the i-th argument had an illegal value */
00082 /*          > 0:  if INFO = i, U(i,i) is exactly zero. The factorization 
00083 */
00084 /*                has been completed, but the factor U is exactly */
00085 /*                singular, and division by zero will occur if it is used 
00086 */
00087 /*                to solve a system of equations. */
00088 
00089 /*  ===================================================================== 
00090 */
00091 
00092 /*     .. Parameters .. */
00093 /*     .. */
00094 /*     .. Local Scalars .. */
00095 /*     .. */
00096 /*     .. External Subroutines .. */
00097 /*     .. */
00098 /*     .. External Functions .. */
00099 /*     .. */
00100 /*     .. Intrinsic Functions .. */
00101 /*     .. */
00102 /*     .. Executable Statements .. */
00103 
00104 /*     Test the input parameters. */
00105 
00106     /* Parameter adjustments */
00107     a_dim1 = *lda;
00108     a_offset = a_dim1 + 1;
00109     a -= a_offset;
00110     --ipiv;
00111 
00112     /* Function Body */
00113     *info = 0;
00114     if (*m < 0) {
00115         *info = -1;
00116     } else if (*n < 0) {
00117         *info = -2;
00118     } else if (*lda < max(1,*m)) {
00119         *info = -4;
00120     }
00121     if (*info != 0) {
00122         i__1 = -(*info);
00123         xerbla_("DGETRF", &i__1, 6L);
00124         return 0;
00125     }
00126 
00127 /*     Quick return if possible */
00128 
00129     if (*m == 0 || *n == 0) {
00130         return 0;
00131     }
00132 
00133 /*     Determine the block size for this environment. */
00134 
00135     nb = ilaenv_(&c__1, "DGETRF", " ", m, n, &c_n1, &c_n1, 6L, 1L);
00136     if (nb <= 1 || nb >= min(*m,*n)) {
00137 
00138 /*        Use unblocked code. */
00139 
00140         dgetf2_(m, n, &a[a_offset], lda, &ipiv[1], info);
00141     } else {
00142 
00143 /*        Use blocked code. */
00144 
00145         i__1 = min(*m,*n);
00146         i__2 = nb;
00147         for (j = 1; i__2 < 0 ? j >= i__1 : j <= i__1; j += i__2) {
00148 /* Computing MIN */
00149             i__3 = min(*m,*n) - j + 1;
00150             jb = min(i__3,nb);
00151 
00152 /*           Factor diagonal and subdiagonal blocks and test for e
00153 xact */
00154 /*           singularity. */
00155 
00156             i__3 = *m - j + 1;
00157             dgetf2_(&i__3, &jb, &a[j + j * a_dim1], lda, &ipiv[j], &iinfo);
00158 
00159 /*           Adjust INFO and the pivot indices. */
00160 
00161             if (*info == 0 && iinfo > 0) {
00162                 *info = iinfo + j - 1;
00163             }
00164 /* Computing MIN */
00165             i__4 = *m, i__5 = j + jb - 1;
00166             i__3 = min(i__4,i__5);
00167             for (i = j; i <= i__3; ++i) {
00168                 ipiv[i] = j - 1 + ipiv[i];
00169 /* L10: */
00170             }
00171 
00172 /*           Apply interchanges to columns 1:J-1. */
00173 
00174             i__3 = j - 1;
00175             i__4 = j + jb - 1;
00176             dlaswp_(&i__3, &a[a_offset], lda, &j, &i__4, &ipiv[1], &c__1);
00177 
00178             if (j + jb <= *n) {
00179 
00180 /*              Apply interchanges to columns J+JB:N. */
00181 
00182                 i__3 = *n - j - jb + 1;
00183                 i__4 = j + jb - 1;
00184                 dlaswp_(&i__3, &a[(j + jb) * a_dim1 + 1], lda, &j, &i__4, &
00185                         ipiv[1], &c__1);
00186 
00187 /*              Compute block row of U. */
00188 
00189                 i__3 = *n - j - jb + 1;
00190                 dtrsm_("Left", "Lower", "No transpose", "Unit", &jb, &i__3, &
00191                         c_b16, &a[j + j * a_dim1], lda, &a[j + (j + jb) * 
00192                         a_dim1], lda, 4L, 5L, 12L, 4L);
00193                 if (j + jb <= *m) {
00194 
00195 /*                 Update trailing submatrix. */
00196 
00197                     i__3 = *m - j - jb + 1;
00198                     i__4 = *n - j - jb + 1;
00199                     dgemm_("No transpose", "No transpose", &i__3, &i__4, &jb, 
00200                             &c_b19, &a[j + jb + j * a_dim1], lda, &a[j + (j + 
00201                             jb) * a_dim1], lda, &c_b16, &a[j + jb + (j + jb) *
00202                              a_dim1], lda, 12L, 12L);
00203                 }
00204             }
00205 /* L20: */
00206         }
00207     }
00208     return 0;
00209 
00210 /*     End of DGETRF */
00211 
00212 } /* dgetrf_ */
00213 

Generated on Wed Sep 5 12:54:19 2007 for DSACSS Operational Code by  doxygen 1.3.9.1