LAPACK 3.3.1
Linear Algebra PACKage

caxpy.f

Go to the documentation of this file.
00001       SUBROUTINE CAXPY(N,CA,CX,INCX,CY,INCY)
00002 *     .. Scalar Arguments ..
00003       COMPLEX CA
00004       INTEGER INCX,INCY,N
00005 *     ..
00006 *     .. Array Arguments ..
00007       COMPLEX CX(*),CY(*)
00008 *     ..
00009 *
00010 *  Purpose
00011 *  =======
00012 *
00013 *     CAXPY constant times a vector plus a vector.
00014 *
00015 *  Further Details
00016 *  ===============
00017 *
00018 *     jack dongarra, linpack, 3/11/78.
00019 *     modified 12/3/93, array(1) declarations changed to array(*)
00020 *
00021 *  =====================================================================
00022 *
00023 *     .. Local Scalars ..
00024       INTEGER I,IX,IY
00025 *     ..
00026 *     .. External Functions ..
00027       REAL SCABS1
00028       EXTERNAL SCABS1
00029 *     ..
00030       IF (N.LE.0) RETURN
00031       IF (SCABS1(CA).EQ.0.0E+0) RETURN
00032       IF (INCX.EQ.1 .AND. INCY.EQ.1) THEN
00033 *
00034 *        code for both increments equal to 1
00035 *
00036          DO I = 1,N
00037             CY(I) = CY(I) + CA*CX(I)
00038          END DO
00039       ELSE
00040 *
00041 *        code for unequal increments or equal increments
00042 *          not equal to 1
00043 *
00044          IX = 1
00045          IY = 1
00046          IF (INCX.LT.0) IX = (-N+1)*INCX + 1
00047          IF (INCY.LT.0) IY = (-N+1)*INCY + 1
00048          DO I = 1,N
00049             CY(IY) = CY(IY) + CA*CX(IX)
00050             IX = IX + INCX
00051             IY = IY + INCY
00052          END DO
00053       END IF
00054 *
00055       RETURN
00056       END
 All Files Functions