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

dsymv.c

Go to the documentation of this file.
00001 
00002 /*  -- translated by f2c (version 19940927).
00003    You must link the resulting object file with the libraries:
00004         -lf2c -lm   (in that order)
00005 */
00006 
00007 #include "f2c.h"
00008 #include "cblasimpexp.h"
00009 
00010 /* Subroutine */ int __IMPEXP__ dsymv_(char *uplo, integer *n, doublereal *alpha, 
00011         doublereal *a, integer *lda, doublereal *x, integer *incx, doublereal 
00012         *beta, doublereal *y, integer *incy)
00013 {
00014 
00015 
00016     /* System generated locals */
00017     integer a_dim1, a_offset, i__1, i__2;
00018 
00019     /* Local variables */
00020     static integer info;
00021     static doublereal temp1, temp2;
00022     static integer i, j;
00023     extern logical lsame_(char *, char *);
00024     static integer ix, iy, jx, jy, kx, ky;
00025     extern /* Subroutine */ int xerbla_(char *, integer *);
00026 
00027 
00028 /*  Purpose   
00029     =======   
00030 
00031     DSYMV  performs the matrix-vector  operation   
00032 
00033        y := alpha*A*x + beta*y,   
00034 
00035     where alpha and beta are scalars, x and y are n element vectors and   
00036     A is an n by n symmetric matrix.   
00037 
00038     Parameters   
00039     ==========   
00040 
00041     UPLO   - CHARACTER*1.   
00042              On entry, UPLO specifies whether the upper or lower   
00043              triangular part of the array A is to be referenced as   
00044              follows:   
00045 
00046                 UPLO = 'U' or 'u'   Only the upper triangular part of A   
00047                                     is to be referenced.   
00048 
00049                 UPLO = 'L' or 'l'   Only the lower triangular part of A   
00050                                     is to be referenced.   
00051 
00052              Unchanged on exit.   
00053 
00054     N      - INTEGER.   
00055              On entry, N specifies the order of the matrix A.   
00056              N must be at least zero.   
00057              Unchanged on exit.   
00058 
00059     ALPHA  - DOUBLE PRECISION.   
00060              On entry, ALPHA specifies the scalar alpha.   
00061              Unchanged on exit.   
00062 
00063     A      - DOUBLE PRECISION array of DIMENSION ( LDA, n ).   
00064              Before entry with  UPLO = 'U' or 'u', the leading n by n   
00065              upper triangular part of the array A must contain the upper 
00066   
00067              triangular part of the symmetric matrix and the strictly   
00068              lower triangular part of A is not referenced.   
00069              Before entry with UPLO = 'L' or 'l', the leading n by n   
00070              lower triangular part of the array A must contain the lower 
00071   
00072              triangular part of the symmetric matrix and the strictly   
00073              upper triangular part of A is not referenced.   
00074              Unchanged on exit.   
00075 
00076     LDA    - INTEGER.   
00077              On entry, LDA specifies the first dimension of A as declared 
00078   
00079              in the calling (sub) program. LDA must be at least   
00080              max( 1, n ).   
00081              Unchanged on exit.   
00082 
00083     X      - DOUBLE PRECISION array of dimension at least   
00084              ( 1 + ( n - 1 )*abs( INCX ) ).   
00085              Before entry, the incremented array X must contain the n   
00086              element vector x.   
00087              Unchanged on exit.   
00088 
00089     INCX   - INTEGER.   
00090              On entry, INCX specifies the increment for the elements of   
00091              X. INCX must not be zero.   
00092              Unchanged on exit.   
00093 
00094     BETA   - DOUBLE PRECISION.   
00095              On entry, BETA specifies the scalar beta. When BETA is   
00096              supplied as zero then Y need not be set on input.   
00097              Unchanged on exit.   
00098 
00099     Y      - DOUBLE PRECISION array of dimension at least   
00100              ( 1 + ( n - 1 )*abs( INCY ) ).   
00101              Before entry, the incremented array Y must contain the n   
00102              element vector y. On exit, Y is overwritten by the updated   
00103              vector y.   
00104 
00105     INCY   - INTEGER.   
00106              On entry, INCY specifies the increment for the elements of   
00107              Y. INCY must not be zero.   
00108              Unchanged on exit.   
00109 
00110 
00111     Level 2 Blas routine.   
00112 
00113     -- Written on 22-October-1986.   
00114        Jack Dongarra, Argonne National Lab.   
00115        Jeremy Du Croz, Nag Central Office.   
00116        Sven Hammarling, Nag Central Office.   
00117        Richard Hanson, Sandia National Labs.   
00118 
00119 
00120 
00121        Test the input parameters.   
00122 
00123     
00124    Parameter adjustments   
00125        Function Body */
00126 #define X(I) x[(I)-1]
00127 #define Y(I) y[(I)-1]
00128 
00129 #define A(I,J) a[(I)-1 + ((J)-1)* ( *lda)]
00130 
00131     info = 0;
00132     if (! lsame_(uplo, "U") && ! lsame_(uplo, "L")) {
00133         info = 1;
00134     } else if (*n < 0) {
00135         info = 2;
00136     } else if (*lda < max(1,*n)) {
00137         info = 5;
00138     } else if (*incx == 0) {
00139         info = 7;
00140     } else if (*incy == 0) {
00141         info = 10;
00142     }
00143     if (info != 0) {
00144         xerbla_("DSYMV ", &info);
00145         return 0;
00146     }
00147 
00148 /*     Quick return if possible. */
00149 
00150     if (*n == 0 || *alpha == 0. && *beta == 1.) {
00151         return 0;
00152     }
00153 
00154 /*     Set up the start points in  X  and  Y. */
00155 
00156     if (*incx > 0) {
00157         kx = 1;
00158     } else {
00159         kx = 1 - (*n - 1) * *incx;
00160     }
00161     if (*incy > 0) {
00162         ky = 1;
00163     } else {
00164         ky = 1 - (*n - 1) * *incy;
00165     }
00166 
00167 /*     Start the operations. In this version the elements of A are   
00168        accessed sequentially with one pass through the triangular part   
00169        of A.   
00170 
00171        First form  y := beta*y. */
00172 
00173     if (*beta != 1.) {
00174         if (*incy == 1) {
00175             if (*beta == 0.) {
00176                 i__1 = *n;
00177                 for (i = 1; i <= *n; ++i) {
00178                     Y(i) = 0.;
00179 /* L10: */
00180                 }
00181             } else {
00182                 i__1 = *n;
00183                 for (i = 1; i <= *n; ++i) {
00184                     Y(i) = *beta * Y(i);
00185 /* L20: */
00186                 }
00187             }
00188         } else {
00189             iy = ky;
00190             if (*beta == 0.) {
00191                 i__1 = *n;
00192                 for (i = 1; i <= *n; ++i) {
00193                     Y(iy) = 0.;
00194                     iy += *incy;
00195 /* L30: */
00196                 }
00197             } else {
00198                 i__1 = *n;
00199                 for (i = 1; i <= *n; ++i) {
00200                     Y(iy) = *beta * Y(iy);
00201                     iy += *incy;
00202 /* L40: */
00203                 }
00204             }
00205         }
00206     }
00207     if (*alpha == 0.) {
00208         return 0;
00209     }
00210     if (lsame_(uplo, "U")) {
00211 
00212 /*        Form  y  when A is stored in upper triangle. */
00213 
00214         if (*incx == 1 && *incy == 1) {
00215             i__1 = *n;
00216             for (j = 1; j <= *n; ++j) {
00217                 temp1 = *alpha * X(j);
00218                 temp2 = 0.;
00219                 i__2 = j - 1;
00220                 for (i = 1; i <= j-1; ++i) {
00221                     Y(i) += temp1 * A(i,j);
00222                     temp2 += A(i,j) * X(i);
00223 /* L50: */
00224                 }
00225                 Y(j) = Y(j) + temp1 * A(j,j) + *alpha * temp2;
00226 /* L60: */
00227             }
00228         } else {
00229             jx = kx;
00230             jy = ky;
00231             i__1 = *n;
00232             for (j = 1; j <= *n; ++j) {
00233                 temp1 = *alpha * X(jx);
00234                 temp2 = 0.;
00235                 ix = kx;
00236                 iy = ky;
00237                 i__2 = j - 1;
00238                 for (i = 1; i <= j-1; ++i) {
00239                     Y(iy) += temp1 * A(i,j);
00240                     temp2 += A(i,j) * X(ix);
00241                     ix += *incx;
00242                     iy += *incy;
00243 /* L70: */
00244                 }
00245                 Y(jy) = Y(jy) + temp1 * A(j,j) + *alpha * temp2;
00246                 jx += *incx;
00247                 jy += *incy;
00248 /* L80: */
00249             }
00250         }
00251     } else {
00252 
00253 /*        Form  y  when A is stored in lower triangle. */
00254 
00255         if (*incx == 1 && *incy == 1) {
00256             i__1 = *n;
00257             for (j = 1; j <= *n; ++j) {
00258                 temp1 = *alpha * X(j);
00259                 temp2 = 0.;
00260                 Y(j) += temp1 * A(j,j);
00261                 i__2 = *n;
00262                 for (i = j + 1; i <= *n; ++i) {
00263                     Y(i) += temp1 * A(i,j);
00264                     temp2 += A(i,j) * X(i);
00265 /* L90: */
00266                 }
00267                 Y(j) += *alpha * temp2;
00268 /* L100: */
00269             }
00270         } else {
00271             jx = kx;
00272             jy = ky;
00273             i__1 = *n;
00274             for (j = 1; j <= *n; ++j) {
00275                 temp1 = *alpha * X(jx);
00276                 temp2 = 0.;
00277                 Y(jy) += temp1 * A(j,j);
00278                 ix = jx;
00279                 iy = jy;
00280                 i__2 = *n;
00281                 for (i = j + 1; i <= *n; ++i) {
00282                     ix += *incx;
00283                     iy += *incy;
00284                     Y(iy) += temp1 * A(i,j);
00285                     temp2 += A(i,j) * X(ix);
00286 /* L110: */
00287                 }
00288                 Y(jy) += *alpha * temp2;
00289                 jx += *incx;
00290                 jy += *incy;
00291 /* L120: */
00292             }
00293         }
00294     }
00295 
00296     return 0;
00297 
00298 /*     End of DSYMV . */
00299 
00300 } /* dsymv_ */
00301 

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