00001 /* sger.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 sger_(integer *m, integer *n, real *alpha, real *x, 00017 integer *incx, real *y, integer *incy, real *a, integer *lda) 00018 { 00019 /* System generated locals */ 00020 integer a_dim1, a_offset, i__1, i__2; 00021 00022 /* Local variables */ 00023 integer i__, j, ix, jy, kx, info; 00024 real temp; 00025 extern /* Subroutine */ int xerbla_(char *, integer *); 00026 00027 /* .. Scalar Arguments .. */ 00028 /* .. */ 00029 /* .. Array Arguments .. */ 00030 /* .. */ 00031 00032 /* Purpose */ 00033 /* ======= */ 00034 00035 /* SGER performs the rank 1 operation */ 00036 00037 /* A := alpha*x*y' + A, */ 00038 00039 /* where alpha is a scalar, x is an m element vector, y is an n element */ 00040 /* vector and A is an m by n matrix. */ 00041 00042 /* Arguments */ 00043 /* ========== */ 00044 00045 /* M - INTEGER. */ 00046 /* On entry, M specifies the number of rows of the matrix A. */ 00047 /* M must be at least zero. */ 00048 /* Unchanged on exit. */ 00049 00050 /* N - INTEGER. */ 00051 /* On entry, N specifies the number of columns of the matrix A. */ 00052 /* N must be at least zero. */ 00053 /* Unchanged on exit. */ 00054 00055 /* ALPHA - REAL . */ 00056 /* On entry, ALPHA specifies the scalar alpha. */ 00057 /* Unchanged on exit. */ 00058 00059 /* X - REAL array of dimension at least */ 00060 /* ( 1 + ( m - 1 )*abs( INCX ) ). */ 00061 /* Before entry, the incremented array X must contain the m */ 00062 /* element vector x. */ 00063 /* Unchanged on exit. */ 00064 00065 /* INCX - INTEGER. */ 00066 /* On entry, INCX specifies the increment for the elements of */ 00067 /* X. INCX must not be zero. */ 00068 /* Unchanged on exit. */ 00069 00070 /* Y - REAL array of dimension at least */ 00071 /* ( 1 + ( n - 1 )*abs( INCY ) ). */ 00072 /* Before entry, the incremented array Y must contain the n */ 00073 /* element vector y. */ 00074 /* Unchanged on exit. */ 00075 00076 /* INCY - INTEGER. */ 00077 /* On entry, INCY specifies the increment for the elements of */ 00078 /* Y. INCY must not be zero. */ 00079 /* Unchanged on exit. */ 00080 00081 /* A - REAL array of DIMENSION ( LDA, n ). */ 00082 /* Before entry, the leading m by n part of the array A must */ 00083 /* contain the matrix of coefficients. On exit, A is */ 00084 /* overwritten by the updated matrix. */ 00085 00086 /* LDA - INTEGER. */ 00087 /* On entry, LDA specifies the first dimension of A as declared */ 00088 /* in the calling (sub) program. LDA must be at least */ 00089 /* max( 1, m ). */ 00090 /* Unchanged on exit. */ 00091 00092 00093 /* Level 2 Blas routine. */ 00094 00095 /* -- Written on 22-October-1986. */ 00096 /* Jack Dongarra, Argonne National Lab. */ 00097 /* Jeremy Du Croz, Nag Central Office. */ 00098 /* Sven Hammarling, Nag Central Office. */ 00099 /* Richard Hanson, Sandia National Labs. */ 00100 00101 00102 /* .. Parameters .. */ 00103 /* .. */ 00104 /* .. Local Scalars .. */ 00105 /* .. */ 00106 /* .. External Subroutines .. */ 00107 /* .. */ 00108 /* .. Intrinsic Functions .. */ 00109 /* .. */ 00110 00111 /* Test the input parameters. */ 00112 00113 /* Parameter adjustments */ 00114 --x; 00115 --y; 00116 a_dim1 = *lda; 00117 a_offset = 1 + a_dim1; 00118 a -= a_offset; 00119 00120 /* Function Body */ 00121 info = 0; 00122 if (*m < 0) { 00123 info = 1; 00124 } else if (*n < 0) { 00125 info = 2; 00126 } else if (*incx == 0) { 00127 info = 5; 00128 } else if (*incy == 0) { 00129 info = 7; 00130 } else if (*lda < max(1,*m)) { 00131 info = 9; 00132 } 00133 if (info != 0) { 00134 xerbla_("SGER ", &info); 00135 return 0; 00136 } 00137 00138 /* Quick return if possible. */ 00139 00140 if (*m == 0 || *n == 0 || *alpha == 0.f) { 00141 return 0; 00142 } 00143 00144 /* Start the operations. In this version the elements of A are */ 00145 /* accessed sequentially with one pass through A. */ 00146 00147 if (*incy > 0) { 00148 jy = 1; 00149 } else { 00150 jy = 1 - (*n - 1) * *incy; 00151 } 00152 if (*incx == 1) { 00153 i__1 = *n; 00154 for (j = 1; j <= i__1; ++j) { 00155 if (y[jy] != 0.f) { 00156 temp = *alpha * y[jy]; 00157 i__2 = *m; 00158 for (i__ = 1; i__ <= i__2; ++i__) { 00159 a[i__ + j * a_dim1] += x[i__] * temp; 00160 /* L10: */ 00161 } 00162 } 00163 jy += *incy; 00164 /* L20: */ 00165 } 00166 } else { 00167 if (*incx > 0) { 00168 kx = 1; 00169 } else { 00170 kx = 1 - (*m - 1) * *incx; 00171 } 00172 i__1 = *n; 00173 for (j = 1; j <= i__1; ++j) { 00174 if (y[jy] != 0.f) { 00175 temp = *alpha * y[jy]; 00176 ix = kx; 00177 i__2 = *m; 00178 for (i__ = 1; i__ <= i__2; ++i__) { 00179 a[i__ + j * a_dim1] += x[ix] * temp; 00180 ix += *incx; 00181 /* L30: */ 00182 } 00183 } 00184 jy += *incy; 00185 /* L40: */ 00186 } 00187 } 00188 00189 return 0; 00190 00191 /* End of SGER . */ 00192 00193 } /* sger_ */