LAPACK 3.3.1 Linear Algebra PACKage

# cdotu.f

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