annotate ext/clapack/src/dgetf2.c @ 514:a15e2c4e111f

Remove unwanted compiler flag
author Chris Cannam <cannam@all-day-breakfast.com>
date Fri, 17 Jan 2020 10:40:31 +0000
parents 905e45637745
children
rev   line source
c@427 1 /* dgetf2.f -- translated by f2c (version 20061008).
c@427 2 You must link the resulting object file with libf2c:
c@427 3 on Microsoft Windows system, link with libf2c.lib;
c@427 4 on Linux or Unix systems, link with .../path/to/libf2c.a -lm
c@427 5 or, if you install libf2c.a in a standard place, with -lf2c -lm
c@427 6 -- in that order, at the end of the command line, as in
c@427 7 cc *.o -lf2c -lm
c@427 8 Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
c@427 9
c@427 10 http://www.netlib.org/f2c/libf2c.zip
c@427 11 */
c@427 12
c@427 13 #include "f2c.h"
c@427 14 #include "blaswrap.h"
c@427 15
c@427 16 /* Table of constant values */
c@427 17
c@427 18 static integer c__1 = 1;
c@427 19 static doublereal c_b8 = -1.;
c@427 20
c@427 21 /* Subroutine */ int dgetf2_(integer *m, integer *n, doublereal *a, integer *
c@427 22 lda, integer *ipiv, integer *info)
c@427 23 {
c@427 24 /* System generated locals */
c@427 25 integer a_dim1, a_offset, i__1, i__2, i__3;
c@427 26 doublereal d__1;
c@427 27
c@427 28 /* Local variables */
c@427 29 integer i__, j, jp;
c@427 30 extern /* Subroutine */ int dger_(integer *, integer *, doublereal *,
c@427 31 doublereal *, integer *, doublereal *, integer *, doublereal *,
c@427 32 integer *), dscal_(integer *, doublereal *, doublereal *, integer
c@427 33 *);
c@427 34 doublereal sfmin;
c@427 35 extern /* Subroutine */ int dswap_(integer *, doublereal *, integer *,
c@427 36 doublereal *, integer *);
c@427 37 extern doublereal dlamch_(char *);
c@427 38 extern integer idamax_(integer *, doublereal *, integer *);
c@427 39 extern /* Subroutine */ int xerbla_(char *, integer *);
c@427 40
c@427 41
c@427 42 /* -- LAPACK routine (version 3.2) -- */
c@427 43 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
c@427 44 /* November 2006 */
c@427 45
c@427 46 /* .. Scalar Arguments .. */
c@427 47 /* .. */
c@427 48 /* .. Array Arguments .. */
c@427 49 /* .. */
c@427 50
c@427 51 /* Purpose */
c@427 52 /* ======= */
c@427 53
c@427 54 /* DGETF2 computes an LU factorization of a general m-by-n matrix A */
c@427 55 /* using partial pivoting with row interchanges. */
c@427 56
c@427 57 /* The factorization has the form */
c@427 58 /* A = P * L * U */
c@427 59 /* where P is a permutation matrix, L is lower triangular with unit */
c@427 60 /* diagonal elements (lower trapezoidal if m > n), and U is upper */
c@427 61 /* triangular (upper trapezoidal if m < n). */
c@427 62
c@427 63 /* This is the right-looking Level 2 BLAS version of the algorithm. */
c@427 64
c@427 65 /* Arguments */
c@427 66 /* ========= */
c@427 67
c@427 68 /* M (input) INTEGER */
c@427 69 /* The number of rows of the matrix A. M >= 0. */
c@427 70
c@427 71 /* N (input) INTEGER */
c@427 72 /* The number of columns of the matrix A. N >= 0. */
c@427 73
c@427 74 /* A (input/output) DOUBLE PRECISION array, dimension (LDA,N) */
c@427 75 /* On entry, the m by n matrix to be factored. */
c@427 76 /* On exit, the factors L and U from the factorization */
c@427 77 /* A = P*L*U; the unit diagonal elements of L are not stored. */
c@427 78
c@427 79 /* LDA (input) INTEGER */
c@427 80 /* The leading dimension of the array A. LDA >= max(1,M). */
c@427 81
c@427 82 /* IPIV (output) INTEGER array, dimension (min(M,N)) */
c@427 83 /* The pivot indices; for 1 <= i <= min(M,N), row i of the */
c@427 84 /* matrix was interchanged with row IPIV(i). */
c@427 85
c@427 86 /* INFO (output) INTEGER */
c@427 87 /* = 0: successful exit */
c@427 88 /* < 0: if INFO = -k, the k-th argument had an illegal value */
c@427 89 /* > 0: if INFO = k, U(k,k) is exactly zero. The factorization */
c@427 90 /* has been completed, but the factor U is exactly */
c@427 91 /* singular, and division by zero will occur if it is used */
c@427 92 /* to solve a system of equations. */
c@427 93
c@427 94 /* ===================================================================== */
c@427 95
c@427 96 /* .. Parameters .. */
c@427 97 /* .. */
c@427 98 /* .. Local Scalars .. */
c@427 99 /* .. */
c@427 100 /* .. External Functions .. */
c@427 101 /* .. */
c@427 102 /* .. External Subroutines .. */
c@427 103 /* .. */
c@427 104 /* .. Intrinsic Functions .. */
c@427 105 /* .. */
c@427 106 /* .. Executable Statements .. */
c@427 107
c@427 108 /* Test the input parameters. */
c@427 109
c@427 110 /* Parameter adjustments */
c@427 111 a_dim1 = *lda;
c@427 112 a_offset = 1 + a_dim1;
c@427 113 a -= a_offset;
c@427 114 --ipiv;
c@427 115
c@427 116 /* Function Body */
c@427 117 *info = 0;
c@427 118 if (*m < 0) {
c@427 119 *info = -1;
c@427 120 } else if (*n < 0) {
c@427 121 *info = -2;
c@427 122 } else if (*lda < max(1,*m)) {
c@427 123 *info = -4;
c@427 124 }
c@427 125 if (*info != 0) {
c@427 126 i__1 = -(*info);
c@427 127 xerbla_("DGETF2", &i__1);
c@427 128 return 0;
c@427 129 }
c@427 130
c@427 131 /* Quick return if possible */
c@427 132
c@427 133 if (*m == 0 || *n == 0) {
c@427 134 return 0;
c@427 135 }
c@427 136
c@427 137 /* Compute machine safe minimum */
c@427 138
c@427 139 sfmin = dlamch_("S");
c@427 140
c@427 141 i__1 = min(*m,*n);
c@427 142 for (j = 1; j <= i__1; ++j) {
c@427 143
c@427 144 /* Find pivot and test for singularity. */
c@427 145
c@427 146 i__2 = *m - j + 1;
c@427 147 jp = j - 1 + idamax_(&i__2, &a[j + j * a_dim1], &c__1);
c@427 148 ipiv[j] = jp;
c@427 149 if (a[jp + j * a_dim1] != 0.) {
c@427 150
c@427 151 /* Apply the interchange to columns 1:N. */
c@427 152
c@427 153 if (jp != j) {
c@427 154 dswap_(n, &a[j + a_dim1], lda, &a[jp + a_dim1], lda);
c@427 155 }
c@427 156
c@427 157 /* Compute elements J+1:M of J-th column. */
c@427 158
c@427 159 if (j < *m) {
c@427 160 if ((d__1 = a[j + j * a_dim1], abs(d__1)) >= sfmin) {
c@427 161 i__2 = *m - j;
c@427 162 d__1 = 1. / a[j + j * a_dim1];
c@427 163 dscal_(&i__2, &d__1, &a[j + 1 + j * a_dim1], &c__1);
c@427 164 } else {
c@427 165 i__2 = *m - j;
c@427 166 for (i__ = 1; i__ <= i__2; ++i__) {
c@427 167 a[j + i__ + j * a_dim1] /= a[j + j * a_dim1];
c@427 168 /* L20: */
c@427 169 }
c@427 170 }
c@427 171 }
c@427 172
c@427 173 } else if (*info == 0) {
c@427 174
c@427 175 *info = j;
c@427 176 }
c@427 177
c@427 178 if (j < min(*m,*n)) {
c@427 179
c@427 180 /* Update trailing submatrix. */
c@427 181
c@427 182 i__2 = *m - j;
c@427 183 i__3 = *n - j;
c@427 184 dger_(&i__2, &i__3, &c_b8, &a[j + 1 + j * a_dim1], &c__1, &a[j + (
c@427 185 j + 1) * a_dim1], lda, &a[j + 1 + (j + 1) * a_dim1], lda);
c@427 186 }
c@427 187 /* L10: */
c@427 188 }
c@427 189 return 0;
c@427 190
c@427 191 /* End of DGETF2 */
c@427 192
c@427 193 } /* dgetf2_ */